Project1

标题: 找个人帮我改下菜单…… [打印本页]

作者: 飯。    时间: 2007-8-12 18:25
提示: 作者被禁止或删除 内容自动屏蔽
作者: 飯。    时间: 2007-8-12 18:25
提示: 作者被禁止或删除 内容自动屏蔽
作者: IamI    时间: 2007-8-12 19:18
嗯,问题不大,把Scene_Menu的刷新改一下就行了
  1. class Game_Player < Game_Character
  2.   #--------------------------------------------------------------------------
  3.   # ● 增加步数
  4.   #--------------------------------------------------------------------------
  5.   def increase_steps
  6.     super
  7.     # 不是强制移动路线的场合
  8.     unless @move_route_forcing
  9.       # 增加步数
  10.       $game_variables[5] += 1
  11.       # 步数是偶数的情况下
  12.       if $game_party.steps % 2 == 0
  13.         # 检查连续伤害
  14.         $game_party.check_map_slip_damage
  15.       end
  16.     end
  17.   end
  18. end
  19. #==============================================================================
  20. # ■ Window_PlayTime
  21. #------------------------------------------------------------------------------
  22. #  菜单画面显示游戏时间的窗口。
  23. #==============================================================================
  24. class Window_Time < Window_Base
  25.   #--------------------------------------------------------------------------
  26.   # ● 初始化对像
  27.   #--------------------------------------------------------------------------
  28.   def initialize
  29.     super(0, 0, 180, 60)
  30.     self.contents = Bitmap.new(width - 32, height - 32)
  31.     self.z = 110
  32.     refresh
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 刷新
  36.   #--------------------------------------------------------------------------
  37.   def refresh
  38.     self.contents.clear
  39.     self.contents.font.color = system_color
  40.     self.contents.draw_text(0, 0, 140, 32, "时间",2)
  41.     self.contents.font.color = normal_color
  42.     time1 = [$game_variables[6],23].min
  43.     time2 = [$game_variables[7],59].min
  44.     self.contents.draw_text(-24, 0, 60, 32,time1.to_s,2)
  45.     self.contents.draw_text(-24, 0, 100, 32,time2.to_s,2)
  46.     self.contents.draw_text(-24, 0, 80, 32,":",2)
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 刷新画面
  50.   #--------------------------------------------------------------------------
  51.   def update
  52.     super
  53.     if Graphics.frame_count / Graphics.frame_rate != @total_sec
  54.       refresh
  55.     end
  56.   end
  57. end
  58. #==============================================================================
  59. # ■ Window_MenuStatus
  60. #------------------------------------------------------------------------------
  61. #  显示菜单画面和同伴状态的窗口。
  62. #==============================================================================

  63. $MT=9
  64. $MJ=9

  65. class Window_MenuStatus < Window_Selectable
  66.   #--------------------------------------------------------------------------
  67.   # ● 初始化目标
  68.   #--------------------------------------------------------------------------
  69.   def initialize
  70.     super(0, 0, 420, 420)
  71.     self.contents = Bitmap.new(width - 32, height - 32)
  72.     refresh
  73.     self.active = false
  74.     self.index = -1
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 刷新
  78.   #--------------------------------------------------------------------------
  79.   def refresh
  80.     self.contents.clear
  81.     @item_max = $game_party.actors.size
  82.     for i in 0...$game_party.actors.size
  83.       actor = $game_party.actors[i]
  84.       bitmap=Bitmap.new("Graphics/Pictures/face")
  85.       src_rect = Rect.new(0, 0, 100, 100) #——可自己调整大小
  86.       self.contents.blt(0, y, bitmap, src_rect)
  87.     self.contents.font.color = normal_color
  88.     #################################################################
  89.     self.contents.draw_text(0, 120, 120, 32, "体力:", 3)
  90.     self.contents.draw_text(20 +  96,120,100,32,"/",0)
  91.     if $game_variables[1]>$MT
  92.       $game_variables[1]=$MT
  93.     end
  94.     self.contents.draw_text(80, 120,120,32,$game_variables[1].to_s,0)
  95.     self.contents.draw_text(20 + 128,120,100,32,$MT.to_s,0)
  96.     ################################################################
  97.     self.contents.draw_text(0, 150, 120, 32, "饥饿度:", 3)
  98.     self.contents.draw_text(20 +  96,150,100,32,"/",0)
  99.     if $game_variables[3]>$MT
  100.       $game_variables[3]=$MT
  101.     end
  102.     self.contents.draw_text(80, 150,120,32,$game_variables[3].to_s,0)
  103.     self.contents.draw_text(20 + 128,150,100,32,$MT.to_s,0)
  104.     ###################################################################
  105.     self.contents.draw_text(0, 200, 100, 32, "奋进力:", 3)
  106.     self.contents.draw_text(80, 200, 120, 32, $game_variables[2].to_s, 2)
  107.     ###################################################################
  108.     self.contents.draw_text(0, 230, 100, 32, "和谐度:", 3)
  109.     self.contents.draw_text(80, 230, 120, 32, $game_variables[4].to_s, 2)
  110.     ######################################################################
  111.     self.contents.draw_text(0, 260, 120, 32, "房屋清洁度:",3)
  112.     self.contents.draw_text(80, 260, 120, 32, $game_variables[5].to_s , 2)
  113.     ###############################################################
  114.     self.contents.draw_text(0, 300, 100, 32, "金钱:", 3)
  115.     self.contents.draw_text(80, 300, 120, 32, $game_party.gold.to_s, 2)
  116.     ##################################################################
  117.     #self.contents.font.color = system_color
  118.     #self.contents.draw_text(0, 330, 120, 32, "步数")
  119.     end
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● 刷新光标矩形
  123.   #--------------------------------------------------------------------------
  124.   def update_cursor_rect
  125.     if @index < 0
  126.       self.cursor_rect.empty
  127.     else
  128.       self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
  129.     end
  130.   end
  131. end

  132. #==============================================================================
  133. # ■ Scene_Menu
  134. #------------------------------------------------------------------------------
  135. #  处理菜单画面的类。
  136. #==============================================================================

  137. class Scene_Menu
  138.   #--------------------------------------------------------------------------
  139.   # ● 初始化对像
  140.   #     menu_index : 命令光标的初期位置
  141.   #--------------------------------------------------------------------------
  142.   def initialize(menu_index = 0)
  143.     @menu_index = menu_index
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 主处理
  147.   #--------------------------------------------------------------------------
  148.   def main
  149.     # 生成命令窗口
  150.     s1 = "物品"
  151.     s2 = "装备"
  152.     s3 = "写日记"
  153.     s4 = "离开菜单"
  154.     @command_window = Window_Command.new(160, [s1, s2, s3, s4])
  155.     @command_window.index = @menu_index
  156.     @command_window.opacity = 0
  157.     @command_window.x = 290
  158.     @command_window.y = 50
  159.     # 同伴人数为 0 的情况下
  160.     if $game_party.actors.size == 0
  161.       # 物品、特技、装备、状态无效化
  162.       @command_window.disable_item(0)
  163.       @command_window.disable_item(1)
  164.       @command_window.disable_item(2)
  165.       @command_window.disable_item(3)
  166.     end
  167.     # 禁止存档的情况下
  168.     if $game_system.save_disabled
  169.       # 存档无效
  170.       @command_window.disable_item(2)
  171.     end
  172.     @steps = $game_variables[5]
  173.     # 生成游戏时间窗口
  174.     @playtime_window = Window_Time.new
  175.     @playtime_window.x = 460
  176.     @playtime_window.y = 0
  177.     # 生成状态窗口
  178.     @status_window = Window_MenuStatus.new
  179.     @status_window.x = 50
  180.     @status_window.y = 30
  181.     # 执行过渡
  182.     Graphics.transition
  183.     # 主循环
  184.     loop do
  185.       # 刷新游戏画面
  186.       Graphics.update
  187.       # 刷新输入信息
  188.       Input.update
  189.       # 刷新画面
  190.       update
  191.       # 如果切换画面就中断循环
  192.       if $scene != self
  193.         break
  194.       end
  195.     end
  196.     # 准备过渡
  197.     Graphics.freeze
  198.     # 释放窗口
  199.     @command_window.dispose
  200.     @playtime_window.dispose
  201.     @status_window.dispose
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 刷新画面
  205.   #--------------------------------------------------------------------------
  206.   def update
  207.     # 刷新窗口
  208.     @command_window.update
  209.     @playtime_window.update
  210.     @status_window.update
  211.     # 命令窗口被激活的情况下: 调用 update_command
  212.     if @command_window.active
  213.       update_command
  214.       return
  215.     end
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 刷新画面 (命令窗口被激活的情况下)
  219.   #--------------------------------------------------------------------------
  220.   def update_command
  221.     # 按下 B 键的情况下
  222.     if Input.trigger?(Input::B)
  223.       # 演奏取消 SE
  224.       $game_system.se_play($data_system.cancel_se)
  225.       # 切换的地图画面
  226.       $scene = Scene_Map.new
  227.       return
  228.     end
  229.     # 按下 C 键的情况下
  230.     if Input.trigger?(Input::C)
  231.       # 同伴人数为 0、存档、游戏结束以外的场合
  232.       if $game_party.actors.size == 0 and @command_window.index < 4
  233.         # 演奏冻结 SE
  234.         $game_system.se_play($data_system.buzzer_se)
  235.         return
  236.       end
  237.       # 命令窗口的光标位置分支
  238.       case @command_window.index
  239.       when 0  # 物品
  240.         # 演奏确定 SE
  241.         $game_system.se_play($data_system.decision_se)
  242.         # 切换到物品画面
  243.         $scene = Scene_Item.new
  244.       when 1  # 装备
  245.         # 演奏确定 SE
  246.         $game_system.se_play($data_system.decision_se)
  247.         # 激活状态窗口
  248.         @command_window.active = false
  249.         $scene = Scene_Equip.new
  250.       when 2  # 存档
  251.         # 禁止存档的情况下
  252.         if $game_system.save_disabled
  253.           # 演奏冻结 SE
  254.           $game_system.se_play($data_system.buzzer_se)
  255.           return
  256.         end
  257.         # 演奏确定 SE
  258.         $game_system.se_play($data_system.decision_se)
  259.         # 切换到存档画面
  260.         $scene = Scene_Save.new
  261.       when 3  # 状态
  262.         # 演奏确定 SE
  263.         $game_system.se_play($data_system.decision_se)
  264.         $scene=Scene_End.new
  265.       end
  266.       return
  267.     end
  268.   end
  269. end
复制代码

修改的地方如下:
1.$MP改成了$MJ,见名知意,默认值为9
2.体力和饥饿度超过最大值会变成最大值
3.去掉了步数窗口,想恢复的话可以参考Window_Steps跟在后面编写
顺便说一句,LZ写脚本习惯貌似不是很好,乱了点~ [LINE]1,#dddddd[/LINE]系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者: 飯。    时间: 2007-8-12 23:49
提示: 作者被禁止或删除 内容自动屏蔽
作者: 飯。    时间: 2007-8-13 02:12
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1