查看: 2885|回复: 3

[已经解决] 求解FUKI简化版文字显示不全而且无法显示角色名字窗口

[复制链接]
梦石
0
星屑
90
在线时间
9 小时
注册时间
2019-6-19
回帖
5
发表于 2019-6-21 21:55:35 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 艾迟 于 2019-6-22 12:21 编辑

用的是这个,自己加了个跳过对话,还改了个地方(847行左右),因为简化版直接用的话显示文字的框会跟着文字变得很奇怪,而且没法改变位置一直在下方
rm7.png
搞了好久只有这么改才正常一点,但是连角色名字窗口都不见了更别说放荡不羁的头像了orz而且调查过一个显示头像的东西以后不管调查什么都会显示头像,明明并没有在那个地方设置
rm8.png rm9.png
  1. #===============================================================
  2. #
  3. #    呼出对话框 ver. 1.31 By パラ犬(日)
  4. #  来自 http://rpg.para.s3p.net/
  5. #
  6. #  汉化修改 66RPG bbschat(2006.1.5)
  7. #    来自
  8. #
  9. #    脚本更新:by KKME◎66RPG.com,2007年2月
  10. #
  11. #===============================================================
  12. #    ●准备工作-窗口Skin
  13. #
  14. #    首先,确认自己使用的对话框窗口Skin,(数据库-系统-窗口外观图形)
  15. #    然后根据该窗口Skin制作对话框尾部使用的两个箭头图形
  16. #    尾部箭头图形命名方式:“窗口skin名-top”,“窗口skin名-under”
  17. #    将该图形文件存放在“Graphics/Windowskins”文件夹下。
  18. #
  19. #    本演示游戏内置2套窗口和箭头图形,
  20. #    一套是游戏默认的“001-Blue01”,一套是定制的“fk”
  21. #    玩家可以根据自己的需要参照样本定制自己的呼出对话框窗口Skin。
  22. #
  23. #  ★●使用方法 edit by KKME◎66RPG.com
  24. #
  25. #    方法一:传统方法:输入脚本:chat(事件编号, "角色姓名")。这样就可以正常显示。
  26. #            这种方法虽然使用麻烦,但是有时候也会用到(比如不显示姓名的对话)。这种方法比方法二优先度高。
  27. #            当不需要这种对话功能时候,直接输入一个脚本:chat,就能全部清空。
  28. #
  29. #    方法二:新方法:直接输入对话,会自动读取人名。
  30. #            举例:首先将事件NPC命名,比如命名为“王小二”
  31. #            则输入对话:
  32. #               王小二:
  33. #               今天天气真好啊。
  34. #    这样就能直接将对话显示在这个NPC头上。如果姓名是我方队员则可自动显示在主角头上。
  35. #    这种方法对于我方队员的情况支持 \n[1]这样的效果。如
  36. #               \n[1]:
  37. #               明天听说要下雨。
  38. #    也能正确显示。对于一般的游戏制作这样已经足够了,如果还有特殊需求——小生是
  39. #    知道有可能需要什么特殊需求的:),其实也设置了接口可以满足,不过需要你自己研究一下。
  40. #            
  41. #
  42. #  ★●角色名字窗口使用角色图片的方法(汉化特别追加功能,原脚本只能使用文字)
  43. #   
  44. #    如果能在对应文件夹中找到文件名和角色名字相同的图片,   
  45. #    则角色名字窗口显示角色头像图片,角色图片最好能包括角色的名字。
  46. #    默认头像图片保存目录为“Graphics/Heads/”,玩家可自行修改。
  47. #
  48. #    如果不想使用角色名字直接作为头像文件名。可以使用下面在 Game_Temp 类里增加的namebmp属性。
  49. #    重新设定角色名字与文件名的对应关系。
  50. #
  51. #  KKME注:这里修改了原有算法,可以支持中文名。小生以为不再需要Game_Temp类了。
  52. #          这里小生知道也会有特殊需求,也是设置好接口了的。如果需要再自己研究或问我吧。不然说多了容易误导。  
  53. #
  54. #    ●信息表示速度的变更方法
  55. #
  56. #    在事件命令行使用[脚本]将数值代入[$mes_speed]
  57. #    速度为 0 即瞬间显示全部信息,数字越大,信息表示速度越慢。
  58. #   (举例:$mes_speed=1)
  59. #
  60. #    ●其他设置
  61. #    \o[150]: 设置对话文字透明度,用来模拟将死之人。<---------沉影不器
  62. #    \a[60]: 设置对话框自动关闭时间,数字是关闭的帧数。省略时间\a默认为45帧。<---------沉影不器
  63. #
  64. #    请参照下面的注释
  65. #===============================================================

  66. module FUKI

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

  69.   # 是否显示尾部图标
  70.   TAIL_SHOW = false
  71.   
  72.   # $MES_SPEED不为0时,是否可以用确定键快速显示对话
  73.   ENABLE_SKIP = true
  74.   
  75.   # Skin的设定
  76.   # 使用数据库默认窗口Skin情况下这里使用[""]
  77.   FUKI_SKIN_NAME = "sk"   # 呼出对话框用Skin
  78.   NAME_SKIN_NAME = "sk"   # 角色名字窗口用Skin
  79.   
  80.   # 字体大小
  81.   MES_FONT_SIZE = 22    # 呼出对话框
  82.   NAME_FONT_SIZE = 14   # 角色名字窗口
  83.   
  84.   # 字体颜色
  85.   #(设定为 Color.new(0, 0, 0, 0) 表示使用普通文字色)
  86.   FUKI_COLOR = Color.new(255, 255, 255, 255)  # 呼出对话框
  87.   NAME_COLOR = Color.new(255, 255, 255, 255)  # 角色名字窗口
  88.   
  89.   # 窗口透明度
  90.   # 如修改窗口透明度请同时修改尾部箭头图形内部的透明度
  91.   FUKI_OPACITY = 255    # 呼出对话框
  92.   MES_OPACITY = 255     # 默认信息窗口
  93.   NAME_OPACITY = 255    # 角色名字窗口
  94.   
  95.   # 角色名字窗口的相对位置
  96.   NAME_SHIFT_X = 0      # 横坐标
  97.   NAME_SHIFT_Y = 16     # 纵坐标
  98.   
  99.   # 窗口表示时是否根据画面大小自动检查窗口出现的位置,
  100.   # 自动改变位置( true / false )
  101.   # 设置成 true 在某些变态情况下可能出现箭头图标颠倒的问题 <- bbschat <= KKME
  102.   POS_FIX = true

  103.   # 在画面最边缘表示时的稍微挪动
  104.   # 使用圆形Skin的角和方框的角重合的情况下为 true
  105.   CORNER_SHIFT = false
  106.   SHIFT_PIXEL = 4   # true 时挪动的象素
  107.   
  108.   # 角色高度尺寸
  109.   CHARACTOR_HEIGHT = 48
  110.   # 呼出对话框的相对位置(纵坐标)
  111.   POP_SHIFT_TOP = 0         # 表示位置为上的时候
  112.   POP_SHIFT_UNDER = 0       # 表示位置为下的时候
  113.   
  114.   # 信息的表示速度(数字越小速度越快,0为瞬间表示)
  115.   # 游戏中 可随时用数字代入 $mes_speed 来改变消息表示速度。
  116.   MES_SPEED = 1
  117.   # 默认的文字自动消失时间为45帧
  118.   DEFAULT_AUTO_CLOSE_TIME = 45
  119. end


  120. #===============================================================
  121. # 初始化两个变量,不要动(by KKME◎66RPG.com)
  122. #===============================================================
  123. $mes_name = ""
  124. $mes_id   = nil


  125. #===============================================================
  126. # 方便用户同时设置2个常用参数而使用的函数
  127. #===============================================================
  128. def chat(id = nil,name = "")
  129.   $mes_id = id
  130.   $mes_name = name
  131. end

  132. #===============================================================
  133. # □ Game_Temp
  134. #===============================================================

  135. class Game_Temp
  136.   attr_accessor  :namebmp              #保存头像图片的Hash表
  137.   alias initialize_fuki initialize
  138.   def initialize
  139.     initialize_fuki
  140.     # 如果不想使用角色名字直接作为头像文件名
  141.     # 可在这里重新设定角色名字与文件名的对应关系
  142.     @namebmp ={}
  143.     end
  144. end

  145. #===============================================================
  146. # □ Window_Message
  147. #===============================================================

  148. class Window_Message < Window_Selectable

  149.   #-----------------------------------------------------------
  150.   # ● 初始化状态
  151.   #-----------------------------------------------------------
  152.   def initialize
  153.     super(80, 304, 480, 160)
  154.     self.contents = Bitmap.new(width - 32, height - 32)
  155.     self.visible = false
  156.     self.z = 9998
  157.     @fade_in = false
  158.     @fade_out = false
  159.     @contents_showing = false
  160.     @cursor_width = 0
  161.     @kkme_name = ""
  162.     self.active = false
  163.     self.index = -1
  164.     @w = 0
  165.     @h = 0
  166.     @wait = 0
  167.     @dx = 0
  168.     @dy = 0
  169.     @auto_close=-1
  170.     $mes_speed = FUKI::MES_SPEED
  171.   end
  172.   
  173.   #-----------------------------------------------------------
  174.   # ○ 决定窗口尺寸并生成窗口
  175.   #-----------------------------------------------------------
  176.   def refresh_create
  177.     @kkme_name = ""
  178.     begin
  179.       @kkme_name = $game_temp.message_text.split(":")[0] if $game_temp.message_text.split(":")[1] != nil
  180.       $game_temp.message_text = $game_temp.message_text[@kkme_name.size + 4,$game_temp.message_text.size] if @kkme_name != ""
  181.     rescue
  182.     end
  183.     self.contents.clear
  184.     self.contents.font.color = normal_color
  185.     self.contents.font.size = FUKI::MES_FONT_SIZE
  186.     # 取得窗口尺寸
  187.     get_windowsize
  188.     w = @w + 32 + 8
  189.     h = @h * (self.contents.font.size + 10) + 26   
  190.     # 生成呼出窗口
  191.     set_fukidasi(self.x, self.y, w, h)
  192.     # 生成角色名字窗口
  193.     set_namewindow
  194.     # 初始化信息表示使用的变量
  195.     @dx = @dy = 0
  196.     @cursor_width = 0
  197.     @contents_drawing = true
  198.     # 瞬间表示的情况下
  199.     if $mes_speed == 0
  200.       # 循环信息描绘处理
  201.       while $game_temp.message_text != ""
  202.         draw_massage
  203.       end
  204.       draw_opt_text
  205.       @contents_showing_end = true
  206.       @contents_drawing = false
  207.     else
  208.       # 一个一个描绘文字
  209.       refresh_drawtext
  210.     end
  211.   end
  212.   
  213.   #-----------------------------------------------------------
  214.   # ○ 一个一个描绘文字
  215.   #-----------------------------------------------------------
  216.   def refresh_drawtext
  217.     # 当按下确定键的时候直接显示剩余的全部文字
  218.     if Input.trigger?(Input::C) and FUKI::ENABLE_SKIP
  219.       # 循环信息描绘处理
  220.       while $game_temp.message_text != ""
  221.         draw_massage
  222.       end
  223.       draw_opt_text
  224.       @contents_showing_end = true
  225.       @contents_drawing = false
  226.     elsif $game_temp.message_text != nil
  227.       if @wait > 0
  228.         @wait -= 1
  229.       elsif @wait == 0
  230.         # 描绘处理
  231.         draw_massage
  232.         @wait = $mes_speed
  233.       end
  234.     end
  235.     # 描绘结束
  236.     if $game_temp.message_text == ""
  237.       draw_opt_text
  238.       @contents_showing_end = true
  239.       @contents_drawing = false
  240.     end
  241.   end
  242.   
  243.   #-----------------------------------------------------------
  244.   # ○ 取得窗口尺寸
  245.   #-----------------------------------------------------------
  246.   def get_windowsize
  247.     x = y = 0
  248.     @h = @w = 0
  249.     @cursor_width = 0
  250.     # 有选择项的话,处理字的缩进
  251.     if $game_temp.choice_start == 0
  252.       x = 16
  253.     end
  254.     # 有等待显示的文字的情况下
  255.     if $game_temp.message_text != nil
  256.     text = $game_temp.message_text.clone
  257.       # 限制文字处理
  258.       begin
  259.         last_text = text.clone
  260.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  261.       end until text == last_text
  262.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  263.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  264.       end
  265.       # 为了方便、将 "\\\" 变换为 "\000"
  266.       text.gsub!(/\\\\/) { "\000" }
  267.       # "\\C" 变为 "\001" 、"\\G" 变为 "\002"
  268.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001" }
  269.       text.gsub!(/\\[Gg]/) { "\002" }
  270.       text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\003[#{$1}]" }
  271.       text.slice!(/\\[Aa]\[(\w+)\]/) { "" }
  272.       # c 获取 1 个字 (如果不能取得文字就循环)
  273.       while ((c = text.slice!(/./m)) != nil)
  274.         # \\ 的情况下
  275.         if c == "\000"
  276.           # 还原为本来的文字
  277.           c = "\"
  278.         end
  279.         # \C[n] 或者 \G 的情况下
  280.         if c == "\001" or c == "\002"
  281.           # 下面的文字
  282.           next
  283.         end
  284.         # 另起一行文字的情况下
  285.         if c == "\n"
  286.           # y 累加 1
  287.           y += 1
  288.           # 取得纵横尺寸
  289.           @h = y
  290.           @w = x > @w ? x : @w
  291.           if y >= $game_temp.choice_start
  292.             @w = x + 8 > @w ? x + 8 : @w
  293.           end
  294.           x = 0
  295.           # 移动到选择项的下一行
  296.           if y >= $game_temp.choice_start
  297.             x = 8
  298.           end
  299.           # 下面的文字
  300.           next
  301.         end
  302.         # x 为要描绘文字的宽度加法运算
  303.         x += self.contents.text_size(c).width
  304.       end
  305.     end
  306.     # 输入数值的情况
  307.     if $game_temp.num_input_variable_id > 0
  308.       digits_max = $game_temp.num_input_digits_max
  309.       number = $game_variables[$game_temp.num_input_variable_id]
  310.       @h += 1
  311.       x = digits_max * self.contents.font.size + 16
  312.       @w = x > @w ? x : @w
  313.     end
  314.   end
  315.   
  316.   #-----------------------------------------------------------
  317.   # ○ 描绘信息处理
  318.   #-----------------------------------------------------------
  319.   def draw_massage
  320.     # 有等待显示的文字的情况下
  321.     if $game_temp.message_text != nil
  322.       text = $game_temp.message_text
  323.       # 限制文字处理
  324.       begin
  325.         last_text = text.clone
  326.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  327.       end until text == last_text
  328.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  329.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  330.       end
  331.       # 为了方便、将 "\\\" 变换为 "\000"
  332.       text.gsub!(/\\\\/) { "\000" }
  333.       # "\\C" 变为 "\001"、"\\G" 变为 "\002"
  334.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  335.       text.gsub!(/\\[Gg]/) { "\002" }
  336.       text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\003[#{$1}]" }
  337.       if text.slice!(/\\[Aa]\[(\w+)\]/)!=nil
  338.         @auto_close=$1.to_i
  339.       else
  340.         if text.slice!(/\\[Aa]/)!=nil
  341.           @auto_close = FUKI::DEFAULT_AUTO_CLOSE_TIME
  342.         end
  343.       end
  344.       # c 获取 1 个字
  345.       if ((c = text.slice!(/./m)) != nil)
  346.         # 选择项的情况
  347.         if @dy >= $game_temp.choice_start
  348.           # 处理字的缩进
  349.           @dx = 8
  350.           # 描绘文字
  351.           self.contents.draw_text(4 + @dx, 24 * @dy, 24, 24, c)
  352.           # x 为要描绘文字宽度的加法运算
  353.           @dx += self.contents.text_size(c).width
  354.           # 循环
  355.           while ((c = text.slice!(/./m)) != "\n")
  356.             # 描绘文字
  357.             self.contents.draw_text(4 + @dx, 24 * @dy, 24, 24, c)
  358.             # x 为要描绘文字宽度的加法运算
  359.             @dx += self.contents.text_size(c).width
  360.           end
  361.           if c == "\n"
  362.             # 更新光标宽度
  363.             @cursor_width = [@cursor_width, @dx].max
  364.             # dy 累加 1
  365.             @dy += 1
  366.             @dx = 0
  367.           end
  368.           return
  369.         end
  370.         # \\ 的情况下
  371.         if c == "\000"
  372.           # 还原为本来的文字
  373.           c = "\"
  374.         end
  375.         
  376.         #\C[n] 的情况下
  377.         if c == "\001"
  378.           # 更改文字色
  379.           text.sub!(/\[([0-9]+)\]/, "")
  380.           color = $1.to_i
  381.           if color >= 0 and color <= 7
  382.             self.contents.font.color = text_color(color)
  383.           end
  384.           return
  385.         end
  386.         
  387.         # \G 的情况下
  388.         if c == "\002"
  389.           # 生成金钱窗口
  390.           if @gold_window == nil
  391.             @gold_window = Window_Gold.new
  392.             @gold_window.x = 560 - @gold_window.width
  393.             if $game_temp.in_battle
  394.               @gold_window.y = 192
  395.             else
  396.               @gold_window.y = self.y >= 128 ? 32 : 384
  397.             end
  398.             @gold_window.opacity = self.opacity
  399.             @gold_window.back_opacity = self.back_opacity
  400.           end
  401.           return
  402.         end
  403.         
  404.         if c == "\003"
  405.           text.sub!(/\[([0-9]+)\]/, "")
  406.           self.contents.font.color.alpha = [[0, $1.to_i].max, 255].min
  407.           return
  408.         end
  409.         
  410.         # 另起一行文字的情况下
  411.         if c == "\n"
  412.           # dy 累加 1
  413.           @dy += 1
  414.           @dx = 0
  415.           return
  416.         end
  417.         
  418.         # 描绘文字
  419.         self.contents.font.size = FUKI::MES_FONT_SIZE
  420.         font_size = self.contents.font.size     
  421.         self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
  422.         # dx 为要描绘文字的宽度加法运算
  423.         @dx += self.contents.text_size(c).width
  424.       end
  425.     end
  426.   end
  427.   
  428.   #-----------------------------------------------------------
  429.   # ○ 选择项和输入数值的情况下
  430.   #-----------------------------------------------------------
  431.   def draw_opt_text
  432.     # 选择项的情况下
  433.     if $game_temp.choice_max > 0
  434.       @item_max = $game_temp.choice_max
  435.       self.active = true
  436.       self.index = 0
  437.     end
  438.     # 输入数值的情况下
  439.     if $game_temp.num_input_variable_id > 0
  440.       digits_max = $game_temp.num_input_digits_max
  441.       number = $game_variables[$game_temp.num_input_variable_id]
  442.       @input_number_window = Window_InputNumber.new(digits_max)
  443.       @input_number_window.number = number
  444.       @input_number_window.x = self.x + 8
  445.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  446.     end
  447.   end
  448.   
  449.   #-----------------------------------------------------------
  450.   # ○ 设置呼出对话框
  451.   #-----------------------------------------------------------
  452.   def set_fukidasi(x, y, width, height)
  453.     begin
  454.       # 不显示暂停标志
  455.       self.pause = false
  456.       # 取得对话框位置
  457.       pos = get_fuki_pos(width, height)
  458.       x = pos[0]
  459.       y = pos[1]
  460.       skin = FUKI::FUKI_SKIN_NAME != "" ? FUKI::FUKI_SKIN_NAME : $game_system.windowskin_name
  461.       # 生成呼出对话框
  462.       self.windowskin = RPG::Cache.windowskin(skin)
  463.       self.x = x
  464.       self.y = y
  465.       self.height = height
  466.       self.width = width
  467.       self.contents.dispose
  468.       self.contents = Bitmap.new(width - 32, height - 32)
  469.       self.back_opacity = FUKI::FUKI_OPACITY
  470.       self.contents.clear
  471.       self.contents.font.color = normal_color
  472.       self.contents.font.size = FUKI::MES_FONT_SIZE
  473.       # 描绘尾部图标
  474.       if $game_system.message_frame == 0
  475.         # 取得位置
  476.         tale_pos = get_tale_pos
  477.         @tale = Sprite.new
  478.         # 是否显示尾部图标 <- bbschat
  479.         if FUKI::TAIL_SHOW == true
  480.           case @message_position
  481.           when 0  # 上
  482.             bitmap = RPG::Cache.windowskin(FUKI::FUKI_SKIN_NAME)
  483.             rect = Rect.new(32, 32, 64, 32)
  484.             @tale.bitmap.blt(0, 0, bitmap, rect)
  485.             bitmap.dispose
  486.             @tale.x = tale_pos[0]
  487.             @tale.x += 8 if @tale.x < 64
  488.             if @tale.x > 640 - 64
  489.               @tale.mirror = true
  490.               @tale.x -= 64
  491.             end
  492.             @tale.y = tale_pos[1]
  493.             @tale.z = self.z + 1
  494.           when 1  # 中
  495.             @tale.dispose
  496.             @tale = nil
  497.           when 2  # 下
  498.             bitmap = RPG::Cache.windowskin(FUKI::FUKI_SKIN_NAME)
  499.             rect = Rect.new(32, 64, 64, 32)
  500.             @tale.bitmap.blt(0, 0, bitmap, rect)
  501.             bitmap.dispose
  502.             @tale.x = tale_pos[0]
  503.             @tale.x += 8 if @tale.x < 64
  504.             if @tale.x > 640 - 64
  505.               @tale.mirror = true
  506.               @tale.x -= 64
  507.             end
  508.             @tale.y = tale_pos[1]
  509.             @tale.z = self.z# + 1
  510.           end
  511.         end
  512.       end
  513.     rescue
  514.       del_fukidasi
  515.       reset_window(width, height)
  516.     end
  517.   end

  518.   #-----------------------------------------------------------
  519.   # ○ 计算呼出对话框的位置
  520.   #-----------------------------------------------------------
  521.   def get_fuki_pos(width, height)
  522.    
  523.     # 取得角色
  524.     if $mes_id != nil
  525.       @character = get_character($mes_id)
  526.     else
  527.       @character = get_character_KKME
  528.     end
  529.     if @character == nil
  530.       # 角色不存在的情况下使用默认信息框
  531.       del_fukidasi
  532.       reset_window(width, height)
  533.       return
  534.     end
  535.     # 处理坐标
  536.     x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - (width / 2)
  537.     # 为尽量显示在画面内而移动横坐标
  538.     if x + width > 640
  539.       x = 640 - width
  540.     elsif x < 0
  541.       x = 0
  542.     end
  543.     # 决定窗口位置
  544.     case $game_system.message_position
  545.       when 0  # 上
  546.         y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  547.       when 1  # 中
  548.         y = (480 - height) / 2
  549.         x = (640 - width) / 2
  550.       when 2  # 下
  551.         y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  552.     end
  553.     # 纪录文章显示位置
  554.     @message_position = $game_system.message_position
  555.     # 如果选择自动修正,则如果文章会显示到画面外则自动改变窗口的尺寸(高度)
  556.     if FUKI::POS_FIX
  557.       case @message_position
  558.         when 0  # 上
  559.           if y <= 0
  560.             @message_position = 2
  561.             y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  562.           end
  563.         when 2  # 下
  564.           if y + height >= 480
  565.             @message_position = 0
  566.             y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  567.           end
  568.       end
  569.     end
  570.     return [x,y]
  571.    
  572.   end
  573.   
  574.   #-----------------------------------------------------------
  575.   # ○ 计算尾部图标的位置
  576.   #-----------------------------------------------------------
  577.   def get_tale_pos
  578.     case @message_position
  579.       when 0  # 上
  580.         # 处理坐标
  581.         x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  582.         # 画面边缘的话则移动位置
  583.         if FUKI::CORNER_SHIFT
  584.           if x == 0
  585.             x = FUKI::SHIFT_PIXEL
  586.           elsif x == 640 - 32
  587.             x = 640 - 32 - FUKI::SHIFT_PIXEL
  588.           end
  589.         end
  590.         y = self.y + self.height - 16
  591.       when 1  # 中
  592.         x = nil
  593.         y = nil
  594.       when 2  # 下
  595.         # 处理坐标
  596.         x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  597.         # 画面边缘的话则移动位置
  598.         if FUKI::CORNER_SHIFT
  599.           if x == 0
  600.             x = FUKI::SHIFT_PIXEL
  601.           elsif @tale.x == 640 - 32
  602.             x = 640 - 32 - FUKI::SHIFT_PIXEL
  603.           end
  604.         end
  605.         y = self.y - 16
  606.     end
  607.     return [x,y]
  608.   end

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

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

  681.       rescue
  682.         
  683.         @face_pic_txt = 0                       #名字窗口使用文字<- bbschat

  684.         # 生成名字
  685.         name_width = mes_name.size / 2 * FUKI::NAME_FONT_SIZE
  686.         name_height = FUKI::NAME_FONT_SIZE
  687.         name_x = self.x + FUKI::NAME_SHIFT_X
  688.         name_y = self.y - name_height - 16 + FUKI::NAME_SHIFT_Y

  689.         # 生成角色名字窗口(只有边框)
  690.         @name_win = Window_Base.new(name_x, name_y, name_width + 16, name_height + 16)
  691.         @name_win.windowskin = RPG::Cache.windowskin(skin)
  692.         @name_win.back_opacity = FUKI::NAME_OPACITY
  693.         @name_win.z = self.z + 1
  694.         
  695.         # 为了使空白比Windows类限定的更小使用双重结构
  696.         @name_contents = Sprite.new
  697.         @name_contents.x = name_x + 12
  698.         @name_contents.y = name_y + 8
  699.         @name_contents.bitmap = Bitmap.new(name_width, name_height)
  700.         @name_contents.z = @name_win.z + 2
  701.         
  702.         # 设定文字色
  703.         nil_color = Color.new(0,0,0,0)
  704.         if FUKI::NAME_COLOR != nil_color
  705.           @name_contents.bitmap.font.color = FUKI::NAME_COLOR
  706.         else
  707.           @name_contents.bitmap.font.color = normal_color
  708.         end
  709.         @name_contents.bitmap.font.size = FUKI::NAME_FONT_SIZE
  710.         # 调整窗口尺寸
  711.         rect = @name_contents.bitmap.text_size(mes_name)
  712.         @name_win.width = rect.width + 32
  713.         # 描画名字
  714.         @name_contents.bitmap.draw_text(rect, mes_name)
  715.       end
  716.     end

  717.   end
  718.   
  719.   #-----------------------------------------------------------
  720.   # ○ 释放呼出对话框和角色名字窗口
  721.   #-----------------------------------------------------------
  722.   def del_fukidasi
  723.     if @tale != nil
  724.       @tale.dispose
  725.       @tale = nil
  726.     end
  727.     if @name_win != nil
  728.       @name_win.dispose
  729.       @name_win = nil
  730.       @name_contents.dispose
  731.       @name_contents = nil
  732.     end
  733.     self.opacity = 0
  734.     self.x = 80
  735.     self.width = 480
  736.     self.height = 160
  737.     self.contents.dispose
  738.     self.contents = Bitmap.new(width - 32, height - 32)
  739.     self.pause = true
  740.   end
  741.   
  742.   #-----------------------------------------------------------
  743.   # ○ 取得角色
  744.   #     parameter : 参数
  745.   #-----------------------------------------------------------
  746.   def get_character(parameter)
  747.     # 参数分歧
  748.     case parameter
  749.     when -1  # 玩家
  750.       return $game_player
  751.     when 0   # 该事件
  752.       events = $game_map.events
  753.       return events == nil ? nil : events[$active_event_id]
  754.     else     # 特定事件
  755.       events = $game_map.events
  756.       return events == nil ? nil : events[parameter]
  757.     end
  758.   end
  759.   
  760.   #-----------------------------------------------------------
  761.   # ● 设定窗口位置和不透明度
  762.   #-----------------------------------------------------------
  763.   def reset_window(width = nil, height = nil)
  764.       case $game_system.message_position
  765.       when 0  # 上
  766.         self.y = 16
  767.       when 1  # 中
  768.         if height != nil and width != nil
  769.           self.y = (480 - height) / 2 - 32
  770.           self.x = (640 - width) / 2
  771.           self.width = width
  772.           self.height = height
  773.           self.contents.dispose
  774.           self.contents = Bitmap.new(width - 32, height - 32)
  775.         else
  776.           self.y = 160
  777.         end
  778.       when 2  # 下
  779.         self.y = 304
  780.       end
  781.     if $game_system.message_frame == 0
  782.       self.opacity = 255
  783.     else
  784.       self.opacity = 0
  785.     end
  786.     self.back_opacity = FUKI::MES_OPACITY
  787.   end
  788.   
  789.   #-----------------------------------------------------------
  790.   # ● 刷新画面
  791.   #-----------------------------------------------------------
  792.   def update
  793.     super
  794.     # 呼出模式下跟随事件移动
  795.     if @tale != nil
  796.       pos = get_fuki_pos(self.width, self.height)
  797.       self.x = pos[0]
  798.       self.y = pos[1]

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

  1009. #===============================================================
  1010. # ■ Window_InputNumber
  1011. #===============================================================

  1012. class Window_InputNumber < Window_Base
  1013.   #-----------------------------------------------------------
  1014.   # ● 初始化对像
  1015.   #     digits_max : 位数
  1016.   #-----------------------------------------------------------
  1017.   def initialize(digits_max)
  1018.     @digits_max = digits_max
  1019.     @number = 0
  1020.     # 从数字的幅度计算(假定与 0~9 等幅)光标的幅度
  1021.     dummy_bitmap = Bitmap.new(32, 32)
  1022.     dummy_bitmap.font.size = FUKI::MES_FONT_SIZE
  1023.     @cursor_width = dummy_bitmap.text_size("0").width + 8
  1024.     dummy_bitmap.dispose
  1025.     super(0, 0, @cursor_width * @digits_max + 32, 64)
  1026.     self.contents = Bitmap.new(width - 32, height - 32)
  1027.     self.contents.font.size = FUKI::MES_FONT_SIZE
  1028.     self.z += 9999
  1029.     self.opacity = 0
  1030.     @index = 0
  1031.     refresh
  1032.     update_cursor_rect
  1033.   end
  1034. end

  1035. #============================================================
  1036. # Game_Map,把events变量公开
  1037. #============================================================
  1038. class Game_Map
  1039.   attr_reader   :events
  1040. end

  1041. #============================================================
  1042. # 便于返回姓名
  1043. #============================================================
  1044. class Game_Event < Game_Character
  1045.   def name
  1046.     return @event.name
  1047.   end
  1048.   def name=(na)
  1049.     @event.name = na
  1050.   end
  1051. end
  1052. end
复制代码
梦石
0
星屑
90
在线时间
9 小时
注册时间
2019-6-19
回帖
5
 楼主| 发表于 2019-6-21 21:59:06 | 显示全部楼层
惊了,为什么我放不了图
回复

使用道具 举报

梦石
0
星屑
90
在线时间
9 小时
注册时间
2019-6-19
回帖
5
 楼主| 发表于 2019-6-22 12:18:05 | 显示全部楼层
本帖最后由 艾迟 于 2019-6-22 12:20 编辑

发帖头像和图片都显示不出来,就是很懵?
回复

使用道具 举报

梦石
0
星屑
90
在线时间
9 小时
注册时间
2019-6-19
回帖
5
 楼主| 发表于 2019-6-22 17:31:06 | 显示全部楼层
虽然还是有点小问题但姑且自己解决了orz
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部