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

Project1

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

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
90
在线时间
9 小时
注册时间
2019-6-19
帖子
7
跳转到指定楼层
1
发表于 2019-6-21 21:55:35 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

用的是这个,自己加了个跳过对话,还改了个地方(847行左右),因为简化版直接用的话显示文字的框会跟着文字变得很奇怪,而且没法改变位置一直在下方

搞了好久只有这么改才正常一点,但是连角色名字窗口都不见了更别说放荡不羁的头像了orz而且调查过一个显示头像的东西以后不管调查什么都会显示头像,明明并没有在那个地方设置

RUBY 代码复制
  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.  
  67. module FUKI
  68.  
  69.   # 头像图片保存目录的设定
  70.   HEAD_PIC_DIR = "Graphics/Heads/"
  71.  
  72.   # 是否显示尾部图标
  73.   TAIL_SHOW = false
  74.  
  75.   # $MES_SPEED不为0时,是否可以用确定键快速显示对话
  76.   ENABLE_SKIP = true
  77.  
  78.   # Skin的设定
  79.   # 使用数据库默认窗口Skin情况下这里使用[""]
  80.   FUKI_SKIN_NAME = "sk"   # 呼出对话框用Skin
  81.   NAME_SKIN_NAME = "sk"   # 角色名字窗口用Skin
  82.  
  83.   # 字体大小
  84.   MES_FONT_SIZE = 22    # 呼出对话框
  85.   NAME_FONT_SIZE = 14   # 角色名字窗口
  86.  
  87.   # 字体颜色
  88.   #(设定为 Color.new(0, 0, 0, 0) 表示使用普通文字色)
  89.   FUKI_COLOR = Color.new(255, 255, 255, 255)  # 呼出对话框
  90.   NAME_COLOR = Color.new(255, 255, 255, 255)  # 角色名字窗口
  91.  
  92.   # 窗口透明度
  93.   # 如修改窗口透明度请同时修改尾部箭头图形内部的透明度
  94.   FUKI_OPACITY = 255    # 呼出对话框
  95.   MES_OPACITY = 255     # 默认信息窗口
  96.   NAME_OPACITY = 255    # 角色名字窗口
  97.  
  98.   # 角色名字窗口的相对位置
  99.   NAME_SHIFT_X = 0      # 横坐标
  100.   NAME_SHIFT_Y = 16     # 纵坐标
  101.  
  102.   # 窗口表示时是否根据画面大小自动检查窗口出现的位置,
  103.   # 自动改变位置( true / false )
  104.   # 设置成 true 在某些变态情况下可能出现箭头图标颠倒的问题 <- bbschat <= KKME
  105.   POS_FIX = true
  106.  
  107.   # 在画面最边缘表示时的稍微挪动
  108.   # 使用圆形Skin的角和方框的角重合的情况下为 true
  109.   CORNER_SHIFT = false
  110.   SHIFT_PIXEL = 4   # true 时挪动的象素
  111.  
  112.   # 角色高度尺寸
  113.   CHARACTOR_HEIGHT = 48
  114.   # 呼出对话框的相对位置(纵坐标)
  115.   POP_SHIFT_TOP = 0         # 表示位置为上的时候
  116.   POP_SHIFT_UNDER = 0       # 表示位置为下的时候
  117.  
  118.   # 信息的表示速度(数字越小速度越快,0为瞬间表示)
  119.   # 游戏中 可随时用数字代入 $mes_speed 来改变消息表示速度。
  120.   MES_SPEED = 1
  121.   # 默认的文字自动消失时间为45帧
  122.   DEFAULT_AUTO_CLOSE_TIME = 45
  123. end
  124.  
  125.  
  126. #===============================================================
  127. # 初始化两个变量,不要动(by KKME◎66RPG.com)
  128. #===============================================================
  129. $mes_name = ""
  130. $mes_id   = nil
  131.  
  132.  
  133. #===============================================================
  134. # 方便用户同时设置2个常用参数而使用的函数
  135. #===============================================================
  136. def chat(id = nil,name = "")
  137.   $mes_id = id
  138.   $mes_name = name
  139. end
  140.  
  141. #===============================================================
  142. # □ Game_Temp
  143. #===============================================================
  144.  
  145. class Game_Temp
  146.   attr_accessor  :namebmp              #保存头像图片的Hash表
  147.   alias initialize_fuki initialize
  148.   def initialize
  149.     initialize_fuki
  150.     # 如果不想使用角色名字直接作为头像文件名
  151.     # 可在这里重新设定角色名字与文件名的对应关系
  152.     @namebmp ={}
  153.     end
  154. end
  155.  
  156. #===============================================================
  157. # □ Window_Message
  158. #===============================================================
  159.  
  160. class Window_Message < Window_Selectable
  161.  
  162.   #-----------------------------------------------------------
  163.   # ● 初始化状态
  164.   #-----------------------------------------------------------
  165.   def initialize
  166.     super(80, 304, 480, 160)
  167.     self.contents = Bitmap.new(width - 32, height - 32)
  168.     self.visible = false
  169.     self.z = 9998
  170.     @fade_in = false
  171.     @fade_out = false
  172.     @contents_showing = false
  173.     @cursor_width = 0
  174.     @kkme_name = ""
  175.     self.active = false
  176.     self.index = -1
  177.     @w = 0
  178.     @h = 0
  179.     @wait = 0
  180.     @dx = 0
  181.     @dy = 0
  182.     @auto_close=-1
  183.     $mes_speed = FUKI::MES_SPEED
  184.   end
  185.  
  186.   #-----------------------------------------------------------
  187.   # ○ 决定窗口尺寸并生成窗口
  188.   #-----------------------------------------------------------
  189.   def refresh_create
  190.     @kkme_name = ""
  191.     begin
  192.       @kkme_name = $game_temp.message_text.split(":")[0] if $game_temp.message_text.split(":")[1] != nil
  193.       $game_temp.message_text = $game_temp.message_text[@kkme_name.size + 4,$game_temp.message_text.size] if @kkme_name != ""
  194.     rescue
  195.     end
  196.     self.contents.clear
  197.     self.contents.font.color = normal_color
  198.     self.contents.font.size = FUKI::MES_FONT_SIZE
  199.     # 取得窗口尺寸
  200.     get_windowsize
  201.     w = @w + 32 + 8
  202.     h = @h * (self.contents.font.size + 10) + 26   
  203.     # 生成呼出窗口
  204.     set_fukidasi(self.x, self.y, w, h)
  205.     # 生成角色名字窗口
  206.     set_namewindow
  207.     # 初始化信息表示使用的变量
  208.     @dx = @dy = 0
  209.     @cursor_width = 0
  210.     @contents_drawing = true
  211.     # 瞬间表示的情况下
  212.     if $mes_speed == 0
  213.       # 循环信息描绘处理
  214.       while $game_temp.message_text != ""
  215.         draw_massage
  216.       end
  217.       draw_opt_text
  218.       @contents_showing_end = true
  219.       @contents_drawing = false
  220.     else
  221.       # 一个一个描绘文字
  222.       refresh_drawtext
  223.     end
  224.   end
  225.  
  226.   #-----------------------------------------------------------
  227.   # ○ 一个一个描绘文字
  228.   #-----------------------------------------------------------
  229.   def refresh_drawtext
  230.     # 当按下确定键的时候直接显示剩余的全部文字
  231.     if Input.trigger?(Input::C) and FUKI::ENABLE_SKIP
  232.       # 循环信息描绘处理
  233.       while $game_temp.message_text != ""
  234.         draw_massage
  235.       end
  236.       draw_opt_text
  237.       @contents_showing_end = true
  238.       @contents_drawing = false
  239.     elsif $game_temp.message_text != nil
  240.       if @wait > 0
  241.         @wait -= 1
  242.       elsif @wait == 0
  243.         # 描绘处理
  244.         draw_massage
  245.         @wait = $mes_speed
  246.       end
  247.     end
  248.     # 描绘结束
  249.     if $game_temp.message_text == ""
  250.       draw_opt_text
  251.       @contents_showing_end = true
  252.       @contents_drawing = false
  253.     end
  254.   end
  255.  
  256.   #-----------------------------------------------------------
  257.   # ○ 取得窗口尺寸
  258.   #-----------------------------------------------------------
  259.   def get_windowsize
  260.     x = y = 0
  261.     @h = @w = 0
  262.     @cursor_width = 0
  263.     # 有选择项的话,处理字的缩进
  264.     if $game_temp.choice_start == 0
  265.       x = 16
  266.     end
  267.     # 有等待显示的文字的情况下
  268.     if $game_temp.message_text != nil
  269.     text = $game_temp.message_text.clone
  270.       # 限制文字处理
  271.       begin
  272.         last_text = text.clone
  273.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  274.       end until text == last_text
  275.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  276.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  277.       end
  278.       # 为了方便、将 "\\\\" 变换为 "\000"
  279.       text.gsub!(/\\\\/) { "\000" }
  280.       # "\\C" 变为 "\001" 、"\\G" 变为 "\002"
  281.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001" }
  282.       text.gsub!(/\\[Gg]/) { "\002" }
  283.       text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\003[#{$1}]" }
  284.       text.slice!(/\\[Aa]\[(\w+)\]/) { "" }
  285.       # c 获取 1 个字 (如果不能取得文字就循环)
  286.       while ((c = text.slice!(/./m)) != nil)
  287.         # \\ 的情况下
  288.         if c == "\000"
  289.           # 还原为本来的文字
  290.           c = "\\"
  291.         end
  292.         # \C[n] 或者 \G 的情况下
  293.         if c == "\001" or c == "\002"
  294.           # 下面的文字
  295.           next
  296.         end
  297.         # 另起一行文字的情况下
  298.         if c == "\n"
  299.           # y 累加 1
  300.           y += 1
  301.           # 取得纵横尺寸
  302.           @h = y
  303.           @w = x > @w ? x : @w
  304.           if y >= $game_temp.choice_start
  305.             @w = x + 8 > @w ? x + 8 : @w
  306.           end
  307.           x = 0
  308.           # 移动到选择项的下一行
  309.           if y >= $game_temp.choice_start
  310.             x = 8
  311.           end
  312.           # 下面的文字
  313.           next
  314.         end
  315.         # x 为要描绘文字的宽度加法运算
  316.         x += self.contents.text_size(c).width
  317.       end
  318.     end
  319.     # 输入数值的情况
  320.     if $game_temp.num_input_variable_id > 0
  321.       digits_max = $game_temp.num_input_digits_max
  322.       number = $game_variables[$game_temp.num_input_variable_id]
  323.       @h += 1
  324.       x = digits_max * self.contents.font.size + 16
  325.       @w = x > @w ? x : @w
  326.     end
  327.   end
  328.  
  329.   #-----------------------------------------------------------
  330.   # ○ 描绘信息处理
  331.   #-----------------------------------------------------------
  332.   def draw_massage
  333.     # 有等待显示的文字的情况下
  334.     if $game_temp.message_text != nil
  335.       text = $game_temp.message_text
  336.       # 限制文字处理
  337.       begin
  338.         last_text = text.clone
  339.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  340.       end until text == last_text
  341.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  342.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  343.       end
  344.       # 为了方便、将 "\\\\" 变换为 "\000"
  345.       text.gsub!(/\\\\/) { "\000" }
  346.       # "\\C" 变为 "\001"、"\\G" 变为 "\002"
  347.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  348.       text.gsub!(/\\[Gg]/) { "\002" }
  349.       text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\003[#{$1}]" }
  350.       if text.slice!(/\\[Aa]\[(\w+)\]/)!=nil
  351.         @auto_close=$1.to_i
  352.       else
  353.         if text.slice!(/\\[Aa]/)!=nil
  354.           @auto_close = FUKI::DEFAULT_AUTO_CLOSE_TIME
  355.         end
  356.       end
  357.       # c 获取 1 个字
  358.       if ((c = text.slice!(/./m)) != nil)
  359.         # 选择项的情况
  360.         if @dy >= $game_temp.choice_start
  361.           # 处理字的缩进
  362.           @dx = 8
  363.           # 描绘文字
  364.           self.contents.draw_text(4 + @dx, 24 * @dy, 24, 24, c)
  365.           # x 为要描绘文字宽度的加法运算
  366.           @dx += self.contents.text_size(c).width
  367.           # 循环
  368.           while ((c = text.slice!(/./m)) != "\n")
  369.             # 描绘文字
  370.             self.contents.draw_text(4 + @dx, 24 * @dy, 24, 24, c)
  371.             # x 为要描绘文字宽度的加法运算
  372.             @dx += self.contents.text_size(c).width
  373.           end
  374.           if c == "\n"
  375.             # 更新光标宽度
  376.             @cursor_width = [@cursor_width, @dx].max
  377.             # dy 累加 1
  378.             @dy += 1
  379.             @dx = 0
  380.           end
  381.           return
  382.         end
  383.         # \\ 的情况下
  384.         if c == "\000"
  385.           # 还原为本来的文字
  386.           c = "\\"
  387.         end
  388.  
  389.         #\C[n] 的情况下
  390.         if c == "\001"
  391.           # 更改文字色
  392.           text.sub!(/\[([0-9]+)\]/, "")
  393.           color = $1.to_i
  394.           if color >= 0 and color <= 7
  395.             self.contents.font.color = text_color(color)
  396.           end
  397.           return
  398.         end
  399.  
  400.         # \G 的情况下
  401.         if c == "\002"
  402.           # 生成金钱窗口
  403.           if @gold_window == nil
  404.             @gold_window = Window_Gold.new
  405.             @gold_window.x = 560 - @gold_window.width
  406.             if $game_temp.in_battle
  407.               @gold_window.y = 192
  408.             else
  409.               @gold_window.y = self.y >= 128 ? 32 : 384
  410.             end
  411.             @gold_window.opacity = self.opacity
  412.             @gold_window.back_opacity = self.back_opacity
  413.           end
  414.           return
  415.         end
  416.  
  417.         if c == "\003"
  418.           text.sub!(/\[([0-9]+)\]/, "")
  419.           self.contents.font.color.alpha = [[0, $1.to_i].max, 255].min
  420.           return
  421.         end
  422.  
  423.         # 另起一行文字的情况下
  424.         if c == "\n"
  425.           # dy 累加 1
  426.           @dy += 1
  427.           @dx = 0
  428.           return
  429.         end
  430.  
  431.         # 描绘文字
  432.         self.contents.font.size = FUKI::MES_FONT_SIZE
  433.         font_size = self.contents.font.size     
  434.         self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
  435.         # dx 为要描绘文字的宽度加法运算
  436.         @dx += self.contents.text_size(c).width
  437.       end
  438.     end
  439.   end
  440.  
  441.   #-----------------------------------------------------------
  442.   # ○ 选择项和输入数值的情况下
  443.   #-----------------------------------------------------------
  444.   def draw_opt_text
  445.     # 选择项的情况下
  446.     if $game_temp.choice_max > 0
  447.       @item_max = $game_temp.choice_max
  448.       self.active = true
  449.       self.index = 0
  450.     end
  451.     # 输入数值的情况下
  452.     if $game_temp.num_input_variable_id > 0
  453.       digits_max = $game_temp.num_input_digits_max
  454.       number = $game_variables[$game_temp.num_input_variable_id]
  455.       @input_number_window = Window_InputNumber.new(digits_max)
  456.       @input_number_window.number = number
  457.       @input_number_window.x = self.x + 8
  458.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  459.     end
  460.   end
  461.  
  462.   #-----------------------------------------------------------
  463.   # ○ 设置呼出对话框
  464.   #-----------------------------------------------------------
  465.   def set_fukidasi(x, y, width, height)
  466.     begin
  467.       # 不显示暂停标志
  468.       self.pause = false
  469.       # 取得对话框位置
  470.       pos = get_fuki_pos(width, height)
  471.       x = pos[0]
  472.       y = pos[1]
  473.       skin = FUKI::FUKI_SKIN_NAME != "" ? FUKI::FUKI_SKIN_NAME : $game_system.windowskin_name
  474.       # 生成呼出对话框
  475.       self.windowskin = RPG::Cache.windowskin(skin)
  476.       self.x = x
  477.       self.y = y
  478.       self.height = height
  479.       self.width = width
  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 = normal_color
  485.       self.contents.font.size = FUKI::MES_FONT_SIZE
  486.       # 描绘尾部图标
  487.       if $game_system.message_frame == 0
  488.         # 取得位置
  489.         tale_pos = get_tale_pos
  490.         @tale = Sprite.new
  491.         # 是否显示尾部图标 <- bbschat
  492.         if FUKI::TAIL_SHOW == true
  493.           case @message_position
  494.           when 0  # 上
  495.             bitmap = RPG::Cache.windowskin(FUKI::FUKI_SKIN_NAME)
  496.             rect = Rect.new(32, 32, 64, 32)
  497.             @tale.bitmap.blt(0, 0, bitmap, rect)
  498.             bitmap.dispose
  499.             @tale.x = tale_pos[0]
  500.             @tale.x += 8 if @tale.x < 64
  501.             if @tale.x > 640 - 64
  502.               @tale.mirror = true
  503.               @tale.x -= 64
  504.             end
  505.             @tale.y = tale_pos[1]
  506.             @tale.z = self.z + 1
  507.           when 1  # 中
  508.             @tale.dispose
  509.             @tale = nil
  510.           when 2  # 下
  511.             bitmap = RPG::Cache.windowskin(FUKI::FUKI_SKIN_NAME)
  512.             rect = Rect.new(32, 64, 64, 32)
  513.             @tale.bitmap.blt(0, 0, bitmap, rect)
  514.             bitmap.dispose
  515.             @tale.x = tale_pos[0]
  516.             @tale.x += 8 if @tale.x < 64
  517.             if @tale.x > 640 - 64
  518.               @tale.mirror = true
  519.               @tale.x -= 64
  520.             end
  521.             @tale.y = tale_pos[1]
  522.             @tale.z = self.z# + 1
  523.           end
  524.         end
  525.       end
  526.     rescue
  527.       del_fukidasi
  528.       reset_window(width, height)
  529.     end
  530.   end
  531.  
  532.   #-----------------------------------------------------------
  533.   # ○ 计算呼出对话框的位置
  534.   #-----------------------------------------------------------
  535.   def get_fuki_pos(width, height)
  536.  
  537.     # 取得角色
  538.     if $mes_id != nil
  539.       @character = get_character($mes_id)
  540.     else
  541.       @character = get_character_KKME
  542.     end
  543.     if @character == nil
  544.       # 角色不存在的情况下使用默认信息框
  545.       del_fukidasi
  546.       reset_window(width, height)
  547.       return
  548.     end
  549.     # 处理坐标
  550.     x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - (width / 2)
  551.     # 为尽量显示在画面内而移动横坐标
  552.     if x + width > 640
  553.       x = 640 - width
  554.     elsif x < 0
  555.       x = 0
  556.     end
  557.     # 决定窗口位置
  558.     case $game_system.message_position
  559.       when 0  # 上
  560.         y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  561.       when 1  # 中
  562.         y = (480 - height) / 2
  563.         x = (640 - width) / 2
  564.       when 2  # 下
  565.         y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  566.     end
  567.     # 纪录文章显示位置
  568.     @message_position = $game_system.message_position
  569.     # 如果选择自动修正,则如果文章会显示到画面外则自动改变窗口的尺寸(高度)
  570.     if FUKI::POS_FIX
  571.       case @message_position
  572.         when 0  # 上
  573.           if y <= 0
  574.             @message_position = 2
  575.             y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  576.           end
  577.         when 2  # 下
  578.           if y + height >= 480
  579.             @message_position = 0
  580.             y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  581.           end
  582.       end
  583.     end
  584.     return [x,y]
  585.  
  586.   end
  587.  
  588.   #-----------------------------------------------------------
  589.   # ○ 计算尾部图标的位置
  590.   #-----------------------------------------------------------
  591.   def get_tale_pos
  592.     case @message_position
  593.       when 0  # 上
  594.         # 处理坐标
  595.         x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  596.         # 画面边缘的话则移动位置
  597.         if FUKI::CORNER_SHIFT
  598.           if x == 0
  599.             x = FUKI::SHIFT_PIXEL
  600.           elsif x == 640 - 32
  601.             x = 640 - 32 - FUKI::SHIFT_PIXEL
  602.           end
  603.         end
  604.         y = self.y + self.height - 16
  605.       when 1  # 中
  606.         x = nil
  607.         y = nil
  608.       when 2  # 下
  609.         # 处理坐标
  610.         x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  611.         # 画面边缘的话则移动位置
  612.         if FUKI::CORNER_SHIFT
  613.           if x == 0
  614.             x = FUKI::SHIFT_PIXEL
  615.           elsif @tale.x == 640 - 32
  616.             x = 640 - 32 - FUKI::SHIFT_PIXEL
  617.           end
  618.         end
  619.         y = self.y - 16
  620.     end
  621.     return [x,y]
  622.   end
  623.  
  624.   #-----------------------------------------------------------
  625.   # ○ 计算名字窗口的位置
  626.   #-----------------------------------------------------------
  627.   def get_name_pos
  628.     case @face_pic_txt
  629.       when 0  # 文字
  630.         x = self.x + FUKI::NAME_SHIFT_X
  631.         y = self.y - FUKI::NAME_FONT_SIZE - 16 + FUKI::NAME_SHIFT_Y
  632.       when 1  # 图片
  633.         if self.x >= @pic_width + 5
  634.           # 默认头像显示在对话框左边
  635.           x = self.x-@pic_width-5
  636.         else
  637.           # 对话框左边放不下时头像显示在右边
  638.           x = self.x + self.width
  639.         end
  640.         y = self.y+self.height/2 - (@pic_height + 5)/2
  641.       end
  642.  
  643.     return [x,y]
  644.   end
  645.  
  646.   #-----------------------------------------------------------
  647.   # ○ 设置角色名字窗口
  648.   #-----------------------------------------------------------
  649.   def set_namewindow
  650.  
  651.     # $mes_name为空时不显示角色名字窗口
  652.     if $mes_name == nil or $mes_name == ""
  653.       return
  654.     else
  655.       # 设定变量
  656.       mes_name = $mes_name
  657.       skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
  658.  
  659.       #判断名称是否有对应的图片"Graphics/heads/" +
  660.       if $game_temp.namebmp[mes_name] == nil then
  661.         sFile = FUKI::HEAD_PIC_DIR + mes_name + ".png"
  662.       else
  663.         sFile = FUKI::HEAD_PIC_DIR + $game_temp.namebmp[mes_name] + ".png"
  664.       end
  665.  
  666.       #if FileTest.exist?(sFile) == true then
  667.       begin
  668.  
  669.         @face_pic_txt = 1                       #名字窗口使用头像<- bbschat
  670.  
  671.         # 生成头像
  672.         bmp = Bitmap.new(sFile)
  673.         @pic_width = bmp.width
  674.         @pic_height = bmp.height
  675.  
  676.         if self.x >= @pic_width + 5
  677.           # 默认头像显示在对话框左边
  678.           name_x = self.x-@pic_width-5
  679.         else
  680.           # 对话框左边放不下时头像显示在右边
  681.           name_x = self.x + self.width
  682.         end
  683.         name_y = self.y+self.height/2 - (@pic_height + 5)/2
  684.  
  685.         # 生成角色头像窗口
  686.         @name_win = Window_Base.new(name_x, name_y, @pic_width + 5, @pic_height + 5)
  687.         @name_win.windowskin = RPG::Cache.windowskin(skin)
  688.         @name_win.back_opacity =0     
  689.         @name_win.z = self.z + 1
  690.  
  691.         @name_contents = Sprite.new
  692.         @name_contents.x = name_x + 2
  693.         @name_contents.y = name_y + 2
  694.         @name_contents.bitmap = bmp
  695.  
  696.         #@name_contents.z = @name_win.z + 2     #这个用了似乎效果不好<- bbschat
  697.  
  698.       rescue
  699.  
  700.         @face_pic_txt = 0                       #名字窗口使用文字<- bbschat
  701.  
  702.         # 生成名字
  703.         name_width = mes_name.size / 2 * FUKI::NAME_FONT_SIZE
  704.         name_height = FUKI::NAME_FONT_SIZE
  705.         name_x = self.x + FUKI::NAME_SHIFT_X
  706.         name_y = self.y - name_height - 16 + FUKI::NAME_SHIFT_Y
  707.  
  708.         # 生成角色名字窗口(只有边框)
  709.         @name_win = Window_Base.new(name_x, name_y, name_width + 16, name_height + 16)
  710.         @name_win.windowskin = RPG::Cache.windowskin(skin)
  711.         @name_win.back_opacity = FUKI::NAME_OPACITY
  712.         @name_win.z = self.z + 1
  713.  
  714.         # 为了使空白比Windows类限定的更小使用双重结构
  715.         @name_contents = Sprite.new
  716.         @name_contents.x = name_x + 12
  717.         @name_contents.y = name_y + 8
  718.         @name_contents.bitmap = Bitmap.new(name_width, name_height)
  719.         @name_contents.z = @name_win.z + 2
  720.  
  721.         # 设定文字色
  722.         nil_color = Color.new(0,0,0,0)
  723.         if FUKI::NAME_COLOR != nil_color
  724.           @name_contents.bitmap.font.color = FUKI::NAME_COLOR
  725.         else
  726.           @name_contents.bitmap.font.color = normal_color
  727.         end
  728.         @name_contents.bitmap.font.size = FUKI::NAME_FONT_SIZE
  729.         # 调整窗口尺寸
  730.         rect = @name_contents.bitmap.text_size(mes_name)
  731.         @name_win.width = rect.width + 32
  732.         # 描画名字
  733.         @name_contents.bitmap.draw_text(rect, mes_name)
  734.       end
  735.     end
  736.  
  737.   end
  738.  
  739.   #-----------------------------------------------------------
  740.   # ○ 释放呼出对话框和角色名字窗口
  741.   #-----------------------------------------------------------
  742.   def del_fukidasi
  743.     if @tale != nil
  744.       @tale.dispose
  745.       @tale = nil
  746.     end
  747.     if @name_win != nil
  748.       @name_win.dispose
  749.       @name_win = nil
  750.       @name_contents.dispose
  751.       @name_contents = nil
  752.     end
  753.     self.opacity = 0
  754.     self.x = 80
  755.     self.width = 480
  756.     self.height = 160
  757.     self.contents.dispose
  758.     self.contents = Bitmap.new(width - 32, height - 32)
  759.     self.pause = true
  760.   end
  761.  
  762.   #-----------------------------------------------------------
  763.   # ○ 取得角色
  764.   #     parameter : 参数
  765.   #-----------------------------------------------------------
  766.   def get_character(parameter)
  767.     # 参数分歧
  768.     case parameter
  769.     when -1  # 玩家
  770.       return $game_player
  771.     when 0   # 该事件
  772.       events = $game_map.events
  773.       return events == nil ? nil : events[$active_event_id]
  774.     else     # 特定事件
  775.       events = $game_map.events
  776.       return events == nil ? nil : events[parameter]
  777.     end
  778.   end
  779.  
  780.   #-----------------------------------------------------------
  781.   # ● 设定窗口位置和不透明度
  782.   #-----------------------------------------------------------
  783.   def reset_window(width = nil, height = nil)
  784.       case $game_system.message_position
  785.       when 0  # 上
  786.         self.y = 16
  787.       when 1  # 中
  788.         if height != nil and width != nil
  789.           self.y = (480 - height) / 2 - 32
  790.           self.x = (640 - width) / 2
  791.           self.width = width
  792.           self.height = height
  793.           self.contents.dispose
  794.           self.contents = Bitmap.new(width - 32, height - 32)
  795.         else
  796.           self.y = 160
  797.         end
  798.       when 2  # 下
  799.         self.y = 304
  800.       end
  801.     if $game_system.message_frame == 0
  802.       self.opacity = 255
  803.     else
  804.       self.opacity = 0
  805.     end
  806.     self.back_opacity = FUKI::MES_OPACITY
  807.   end
  808.  
  809.   #-----------------------------------------------------------
  810.   # ● 刷新画面
  811.   #-----------------------------------------------------------
  812.   def update
  813.     super
  814.     # 呼出模式下跟随事件移动
  815.     if @tale != nil
  816.       pos = get_fuki_pos(self.width, self.height)
  817.       self.x = pos[0]
  818.       self.y = pos[1]
  819.  
  820.       tale_pos = get_tale_pos
  821.       @tale.x = tale_pos[0]
  822.       @tale.y = tale_pos[1]
  823.  
  824.       if @name_win != nil
  825.         name_pos = get_name_pos
  826.         @name_win.x = name_pos[0]
  827.         @name_win.y = name_pos[1]
  828.         case @face_pic_txt
  829.           when 0  # 文字
  830.             @name_contents.x = @name_win.x + 12
  831.             @name_contents.y = @name_win.y + 8
  832.           when 1  # 图片
  833.             @name_contents.x = @name_win.x + 2
  834.             @name_contents.y = @name_win.y + 2
  835.           end
  836.       end
  837.     end
  838.  
  839.     # 渐变的情况下
  840.     if @fade_in
  841.       self.contents_opacity += 24
  842.       if @name_win != nil
  843.         @name_win.opacity += 24
  844.       end
  845.       if @tale != nil
  846.         @tale.opacity += 24
  847.       end
  848.       if @input_number_window != nil
  849.         @input_number_window.contents_opacity += 24
  850.       end
  851.       if self.contents_opacity == 255
  852.         @fade_in = false
  853.       end
  854.       return
  855.     end
  856.     # 显示信息中的情况下
  857.     if @contents_drawing
  858.       refresh_drawtext
  859.       return
  860.     end
  861.     # 输入数值的情况下
  862.     if @input_number_window != nil
  863.       @input_number_window.update
  864.       # 确定
  865.       if Input.trigger?(Input::C)
  866.         $game_system.se_play($data_system.decision_se)
  867.         $game_variables[$game_temp.num_input_variable_id] =
  868.           @input_number_window.number
  869.         $game_map.need_refresh = true
  870.         # 释放输入数值窗口
  871.         @input_number_window.dispose
  872.         @input_number_window = nil
  873.         terminate_message
  874.       end
  875.       return
  876.     end
  877.     # 显示信息结束的情况下
  878.     if @contents_showing_end
  879.       # 不是显示选择项且不是呼出对话模式则显示暂停标志
  880.       if $game_temp.choice_max == 0 and @tale == nil
  881.         self.pause = true
  882.       else
  883.         self.pause = false
  884.       end
  885.       # 取消
  886.       if Input.trigger?(Input::B)
  887.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  888.           $game_system.se_play($data_system.cancel_se)
  889.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  890.           terminate_message
  891.         end
  892.       end
  893.       # 自动关闭
  894.       @auto_close > 0 ? @auto_close-=1 : @auto_close=-1
  895.       if @auto_close==0
  896.         # 文字还没有处理完的时候
  897.           # 选择项
  898.           if $game_temp.choice_max > 0
  899.             $game_system.se_play($data_system.decision_se)
  900.             $game_temp.choice_proc.call(self.index)
  901.           end
  902.           terminate_message
  903.           del_fukidasi
  904.         end
  905.       # 确定
  906.       if Input.trigger?(Input::C) and @auto_close == -1
  907.         if $game_temp.choice_max > 0
  908.           $game_system.se_play($data_system.decision_se)
  909.           $game_temp.choice_proc.call(self.index)
  910.         end
  911.         terminate_message
  912.         # 释放呼出窗口
  913.         del_fukidasi
  914.       end
  915.       return
  916.     end
  917.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  918.     if @fade_out == false and $game_temp.message_text != nil
  919.       @contents_showing = true
  920.       $game_temp.message_window_showing = true
  921.       reset_window
  922.       refresh_create
  923.       if @name_win != nil
  924.         @name_win.opacity = 0
  925.       end
  926.       if @tale != nil
  927.         @tale.opacity = 0
  928.       end
  929.       Graphics.frame_reset
  930.       self.visible = true
  931.       self.contents_opacity = 0
  932.       if @input_number_window != nil
  933.         @input_number_window.contents_opacity = 0
  934.       end
  935.       @fade_in = true
  936.       return
  937.     end
  938.     # 没有可以显示的信息、但是窗口为可见的情况下
  939.     if self.visible
  940.       @fade_out = true
  941.       self.opacity -= 48
  942.       if @name_win != nil
  943.         @name_win.opacity -= 48
  944.       end
  945.       if @tale != nil
  946.         @tale.opacity -= 48
  947.       end
  948.       if self.opacity == 0
  949.         self.visible = false
  950.         @fade_out = false
  951.         $game_temp.message_window_showing = false
  952.         del_fukidasi
  953.       end
  954.       return
  955.     end
  956.   end
  957.  
  958.   #-----------------------------------------------------------
  959.   # ● 释放
  960.   #-----------------------------------------------------------
  961.   def dispose
  962.     terminate_message
  963.     $game_temp.message_window_showing = false
  964.     if @input_number_window != nil
  965.       @input_number_window.dispose
  966.     end
  967.     super
  968.   end
  969.  
  970.   #-----------------------------------------------------------
  971.   # ● 信息结束处理
  972.   #-----------------------------------------------------------
  973.   def terminate_message
  974.     @auto_close = -1
  975.     self.active = false
  976.     self.pause = false
  977.     self.index = -1
  978.     self.contents.clear
  979.     # 清除显示中标志
  980.     @contents_showing = false
  981.     @contents_showing_end = false
  982.     unless @kkme_name == "" or @kkme_name == nil
  983.       $mes_name = ""
  984.       @kkme_name = ""
  985.     end
  986.     # 呼叫信息调用
  987.     if $game_temp.message_proc != nil
  988.       $game_temp.message_proc.call
  989.     end
  990.     # 清除文章、选择项、输入数值的相关变量
  991.     $game_temp.message_text = nil
  992.     $game_temp.message_proc = nil
  993.     $game_temp.choice_start = 99
  994.     $game_temp.choice_max = 0
  995.     $game_temp.choice_cancel_type = 0
  996.     $game_temp.choice_proc = nil
  997.     $game_temp.num_input_start = 99
  998.     $game_temp.num_input_variable_id = 0
  999.     $game_temp.num_input_digits_max = 0
  1000.     # 释放金钱窗口
  1001.     if @gold_window != nil
  1002.       @gold_window.dispose
  1003.       @gold_window = nil
  1004.     end
  1005.   end
  1006.  
  1007.   #-----------------------------------------------------------
  1008.   # ● 刷新光标矩形
  1009.   #-----------------------------------------------------------
  1010.   def update_cursor_rect
  1011.     if @index >= 0
  1012.       n = $game_temp.choice_start + @index
  1013.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  1014.     else
  1015.       self.cursor_rect.empty
  1016.     end
  1017.   end
  1018.   #-----------------------------------------------------------
  1019.   # ● 取得普通文字色
  1020.   #-----------------------------------------------------------
  1021.   def normal_color
  1022.     nil_color = Color.new(0,0,0,0)
  1023.     if FUKI::FUKI_COLOR != nil_color
  1024.       color = FUKI::FUKI_COLOR
  1025.     else
  1026.       color = super
  1027.     end
  1028.     return color
  1029.   end
  1030.  
  1031. #===============================================================
  1032. # ■ Window_InputNumber
  1033. #===============================================================
  1034.  
  1035. class Window_InputNumber < Window_Base
  1036.   #-----------------------------------------------------------
  1037.   # ● 初始化对像
  1038.   #     digits_max : 位数
  1039.   #-----------------------------------------------------------
  1040.   def initialize(digits_max)
  1041.     @digits_max = digits_max
  1042.     @number = 0
  1043.     # 从数字的幅度计算(假定与 0~9 等幅)光标的幅度
  1044.     dummy_bitmap = Bitmap.new(32, 32)
  1045.     dummy_bitmap.font.size = FUKI::MES_FONT_SIZE
  1046.     @cursor_width = dummy_bitmap.text_size("0").width + 8
  1047.     dummy_bitmap.dispose
  1048.     super(0, 0, @cursor_width * @digits_max + 32, 64)
  1049.     self.contents = Bitmap.new(width - 32, height - 32)
  1050.     self.contents.font.size = FUKI::MES_FONT_SIZE
  1051.     self.z += 9999
  1052.     self.opacity = 0
  1053.     @index = 0
  1054.     refresh
  1055.     update_cursor_rect
  1056.   end
  1057. end
  1058.  
  1059. #============================================================
  1060. # Game_Map,把events变量公开
  1061. #============================================================
  1062. class Game_Map
  1063.   attr_reader   :events
  1064. end
  1065.  
  1066. #============================================================
  1067. # 便于返回姓名
  1068. #============================================================
  1069. class Game_Event < Game_Character
  1070.   def name
  1071.     return @event.name
  1072.   end
  1073.   def name=(na)
  1074.     @event.name = na
  1075.   end
  1076. end
  1077. end

Lv1.梦旅人

梦石
0
星屑
90
在线时间
9 小时
注册时间
2019-6-19
帖子
7
2
 楼主| 发表于 2019-6-21 21:59:06 | 只看该作者
惊了,为什么我放不了图
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
90
在线时间
9 小时
注册时间
2019-6-19
帖子
7
3
 楼主| 发表于 2019-6-22 12:18:05 | 只看该作者
本帖最后由 艾迟 于 2019-6-22 12:20 编辑

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
90
在线时间
9 小时
注册时间
2019-6-19
帖子
7
4
 楼主| 发表于 2019-6-22 17:31:06 | 只看该作者
虽然还是有点小问题但姑且自己解决了orz
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-25 10:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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