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

Project1

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

[已经过期] 谁能帮一下我,大神们

[复制链接]

Lv1.梦旅人

梦石
0
星屑
280
在线时间
4 小时
注册时间
2013-9-23
帖子
2
跳转到指定楼层
1
发表于 2013-9-23 08:30:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我不会修改RPG脚本,我想在对话框里加人物头像和半身像,怎么办

评分

参与人数 1星屑 -20 收起 理由
myownroc -20 标题格式错误

查看全部评分

Lv3.寻梦者

梦石
0
星屑
2744
在线时间
2630 小时
注册时间
2013-1-16
帖子
5657

贵宾

2
发表于 2013-9-23 09:01:02 | 只看该作者
请在站内搜索
如果搜索到的结果返回论坛首页,请右击链接,复制url地址,将其粘贴出来后,把66rpg改为cgyouxi
(Created by @喵kano)


施工现场:hotege.github.io
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
3
发表于 2013-9-23 14:05:49 | 只看该作者
如果不会改脚本的话,那就用事件呗

公共事件-显示图片

具体XY坐标自己调整

话说我刚接触XP就是这样弄的。。。


如果要脚本,附送一个给你
但还是要你自己去改

  1. #    呼出对话框 ver. 1.31 By パラ犬(日)
  2. #  来自 http://rpg.para.s3p.net/
  3. #
  4. #  汉化修改 66RPG bbschat(2006.1.5)
  5. #    来自 http://www.66RPG.com/
  6. #
  7. #    ●准备工作-窗口Skin
  8. #
  9. #    首先,确认自己使用的对话框窗口Skin,(数据库-系统-窗口外观图形)
  10. #    然后根据该窗口Skin制作对话框尾部使用的两个箭头图形
  11. #    尾部箭头图形命名方式:“窗口skin名_top”,“窗口skin名_under”
  12. #    将该图形文件存放在“Graphics/Windowskins”文件夹下。
  13. #
  14. #    本演示游戏内置2套窗口和箭头图形,
  15. #    一套是游戏默认的“001-Blue01”,一套是定制的“fk”
  16. #    玩家可以根据自己的需要参照样本定制自己的呼出对话框窗口Skin。
  17. #
  18. #    ●呼出对话框使用方法
  19. #
  20. #    在事件命令行使用[脚本]将事件ID代入[$mes_id]
  21. #    该事件就可以使用呼出对话框了。
  22. #   (举例:$mes_id=4)
  23. #
  24. #    ID 代入 -1 表示玩家,代入 0 表示事件自身。
  25. #    代入 nil 或者 "" 则返回成通常的信息窗口。
  26. #    对话框的表示位置可以通过事件的“更改文章选项”来设定(上、中、下)。
  27. #    表示位置为“中央”的话,不管事件位置在哪里,对话框都将显示在画面中央。
  28. #
  29. #    ●角色名字窗口的使用文字的方法
  30. #
  31. #    在事件命令行使用[脚本]将文字列代入[$mes_name]
  32. #    对话框就会显示角色名字窗口
  33. #   (举例:$mes_name="阿尔西斯")
  34. #    代入 nil 或者 "" 则不显示角色名字窗口。
  35. #
  36. #    以上两个机能是独立的,所以可以单独使用
  37. #
  38. #   $mes_id=(ID) + $mes_name="名字"  :呼出对话框显示 + 角色名字窗口
  39. #   $mes_id=(ID) + $mes_name=""      :呼出对话框显示(没有角色名字)
  40. #   $mes_id=nil  + $mes_name="名字"  :默认信息窗口 + 角色名字窗口
  41. #   $mes_id=nil  + $mes_name=""      :默认信息窗口(没有角色名字)
  42. #
  43. #    ●角色名字窗口使用角色图片的方法(汉化特别追加功能,原脚本只能使用文字)
  44. #   
  45. #    如果能在对应文件夹中找到文件名和角色名字相同的图片,   
  46. #    则角色名字窗口显示角色头像图片,角色图片最好能包括角色的名字。
  47. #    默认头像图片保存目录为“Graphics/Heads/”,玩家可自行修改。
  48. #
  49. #    如果不想使用角色名字直接作为头像文件名。
  50. #    可以使用下面在 Game_Temp 类里增加的namebmp属性。
  51. #    重新设定角色名字与文件名的对应关系。
  52. #
  53. #    ●信息表示速度的变更方法
  54. #
  55. #    在事件命令行使用[脚本]将数值代入[$mes_speed]
  56. #    速度为 0 即瞬间显示全部信息,数字越大,信息表示速度越慢。
  57. #   (举例:$mes_speed=1)
  58. #
  59. #    ●其他设置
  60. #
  61. #    请参照下面的注释
  62. #==============================================================================

  63. module FUKI

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

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

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

  119. end

  120. #==============================================================================
  121. # 方便用户同时设置2个常用参数而使用的函数
  122. #==============================================================================
  123. def chat(id = 0,name = "")
  124.   $mes_id = id
  125.   $mes_name = name
  126. end

  127. #==============================================================================
  128. # □ Game_Temp
  129. #==============================================================================

  130. class Game_Temp
  131.   attr_accessor  :namebmp              #保存头像图片的Hash表
  132.   alias initialize_fuki initialize
  133.   def initialize
  134.     initialize_fuki
  135.     # 如果不想使用角色名字直接作为头像文件名
  136.     # 可在这里重新设定角色名字与文件名的对应关系
  137.     @namebmp ={"lf"=>"liufan", "yy"=>"zhangying", "wy"=>"wangyun","sj"=>"shuijing",
  138.     "lb"=>"lvbu","dc"=>"diaochan"}
  139.   end
  140. end

  141. #==============================================================================
  142. # □ Window_FukiMessage
  143. #==============================================================================

  144. class Window_FukiMessage < Window_Selectable

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

  550.   #--------------------------------------------------------------------------
  551.   # ○ 计算名字窗口的位置
  552.   #--------------------------------------------------------------------------
  553.   def get_name_pos
  554.     case @face_pic_txt
  555.       when 0  # 文字
  556.         x = self.x + FUKI::NAME_SHIFT_X
  557.         y = self.y - FUKI::NAME_FONT_SIZE - 16 + FUKI::NAME_SHIFT_Y
  558.       when 1  # 图片
  559.         if self.x >= @pic_width + 5
  560.           # 默认头像显示在对话框左边
  561.           x = self.x-@pic_width-5
  562.         else
  563.           # 对话框左边放不下时头像显示在右边
  564.           x = self.x + self.width
  565.         end
  566.         y = self.y+self.height/2 - (@pic_height + 5)/2
  567.       end

  568.     return [x,y]
  569.   end
  570.   
  571.   #--------------------------------------------------------------------------
  572.   # ○ 设置角色名字窗口
  573.   #--------------------------------------------------------------------------
  574.   def set_namewindow
  575.    
  576.     # $mes_name为空时不显示角色名字窗口
  577.     if $mes_name == nil or $mes_name == ""
  578.       return
  579.     else
  580.       # 设定变量
  581.       mes_name = $mes_name
  582.       skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
  583.       
  584.       #判断名称是否有对应的图片"Graphics/heads/" +
  585.       if $game_temp.namebmp[mes_name] == nil then
  586.         sFile = "Graphics/Heads/" + mes_name + ".png"
  587.       else
  588.         sFile = "Graphics/Heads/" + $game_temp.namebmp[mes_name] + ".png"
  589.       end
  590.       
  591.       if FileTest.exist?(sFile) == true then
  592.         
  593.         @face_pic_txt = 1                       #名字窗口使用头像<- bbschat
  594.         
  595.         # 生成头像
  596.         bmp = Bitmap.new(sFile)
  597.         @pic_width = bmp.width
  598.         @pic_height = bmp.height
  599.         
  600.         if self.x >= @pic_width + 5
  601.           # 默认头像显示在对话框左边
  602.           name_x = self.x-@pic_width-5
  603.         else
  604.           # 对话框左边放不下时头像显示在右边
  605.           name_x = self.x + self.width
  606.         end
  607.         name_y = self.y+self.height/2 - (@pic_height + 5)/2
  608.         
  609.         # 生成角色头像窗口
  610.         @name_win = Window_Base.new(name_x, name_y, @pic_width + 5, @pic_height + 5)
  611.         @name_win.windowskin = RPG::Cache.windowskin(skin)
  612.         @name_win.back_opacity =0     
  613.         @name_win.z = self.z + 1
  614.         
  615.         @name_contents = Sprite.new
  616.         @name_contents.x = name_x + 2
  617.         @name_contents.y = name_y + 2
  618.         @name_contents.bitmap = bmp
  619.         #@name_contents.z = @name_win.z + 2     #这个用了似乎效果不好<- bbschat
  620.         
  621.       else
  622.         
  623.         @face_pic_txt = 0                       #名字窗口使用文字<- bbschat

  624.         # 生成名字
  625.         name_width = mes_name.size / 2 * FUKI::NAME_FONT_SIZE
  626.         name_height = FUKI::NAME_FONT_SIZE
  627.         name_x = self.x + FUKI::NAME_SHIFT_X
  628.         name_y = self.y - name_height - 16 + FUKI::NAME_SHIFT_Y

  629.         # 生成角色名字窗口(只有边框)
  630.         @name_win = Window_Base.new(name_x, name_y, name_width + 16, name_height + 16)
  631.         @name_win.windowskin = RPG::Cache.windowskin(skin)
  632.         @name_win.back_opacity = FUKI::NAME_OPACITY
  633.         @name_win.z = self.z + 1
  634.         
  635.         # 为了使空白比Windows类限定的更小使用双重结构
  636.         @name_contents = Sprite.new
  637.         @name_contents.x = name_x + 12
  638.         @name_contents.y = name_y + 8
  639.         @name_contents.bitmap = Bitmap.new(name_width, name_height)
  640.         @name_contents.z = @name_win.z + 2
  641.         
  642.         # 设定文字色
  643.         nil_color = Color.new(0,0,0,0)
  644.         if FUKI::NAME_COLOR != nil_color
  645.           @name_contents.bitmap.font.color = FUKI::NAME_COLOR
  646.         else
  647.           @name_contents.bitmap.font.color = normal_color
  648.         end
  649.         @name_contents.bitmap.font.size = FUKI::NAME_FONT_SIZE
  650.         # 调整窗口尺寸
  651.         rect = @name_contents.bitmap.text_size(mes_name)
  652.         @name_win.width = rect.width + 32
  653.         # 描画名字
  654.         @name_contents.bitmap.draw_text(rect, mes_name)
  655.       end
  656.     end

  657.   end
  658.   
  659.   #--------------------------------------------------------------------------
  660.   # ○ 释放呼出对话框和角色名字窗口
  661.   #--------------------------------------------------------------------------
  662.   def del_fukidasi
  663.     if @tale != nil
  664.       @tale.dispose
  665.       @tale = nil
  666.     end
  667.     if @name_win != nil
  668.       @name_win.dispose
  669.       @name_win = nil
  670.       @name_contents.dispose
  671.       @name_contents = nil
  672.     end
  673.     self.opacity = 0
  674.     self.x = 80
  675.     self.width = 480
  676.     self.height = 160
  677.     self.contents.dispose
  678.     self.contents = Bitmap.new(width - 32, height - 32)
  679.     self.pause = true
  680.   end
  681.   
  682.   #--------------------------------------------------------------------------
  683.   # ○ 取得角色
  684.   #     parameter : 参数
  685.   #--------------------------------------------------------------------------
  686.   def get_character(parameter)
  687.     # 参数分歧
  688.     case parameter
  689.     when -1  # 玩家
  690.       return $game_player
  691.     when 0   # 该事件
  692.       events = $game_map.events
  693.       return events == nil ? nil : events[$active_event_id]
  694.     else     # 特定事件
  695.       events = $game_map.events
  696.       return events == nil ? nil : events[parameter]
  697.     end
  698.   end
  699.   
  700.   #--------------------------------------------------------------------------
  701.   # ● 设定窗口位置和不透明度
  702.   #--------------------------------------------------------------------------
  703.   def reset_window
  704.     if $game_temp.in_battle
  705.       self.y = 16
  706.     else
  707.       case $game_system.message_position
  708.       when 0  # 上
  709.         self.y = 16
  710.       when 1  # 中
  711.         self.y = 160
  712.       when 2  # 下
  713.         self.y = 304
  714.       end
  715.     end
  716.     if $game_system.message_frame == 0
  717.       self.opacity = 255
  718.     else
  719.       self.opacity = 0
  720.     end
  721.     self.back_opacity = FUKI::MES_OPACITY
  722.   end
  723.   
  724.   #--------------------------------------------------------------------------
  725.   # ● 刷新画面
  726.   #--------------------------------------------------------------------------
  727.   def update
  728.     super
  729.     # 呼出模式下跟随事件移动
  730.     if @tale != nil
  731.       pos = get_fuki_pos(self.width, self.height)
  732.       self.x = pos[0]
  733.       self.y = pos[1]

  734.       tale_pos = get_tale_pos
  735.       @tale.x = tale_pos[0]
  736.       @tale.y = tale_pos[1]
  737.       
  738.       if @name_win != nil
  739.         name_pos = get_name_pos
  740.         @name_win.x = name_pos[0]
  741.         @name_win.y = name_pos[1]-4
  742.         case @face_pic_txt
  743.           when 0  # 文字
  744.             @name_contents.x = @name_win.x + 12
  745.             @name_contents.y = @name_win.y + 8
  746.           when 1  # 图片
  747.             @name_contents.x = @name_win.x + 2
  748.             @name_contents.y = @name_win.y + 2
  749.           end
  750.       end
  751.     end
  752.    
  753.     # 渐变的情况下
  754.     if @fade_in
  755.       self.contents_opacity += 24
  756.       if @name_win != nil
  757.         @name_win.opacity += 24
  758.       end
  759.       if @tale != nil
  760.         @tale.opacity += 24
  761.       end
  762.       if @input_number_window != nil
  763.         @input_number_window.contents_opacity += 24
  764.       end
  765.       if self.contents_opacity == 255
  766.         @fade_in = false
  767.       end
  768.       return
  769.     end
  770.     # 显示信息中的情况下
  771.     if @contents_drawing
  772.       refresh_drawtext
  773.       return
  774.     end
  775.     # 输入数值的情况下
  776.     if @input_number_window != nil
  777.       @input_number_window.update
  778.       # 确定
  779.       if Input.trigger?(Input::C)
  780.         $game_system.se_play($data_system.decision_se)
  781.         $game_variables[$game_temp.num_input_variable_id] =
  782.           @input_number_window.number
  783.         $game_map.need_refresh = true
  784.         # 释放输入数值窗口
  785.         @input_number_window.dispose
  786.         @input_number_window = nil
  787.         terminate_message
  788.       end
  789.       return
  790.     end
  791.     # 显示信息结束的情况下
  792.     if @contents_showing_end
  793.       # 不是显示选择项且不是呼出对话模式则显示暂停标志
  794.       if $game_temp.choice_max == 0 and @tale == nil
  795.         self.pause = true
  796.       else
  797.         self.pause = false
  798.       end
  799.       # 取消
  800.       if Input.trigger?(Input::B)
  801.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  802.           $game_system.se_play($data_system.cancel_se)
  803.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  804.           terminate_message
  805.         end
  806.       end
  807.       # 确定
  808.       if Input.trigger?(Input::C)
  809.         if $game_temp.choice_max > 0
  810.           $game_system.se_play($data_system.decision_se)
  811.           $game_temp.choice_proc.call(self.index)
  812.         end
  813.         terminate_message
  814.         # 释放呼出窗口
  815.         del_fukidasi
  816.       end
  817.       return
  818.     end
  819.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  820.     if @fade_out == false and $game_temp.message_text != nil
  821.       @contents_showing = true
  822.       $game_temp.message_window_showing = true
  823.       reset_window
  824.       refresh_create
  825.       if @name_win != nil
  826.         @name_win.opacity = 0
  827.       end
  828.       if @tale != nil
  829.         @tale.opacity = 0
  830.       end
  831.       Graphics.frame_reset
  832.       self.visible = true
  833.       self.contents_opacity = 0
  834.       if @input_number_window != nil
  835.         @input_number_window.contents_opacity = 0
  836.       end
  837.       @fade_in = true
  838.       return
  839.     end
  840.     # 没有可以显示的信息、但是窗口为可见的情况下
  841.     if self.visible
  842.       @fade_out = true
  843.       self.opacity -= 48
  844.       if @name_win != nil
  845.         @name_win.opacity -= 48
  846.       end
  847.       if @tale != nil
  848.         @tale.opacity -= 48
  849.       end
  850.       if self.opacity == 0
  851.         self.visible = false
  852.         @fade_out = false
  853.         $game_temp.message_window_showing = false
  854.         del_fukidasi
  855.       end
  856.       return
  857.     end
  858.   end
  859.   
  860.   #--------------------------------------------------------------------------
  861.   # ● 释放
  862.   #--------------------------------------------------------------------------
  863.   def dispose
  864.     terminate_message
  865.     $game_temp.message_window_showing = false
  866.     if @input_number_window != nil
  867.       @input_number_window.dispose
  868.     end
  869.     super
  870.   end
  871.   
  872.   #--------------------------------------------------------------------------
  873.   # ● 信息结束处理
  874.   #--------------------------------------------------------------------------
  875.   def terminate_message
  876.     self.active = false
  877.     self.pause = false
  878.     self.index = -1
  879.     self.contents.clear
  880.     # 清除显示中标志
  881.     @contents_showing = false
  882.     @contents_showing_end = false
  883.     # 呼叫信息调用
  884.     if $game_temp.message_proc != nil
  885.       $game_temp.message_proc.call
  886.     end
  887.     # 清除文章、选择项、输入数值的相关变量
  888.     $game_temp.message_text = nil
  889.     $game_temp.message_proc = nil
  890.     $game_temp.choice_start = 99
  891.     $game_temp.choice_max = 0
  892.     $game_temp.choice_cancel_type = 0
  893.     $game_temp.choice_proc = nil
  894.     $game_temp.num_input_start = 99
  895.     $game_temp.num_input_variable_id = 0
  896.     $game_temp.num_input_digits_max = 0
  897.     # 释放金钱窗口
  898.     if @gold_window != nil
  899.       @gold_window.dispose
  900.       @gold_window = nil
  901.     end
  902.   end
  903.   
  904.   #--------------------------------------------------------------------------
  905.   # ● 刷新光标矩形
  906.   #--------------------------------------------------------------------------
  907.   def update_cursor_rect
  908.     if [url=home.php?mod=space&uid=370741]@Index[/url] >= 0
  909.       n = $game_temp.choice_start + @index
  910.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  911.     else
  912.       self.cursor_rect.empty
  913.     end
  914.   end
  915.   #--------------------------------------------------------------------------
  916.   # ● 取得普通文字色
  917.   #--------------------------------------------------------------------------
  918.   def normal_color
  919.     nil_color = Color.new(0,0,0,0)
  920.     if FUKI::FUKI_COLOR != nil_color
  921.       color = FUKI::FUKI_COLOR
  922.     else
  923.       color = super
  924.     end
  925.     return color
  926.   end
  927. end

  928. #==============================================================================
  929. # ■ Interpreter
  930. #==============================================================================

  931. class Interpreter
  932.   #--------------------------------------------------------------------------
  933.   # ● 设置事件
  934.   #     event_id : 事件 ID
  935.   #--------------------------------------------------------------------------
  936.   alias setup_fuki setup
  937.   def setup(list, event_id)
  938.     setup_fuki(list, event_id)
  939.     # 如果不是战斗中
  940.     if !($game_temp.in_battle)
  941.       # 记录事件 ID
  942.       $active_event_id = event_id
  943.     end
  944.   end
  945. end

  946. #==============================================================================
  947. # ■ Scene_Map
  948. #==============================================================================

  949. class Scene_Map
  950.   #--------------------------------------------------------------------------
  951.   # ● 主处理
  952.   #--------------------------------------------------------------------------
  953.   def main
  954.     # 生成活动块
  955.     @spriteset = Spriteset_Map.new
  956.     # 生成信息窗口
  957.     @message_window = Window_FukiMessage.new
  958.     @message_window.z = 9999
  959.     # 执行过渡
  960.     Graphics.transition
  961.     # 主循环
  962.     loop do
  963.       # 刷新游戏画面
  964.       Graphics.update
  965.       # 刷新输入信息
  966.       Input.update
  967.       # 刷新画面
  968.       update
  969.       # 如果画面切换的话就中断循环
  970.       if $scene != self
  971.         break
  972.       end
  973.     end
  974.     # 准备过渡
  975.     Graphics.freeze
  976.     # 释放活动块
  977.     @spriteset.dispose
  978.     # 释放信息窗口
  979.     @message_window.dispose
  980.     # 标题画面切换中的情况下
  981.     if $scene.is_a?(Scene_Title)
  982.       # 淡入淡出画面
  983.       Graphics.transition
  984.       Graphics.freeze
  985.     end
  986.   end
  987. end

  988. #==============================================================================
  989. # ■ Window_InputNumber
  990. #==============================================================================

  991. class Window_InputNumber < Window_Base
  992.   #--------------------------------------------------------------------------
  993.   # ● 初始化对像
  994.   #     digits_max : 位数
  995.   #--------------------------------------------------------------------------
  996.   def initialize(digits_max)
  997.     @digits_max = digits_max
  998.     [url=home.php?mod=space&uid=27178]@Number[/url] = 0
  999.     # 从数字的幅度计算(假定与 0~9 等幅)光标的幅度
  1000.     dummy_bitmap = Bitmap.new(32, 32)
  1001.     dummy_bitmap.font.size = FUKI::MES_FONT_SIZE
  1002.     @cursor_width = dummy_bitmap.text_size("0").width + 8
  1003.     dummy_bitmap.dispose
  1004.     super(0, 0, @cursor_width * @digits_max + 32, 64)
  1005.     self.contents = Bitmap.new(width - 32, height - 32)
  1006.     self.contents.font.size = FUKI::MES_FONT_SIZE
  1007.     self.z += 9999
  1008.     self.opacity = 0
  1009.     @index = 0
  1010.     refresh
  1011.     update_cursor_rect
  1012.   end
  1013. end
复制代码

评分

参与人数 1星屑 +45 收起 理由
myownroc + 45 塞糖

查看全部评分


   
【RMXP共享】50个脚本整合的系统
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 05:36

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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