设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2012|回复: 1
打印 上一主题 下一主题

[已经过期] Sherryx整合测试版1.01里漫画式对话框处理选择项的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
381 小时
注册时间
2012-8-13
帖子
113
跳转到指定楼层
1
发表于 2012-9-6 20:28:00 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 tyq4590 于 2012-9-7 00:36 编辑

如题,在使用过程中发现显示选择项的时候总会卡掉最后的一部分选项,2个选项的时候第二个选项的底部会被卡掉一点,而3个的时候直接把第三个选项卡掉一半之多,如下图:

1.jpg (142.91 KB, 下载次数: 7)

1.jpg

Lv1.梦旅人

梦石
0
星屑
50
在线时间
381 小时
注册时间
2012-8-13
帖子
113
2
 楼主| 发表于 2012-9-6 20:32:59 | 只看该作者
  1. class Game_Event < Game_Character
  2.   #===========================================================================
  3.   # 便于返回姓名和修改姓名
  4.   #===========================================================================
  5.   def name
  6.     return @event.name
  7.   end
  8.   def name=(na)
  9.     @event.name = na
  10.   end
  11. end
  12. #==============================================================================
  13. #
  14. #    呼出对话框 ver. 1.31 By パラ犬(日)
  15. #  来自 http://rpg.para.s3p.net/
  16. #
  17. #  汉化修改 66RPG bbschat(2006.1.5)
  18. #    来自 http://www.66RPG.com/
  19. #
  20. #    脚本更新:by KKME◎66RPG.com,2007年2月
  21. #
  22. #    脚本更新:by 绫晓露雪萌◎66RPG.com,2007年7月
  23. #
  24. #==============================================================================

  25. module FUKI

  26.   # 头像图片保存目录的设定
  27.   HEAD_PIC_DIR = "Graphics/Heads/"

  28.   # 是否显示尾部图标
  29.   TAIL_SHOW = true
  30.   
  31.   # Skin的设定
  32.   # 使用数据库默认窗口Skin情况下这里使用[""]
  33.   FUKI_SKIN_NAME = "001-Blue01"   # 呼出对话框用Skin
  34.   NAME_SKIN_NAME = "001-Blue01"   # 角色名字窗口用Skin
  35.   
  36.   # 字体大小
  37.   MES_FONT_SIZE = 19    # 呼出对话框
  38.   NAME_FONT_SIZE = 14   # 角色名字窗口
  39.   
  40.   # 字体颜色
  41.   #(设定为 Color.new(0, 0, 0, 0) 表示使用普通文字色)
  42.   FUKI_COLOR = Color.new(0, 0, 0, 255)  # 呼出对话框
  43.   NAME_COLOR = Color.new(0, 0, 0, 255)  # 角色名字窗口
  44.   
  45.   # 窗口透明度
  46.   # 如修改窗口透明度请同时修改尾部箭头图形内部的透明度
  47.   FUKI_OPACITY = 255    # 呼出对话框
  48.   MES_OPACITY = 255     # 默认信息窗口
  49.   NAME_OPACITY = 255    # 角色名字窗口
  50.   
  51.   # 角色名字窗口的相对位置
  52.   NAME_SHIFT_X = 0      # 横坐标
  53.   NAME_SHIFT_Y = 16     # 纵坐标
  54.   
  55.   # 窗口表示时是否根据画面大小自动检查窗口出现的位置,
  56.   # 自动改变位置( true / false )
  57.   # 设置成 true 在某些变态情况下可能出现箭头图标颠倒的问题 <- bbschat <= KKME
  58.   POS_FIX = false

  59.   # 在画面最边缘表示时的稍微挪动
  60.   # 使用圆形Skin的角和方框的角重合的情况下为 true
  61.   CORNER_SHIFT = false
  62.   SHIFT_PIXEL = 4   # true 时挪动的象素
  63.   
  64.   # 角色高度尺寸
  65.   CHARACTOR_HEIGHT = 108
  66.   # 呼出对话框的相对位置(纵坐标)
  67.   POP_SHIFT_TOP = 0         # 表示位置为上的时候
  68.   POP_SHIFT_UNDER = 2       # 表示位置为下的时候
  69.   
  70.   # 信息的表示速度(数字越小速度越快,0为瞬间表示)
  71.   # 游戏中 可随时用数字代入 $mes_speed 来改变消息表示速度。
  72.   MES_SPEED = 1

  73. end


  74. #==============================================================================
  75. # 初始化两个变量,不要动(by KKME◎66RPG.com)
  76. #==============================================================================
  77. $mes_name = ""
  78. $mes_id   = nil


  79. #==============================================================================
  80. # 方便用户同时设置2个常用参数而使用的函数
  81. #==============================================================================
  82. def chat(id = nil,name = "")
  83.   $mes_id = id
  84.   $mes_name = name
  85. end

  86. #==============================================================================
  87. # □ Game_Temp
  88. #==============================================================================

  89. class Game_Temp
  90.   attr_accessor  :namebmp              #保存头像图片的Hash表
  91.   alias initialize_fuki initialize
  92.   def initialize
  93.     initialize_fuki
  94.     # 如果不想使用角色名字直接作为头像文件名
  95.     # 可在这里重新设定角色名字与文件名的对应关系
  96.     @namebmp ={"玩家"=>"维斯特"}
  97.   end
  98. end

  99. #==============================================================================
  100. # □ Window_Message
  101. #==============================================================================

  102. class Window_Message < Window_Selectable

  103.   #--------------------------------------------------------------------------
  104.   # ● 初始化状态
  105.   #--------------------------------------------------------------------------
  106.   def initialize
  107.     super(80, 304, 480, 160)
  108.     self.contents = Bitmap.new(width - 32, height - 32)
  109.     self.contents.font.color = text_color(0)
  110.     self.visible = false
  111.     self.z = 9998
  112.     @fade_in = false
  113.     @fade_out = false
  114.     @contents_showing = false
  115.     @cursor_width = 0
  116.     @kkme_name = ""
  117.     self.active = false
  118.     self.index = -1
  119.     @w = 0
  120.     @h = 0
  121.     @wait = 0
  122.     @dx = 0
  123.     @dy = 0
  124.     $mes_speed = FUKI::MES_SPEED
  125.    
  126.     #------------------------
  127.     # ★ 特殊时期中断标志
  128.     #------------------------
  129.     @no_term_stop = false
  130.     @save_x = 0
  131.     @save_y = 0
  132.     @old_text_info = []
  133.   end
  134.   
  135.   #--------------------------------------------------------------------------
  136.   # ○ 决定窗口尺寸并生成窗口
  137.   #--------------------------------------------------------------------------
  138.   def refresh_create
  139.     unless @no_term_stop
  140.       @pic_skin.dispose if @pic_skin != nil
  141.     end
  142.       @kkme_name = ""
  143.       begin
  144.         @kkme_name = $game_temp.message_text.split(":")[0] if $game_temp.message_text.split(":")[1] != nil
  145.         if @kkme_name != ""
  146.           jiajia = '\c[1]【' + @kkme_name + '】\c[0]'
  147.           $game_temp.message_text = jiajia + $game_temp.message_text[@kkme_name.size + 2,$game_temp.message_text.size]
  148.        else
  149.           $game_temp.message_text =$game_temp.message_text #'\c[0]' + $game_temp.message_text
  150.         end      
  151.       rescue
  152.       end
  153.     unless @no_term_stop
  154.       self.contents.clear
  155.       self.contents.font.color = Color.new(0, 0, 0, 255)
  156.       self.contents.font.size = FUKI::MES_FONT_SIZE
  157.       # 取得窗口尺寸
  158.       get_windowsize
  159.       w = @w + 32 + 8
  160.       h = @h * (self.contents.font.size + 10) + 26
  161.       # 生成呼出窗口   
  162.       # 生成角色名字窗口
  163.       set_fukidasi(self.x, self.y, w, h)
  164.       set_namewindow
  165.       pic_back
  166.     end
  167.     # 初始化信息表示使用的变量
  168.     @dx = @save_x # 0
  169.     @dy = @save_y # 0
  170.     @cursor_width = 0
  171.     @contents_drawing = true
  172.     update
  173.     # 瞬间表示的情况下
  174.     if $mes_speed == 0
  175.       # 循环信息描绘处理
  176.       while $game_temp.message_text != ""
  177.         draw_massage
  178.       end
  179.       draw_opt_text
  180.       @contents_showing_end = true
  181.       @contents_drawing = false
  182.     else
  183.       # 一个一个描绘文字
  184.       refresh_drawtext
  185.     end
  186.   end
  187.   
  188.   #--------------------------------------------------------------------------
  189.   # ○ 一个一个描绘文字
  190.   #--------------------------------------------------------------------------
  191.   def refresh_drawtext
  192.     if $game_temp.message_text != nil
  193.       if @wait > 0
  194.         @wait -= 1
  195.       elsif @wait == 0
  196.         # 描绘处理
  197.         draw_massage
  198.         @wait = $mes_speed
  199.       end
  200.     end
  201.     # 描绘结束
  202.     if $game_temp.message_text == ""
  203.       draw_opt_text
  204.       @contents_showing_end = true
  205.       @contents_drawing = false
  206.     end
  207.   end
  208.   
  209.   #--------------------------------------------------------------------------
  210.   # ○ 取得窗口尺寸
  211.   #--------------------------------------------------------------------------
  212.   def get_windowsize
  213.     x = y = 0
  214.     @h = @w = 0
  215.     @cursor_width = 0
  216.     # 有选择项的话,处理字的缩进
  217.     if $game_temp.choice_start == 0
  218.       x = 16
  219.     end
  220.     # 有等待显示的文字的情况下
  221.     if $game_temp.message_text != nil
  222.     text = $game_temp.message_text.clone
  223.       # 限制文字处理
  224.       begin
  225.         last_text = text.clone
  226.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  227.       end until text == last_text
  228.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  229.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  230.       end
  231.       # 为了方便、将 "\\\\" 变换为 "\000"
  232.       text.gsub!(/\\\\/) { "\000" }
  233.       # "\\C" 变为 "\001" 、"\\G" 变为 "\002"
  234.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001" }
  235.       text.gsub!(/\\[Gg]/) { "\002" }
  236.       # c 获取 1 个字 (如果不能取得文字就循环)
  237.       while ((c = text.slice!(/./m)) != nil)
  238.         # \\ 的情况下
  239.         if c == "\000"
  240.           # 还原为本来的文字
  241.           c = "\\"
  242.         end
  243.         # \C[n] 或者 \G 的情况下
  244.         if c == "\001" or c == "\002"
  245.           # 下面的文字
  246.           next
  247.         end
  248.         # 另起一行文字的情况下
  249.         if c == "\n"
  250.           # y 累加 1
  251.           y += 1
  252.           # 取得纵横尺寸
  253.           @h = y
  254.           @w = x > @w ? x : @w
  255.           if y >= $game_temp.choice_start
  256.             @w = x + 8 > @w ? x + 8 : @w
  257.           end
  258.           x = 0
  259.           # 移动到选择项的下一行
  260.           if y >= $game_temp.choice_start
  261.             x = 8
  262.           end
  263.           # 下面的文字
  264.           next
  265.         end
  266.         # x 为要描绘文字的宽度加法运算
  267.         x += self.contents.text_size(c).width
  268.       end
  269.     end
  270.     # 输入数值的情况
  271.     if $game_temp.num_input_variable_id > 0
  272.       digits_max = $game_temp.num_input_digits_max
  273.       number = $game_variables[$game_temp.num_input_variable_id]
  274.       @h += 1
  275.       x = digits_max * self.contents.font.size + 16
  276.       @w = x > @w ? x : @w
  277.     end
  278.   end
  279.   
  280.   #--------------------------------------------------------------------------
  281.   # ○ 描绘信息处理
  282.   #--------------------------------------------------------------------------
  283.   def draw_massage
  284.     # 有等待显示的文字的情况下
  285.     if $game_temp.message_text != nil or @old_text_info != nil
  286.       text = $game_temp.message_text
  287.       # 限制文字处理
  288.       begin
  289.         last_text = text.clone
  290.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  291.       end until text == last_text
  292.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  293.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  294.       end
  295.       # 为了方便、将 "\\\\" 变换为 "\000"
  296.       text.gsub!(/\\\\/) { "\000" }
  297.       # "\\C" 变为 "\001"、"\\G" 变为 "\002"
  298.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  299.       text.gsub!(/\\[Gg]/) { "\002" }
  300.       # c 获取 1 个字
  301.       c = text.slice!(/./m)
  302.       # 选择项的情况 修改
  303.       if @dy >= $game_temp.choice_start
  304.         self.contents.font.color = Color.new(0, 0, 0, 255)
  305.         self.contents.font.size = 18
  306.         # 处理字的缩进
  307.         @dx = 8
  308.         # 描绘文字
  309.         self.contents.draw_text(4 + @dx, 32 * @dy, 40, 32, c)
  310.         # x 为要描绘文字宽度的加法运算
  311.         @dx += self.contents.text_size(c).width
  312.         # 循环
  313.         while ((c = text.slice!(/./m)) != "\n")
  314.           # 描绘文字
  315.           self.contents.draw_text(4 + @dx, 32 * @dy, 40, 32, c)
  316.           # x 为要描绘文字宽度的加法运算
  317.           @dx += self.contents.text_size(c).width
  318.         end
  319.         if c == "\n"
  320.           # 更新光标宽度
  321.           @cursor_width = [@cursor_width, @dx].max
  322.           # dy 累加 1
  323.           @dy += 1
  324.           @dx = 0
  325.         end
  326.         return
  327.       end
  328.       # \\ 的情况下
  329.       if c == "\000"
  330.         # 还原为本来的文字
  331.         c = "\\"
  332.       end
  333.       #\C[n] 的情况下
  334.       if c == "\001"
  335.         # 更改文字色
  336.         text.sub!(/\[([0-9]+)\]/, "")
  337.         color = $1.to_i
  338.         if color >= 0 and color <= 7
  339.           self.contents.font.color = text_color(color)
  340.         end
  341.       end
  342.       # \G 的情况下
  343.       if c == "\002"
  344.         # ★生成金钱窗口★
  345.         @contents_showing_end = true
  346.         @contents_drawing = false
  347.         terminate_messageX
  348.         @save_x = @dx
  349.         @save_y = @dy
  350.       end
  351.       # 另起一行文字的情况下
  352.       if c == "\n"
  353.         # dy 累加 1
  354.         @dy += 1
  355.         @dx = 0
  356.       end
  357.       # 描绘文字
  358.       
  359.       size_zy = 6 # 设定文字动态增大——别问我这么重要的参数为什么放在这里而不放在顶部,有特殊原因的。
  360.       
  361.       
  362.       unless @old_text_info == []
  363.         self.contents.fill_rect (4 + @old_text_info[0], (@old_text_info[2]+10-size_zy)*@old_text_info[1] - size_zy/2 ,@old_text_info[2],@old_text_info[2],Color.new(0,0,0,0))
  364.         col = self.contents.font.color.clone
  365.         self.contents.font.color = @old_text_info[3].clone
  366.         self.contents.font.size = @old_text_info[2] -= size_zy
  367.         self.contents.draw_text(4 + @old_text_info[0], (@old_text_info[2]+10)*@old_text_info[1],@old_text_info[2],@old_text_info[2],@old_text_info[4])
  368.         self.contents.font.color = col
  369.         @old_text_info = []
  370.       end
  371.       if c != nil
  372.         self.contents.font.size = FUKI::MES_FONT_SIZE
  373.         font_size = self.contents.font.size += size_zy
  374.         @old_text_info.push(@dx , @dy , font_size, self.contents.font.color.clone, c)
  375.         self.contents.draw_text(4+@dx, (font_size+10-size_zy)*@dy - size_zy/2, font_size, font_size, c)
  376.         self.contents.font.size -= size_zy
  377.         # dx 为要描绘文字的宽度加法运算
  378.         @dx += self.contents.text_size(c).width
  379.       end
  380.     end
  381.   end
  382.   
  383.   #--------------------------------------------------------------------------
  384.   # ○ 选择项和输入数值的情况下
  385.   #--------------------------------------------------------------------------
  386.   def draw_opt_text
  387.     # 选择项的情况下
  388.     if $game_temp.choice_max > 0
  389.       @item_max = $game_temp.choice_max
  390.       self.active = true
  391.       self.index = 0
  392.     end
  393.     # 输入数值的情况下
  394.     if $game_temp.num_input_variable_id > 0
  395.       digits_max = $game_temp.num_input_digits_max
  396.       number = $game_variables[$game_temp.num_input_variable_id]
  397.       @input_number_window = Window_InputNumber.new(digits_max)
  398.       @input_number_window.number = number
  399.       @input_number_window.x = self.x + 8
  400.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  401.     end
  402.   end
  403.   
  404.   def pic_back
  405.     @pic_skin.dispose if @pic_skin != nil
  406.     @pic_skin = Sprite.new
  407.     @pic_skin.opacity = 0 unless @no_term_stop
  408.     @pic_skin.bitmap = Bitmap.new(self.width + 35, self.height + 35)
  409.     @pic_skin.x = self.x + 2
  410.     @pic_skin.y = self.y + 2
  411.     @pic_skin.z = self.z
  412.     @pic_skin.bitmap.blt(0, 0, RPG::Cache.icon("message_左上"),  RPG::Cache.icon("message_左上").rect)
  413.     @pic_skin.bitmap.blt(self.width - 35, 0, RPG::Cache.icon("message_右上"),  RPG::Cache.icon("message_右上").rect)
  414.     @pic_skin.bitmap.blt(0, self.height - 35, RPG::Cache.icon("message_左下"),  RPG::Cache.icon("message_左下").rect)
  415.     @pic_skin.bitmap.blt(self.width - 35, self.height - 35, RPG::Cache.icon("message_右下"),  RPG::Cache.icon("message_右下").rect)
  416.     @pic_skin.bitmap.stretch_blt(Rect.new(0,35,35,self.height-70), RPG::Cache.icon("message_左"), RPG::Cache.icon("message_左").rect)
  417.     @pic_skin.bitmap.stretch_blt(Rect.new(self.width - 35,35,35,self.height-70), RPG::Cache.icon("message_右"), RPG::Cache.icon("message_右").rect)
  418.     @pic_skin.bitmap.stretch_blt(Rect.new(35,0,self.width-70,35), RPG::Cache.icon("message_上"), RPG::Cache.icon("message_上").rect)
  419.     @pic_skin.bitmap.stretch_blt(Rect.new(35,self.height-35,self.width-70,35), RPG::Cache.icon("message_下"), RPG::Cache.icon("message_下").rect)
  420.     @pic_skin.bitmap.stretch_blt(Rect.new(35,35,self.width-70,self.height-70), RPG::Cache.icon("message_中"), RPG::Cache.icon("message_中").rect)
  421.   end
  422.    
  423.   
  424.   #--------------------------------------------------------------------------
  425.   # ○ 设置呼出对话框
  426.   #--------------------------------------------------------------------------
  427.   def set_fukidasi(x, y, width, height)
  428.     begin
  429.       # 不显示暂停标志
  430.       self.pause = false
  431.       # 取得对话框位置
  432.       pos = get_fuki_pos(width, height)
  433.       x = pos[0]
  434.       y = pos[1]
  435.       skin = FUKI::FUKI_SKIN_NAME != "" ? FUKI::FUKI_SKIN_NAME : $game_system.windowskin_name
  436.       # 生成呼出对话框
  437.       self.windowskin = RPG::Cache.windowskin(skin)
  438.       self.x = x
  439.       self.y = y
  440.       self.height = height
  441.       self.width = width
  442.       #self.opacity = 0
  443.       
  444.       unless @no_term_stop
  445.         self.contents.dispose
  446.         self.contents = Bitmap.new(width - 32, height - 32)
  447.         self.back_opacity = FUKI::FUKI_OPACITY
  448.         self.contents.clear
  449.         self.contents.font.color = Color.new(0, 0, 0, 255)
  450.         self.contents.font.size = FUKI::MES_FONT_SIZE
  451.       end
  452.       # 描绘尾部图标
  453.       if $game_system.message_frame == 0
  454.         # 取得位置
  455.         tale_pos = get_tale_pos
  456.         @tale = Sprite.new
  457.         @tale.opacity = 200
  458.         # 是否显示尾部图标 <- bbschat
  459.         if FUKI::TAIL_SHOW == true
  460.           case @message_position
  461.             when 0  # 上
  462.               @tale.bitmap = RPG::Cache.icon("message_箭头")
  463.               @tale.x = tale_pos[0]
  464.               @tale.y = tale_pos[1]
  465.               @tale.z = self.z + 1
  466.             when 1  # 中
  467.               @tale.dispose
  468.               @tale = nil
  469.             when 2  # 下
  470.               @tale.bitmap = RPG::Cache.icon("message_箭头2")
  471.               @tale.x = tale_pos[0]
  472.               @tale.y = tale_pos[1]
  473.               @tale.z = self.z + 1
  474.           end
  475.         end
  476.       end
  477.     rescue
  478.       del_fukidasi
  479.       reset_window(width, height)
  480.     end
  481.   end
  482.   #--------------------------------------------------------------------------
  483.   # ○ 新功能:根据输入文章计算呼出对话框的位置
  484.   #--------------------------------------------------------------------------
  485.   def get_character_KKME
  486.     if @kkme_name == "" or @kkme_name == nil
  487.       return nil
  488.     else
  489.       @kkme_name.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  490.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  491.       end
  492.       $mes_name = @kkme_name
  493.       for ev in $game_map.events.values
  494.         if ev.name == @kkme_name
  495.           return ev
  496.         end
  497.       end
  498.       for actor in $game_party.actors
  499.         if actor.name == @kkme_name
  500.           return $game_player
  501.         end
  502.       end
  503.       return nil
  504.     end
  505.   end
  506.    
  507.   
  508.   #--------------------------------------------------------------------------
  509.   # ○ 计算呼出对话框的位置
  510.   #--------------------------------------------------------------------------
  511.   def get_fuki_pos(width, height)
  512.    
  513.     # 取得角色
  514.     if $mes_id != nil
  515.       @character = get_character($mes_id)
  516.     else
  517.       @character = get_character_KKME
  518.     end
  519.    
  520.     if @character == nil
  521.       # 角色不存在的情况下使用默认信息框
  522.       del_fukidasi
  523.       reset_window(width, height)
  524.       return
  525.     end
  526.     # 处理坐标
  527.     x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - (width / 2)
  528.     # 为尽量显示在画面内而移动横坐标
  529.     if x + width > 640
  530.       x = 640 - width
  531.     elsif x < 0
  532.       x = 0
  533.     end
  534.     # 决定窗口位置
  535.     case $game_system.message_position
  536.       when 0  # 上
  537.         y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  538.       when 1  # 中
  539.         y = (480 - height) / 2
  540.         x = (640 - width) / 2
  541.       when 2  # 下
  542.         y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  543.     end
  544.     # 纪录文章显示位置
  545.     @message_position = $game_system.message_position
  546.     # 如果选择自动修正,则如果文章会显示到画面外则自动改变窗口的尺寸(高度)
  547.     if FUKI::POS_FIX
  548.       case @message_position
  549.         when 0  # 上
  550.           if y <= 0
  551.             @message_position = 2
  552.             y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  553.           end
  554.         when 2  # 下
  555.           if y + height >= 480
  556.             @message_position = 0
  557.             y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  558.           end
  559.       end
  560.     end
  561.     return [x,y]
  562.    
  563.   end
  564.   
  565.   #--------------------------------------------------------------------------
  566.   # ○ 计算尾部图标的位置
  567.   #--------------------------------------------------------------------------
  568.   def get_tale_pos
  569.     case @message_position
  570.       when 0  # 上
  571.         # 处理坐标
  572.         x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  573.         # 画面边缘的话则移动位置
  574.         if FUKI::CORNER_SHIFT
  575.           if x == 0
  576.             x = FUKI::SHIFT_PIXEL
  577.           elsif x == 640 - 32
  578.             x = 640 - 32 - FUKI::SHIFT_PIXEL
  579.           end
  580.         end
  581.         y = self.y + self.height - 16
  582.       when 1  # 中
  583.         x = nil
  584.         y = nil
  585.       when 2  # 下
  586.         # 处理坐标
  587.         x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  588.         # 画面边缘的话则移动位置
  589.         if FUKI::CORNER_SHIFT
  590.           if x == 0
  591.             x = FUKI::SHIFT_PIXEL
  592.           elsif @tale.x == 640 - 32
  593.             x = 640 - 32 - FUKI::SHIFT_PIXEL
  594.           end
  595.         end
  596.         y = self.y - 16
  597.     end
  598.     return [x+8, y+10]
  599.   end

  600.   #--------------------------------------------------------------------------
  601.   # ○ 计算名字窗口的位置
  602.   #--------------------------------------------------------------------------
  603.   def get_name_pos
  604.     case @face_pic_txt
  605.       when 0  # 文字
  606.         x = self.x + FUKI::NAME_SHIFT_X
  607.         y = self.y - FUKI::NAME_FONT_SIZE - 16 + FUKI::NAME_SHIFT_Y
  608.       when 1  # 图片
  609.         if self.x >= @pic_width + 5
  610.           # 默认头像显示在对话框左边
  611.           x = self.x-@pic_width-5
  612.         else
  613.           # 对话框左边放不下时头像显示在右边
  614.           x = self.x + self.width
  615.         end
  616.         y = self.y+self.height/2 - (@pic_height + 5)/2
  617.       end

  618.     return [x,y]
  619.   end
  620.   
  621.   #--------------------------------------------------------------------------
  622.   # ○ 设置角色名字窗口
  623.   #--------------------------------------------------------------------------
  624.   def set_namewindow
  625.    
  626.     # $mes_name为空时不显示角色名字窗口
  627.     if $mes_name == nil or $mes_name == ""
  628.       return
  629.     else
  630.       # 设定变量
  631.       mes_name = $mes_name
  632.       skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
  633.       
  634.       #判断名称是否有对应的图片"Graphics/heads/" +
  635.       if $game_temp.namebmp[mes_name] == nil then
  636.         sFile = "Graphics/heads/" + mes_name + ".png"
  637.       else
  638.         sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + ".png"
  639.       end
  640.       
  641.       #if FileTest.exist?(sFile) == true then
  642.       begin
  643.                
  644.         @face_pic_txt = 1                       #名字窗口使用头像<- bbschat
  645.         
  646.         # 生成头像
  647.         bmp = Bitmap.new(sFile)
  648.         @pic_width = bmp.width
  649.         @pic_height = bmp.height
  650.         
  651.         self.width += @pic_width
  652.         
  653.         if self.x >= @pic_width + 5
  654.           # 默认头像显示在对话框左边
  655.           name_x = self.x-@pic_width-5
  656.         else
  657.           # 对话框左边放不下时头像显示在右边
  658.           name_x = self.x + self.width
  659.         end
  660.         name_y = self.y+self.height/2 - (@pic_height + 5)/2
  661.         
  662.         # 生成角色头像窗口
  663.         #@name_win = Window_Base.new(name_x, name_y, @pic_width + 5, @pic_height + 5)
  664.         #@name_win.windowskin = RPG::Cache.windowskin(skin)
  665.         #@name_win.opacity =0     
  666.         #@name_win.z = self.z + 1
  667.         @name_contents.dispose if @name_contents != nil
  668.         @name_contents = Sprite.new
  669.         @name_contents.x = self.x + self.width - bmp.width
  670.         @name_contents.y = name_y - 7
  671.         @name_contents.bitmap = bmp
  672.         @name_contents.z = self.z + 3
  673.         @name_contents.opacity = 0
  674.         #self.width += 50
  675.         #@name_contents.z = @name_win.z + 2     #这个用了似乎效果不好<- bbschat
  676.         
  677.       rescue
  678.       end
  679.     end

  680.   end
  681.   
  682.   #--------------------------------------------------------------------------
  683.   # ○ 释放呼出对话框和角色名字窗口
  684.   #--------------------------------------------------------------------------
  685.   def del_fukidasi
  686.     if @tale != nil
  687.       @tale.dispose
  688.       @tale = nil
  689.     end
  690.     if @name_win != nil
  691.       @name_win.dispose
  692.       @name_win = nil
  693.       @name_contents.dispose
  694.       @name_contents = nil
  695.     end
  696.     self.opacity = 0
  697.     self.x = 90
  698.     self.width = 460
  699.     self.height = 120
  700.     self.contents.dispose
  701.     self.contents = Bitmap.new(width - 32, height - 24)
  702.     self.pause = true
  703.   end
  704.   
  705.   #--------------------------------------------------------------------------
  706.   # ○ 取得角色
  707.   #     parameter : 参数
  708.   #--------------------------------------------------------------------------
  709. # def get_character(parameter)
  710.     # 参数分歧
  711. #   case parameter
  712. #   when -1  # 玩家
  713.    #   return $game_player
  714.   #  when 0   # 该事件
  715.   #    events = $game_map.events
  716.   #    return events == nil ? nil : events[$active_event_id]
  717.   #  else     # 特定事件
  718.   #    events = $game_map.events
  719.   #    return events == nil ? nil : events[parameter]
  720.   #  end
  721. # end
  722.    #-------------------------------------------------------------------
  723. # ○ 取得角色
  724. #     parameter : 参数
  725. #-------------------------------------------------------------------
  726. def get_character(parameter)
  727.   # 参数分歧
  728.   case parameter
  729.   when -1  # 玩家
  730.     return $game_player
  731.   when 0   # 该事件
  732.     events = $game_map.events
  733.     return events == nil ? nil : events[$active_event_id]
  734.   else     # 特定事件
  735.     if parameter >0
  736.       events = $game_map.events
  737.       return events == nil ? nil : events[parameter]
  738.     else
  739.       $game_party.return_char(-parameter-2)
  740.     end
  741.   end
  742. end

  743.   #--------------------------------------------------------------------------
  744.   # ● 设定窗口位置和不透明度
  745.   #--------------------------------------------------------------------------
  746.   def reset_window(width = nil, height = nil)
  747.     if $game_temp.in_battle
  748.       self.y = 16
  749.     else
  750.       case $game_system.message_position
  751.       when 0  # 上
  752.         self.y = 16
  753.       when 1  # 中
  754.   #      if height != nil and width != nil
  755.     #      self.y = (480 - height) / 2 - 32
  756.     ##      self.x = (640 - width) / 2
  757.      #     self.width = width
  758.     #      self.height = height
  759.     #      self.contents.dispose
  760.     #      self.contents = Bitmap.new(width - 32, height - 32)
  761.     #    else
  762.           self.y = 160
  763.      #   end
  764.       when 2  # 下
  765.         self.y = 324
  766.       end
  767.     end
  768.     #if $game_system.message_frame == 0
  769.       #self.opacity = 255
  770.     #else
  771.       self.opacity = 0
  772.     #end
  773.     self.back_opacity = FUKI::MES_OPACITY
  774.   end
  775.   
  776.   #--------------------------------------------------------------------------
  777.   # ● 刷新画面
  778.   #--------------------------------------------------------------------------
  779.   def update
  780.     super
  781.     #if @no_term_stop
  782.       #terminate_messageX      
  783.     #end
  784.    
  785.     # 呼出模式下跟随事件移动
  786.     if @tale != nil
  787.       pos = get_fuki_pos(self.width, self.height)
  788.       self.x = pos[0]
  789.       self.y = pos[1]

  790.       tale_pos = get_tale_pos
  791.       @tale.x = tale_pos[0]
  792.       @tale.y = tale_pos[1]
  793.    
  794.       @pic_skin.x = self.x + 2
  795.       @pic_skin.y = self.y + 2
  796.       if @name_contents != nil and !@name_contents.disposed?
  797.       @name_contents.x = self.x + self.width - @name_contents.bitmap.width - 22
  798.       @name_contents.y = self.y + self.height - @name_contents.bitmap.height - 6
  799.       end
  800.    
  801.       if @name_win != nil
  802.         name_pos = get_name_pos
  803.         @name_win.x = name_pos[0]
  804.         @name_win.y = name_pos[1]
  805.         case @face_pic_txt
  806.           when 0  # 文字
  807.             @name_contents.x = @name_win.x + 12
  808.             @name_contents.y = @name_win.y + 8
  809.           when 1  # 图片
  810.             @name_contents.x = @name_win.x + 2
  811.             @name_contents.y = @name_win.y + 2
  812.           end
  813.       end
  814.     end
  815.    
  816.     # 渐变的情况下
  817.     if @fade_in
  818.       #if @no_term_stop
  819.         #@fade_in = false
  820.         #return
  821.       #else        
  822.         self.contents_opacity += 24
  823.         @pic_skin.opacity += 20
  824.         if @name_win != nil
  825.           @name_win.opacity += 24
  826.         end
  827.         if @tale != nil
  828.           @name_contents.opacity += 24 if @name_contents != nil and !@name_contents.disposed?
  829.           @tale.opacity += 20
  830.         end
  831.         if @input_number_window != nil
  832.           @input_number_window.contents_opacity += 24
  833.         end
  834.         if self.contents_opacity == 255
  835.           @fade_in = false
  836.         end
  837.         return
  838.       #end
  839.     end
  840.     # 显示信息中的情况下
  841.     if @contents_drawing
  842.       refresh_drawtext
  843.       return
  844.     end
  845.     # 输入数值的情况下
  846.     if @input_number_window != nil
  847.       @input_number_window.update
  848.       # 确定
  849.       if Input.trigger?(Input::C)
  850.         $game_system.se_play($data_system.decision_se)
  851.         $game_variables[$game_temp.num_input_variable_id] =
  852.           @input_number_window.number
  853.         $game_map.need_refresh = true
  854.         # 释放输入数值窗口
  855.         @input_number_window.dispose
  856.         @input_number_window = nil
  857.         terminate_message
  858.       end
  859.       return
  860.     end
  861.     # 显示信息结束的情况下
  862.     if @contents_showing_end
  863.       # 不是显示选择项且不是呼出对话模式则显示暂停标志
  864.       if $game_temp.choice_max == 0 and @tale == nil
  865.         self.pause = true
  866.       else
  867.         self.pause = false
  868.       end
  869.       # 取消
  870.       if Input.trigger?(Input::B)
  871.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  872.           $game_system.se_play($data_system.cancel_se)
  873.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  874.           terminate_message
  875.         end
  876.       end
  877.       # 确定
  878.       if Input.trigger?(Input::C)
  879.         if $game_temp.choice_max > 0
  880.           $game_system.se_play($data_system.decision_se)
  881.           $game_temp.choice_proc.call(self.index)
  882.         end
  883.         terminate_message
  884.         # 释放呼出窗口
  885.         del_fukidasi
  886.       end
  887.       return
  888.     end
  889.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  890.     if @fade_out == false and $game_temp.message_text != nil
  891.       @contents_showing = true
  892.       $game_temp.message_window_showing = true
  893.       reset_window
  894.       refresh_create
  895.       if @no_term_stop
  896.         self.visible = true        
  897.       else
  898.         if @name_win != nil
  899.           @name_win.opacity = 0
  900.         end
  901.         if @tale != nil
  902.           @tale.opacity = 0
  903.         end
  904.         Graphics.frame_reset
  905.         self.visible = true
  906.         self.contents_opacity = 0
  907.         if @input_number_window != nil
  908.           @input_number_window.contents_opacity = 0
  909.         end
  910.         @fade_in = true
  911.       end
  912.       return
  913.     end
  914.    
  915.     # 没有可以显示的信息、但是窗口为可见的情况下
  916.     unless @no_term_stop
  917.       if self.visible
  918.         @fade_out = true
  919.         self.opacity -= 48
  920.         @name_contents.opacity -= 48 if @name_contents != nil and !@name_contents.disposed?
  921.         @pic_skin.opacity -= 48 if @pic_skin != nil and !@pic_skin.disposed?
  922.         if @name_win != nil
  923.           @name_win.opacity -= 48        
  924.         end
  925.         if @tale != nil
  926.           @tale.opacity -= 48 if @tale != nil and [email protected]?
  927.         end
  928.         if (@name_contents == nil) or @name_contents.disposed? or (@name_contents.opacity == 0)
  929.           self.visible = false
  930.           @name_contents.dispose if @name_contents != nil
  931.           @pic_skin.dispose
  932.           @fade_out = false
  933.           $game_temp.message_window_showing = false
  934.           del_fukidasi
  935.         end
  936.         return
  937.       end
  938.     else
  939.       $game_temp.message_window_showing = false   
  940.     end
  941.    
  942.   end
  943.   
  944.   #--------------------------------------------------------------------------
  945.   # ● 释放
  946.   #--------------------------------------------------------------------------
  947.   def dispose
  948.     terminate_message
  949.     $game_temp.message_window_showing = false
  950.     if @input_number_window != nil
  951.       @input_number_window.dispose
  952.     end
  953.     super
  954.   end
  955.   
  956.   #--------------------------------------------------------------------------
  957.   # ● 信息结束处理
  958.   #--------------------------------------------------------------------------
  959.   def terminate_message
  960.     self.active = false
  961.     self.pause = false
  962.     self.index = -1
  963.     self.contents.clear
  964.     # 清除显示中标志
  965.     @contents_showing = false
  966.     @contents_showing_end = false
  967.     unless @kkme_name == "" or @kkme_name == nil
  968.       $mes_name = ""
  969.       @kkme_name = ""
  970.     end
  971.     # 呼叫信息调用
  972.     if $game_temp.message_proc != nil
  973.       $game_temp.message_proc.call
  974.     end
  975.     # 清除文章、选择项、输入数值的相关变量
  976.     $game_temp.message_text = nil
  977.     $game_temp.message_proc = nil
  978.     $game_temp.choice_start = 99
  979.     $game_temp.choice_max = 0
  980.     $game_temp.choice_cancel_type = 0
  981.     $game_temp.choice_proc = nil
  982.     $game_temp.num_input_start = 99
  983.     $game_temp.num_input_variable_id = 0
  984.     $game_temp.num_input_digits_max = 0
  985.     # 释放金钱窗口
  986.     if @gold_window != nil
  987.       @gold_window.dispose
  988.       @gold_window = nil
  989.     end
  990.     @no_term_stop = false
  991.     @save_x = 0
  992.     @save_y = 0
  993.   end

  994.   #--------------------------------------------------------------------------
  995.   # ● ★信息结束处理★
  996.   #--------------------------------------------------------------------------
  997.   def terminate_messageX
  998.     self.active = false
  999.     self.pause = false
  1000.     self.index = -1
  1001.     # 清除显示中标志
  1002.     @contents_showing = false
  1003.     @contents_showing_end = false
  1004.     # 呼叫信息调用
  1005.     if $game_temp.message_proc != nil
  1006.       $game_temp.message_proc.call
  1007.     end
  1008.     # 清除文章、选择项、输入数值的相关变量
  1009.     $game_temp.message_text = nil
  1010.     $game_temp.message_proc = nil
  1011.     @no_term_stop = true
  1012.   end
  1013.   
  1014.   def clear
  1015.     self.contents.clear   
  1016.     @save_x = 0
  1017.     @save_y = 0
  1018.   end
  1019.   #--------------------------------------------------------------------------
  1020.   # ● 刷新光标矩形
  1021.   #--------------------------------------------------------------------------
  1022.   def update_cursor_rect
  1023.     if @index >= 0
  1024.       n = $game_temp.choice_start + @index
  1025.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  1026.     else
  1027.       self.cursor_rect.empty
  1028.     end
  1029.   end
  1030.   #--------------------------------------------------------------------------
  1031.   # ● 取得普通文字色
  1032.   #--------------------------------------------------------------------------
  1033.   def normal_color
  1034.     nil_color = Color.new(0,0,0,255)
  1035.     if FUKI::FUKI_COLOR != nil_color
  1036.       color = FUKI::FUKI_COLOR
  1037.     else
  1038.       color = super
  1039.     end
  1040.     return color
  1041.   end
  1042. end

复制代码

评分

参与人数 1星屑 +100 收起 理由
hcm + 100 感谢回答

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-27 16:18

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表