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

Project1

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

选择项的 【光标】 不能显示。

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
55 小时
注册时间
2007-7-11
帖子
107
跳转到指定楼层
1
发表于 2009-6-4 19:43:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
用了这个脚本后,选择项的 【光标】 不能显示。
晕死,超过最大字数了。。
  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://rpg.blue/web/
  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 = ""   # 呼出对话框用Skin
  34.   NAME_SKIN_NAME = ""   # 角色名字窗口用Skin
  35.   
  36.   # 字体大小
  37.   MES_FONT_SIZE = 16   # 呼出对话框
  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 = true

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

  635.   #--------------------------------------------------------------------------
  636.   # ○ 计算名字窗口的位置
  637.   #--------------------------------------------------------------------------
  638.   def get_name_pos   
  639.     case @face_pic_txt
  640.       when 0  # 文字
  641.         x = self.x + FUKI::NAME_SHIFT_X
  642.         y = self.y - FUKI::NAME_FONT_SIZE - 16 + FUKI::NAME_SHIFT_Y
  643.       when 1  # 图片
  644.         if self.x >= @pic_width + 5
  645.           # 默认头像显示在对话框左边
  646.           x = self.x-@pic_width-5
  647.         else
  648.           # 对话框左边放不下时头像显示在右边
  649.           x = self.x + self.width
  650.         end
  651.         y = self.y+self.height/2 - (@pic_height + 5)/2
  652.       end

  653.     return [x,y]
  654.   end
  655.   
  656.   #--------------------------------------------------------------------------
  657.   # ○ 设置角色名字窗口
  658.   #--------------------------------------------------------------------------
  659.   def set_namewindow
  660.    
  661.     # $mes_name为空时不显示角色名字窗口
  662.     if $mes_name == nil or $mes_name == ""
  663.       return
  664.     else
  665.       # 设定变量
  666.       mes_name = $mes_name
  667.       skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
  668.       
  669.       #判断名称是否有对应的图片"Graphics/heads/" +
  670.       if $game_temp.namebmp[mes_name] == nil then
  671.         sFile = "Graphics/heads/" + mes_name + ".jpg"
  672.       else
  673.         sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + ".jpg"
  674.       end
  675.       
  676.       #if FileTest.exist?(sFile) == true then
  677.       begin
  678.                
  679.         @face_pic_txt = 1                       #名字窗口使用头像<- bbschat
  680.         
  681.         # 生成头像
  682.         bmp = Bitmap.new(sFile)
  683.         @pic_width = bmp.width
  684.         @pic_height = bmp.height
  685.         
  686.         self.width += @pic_width
  687.         
  688.         if self.x >= @pic_width + 5
  689.           # 默认头像显示在对话框左边
  690.           name_x = self.x-@pic_width-5
  691.         else
  692.           # 对话框左边放不下时头像显示在右边
  693.           name_x = self.x + self.width
  694.         end
  695.         name_y = self.y+self.height/2 - (@pic_height + 5)/2

  696.         # 生成角色头像窗口
  697.         #@name_win = Window_Base.new(name_x, name_y, @pic_width + 5, @pic_height + 5)
  698.         #@name_win.windowskin = RPG::Cache.windowskin(skin)
  699.         #@name_win.opacity =0     
  700.         #@name_win.z = self.z + 1
  701.         @name_contents.dispose if @name_contents != nil
  702.         @name_contents = Sprite.new
  703.         @name_contents.x = self.x + self.width - bmp.width
  704.         @name_contents.y = name_y #- 7
  705.         @name_contents.bitmap = bmp
  706.         @name_contents.z = self.z + 3
  707.         @name_contents.opacity = 0
  708.         #self.width += 50
  709.         #@name_contents.z = @name_win.z + 2     #这个用了似乎效果不好<- bbschat
  710.         
  711.       rescue
  712.         @face_pic_txt = 0                        #名字窗口使用头像<- bbschat
  713.         
  714.         # 生成头像
  715.         bmp = Bitmap.new(1,1)
  716.         @pic_width = bmp.width
  717.         @pic_height = bmp.height
  718.         
  719.         self.width += @pic_width        
  720.         if self.x >= @pic_width + 5
  721.           # 默认头像显示在对话框左边
  722.           name_x = self.x-@pic_width-5
  723.         else
  724.           # 对话框左边放不下时头像显示在右边
  725.           name_x = self.x + self.width
  726.         end
  727.         name_y = self.y+self.height/2 - (@pic_height + 5)/2
  728.         
  729.         # 生成角色头像窗口
  730.         #@name_win = Window_Base.new(name_x, name_y, @pic_width + 5, @pic_height + 5)
  731.         #@name_win.windowskin = RPG::Cache.windowskin(skin)
  732.         #@name_win.opacity =0     
  733.         #@name_win.z = self.z + 1
  734.         @name_contents.dispose if @name_contents != nil
  735.         @name_contents = Sprite.new
  736.         @name_contents.x = self.x + self.width - bmp.width
  737.         @name_contents.y = name_y #- 7
  738.         @name_contents.bitmap = bmp
  739.         @name_contents.z = self.z + 3
  740.         @name_contents.opacity = 0
  741.       end
  742.     end

  743.   end
复制代码

  【下面还有】!!
金庸群侠传-我是传奇,全新的开始。

Lv1.梦旅人

梦石
0
星屑
50
在线时间
55 小时
注册时间
2007-7-11
帖子
107
2
 楼主| 发表于 2009-6-4 19:43:30 | 只看该作者
  1. #--------------------------------------------------------------------------
  2.   # ○ 释放呼出对话框和角色名字窗口
  3.   #--------------------------------------------------------------------------
  4.   def del_fukidasi
  5.     if @tale != nil
  6.       @tale.dispose
  7.       @tale = nil
  8.     end
  9.     if @name_win != nil
  10.       @name_win.dispose
  11.       @name_win = nil
  12.       @name_contents.dispose
  13.       @name_contents = nil
  14.     end
  15.     self.opacity = 0
  16.     self.x = 90
  17.     self.width = 460
  18.     self.height = 120
  19.     self.contents.dispose
  20.     self.contents = Bitmap.new(width - 32, height - 32)
  21.     self.pause = true
  22.   end
  23.   
  24.   #--------------------------------------------------------------------------
  25.   # ○ 取得角色
  26.   #     parameter : 参数
  27.   #--------------------------------------------------------------------------
  28.   def get_character(parameter)
  29.     # 参数分歧
  30.     case parameter
  31.     when -1  # 玩家
  32.       return $game_player
  33.     when 0   # 该事件
  34.       events = $game_map.events
  35.       return events == nil ? nil : events[$active_event_id]
  36.     else     # 特定事件
  37.       events = $game_map.events
  38.       return events == nil ? nil : events[parameter]
  39.     end
  40.   end
  41.   
  42.   #--------------------------------------------------------------------------
  43.   # ● 设定窗口位置和不透明度
  44.   #--------------------------------------------------------------------------
  45.   def reset_window(width = nil, height = nil)
  46.     if $game_temp.in_battle
  47.       self.y = 16
  48.     else
  49.       case $game_system.message_position
  50.       when 0  # 上
  51.         self.y = 16
  52.       when 1  # 中
  53.         if height != nil and width != nil
  54.           self.y = (480 - height) / 2 - 32
  55.           self.x = (640 - width) / 2
  56.           self.width = width
  57.           self.height = height
  58.           self.contents.dispose
  59.           self.contents = Bitmap.new(width - 32, height - 32)
  60.         else
  61.           self.y = 160
  62.         end
  63.       when 2  # 下
  64.         self.y = 304
  65.       end
  66.     end
  67.     #if $game_system.message_frame == 0
  68.       #self.opacity = 255
  69.     #else
  70.       self.opacity = 0
  71.     #end
  72.     self.back_opacity = FUKI::MES_OPACITY
  73.   end
  74.   
  75.   #--------------------------------------------------------------------------
  76.   # ● 刷新画面
  77.   #--------------------------------------------------------------------------
  78.   def update
  79.     super
  80.     #if @no_term_stop
  81.       #terminate_messageX      
  82.     #end
  83.   
  84.     # 呼出模式下跟随事件移动
  85.     if @tale != nil
  86.       pos = get_fuki_pos(self.width, self.height)
  87.       if pos != nil
  88.         self.x = pos[0]
  89.         self.y = pos[1]
  90.         tale_pos = get_tale_pos
  91.         @tale.x = self.x#tale_pos[0]
  92.         @tale.y = self.y + self.height - 4#tale_pos[1]
  93.       else
  94.         p "出错。出错推断于你没有设置chat(id,name)。对于有\g中断的对话,必须使用chat(id,name)来设置人物ID和名字"
  95.       end
  96.    
  97.       @pic_skin.x = self.x + 2
  98.       @pic_skin.y = self.y + 2
  99.       if @name_contents != nil and !@name_contents.disposed?
  100.       @name_contents.x = self.x + self.width - @name_contents.bitmap.width - 22
  101.       @name_contents.y = self.y  + self.height / 2 - @name_contents.bitmap.height / 2#- 6
  102.       end
  103.    
  104.       if @name_win != nil
  105.         name_pos = get_name_pos
  106.         @name_win.x = name_pos[0]
  107.         @name_win.y = name_pos[1]
  108.         case @face_pic_txt
  109.           when 0  # 文字
  110.             @name_contents.x = @name_win.x + 12
  111.             @name_contents.y = @name_win.y + 8
  112.           when 1  # 图片
  113.             @name_contents.x = @name_win.x + 2
  114.             @name_contents.y = @name_win.y + 2
  115.           end
  116.       end
  117.     end
  118.    
  119.     # 渐变的情况下
  120.     if @fade_in
  121.       #if @no_term_stop
  122.         #@fade_in = false
  123.         #return
  124.       #else        
  125.         self.contents_opacity += 24
  126.         @pic_skin.opacity += 20
  127.         if @name_win != nil
  128.           @name_win.opacity += 24
  129.         end
  130.         if @tale != nil
  131.           @name_contents.opacity += 24 if @name_contents != nil and !@name_contents.disposed?
  132.           @tale.opacity += 24
  133.         end
  134.         if @input_number_window != nil
  135.           @input_number_window.contents_opacity += 24
  136.         end
  137.         if self.contents_opacity == 255
  138.           @fade_in = false
  139.         end
  140.         return
  141.       #end
  142.     end
  143.     # 显示信息中的情况下
  144.     if @contents_drawing
  145.       refresh_drawtext
  146.       return
  147.     end
  148.     # 输入数值的情况下
  149.     if @input_number_window != nil
  150.       @input_number_window.update
  151.       # 确定
  152.       if Input.trigger?(Input::C)
  153.         $game_system.se_play($data_system.decision_se)
  154.         $game_variables[$game_temp.num_input_variable_id] =
  155.           @input_number_window.number
  156.         $game_map.need_refresh = true
  157.         # 释放输入数值窗口
  158.         @input_number_window.dispose
  159.         @input_number_window = nil
  160.         terminate_message
  161.       end
  162.       return
  163.     end
  164.     # 显示信息结束的情况下
  165.     if @contents_showing_end
  166.       # 不是显示选择项且不是呼出对话模式则显示暂停标志
  167.       if $game_temp.choice_max == 0 and @tale == nil
  168.         self.pause = true
  169.       else
  170.         self.pause = false
  171.       end
  172.       # 取消
  173.       if Input.trigger?(Input::B)
  174.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  175.           $game_system.se_play($data_system.cancel_se)
  176.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  177.           terminate_message
  178.         end
  179.       end
  180.       # 确定
  181.       if Input.trigger?(Input::C)
  182.         if $game_temp.choice_max > 0
  183.           $game_system.se_play($data_system.decision_se)
  184.           $game_temp.choice_proc.call(self.index)
  185.         end
  186.         terminate_message
  187.         # 释放呼出窗口
  188.         del_fukidasi
  189.       end
  190.       return
  191.     end
  192.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  193.     if @fade_out == false and $game_temp.message_text != nil
  194.       @contents_showing = true
  195.       $game_temp.message_window_showing = true
  196.       reset_window
  197.       refresh_create
  198.       if @no_term_stop
  199.         self.visible = true        
  200.       else
  201.         if @name_win != nil
  202.           @name_win.opacity = 0
  203.         end
  204.         if @tale != nil
  205.           @tale.opacity = 0
  206.         end
  207.         Graphics.frame_reset
  208.         self.visible = true
  209.         self.contents_opacity = 0
  210.         if @input_number_window != nil
  211.           @input_number_window.contents_opacity = 0
  212.         end
  213.         @fade_in = true
  214.       end
  215.       return
  216.     end
  217.    
  218.     # 没有可以显示的信息、但是窗口为可见的情况下
  219.     unless @no_term_stop
  220.       if self.visible
  221.         @fade_out = true
  222.         self.opacity -= 48
  223.         @name_contents.opacity -= 48 if @name_contents != nil and !@name_contents.disposed?
  224.         @pic_skin.opacity -= 48 if @pic_skin != nil and !@pic_skin.disposed?
  225.         if @name_win != nil
  226.           @name_win.opacity -= 48        
  227.         end
  228.         if @tale != nil
  229.           @tale.opacity -= 48 if @tale != nil and [email protected]?
  230.         end
  231.         if (@name_contents == nil) or @name_contents.disposed? or (@name_contents.opacity == 0)
  232.           self.visible = false
  233.           @name_contents.dispose if @name_contents != nil
  234.           @pic_skin.dispose
  235.           @fade_out = false
  236.           $game_temp.message_window_showing = false
  237.           del_fukidasi
  238.         end
  239.         return
  240.       end
  241.     else
  242.       $game_temp.message_window_showing = false   
  243.     end   
  244.   end
  245.   
  246.   #--------------------------------------------------------------------------
  247.   # ● 释放
  248.   #--------------------------------------------------------------------------
  249.   def dispose
  250.     terminate_message
  251.     $game_temp.message_window_showing = false
  252.     if @input_number_window != nil
  253.       @input_number_window.dispose
  254.     end
  255.     super
  256.   end
  257.   
  258.   #--------------------------------------------------------------------------
  259.   # ● 信息结束处理
  260.   #--------------------------------------------------------------------------
  261.   def terminate_message
  262.     self.active = false
  263.     self.pause = false
  264.     self.index = -1
  265.     self.contents.clear
  266.     # 清除显示中标志
  267.     @contents_showing = false
  268.     @contents_showing_end = false
  269.     unless @kkme_name == "" or @kkme_name == nil
  270.       $mes_name = ""
  271.       @kkme_name = ""
  272.     end
  273.     # 呼叫信息调用
  274.     if $game_temp.message_proc != nil
  275.       $game_temp.message_proc.call
  276.     end
  277.     # 清除文章、选择项、输入数值的相关变量
  278.     $game_temp.message_text = nil
  279.     $game_temp.message_proc = nil
  280.     $game_temp.choice_start = 99
  281.     $game_temp.choice_max = 0
  282.     $game_temp.choice_cancel_type = 0
  283.     $game_temp.choice_proc = nil
  284.     $game_temp.num_input_start = 99
  285.     $game_temp.num_input_variable_id = 0
  286.     $game_temp.num_input_digits_max = 0
  287.     # 释放金钱窗口
  288.     if @gold_window != nil
  289.       @gold_window.dispose
  290.       @gold_window = nil
  291.     end
  292.     @no_term_stop = false
  293.     @save_x = 0
  294.     @save_y = 0
  295.   end

  296.   #--------------------------------------------------------------------------
  297.   # ● ★信息结束处理★
  298.   #--------------------------------------------------------------------------
  299.   def terminate_messageX
  300.     self.active = false
  301.     self.pause = false
  302.     self.index = -1
  303.     # 清除显示中标志
  304.     @contents_showing = false
  305.     @contents_showing_end = false
  306.     # 呼叫信息调用
  307.     if $game_temp.message_proc != nil
  308.       $game_temp.message_proc.call
  309.     end
  310.     # 清除文章、选择项、输入数值的相关变量
  311.     $game_temp.message_text = nil
  312.     $game_temp.message_proc = nil
  313.     @no_term_stop = true
  314.   end
  315.   
  316.   def clear
  317.     self.contents.clear   
  318.     @save_x = 0
  319.     @save_y = 0
  320.   end
  321.   #--------------------------------------------------------------------------
  322.   # ● 刷新光标矩形
  323.   #--------------------------------------------------------------------------
  324.   def update_cursor_rect
  325.     if @index >= 0
  326.       n = $game_temp.choice_start + @index
  327.       self.cursor_rect.set(8, n * (self.contents.font.size + 10), @cursor_width, 32)
  328.     else
  329.       self.cursor_rect.empty
  330.     end
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ● 取得普通文字色
  334.   #--------------------------------------------------------------------------
  335.   def normal_color
  336.     nil_color = Color.new(0,0,0,255)
  337.     if FUKI::FUKI_COLOR != nil_color
  338.       color = FUKI::FUKI_COLOR
  339.     else
  340.       color = super
  341.     end
  342.     return color
  343.   end
  344. end

  345.   class Interpreter  
  346.     def clearword
  347.       $scene.message_window.clear
  348.     end
  349.   end
  350.   
  351.   class Scene_Map
  352.     attr_accessor :message_window
  353.   end
复制代码
金庸群侠传-我是传奇,全新的开始。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

剑圣

梦石
0
星屑
50
在线时间
122 小时
注册时间
2008-8-31
帖子
778
3
发表于 2009-6-4 19:50:10 | 只看该作者
尝试在干净脚本下会不会出错
如果仍然出错就换一个对话脚本吧……主站上搜索FUKI,有一大堆……

PC/IOS/Android共享的RM RPG:未名大学
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
55 小时
注册时间
2007-7-11
帖子
107
4
 楼主| 发表于 2009-6-4 20:14:50 | 只看该作者
在干净的脚本上我也试验了。。也不行啊。

这个脚本我是从  古代版《卖车》   上拿来的。
因为对这里面的对话框  很是眼馋啊。。。
金庸群侠传-我是传奇,全新的开始。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-18 08:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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