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

Project1

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

[已经过期] 求教怎么用图片显示文字或反推

[复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
30 小时
注册时间
2010-8-22
帖子
18
跳转到指定楼层
1
发表于 2015-1-21 12:08:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
类似于字体 ,不过是图片格式,
象英文,日语这样字体少的比较适用
根据对话文本所用的字,显示哪个图片哪个坐标的字(一图多字)或哪张图片(一图单字)
要改的地方蛮多的,开始界面,读取界面,菜单界面,对话框……

主要是发现一个日文游戏,平时用agth提取文本自动翻译……
一般日文里多有用中文的,猜猜意思也可以,但这游戏……除了游戏名半个中文字都没有……
但是这游戏有使用这类脚本,提取不出文字来,解包翻译……也因为原脚本没定义中文也不能显示……
想自己修改脚本,但是水平有限,不是字完全不显示,就是某些界面显示了某些又没显示,或界面显示错乱……

所以想看看干净的(因为游戏还修改了界面所以更不知道该怎么改回)类似脚本,反推回去
或者大神有兴趣解题的游戏名 腐界に眠る王女のアバドーン
求改回方法~

Lv1.梦旅人

梦石
0
星屑
50
在线时间
206 小时
注册时间
2014-2-8
帖子
396
2
发表于 2015-1-21 20:29:59 | 只看该作者
很麻烦,不过具体作法应该可以完成,仿照对话里的\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://www.66RPG.com/
  19. #
  20. #    脚本更新:by KKME◎66RPG.com,2007年2月
  21. #
  22. #    脚本更新:by 绫晓露雪萌◎66RPG.com,2007年7月
  23. #
  24. #==============================================================================

  25. module FUKI

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

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

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

  73. end


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


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

  87. #==============================================================================
  88. # □ Game_Temp
  89. #==============================================================================

  90. class Game_Temp
  91.   attr_accessor  :namebmp              #保存头像图片的Hash表
  92.   alias initialize_fuki initialize
  93.   def initialize
  94.     initialize_fuki
  95.     # 如果不想使用角色名字直接作为头像文件名
  96.     # 可在这里重新设定角色名字与文件名的对应关系
  97.     @namebmp ={"玛戈壁"=>"001-Player-Face", "草尼玛"=>"002-Player-Face", "菊花残"=>"003-Player-Face"}
  98.   end
  99. end

  100. #==============================================================================
  101. # □ Window_Message
  102. #==============================================================================

  103. class Window_Message < Window_Selectable

  104.   #--------------------------------------------------------------------------
  105.   # ● 初始化状态
  106.   #--------------------------------------------------------------------------
  107.   def initialize
  108.     super(80, 304, 480, 160)
  109.     self.contents = Bitmap.new(width - 32, height - 32)
  110.     self.contents.font.color = text_color(0)
  111.     self.visible = false
  112.     self.z = 9998

  113.     @fade_in = false
  114.     @fade_out = false
  115.     @contents_showing = false
  116.     @cursor_width = 0
  117.     @kkme_name = ""

  118.     self.active = false
  119.     self.index = -1

  120. #呼出对话框的宽和高
  121.     [url=home.php?mod=space&uid=133944]@w[/url] = 0
  122.     @h = 0
  123.    
  124.     @wait=0
  125.     #[url=home.php?mod=space&uid=36110]@Wait[/url] = 0
  126.     @dx = 0
  127.     @dy = 0
  128.     $mes_speed = FUKI::MES_SPEED
  129.    
  130.     #------------------------
  131.     # ★ 特殊时期中断标志
  132.     #------------------------
  133.     @no_term_stop = false
  134.     @save_x = 0
  135.     @save_y = 0
  136.     @old_text_info = []

  137.   end
  138.   
  139.   #--------------------------------------------------------------------------
  140.   # ○ 决定窗口尺寸并生成窗口
  141.   #--------------------------------------------------------------------------
  142.   def refresh_create
  143.    
  144.      unless @no_term_stop
  145.         @pic_skin.dispose  if @pic_skin != nil
  146.      end

  147.   #用于存取用类似“王小二:  ”方式显示文章时的角色名
  148.       @kkme_name = ""

  149.     begin
  150.         @kkme_name=$game_temp.message_text.split(":")[0]  if  $game_temp.message_text.split(":")[1] != nil
  151.         if @kkme_name != ""
  152.           jiajia = '\c[1]【' + @kkme_name + '】\c[0]'
  153.           $game_temp.message_text = jiajia + $game_temp.message_text[@kkme_name.size + 3,$game_temp.message_text.size]
  154.         else
  155.           $game_temp.message_text = $game_temp.message_text #'\c[0]' + $game_temp.message_text
  156.         end      
  157.     rescue
  158.     end

  159.     unless @no_term_stop
  160.       self.contents.clear
  161.       self.contents.font.color = Color.new(0, 0, 0, 255)
  162.       self.contents.font.size = FUKI::MES_FONT_SIZE
  163.       
  164.       # 取得对话框窗口尺寸
  165.       get_windowsize
  166.       
  167.       w = @w + 32 + 8
  168.       h = @h * (self.contents.font.size + 10) + 26
  169.       
  170.       # 生成呼出窗口   
  171.       # 生成角色名字窗口
  172.       set_fukidasi(self.x, self.y, w, h)
  173.       set_namewindow
  174.       
  175.       pic_back
  176.     end

  177.     # 初始化信息表示使用的变量
  178.     @dx = @save_x # 0
  179.     @dy = @save_y # 0

  180.     @cursor_width = 0
  181.     @contents_drawing = true
  182.    
  183.     update
  184.    
  185.     # 瞬间表示的情况下
  186.     if $mes_speed == 0
  187.       # 循环信息描绘处理
  188.       while $game_temp.message_text != ""
  189.         draw_massage
  190.       end
  191.       draw_opt_text
  192.       @contents_showing_end = true
  193.       @contents_drawing = false
  194.     else
  195.       # 一个一个描绘文字
  196.       refresh_drawtext
  197.     end # end  if $mes_speed == 0
  198.   end  # end def
  199.   
  200.   #--------------------------------------------------------------------------
  201.   # ○ 一个一个描绘文字 #拖长了每次draw_massage之间间隔的时间
  202.   #--------------------------------------------------------------------------
  203.   def refresh_drawtext
  204.     if $game_temp.message_text != nil
  205.       if @wait > 0
  206.         @wait -= 1
  207.       elsif @wait == 0
  208.         # 描绘处理
  209.         draw_massage
  210.         @wait = $mes_speed
  211.       end
  212.     end

  213.     # 描绘结束
  214.     if $game_temp.message_text == ""
  215.       draw_opt_text
  216.       @contents_showing_end = true
  217.       @contents_drawing = false
  218.     end
  219.   end
  220.   
  221.   #--------------------------------------------------------------------------
  222.   # ○ 取得窗口尺寸
  223.   #--------------------------------------------------------------------------
  224.   def get_windowsize
  225.     x = y = 0
  226.     @h = @w = 0
  227.     @cursor_width = 0
  228.     # 有选择项的话,处理字的缩进
  229.     if $game_temp.choice_start == 0
  230.       x = 16
  231.     end
  232.    
  233.     # 有等待显示的文字的情况下
  234.     if $game_temp.message_text != nil
  235.       text = $game_temp.message_text.clone
  236.       
  237.       # 转义字符处理
  238.       begin
  239.         last_text = text.clone
  240.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  241.       end until text == last_text
  242.       
  243.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  244.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  245.       end
  246.       
  247.       # 为了方便、将 "\\\\" 变换为 "\000"
  248.       text.gsub!(/\\\\/) { "\000" }
  249.       
  250.       # "\\C" 变为 "\001" 、"\\G" 变为 "\002"
  251.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001" }
  252.       
  253.       #这里只是计算窗口中的字符量与宽和高,并不需要输出字符来,故不需要在标志符#\001后添加对应的颜色编号
  254.       #text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  255.       
  256.       text.gsub!(/\\[Gg]/) { "\002" }

  257.       # c 获取 1 个字 (如果不能取得文字就循环)
  258.       while ((c = text.slice!(/./m)) != nil)
  259.         
  260.         # \\ 的情况下
  261.         if c == "\000"
  262.           # 还原为本来的文字
  263.           c = "\\"
  264.         end
  265.         
  266.         # \C[n] 或者 \G 的情况下
  267.         if c == "\001" or c == "\002"
  268.           # 下面的文字
  269.           next
  270.         end
  271.         
  272.         # 另起一行文字的情况下
  273.         if c == "\n"
  274.           # y 累加 1
  275.           y += 1
  276.           # 取得纵横尺寸(行的总数)
  277.           @h = y
  278.           @w = x > @w ? x : @w
  279.         
  280.           if y >= $game_temp.choice_start
  281.             @w = x + 8 > @w ? x + 8 : @w
  282.           end

  283.           x = 0
  284.           # 若下一行为选择项,则行开头缩进8个单位长度
  285.           if y >= $game_temp.choice_start
  286.             x = 8
  287.           end

  288.           # 下面的文字
  289.           next
  290.         end # end if c==”\n”

  291.         # x 为要描绘文字的宽度加法运算
  292.         x += self.contents.text_size(c).width
  293.       end # end while ((c = text.slice!(/./m)) != nil)
  294.     end # end if $game_temp.message_text != nil

  295.     # 输入数值的情况
  296.     if $game_temp.num_input_variable_id > 0
  297.       digits_max = $game_temp.num_input_digits_max
  298.       number = $game_variables[$game_temp.num_input_variable_id]
  299.       @h += 1
  300.       x = digits_max * self.contents.font.size + 16
  301.       @w = x > @w ? x : @w   # @w记录着对话框中的最大行宽度
  302.     end
  303.   end # end def get window_size
  304.   
  305.   #--------------------------------------------------------------------------
  306.   # ○ 描绘信息处理(描绘一个字符)
  307.   #--------------------------------------------------------------------------
  308.   def draw_massage

  309.     # 有等待显示的文字的情况下
  310.     if $game_temp.message_text != nil or @old_text_info != nil
  311.       text = $game_temp.message_text
  312.       #old_text_info?

  313.      # 限制文字处理
  314.       begin
  315.         last_text = text.clone
  316.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  317.       end until text == last_text
  318.       
  319.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  320.          $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  321.       end
  322.       
  323.       # 把文章中的"\\" 变为 "\000"
  324.       text.gsub!(/\\\\/) { "\000" }
  325.       
  326.       # 把文章中的"\\C[num]" 变为 "\001[(num)]"
  327.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  328.       
  329.       # 把"\\G"  变为 "\002"
  330.       text.gsub!(/\\[Gg]/) { "\002" }
  331.       
  332.       # c 获取 1 个字符
  333.       c = text.slice!(/./m)
  334.       
  335.       # 如果该行文字为选择项
  336.       if @dy >= $game_temp.choice_start
  337.       #==================先描绘第一个文字==================  
  338.         self.contents.font.color = Color.new(0, 0, 0, 255)
  339.         # 改行头部缩进个单位长度
  340.         @dx = 8
  341.         
  342.         # 描绘文字
  343.         if c == "\000" or c == "\001" or c == "\002" or c == "\n"
  344.            c==""
  345.         else
  346.            self.contents.draw_text(4 + @dx, 32 * @dy, 40, 32, c)
  347.            # x 为要描绘文字宽度的加法运算
  348.            @dx += self.contents.text_size(c).width
  349.         end      
  350.          
  351.          
  352.          
  353.       #================再把该行文字全都显示出来==============
  354.       #可见本Fuki对话框在显示选择项时并无打印功能
  355.         while (  (c = text.slice!(/./m))  !=  "\n" )
  356.         
  357.           #位置放前了!!!
  358.           # 描绘文字
  359.           if c == "\001" or c == "\002" or c == "\003" or c == "\n"
  360.                    c==""      
  361.           else
  362.             self.contents.draw_text(4 + @dx, 32 * @dy, 40, 32, c)
  363.             # x 为要描绘文字宽度的加法运算
  364.             @dx += self.contents.text_size(c).width
  365.           end
  366.         end  # end  while (  (c = text.slice!(/./m))  !=  "\n" )
  367.         
  368.         if c == "\n"
  369.           # 更新光标宽度
  370.           @cursor_width = [@cursor_width, @dx].max
  371.           # dy 累加 1
  372.           @dy += 1
  373.           @dx = 0
  374.         end
  375.         
  376.         return
  377.       end  # end if @dy >= $game_temp.choice_start
  378.      #======================================================
  379.    
  380.      #显示非选择项的文章
  381.        # \\ 的情况下
  382.       if c == "\000"
  383.         # 还原为本来“\\”的文字
  384.         c = "\\"
  385.       end
  386.       
  387.       #\C[n] 的情况下
  388.       if c == "\001"
  389.         # 更改文字色
  390.         text.sub!(/\[([0-9]+)\]/, "")
  391.         color = $1.to_i
  392.         if color >= 0 and color <= 9
  393.           self.contents.font.color = text_color(color)
  394.         end
  395.       end
  396.       
  397.       # \G 的情况下
  398.       if c == "\002"
  399.         # ★生成金钱窗口★
  400.         @contents_showing_end = true
  401.         @contents_drawing = false
  402.         terminate_messageX
  403.         
  404.         @save_x = @dx
  405.         @save_y = @dy
  406.       end
  407.       
  408.       # 另起一行文字的情况下
  409.       if c == "\n"
  410.         # dy 累加 1
  411.         @dy += 1
  412.         @dx = 0
  413.       end
  414.       # 描绘文字
  415.       
  416.       size_zy = 6 # 设定文字动态增大——别问我这么重要的参数为什么放在这里而不放在顶部,有特殊原因的。
  417.       
  418.      #
  419.      unless @old_text_info == []
  420.         self.contents.fill_rect (4 + @old_text_info[0], (@old_text_info[2]+10-size_zy)*@old_text_info[1] - size_zy/2 ,@old_text_info[2],@old_text_info[2],Color.new(0,0,0,0))
  421.         col = self.contents.font.color.clone
  422.         self.contents.font.color = @old_text_info[3].clone
  423.         self.contents.font.size = @old_text_info[2] -= size_zy     
  424.         self.contents.draw_text(4 + @old_text_info[0], (@old_text_info[2]+10)*@old_text_info[1],@old_text_info[2],@old_text_info[2],@old_text_info[4])
  425.         self.contents.font.color = col
  426.         @old_text_info = []

  427.      end # end unless @old_text_info == []
  428.      
  429.      if c != nil
  430.         self.contents.font.size = FUKI::MES_FONT_SIZE
  431.         font_size = self.contents.font.size += size_zy
  432.         unless    c == "\000" or c == "\001" or c == "\002" or c == "\n"
  433.         @old_text_info.push(@dx , @dy , font_size, self.contents.font.color.clone, c)
  434.         end
  435.         unless   c == "\000" or c == "\001" or c == "\002" or c == "\n"
  436.           self.contents.draw_text(4+@dx, (font_size+10-size_zy)*@dy - size_zy/2, font_size, font_size, c)
  437.           self.contents.font.size -= size_zy
  438.           # dx 为要描绘文字的宽度加法运算
  439.           @dx += self.contents.text_size(c).width
  440.         end

  441.       end # end if c != nil
  442.    
  443.     end # end   if $game_temp.message_text != nil or @old_text_info != nil
  444.         #           text = $game_temp.message_text
  445.   end # end def
  446.   
  447.   #--------------------------------------------------------------------------
  448.   # ○ 选择项和输入数值的情况下
  449.   #--------------------------------------------------------------------------
  450.   def draw_opt_text
  451.     # 选择项的情况下
  452.     if $game_temp.choice_max > 0
  453.       @item_max = $game_temp.choice_max
  454.       self.active = true
  455.       self.index = 0
  456.     end
  457.     # 输入数值的情况下
  458.     if $game_temp.num_input_variable_id > 0
  459.       digits_max = $game_temp.num_input_digits_max
  460.       number = $game_variables[$game_temp.num_input_variable_id]
  461.       @input_number_window = Window_InputNumber.new(digits_max)
  462.       @input_number_window.number = number
  463.       @input_number_window.x = self.x + 8
  464.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  465.     end
  466.   end
  467.   
  468.   def pic_back
  469.     @pic_skin.dispose if @pic_skin != nil
  470.     @pic_skin = Sprite.new
  471.     @pic_skin.opacity = 0 unless @no_term_stop
  472.     @pic_skin.bitmap = Bitmap.new(self.width + 35, self.height + 35)
  473.     @pic_skin.x = self.x + 2
  474.     @pic_skin.y = self.y + 2
  475.     @pic_skin.z = self.z
  476.     @pic_skin.bitmap.blt(0, 0, RPG::Cache.icon("message_左上"),  RPG::Cache.icon("message_左上").rect)
  477.     @pic_skin.bitmap.blt(self.width - 35, 0, RPG::Cache.icon("message_右上"),  RPG::Cache.icon("message_右上").rect)
  478.     @pic_skin.bitmap.blt(0, self.height - 35, RPG::Cache.icon("message_左下"),  RPG::Cache.icon("message_左下").rect)
  479.     @pic_skin.bitmap.blt(self.width - 35, self.height - 35, RPG::Cache.icon("message_右下"),  RPG::Cache.icon("message_右下").rect)
  480.     @pic_skin.bitmap.stretch_blt(Rect.new(0,35,35,self.height-70), RPG::Cache.icon("message_左"), RPG::Cache.icon("message_左").rect)
  481.     @pic_skin.bitmap.stretch_blt(Rect.new(self.width - 35,35,35,self.height-70), RPG::Cache.icon("message_右"), RPG::Cache.icon("message_右").rect)
  482.     @pic_skin.bitmap.stretch_blt(Rect.new(35,0,self.width-70,35), RPG::Cache.icon("message_上"), RPG::Cache.icon("message_上").rect)
  483.     @pic_skin.bitmap.stretch_blt(Rect.new(35,self.height-35,self.width-70,35), RPG::Cache.icon("message_下"), RPG::Cache.icon("message_下").rect)
  484.     @pic_skin.bitmap.stretch_blt(Rect.new(35,35,self.width-70,self.height-70), RPG::Cache.icon("message_中"), RPG::Cache.icon("message_中").rect)
  485.   end
  486.    
  487.   
  488.   #--------------------------------------------------------------------------
  489.   # ○ 设置呼出对话框
  490.   #--------------------------------------------------------------------------
  491.   def set_fukidasi(x, y, width, height)
  492.     begin
  493.       # 不显示暂停标志
  494.       self.pause = false
  495.       # 取得对话框位置
  496.       pos = get_fuki_pos(width, height)
  497.       x = pos[0]
  498.       y = pos[1]
  499.       skin = FUKI::FUKI_SKIN_NAME != "" ? FUKI::FUKI_SKIN_NAME : $game_system.windowskin_name
  500.       # 生成呼出对话框
  501.       self.windowskin = RPG::Cache.windowskin(skin)
  502.       self.x = x
  503.       self.y = y
  504.       self.height = height
  505.       self.width = width
  506.       #self.opacity = 0
  507.       
  508.       unless @no_term_stop
  509.         self.contents.dispose
  510.         self.contents = Bitmap.new(width - 32, height - 32)
  511.         self.back_opacity = FUKI::FUKI_OPACITY
  512.         self.contents.clear
  513.         self.contents.font.color = Color.new(0, 0, 0, 255)
  514.         self.contents.font.size = FUKI::MES_FONT_SIZE
  515.       end
  516.       # 描绘尾部图标
  517.       if $game_system.message_frame == 0
  518.         # 取得位置
  519.         tale_pos = get_tale_pos
  520.         @tale = Sprite.new
  521.         @tale.opacity = 200
  522.         # 是否显示尾部图标 <- bbschat
  523.         if FUKI::TAIL_SHOW == true
  524.           case @message_position
  525.             when 0  # 上
  526.               @tale.bitmap = RPG::Cache.icon("message_箭头")
  527.               @tale.x = tale_pos[0]
  528.               @tale.y = tale_pos[1]
  529.               @tale.z = self.z + 1
  530.             when 1  # 中
  531.               @tale.dispose
  532.               @tale = nil
  533.             when 2  # 下
  534.               @tale.bitmap = RPG::Cache.icon("message_箭头2")
  535.               @tale.x = tale_pos[0]
  536.               @tale.y = tale_pos[1]
  537.               @tale.z = self.z + 1
  538.           end
  539.         end
  540.       end
  541.     rescue
  542.       del_fukidasi
  543.       reset_window(width, height)
  544.     end
  545.   end
  546.   #--------------------------------------------------------------------------
  547.   # ○ 新功能:根据输入文章计算呼出对话框的位置
  548.   #--------------------------------------------------------------------------
  549.   def get_character_KKME
  550.     if @kkme_name == "" or @kkme_name == nil
  551.       return nil
  552.     else
  553.       @kkme_name.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  554.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  555.       end
  556.       $mes_name = @kkme_name
  557.       for ev in $game_map.events.values
  558.         if ev.name == @kkme_name
  559.           return ev
  560.         end
  561.       end
  562.       for actor in $game_party.actors
  563.         if actor.name == @kkme_name
  564.           return $game_player
  565.         end
  566.       end
  567.       return nil
  568.     end
  569.   end
  570.    
  571.   
  572.   #--------------------------------------------------------------------------
  573.   # ○ 计算呼出对话框的位置
  574.   #--------------------------------------------------------------------------
  575.   def get_fuki_pos(width, height)
  576.    
  577.     # 取得角色
  578.     if $mes_id != nil
  579.       [url=home.php?mod=space&uid=2631396]@character[/url] = get_character($mes_id)
  580.     else
  581.       @character = get_character_KKME
  582.     end
  583.    
  584.     if @character == nil
  585.       # 角色不存在的情况下使用默认信息框
  586.       del_fukidasi
  587.       reset_window(width, height)
  588.       return
  589.     end
  590.     # 处理坐标
  591.     x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - (width / 2)
  592.     # 为尽量显示在画面内而移动横坐标
  593.     if x + width > 640
  594.       x = 640 - width
  595.     elsif x < 0
  596.       x = 0
  597.     end
  598.     # 决定窗口位置
  599.     case $game_system.message_position
  600.       when 0  # 上
  601.         y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  602.       when 1  # 中
  603.         y = (480 - height) / 2
  604.         x = (640 - width) / 2
  605.       when 2  # 下
  606.         y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  607.     end
  608.     # 纪录文章显示位置
  609.     @message_position = $game_system.message_position
  610.     # 如果选择自动修正,则如果文章会显示到画面外则自动改变窗口的尺寸(高度)
  611.     if FUKI::POS_FIX
  612.       case @message_position
  613.         when 0  # 上
  614.           if y <= 0
  615.             @message_position = 2
  616.             y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  617.           end
  618.         when 2  # 下
  619.           if y + height >= 480
  620.             @message_position = 0
  621.             y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  622.           end
  623.       end
  624.     end
  625.     return [x,y]
  626.    
  627.   end
  628.   
  629.   #--------------------------------------------------------------------------
  630.   # ○ 计算尾部图标的位置
  631.   #--------------------------------------------------------------------------
  632.   def get_tale_pos
  633.     case @message_position
  634.       when 0  # 上
  635.         # 处理坐标
  636.         x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  637.         # 画面边缘的话则移动位置
  638.         if FUKI::CORNER_SHIFT
  639.           if x == 0
  640.             x = FUKI::SHIFT_PIXEL
  641.           elsif x == 640 - 32
  642.             x = 640 - 32 - FUKI::SHIFT_PIXEL
  643.           end
  644.         end
  645.         y = self.y + self.height - 16
  646.       when 1  # 中
  647.         x = nil
  648.         y = nil
  649.       when 2  # 下
  650.         # 处理坐标
  651.         x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  652.         # 画面边缘的话则移动位置
  653.         if FUKI::CORNER_SHIFT
  654.           if x == 0
  655.             x = FUKI::SHIFT_PIXEL
  656.           elsif @tale.x == 640 - 32
  657.             x = 640 - 32 - FUKI::SHIFT_PIXEL
  658.           end
  659.         end
  660.         y = self.y - 16
  661.     end
  662.     return [x+8, y+10]
  663.   end

  664.   #--------------------------------------------------------------------------
  665.   # ○ 计算名字窗口的位置
  666.   #--------------------------------------------------------------------------
  667.   def get_name_pos
  668.     case @face_pic_txt
  669.       when 0  # 文字
  670.         x = self.x + FUKI::NAME_SHIFT_X
  671.         y = self.y - FUKI::NAME_FONT_SIZE - 16 + FUKI::NAME_SHIFT_Y
  672.       when 1  # 图片
  673.         if self.x >= @pic_width + 5
  674.           # 默认头像显示在对话框左边
  675.           x = self.x-@pic_width-5
  676.         else
  677.           # 对话框左边放不下时头像显示在右边
  678.           x = self.x + self.width
  679.         end
  680.         y = self.y+self.height/2 - (@pic_height + 5)/2
  681.       end

  682.     return [x,y]
  683.   end
  684.   
  685.   #--------------------------------------------------------------------------
  686.   # ○ 设置角色名字窗口
  687.   #--------------------------------------------------------------------------
  688.   def set_namewindow
  689.    
  690.     # $mes_name为空时不显示角色名字窗口
  691.     if $mes_name == nil or $mes_name == ""
  692.       return
  693.     else
  694.       # 设定变量
  695.       mes_name = $mes_name
  696.       skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
  697.       
  698.       #判断名称是否有对应的图片"Graphics/heads/" +
  699.       if $game_temp.namebmp[mes_name] == nil then
  700.         sFile = "Graphics/heads/" + mes_name + ".png"
  701.       else
  702. =begin
  703.         case $表情#这是作者所作的表情的分别判定,本游戏采用下面方法,也可以用该的方法
  704.           when 0
  705.             sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + ".png"#普通 normal
  706.           when 1
  707.             sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + "1.png"#怒 这个英文我不会
  708.           when 2
  709.             sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + "2.png"#脸红 in a red face
  710.           when 3
  711.             sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + "3.png"#哭 crying
  712.           when 4
  713.             sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + "4.png"#强笑 like smelling
  714.           when 5
  715.             sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + "5.png"#兴奋 excited
  716.         end
  717.         #sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + ".png"
  718.         $表情 = 0
  719. =end
  720.         if $表情==0
  721.           sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + ".png"#普通 normal
  722.         else
  723.           sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + "#{$表情}.png"#其他 other
  724.           $表情 = 0
  725.         end
  726.         #这种方法编写起来更加简便了。
  727.       end
  728.       
  729.       #if FileTest.exist?(sFile) == true then
  730.       begin
  731.                
  732.         @face_pic_txt = 1                       #名字窗口使用头像<- bbschat
  733.         
  734.         # 生成头像
  735.         bmp = Bitmap.new(sFile)
  736.         @pic_width = bmp.width
  737.         @pic_height = bmp.height
  738.         
  739.         self.width += @pic_width
  740.         
  741.         if self.x >= @pic_width + 5
  742.           # 默认头像显示在对话框左边
  743.           name_x = self.x-@pic_width-5
  744.         else
  745.           # 对话框左边放不下时头像显示在右边
  746.           name_x = self.x + self.width
  747.         end
  748.         name_y = self.y+self.height/2 - (@pic_height + 5)/2
  749.         
  750.         # 生成角色头像窗口
  751.         #@name_win = Window_Base.new(name_x, name_y, @pic_width + 5, @pic_height + 5)
  752.         #@name_win.windowskin = RPG::Cache.windowskin(skin)
  753.         #@name_win.opacity =0     
  754.         #@name_win.z = self.z + 1
  755.         @name_contents.dispose if @name_contents != nil
  756.         @name_contents = Sprite.new
  757.         @name_contents.x = self.x + self.width - bmp.width
  758.         @name_contents.y = name_y - 7
  759.         @name_contents.bitmap = bmp
  760.         @name_contents.z = self.z + 3
  761.         @name_contents.opacity = 0
  762.         #self.width += 50
  763.         #@name_contents.z = @name_win.z + 2     #这个用了似乎效果不好<- bbschat
  764.         
  765.       rescue
  766.       end
  767.     end

  768.   end
  769.   
  770.   #--------------------------------------------------------------------------
  771.   # ○ 释放呼出对话框和角色名字窗口
  772.   #--------------------------------------------------------------------------
  773.   def del_fukidasi
  774.     if @tale != nil
  775.       @tale.dispose
  776.       @tale = nil
  777.     end
  778.     if @name_win != nil
  779.       @name_win.dispose
  780.       @name_win = nil
  781.       @name_contents.dispose
  782.       @name_contents = nil
  783.     end
  784.     self.opacity = 0
  785.     self.x = 90
  786.     self.width = 460
  787.     self.height = 120
  788.     self.contents.dispose
  789.     self.contents = Bitmap.new(width - 32, height - 32)
  790.     self.pause = true
  791.   end
  792.   
  793.   #--------------------------------------------------------------------------
  794.   # ○ 取得角色
  795.   #     parameter : 参数
  796.   #--------------------------------------------------------------------------
  797. # def get_character(parameter)
  798.     # 参数分歧
  799. #   case parameter
  800. #   when -1  # 玩家
  801.    #   return $game_player
  802.   #  when 0   # 该事件
  803.   #    events = $game_map.events
  804.   #    return events == nil ? nil : events[$active_event_id]
  805.   #  else     # 特定事件
  806.   #    events = $game_map.events
  807.   #    return events == nil ? nil : events[parameter]
  808.   #  end
  809. # end
  810.    #-------------------------------------------------------------------
  811. # ○ 取得角色
  812. #     parameter : 参数
  813. #-------------------------------------------------------------------
  814. def get_character(parameter)
  815.   # 参数分歧
  816.   case parameter
  817.   when -1  # 玩家
  818.     return $game_player
  819.   when 0   # 该事件
  820.     events = $game_map.events
  821.     return events == nil ? nil : events[$active_event_id]
  822.   else     # 特定事件
  823.     if parameter >0
  824.       events = $game_map.events
  825.       return events == nil ? nil : events[parameter]
  826.     else
  827.       $game_party.return_char(-parameter-2)
  828.     end
  829.   end
  830. end

  831.   #--------------------------------------------------------------------------
  832.   # ● 设定窗口位置和不透明度
  833.   #--------------------------------------------------------------------------
  834.   def reset_window(width = nil, height = nil)
  835.     if $game_temp.in_battle
  836.       self.y = 16
  837.     else
  838.       case $game_system.message_position
  839.       when 0  # 上
  840.         self.y = 16
  841.       when 1  # 中
  842.   #      if height != nil and width != nil
  843.     #      self.y = (480 - height) / 2 - 32
  844.     ##      self.x = (640 - width) / 2
  845.      #     self.width = width
  846.     #      self.height = height
  847.     #      self.contents.dispose
  848.     #      self.contents = Bitmap.new(width - 32, height - 32)
  849.     #    else
  850.           self.y = 160
  851.      #   end
  852.       when 2  # 下
  853.         self.y = 324
  854.       end
  855.     end
  856.     #if $game_system.message_frame == 0
  857.       #self.opacity = 255
  858.     #else
  859.       self.opacity = 0
  860.     #end
  861.     self.back_opacity = FUKI::MES_OPACITY
  862.   end
  863.   
  864.   #--------------------------------------------------------------------------
  865.   # ● 刷新画面
  866.   #--------------------------------------------------------------------------
  867.   def update
  868.     super
  869.     #if @no_term_stop
  870.       #terminate_messageX      
  871.     #end
  872.    
  873.     # 呼出模式下跟随事件移动
  874.     if @tale != nil
  875.       pos = get_fuki_pos(self.width, self.height)
  876.       self.x = pos[0]
  877.       self.y = pos[1]

  878.       tale_pos = get_tale_pos
  879.       @tale.x = tale_pos[0]
  880.       @tale.y = tale_pos[1]
  881.    
  882.       @pic_skin.x = self.x + 2
  883.       @pic_skin.y = self.y + 2
  884.       if @name_contents != nil and !@name_contents.disposed?
  885.       @name_contents.x = self.x + self.width - @name_contents.bitmap.width - 22
  886.       @name_contents.y = self.y + self.height - @name_contents.bitmap.height - 6
  887.       end
  888.    
  889.       if @name_win != nil
  890.         name_pos = get_name_pos
  891.         @name_win.x = name_pos[0]
  892.         @name_win.y = name_pos[1]
  893.         case @face_pic_txt
  894.           when 0  # 文字
  895.             @name_contents.x = @name_win.x + 12
  896.             @name_contents.y = @name_win.y + 8
  897.           when 1  # 图片
  898.             @name_contents.x = @name_win.x + 2
  899.             @name_contents.y = @name_win.y + 2
  900.           end
  901.       end
  902.     end
  903.    
  904.     # 渐变的情况下
  905.     if @fade_in
  906.       #if @no_term_stop
  907.         #@fade_in = false
  908.         #return
  909.       #else        
  910.         self.contents_opacity += 24
  911.         @pic_skin.opacity += 20
  912.         if @name_win != nil
  913.           @name_win.opacity += 24
  914.         end
  915.         if @tale != nil
  916.           @name_contents.opacity += 24 if @name_contents != nil and !@name_contents.disposed?
  917.           @tale.opacity += 20
  918.         end
  919.         if @input_number_window != nil
  920.           @input_number_window.contents_opacity += 24
  921.         end
  922.         if self.contents_opacity == 255
  923.           @fade_in = false
  924.         end
  925.         return
  926.       #end
  927.     end
  928.     # 显示信息中的情况下
  929.     if @contents_drawing
  930.       refresh_drawtext
  931.       return
  932.     end
  933.     # 输入数值的情况下
  934.     if @input_number_window != nil
  935.       @input_number_window.update
  936.       # 确定
  937.       if Input.trigger?(Input::C)
  938.         $game_system.se_play($data_system.decision_se)
  939.         $game_variables[$game_temp.num_input_variable_id] =
  940.           @input_number_window.number
  941.         $game_map.need_refresh = true
  942.         # 释放输入数值窗口
  943.         @input_number_window.dispose
  944.         @input_number_window = nil
  945.         terminate_message
  946.       end
  947.       return
  948.     end
  949.     # 显示信息结束的情况下
  950.     if @contents_showing_end
  951.       # 不是显示选择项且不是呼出对话模式则显示暂停标志
  952.       if $game_temp.choice_max == 0 and @tale == nil
  953.         self.pause = true
  954.       else
  955.         self.pause = false
  956.       end
  957.       # 取消
  958.       if Input.trigger?(Input::B)
  959.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  960.           $game_system.se_play($data_system.cancel_se)
  961.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  962.           terminate_message
  963.         end
  964.       end
  965.       # 确定
  966.       if Input.trigger?(Input::C)
  967.         if $game_temp.choice_max > 0
  968.           $game_system.se_play($data_system.decision_se)
  969.           $game_temp.choice_proc.call(self.index)
  970.         end
  971.         terminate_message
  972.         # 释放呼出窗口
  973.         del_fukidasi
  974.       end
  975.       return
  976.     end
  977.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  978.     if @fade_out == false and $game_temp.message_text != nil
  979.       @contents_showing = true
  980.       $game_temp.message_window_showing = true
  981.       reset_window
  982.       refresh_create
  983.       if @no_term_stop
  984.         self.visible = true        
  985.       else
  986.         if @name_win != nil
  987.           @name_win.opacity = 0
  988.         end
  989.         if @tale != nil
  990.           @tale.opacity = 0
  991.         end
  992.         Graphics.frame_reset
  993.         self.visible = true
  994.         self.contents_opacity = 0
  995.         if @input_number_window != nil
  996.           @input_number_window.contents_opacity = 0
  997.         end
  998.         @fade_in = true
  999.       end # end if @no_term_stop
  1000.       return
  1001.     end#end if @fade_out == false and $game_temp.message_text != nil
  1002.    
  1003.     # 没有可以显示的信息、但是窗口为可见的情况下
  1004.     unless @no_term_stop
  1005.       if self.visible
  1006.         @fade_out = true
  1007.         self.opacity -= 48
  1008.         @name_contents.opacity -= 48 if @name_contents != nil and !@name_contents.disposed?
  1009.         @pic_skin.opacity -= 48 if @pic_skin != nil and !@pic_skin.disposed?
  1010.         
  1011.         if @name_win != nil
  1012.           @name_win.opacity -= 48        
  1013.         end
  1014.         
  1015.         if @tale != nil
  1016.           @tale.opacity -= 48 if @tale != nil and [email protected]?
  1017.         end
  1018.         
  1019.         if (@name_contents == nil) or @name_contents.disposed? or (@name_contents.opacity == 0)
  1020.           self.visible = false
  1021.           @name_contents.dispose if @name_contents != nil
  1022.           @pic_skin.dispose
  1023.           @fade_out = false
  1024.           $game_temp.message_window_showing = false
  1025.           del_fukidasi
  1026.         end
  1027.         
  1028.         return
  1029.       
  1030.       end #end if self.visible
  1031.     else
  1032.       $game_temp.message_window_showing = false   
  1033.     end
  1034.    
  1035.   end#end def
  1036.   
  1037.   #--------------------------------------------------------------------------
  1038.   # ● 释放
  1039.   #--------------------------------------------------------------------------
  1040.   def dispose
  1041.     terminate_message
  1042.     $game_temp.message_window_showing = false
  1043.     if @input_number_window != nil
  1044.       @input_number_window.dispose
  1045.     end
  1046.     super
  1047.   end
  1048.   
  1049.   #--------------------------------------------------------------------------
  1050.   # ● 信息结束处理
  1051.   #--------------------------------------------------------------------------
  1052.   def terminate_message
  1053.     self.active = false
  1054.     self.pause = false
  1055.     self.index = -1
  1056.     self.contents.clear
  1057.     # 清除显示中标志
  1058.     @contents_showing = false
  1059.     @contents_showing_end = false
  1060.     unless @kkme_name == "" or @kkme_name == nil
  1061.       $mes_name = ""
  1062.       @kkme_name = ""
  1063.     end
  1064.     # 呼叫信息调用
  1065.     if $game_temp.message_proc != nil
  1066.       $game_temp.message_proc.call
  1067.     end
  1068.     # 清除文章、选择项、输入数值的相关变量
  1069.     $game_temp.message_text = nil
  1070.     $game_temp.message_proc = nil
  1071.     $game_temp.choice_start = 99
  1072.     $game_temp.choice_max = 0
  1073.     $game_temp.choice_cancel_type = 0
  1074.     $game_temp.choice_proc = nil
  1075.     $game_temp.num_input_start = 99
  1076.     $game_temp.num_input_variable_id = 0
  1077.     $game_temp.num_input_digits_max = 0
  1078.     # 释放金钱窗口
  1079.     if @gold_window != nil
  1080.       @gold_window.dispose
  1081.       @gold_window = nil
  1082.     end
  1083.     @no_term_stop = false
  1084.     @save_x = 0
  1085.     @save_y = 0
  1086.   end

  1087.   #--------------------------------------------------------------------------
  1088.   # ● ★信息结束处理★
  1089.   #--------------------------------------------------------------------------
  1090.   def terminate_messageX
  1091.     self.active = false
  1092.     self.pause = false
  1093.     self.index = -1
  1094.     # 清除显示中标志
  1095.     @contents_showing = false
  1096.     @contents_showing_end = false
  1097.     # 呼叫信息调用
  1098.     if $game_temp.message_proc != nil
  1099.       $game_temp.message_proc.call
  1100.     end
  1101.     # 清除文章、选择项、输入数值的相关变量
  1102.     $game_temp.message_text = nil
  1103.     $game_temp.message_proc = nil
  1104.     @no_term_stop = true
  1105.   end
  1106.   
  1107.   def clear
  1108.     self.contents.clear   
  1109.     @save_x = 0
  1110.     @save_y = 0
  1111.   end
  1112.   #--------------------------------------------------------------------------
  1113.   # ● 刷新光标矩形
  1114.   #--------------------------------------------------------------------------
  1115.   def update_cursor_rect
  1116.     #if @Index >= 0
  1117.     if index >=0
  1118.       n = $game_temp.choice_start + @index
  1119.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  1120.     else
  1121.       self.cursor_rect.empty
  1122.     end
  1123.   end
  1124.   #--------------------------------------------------------------------------
  1125.   # ● 取得普通文字色
  1126.   #--------------------------------------------------------------------------
  1127.   def normal_color
  1128.     nil_color = Color.new(0,0,0,255)
  1129.     if FUKI::FUKI_COLOR != nil_color
  1130.       color = FUKI::FUKI_COLOR
  1131.     else
  1132.       color = super
  1133.     end
  1134.     return color
  1135.   end
  1136. end
复制代码
刚接触RPG的新人们裤艾来这里!在这里能够帮助你们提高自身的能力,让大家来帮助每个人实现自己的创意、构想!
也许你只是正在看RPG教程的新人,或者是正在努力学着制作自己的RPG的制作者,或者是狂热的RPG游戏喜爱者,
但都不重要!
加入我们,我们会帮助你实现梦想,或者帮助你更好的运用RPG并且创造个人的一片天地!周末我们会不定时间开放RM技术讨论活动或者RM经验交流课!
加入我们,我们愿意与你共同创造奇迹,共同进步!
QQ群号:329443038  
或者联系QQ:573932914
我们和你站在同一线!
要求只有:常能上线
我们会用十分的热情接纳你!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
30 小时
注册时间
2010-8-22
帖子
18
3
 楼主| 发表于 2015-1-22 10:32:45 | 只看该作者
的确很麻烦,触及的界面比较多,好吧,是所有界面都改了,而且又加了其他选项弄的不好判断
相当于自制字体,不过是字体的话还好直接修改字体就行了,那个游戏弄了个脚本来判断每个文字对应哪张图片哪个坐标的文字图片
实在能力有限,勉强能看懂点,没能力改……
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 15:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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