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

Project1

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

上次看了一个菜单整合的帖子``用了以后发现有问题``

 关闭 [复制链接]
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-7-26
帖子
49
跳转到指定楼层
1
发表于 2007-7-26 00:09:38 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-7-26
帖子
49
7
 楼主| 发表于 2007-7-26 01:04:01 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
431
在线时间
125 小时
注册时间
2006-11-2
帖子
1200
6
发表于 2007-7-26 01:03:13 | 只看该作者
Scene_End 中 搜索 $scene = Scene_Menu.new(5) 改为
$scene = Scene_Menu.new(6)
和记忆一起封存着的ID...
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-7-26
帖子
49
5
 楼主| 发表于 2007-7-26 00:32:57 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-7-26
帖子
49
4
 楼主| 发表于 2007-7-26 00:32:13 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
431
在线时间
125 小时
注册时间
2006-11-2
帖子
1200
3
发表于 2007-7-26 00:21:59 | 只看该作者
  1. class Scene_Menu
  2. # --------------------------------
  3.   def initialize(menu_index = 0)
  4.     @menu_index = menu_index
  5.     @changer = 0
  6.     @where = 0
  7.     @checker = 0
  8.   end
  9. # --------------------------------
  10.   def main
  11.     s1 = $data_system.words.item
  12.     s2 = $data_system.words.skill
  13.     s3 = $data_system.words.equip
  14.     s4 = "状态"
  15.     s5 = "储存进度"
  16.     s6 = "读取进度"
  17.     s7 = "离开游戏"
  18.     s8 = "调整队伍"
  19.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8])
  20.     @command_window.index = @menu_index
  21.     if $game_party.actors.size == 0
  22.       @command_window.disable_item(0)
  23.       @command_window.disable_item(1)
  24.       @command_window.disable_item(2)
  25.       @command_window.disable_item(3)
  26.     end
  27.     if $game_system.save_disabled
  28.       @command_window.disable_item(4)
  29.     end
  30.     if $game_party.actors.size == 1
  31.       @command_window.disable_item(7)
  32.     end
  33.     @playtime_window = Window_PlayTime.new
  34.     @playtime_window.x = 0
  35.     @playtime_window.y = 288
  36.     @gold_window = Window_Gold.new
  37.     @gold_window.x = 0
  38.     @gold_window.y = 396
  39.     @status_window = Window_MenuStatus.new
  40.     @status_window.x = 160
  41.     @status_window.y = 0
  42.     Graphics.transition
  43.     loop do
  44.       Graphics.update
  45.       Input.update
  46.       update
  47.       if $scene != self
  48.         break
  49.       end
  50.     end
  51.     Graphics.freeze
  52.     @command_window.dispose
  53.     @playtime_window.dispose
  54.     @gold_window.dispose
  55.     @status_window.dispose
  56.   end
  57. # --------------------------------
  58.   def update
  59.     @command_window.update
  60.     @playtime_window.update
  61.     @gold_window.update
  62.     @status_window.update
  63.     if @command_window.active
  64.       update_command
  65.       return
  66.     end
  67.     if @status_window.active
  68.       update_status
  69.       return
  70.     end
  71.   end
  72. # --------------------------------
  73.   def update_command
  74.     if Input.trigger?(Input::B)
  75.       $game_system.se_play($data_system.cancel_se)
  76.       $scene = Scene_Map.new
  77.       $game_player.character_name = $game_party.actors[0].character_name
  78.       return
  79.     end
  80.     if Input.trigger?(Input::C)
  81.       if $game_party.actors.size == 0 and @command_window.index < 4
  82.         $game_system.se_play($data_system.buzzer_se)
  83.         return
  84.       end
  85.       if $game_party.actors.size == 1 and @command_window.index ==7
  86.         $game_system.se_play($data_system.buzzer_se)
  87.         return
  88.       end
  89.       case @command_window.index
  90.       when 0
  91.         $game_system.se_play($data_system.decision_se)
  92.         $scene = Scene_Item.new
  93.       when 1
  94.         $game_system.se_play($data_system.decision_se)
  95.         @command_window.active = false
  96.         @status_window.active = true
  97.         @status_window.index = 0
  98.       when 2
  99.         $game_system.se_play($data_system.decision_se)
  100.         @command_window.active = false
  101.         @status_window.active = true
  102.         @status_window.index = 0
  103.       when 3
  104.         $game_system.se_play($data_system.decision_se)
  105.         @command_window.active = false
  106.         @status_window.active = true
  107.         @status_window.index = 0
  108.       when 4
  109.         if $game_system.save_disabled
  110.           $game_system.se_play($data_system.buzzer_se)
  111.           return
  112.         end
  113.         $game_system.se_play($data_system.decision_se)
  114.         $scene = Scene_Save.new
  115.       when 5
  116.          $game_system.se_play($data_system.decision_se)
  117.           $scene = Scene_Load2.new

  118.       when 6
  119.          $game_system.se_play($data_system.decision_se)
  120.          $scene = Scene_End.new

  121.       when 7
  122.         $game_system.se_play($data_system.decision_se)
  123.         @checker = 0
  124.         @command_window.active = false
  125.         @status_window.active = true
  126.         @status_window.index = 0

  127.       end
  128.       return
  129.     end
  130.   end
  131. # --------------------------------
  132.   def update_status
  133.     if Input.trigger?(Input::B)
  134.       $game_system.se_play($data_system.cancel_se)
  135.       @command_window.active = true
  136.       @status_window.active = false
  137.       @status_window.index = -1
  138.       return
  139.     end
  140.     if Input.trigger?(Input::C)
  141.       case @command_window.index
  142.       when 1
  143.         if $game_party.actors[@status_window.index].restriction >= 2
  144.           $game_system.se_play($data_system.buzzer_se)
  145.           return
  146.         end
  147.         $game_system.se_play($data_system.decision_se)
  148.         $scene = Scene_Skill.new(@status_window.index)
  149.       when 2
  150.         $game_system.se_play($data_system.decision_se)
  151.         $scene = Scene_Equip.new(@status_window.index)
  152.       when 3
  153.         $game_system.se_play($data_system.decision_se)
  154.         $scene = Scene_Status.new(@status_window.index)
  155.       when 7
  156.         $game_system.se_play($data_system.decision_se)
  157.         if @checker == 0
  158.           @changer = $game_party.actors[@status_window.index]
  159.           @where = @status_window.index
  160.           @checker = 1
  161.         else
  162.           $game_party.actors[@where] = $game_party.actors[@status_window.index]
  163.           $game_party.actors[@status_window.index] = @changer
  164.           @checker = 0
  165.           @status_window.refresh
  166.         end
  167.       end
  168.       return
  169.     end
  170.   end
  171. end

  172. #==============================================================================
  173. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  174. #==============================================================================

  175. #==============================================================================
  176. # ■ Scene_Load2
  177. #------------------------------------------------------------------------------
  178. #  处理读档画面的类。
  179. #==============================================================================

  180. class Scene_Load2 < Scene_File
  181.   #--------------------------------------------------------------------------
  182.   # ● 初始化对像
  183.   #--------------------------------------------------------------------------
  184.   def initialize
  185.     # 再生成临时对像
  186.     $game_temp = Game_Temp.new
  187.     # 选择存档时间最新的文件
  188.     $game_temp.last_file_index = 0
  189.     latest_time = Time.at(0)
  190.     for i in 0..3
  191.       filename = make_filename(i)
  192.       if FileTest.exist?(filename)
  193.         file = File.open(filename, "r")
  194.         if file.mtime > latest_time
  195.           latest_time = file.mtime
  196.           $game_temp.last_file_index = i
  197.         end
  198.         file.close
  199.       end
  200.     end
  201.     super("要载入哪个文件?")
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 确定时的处理
  205.   #--------------------------------------------------------------------------
  206.   def on_decision(filename)
  207.     # 文件不存在的情况下
  208.     unless FileTest.exist?(filename)
  209.       # 演奏冻结 SE
  210.       $game_system.se_play($data_system.buzzer_se)
  211.       return
  212.     end
  213.     # 演奏读档 SE
  214.     $game_system.se_play($data_system.load_se)
  215.     # 写入存档数据
  216.     file = File.open(filename, "rb")
  217.     read_save_data(file)
  218.     file.close
  219.     # 还原 BGM、BGS
  220.     $game_system.bgm_play($game_system.playing_bgm)
  221.     $game_system.bgs_play($game_system.playing_bgs)
  222.     # 刷新地图 (执行并行事件)
  223.     $game_map.update
  224.     # 切换到地图画面
  225.     $scene = Scene_Map.new
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● 取消时的处理
  229.   #--------------------------------------------------------------------------
  230.   def on_cancel
  231.     # 演奏取消 SE
  232.     $game_system.se_play($data_system.cancel_se)
  233.     # 切换到标题画面
  234.     $scene = Scene_Menu.new(5)
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ● 读取存档数据
  238.   #     file : 读取用文件对像 (已经打开)
  239.   #--------------------------------------------------------------------------
  240.   def read_save_data(file)
  241.     # 读取描绘存档文件用的角色数据
  242.     characters = Marshal.load(file)
  243.     # 读取测量游戏时间用画面计数
  244.     Graphics.frame_count = Marshal.load(file)
  245.     # 读取各种游戏对像
  246.     $game_system        = Marshal.load(file)
  247.     $game_switches      = Marshal.load(file)
  248.     $game_variables     = Marshal.load(file)
  249.     $game_self_switches = Marshal.load(file)
  250.     $game_screen        = Marshal.load(file)
  251.     $game_actors        = Marshal.load(file)
  252.     $game_party         = Marshal.load(file)
  253.     $game_troop         = Marshal.load(file)
  254.     $game_map           = Marshal.load(file)
  255.     $game_player        = Marshal.load(file)
  256.     # 魔法编号与保存时有差异的情况下
  257.     # (加入编辑器的编辑过的数据)
  258.     if $game_system.magic_number != $data_system.magic_number
  259.       # 重新装载地图
  260.       $game_map.setup($game_map.map_id)
  261.       $game_player.center($game_player.x, $game_player.y)
  262.     end
  263.     # 刷新同伴成员
  264.     $game_party.refresh
  265.   end
  266. end

  267. ##==============================================================================
  268. # ■ Window_Gold
  269. #------------------------------------------------------------------------------
  270. #  显示金钱的窗口。
  271. #==============================================================================

  272. class Window_Gold < Window_Base
  273.   #--------------------------------------------------------------------------
  274.   # ● 初始化窗口
  275.   #--------------------------------------------------------------------------
  276.   def initialize
  277.     super(0, 0, 160, 84)
  278.     self.contents = Bitmap.new(width - 32, height - 32)
  279.     refresh
  280.   end
  281.   #--------------------------------------------------------------------------
  282.   # ● 刷新
  283.   #--------------------------------------------------------------------------
  284.   def refresh
  285.     self.contents.clear
  286.     cx = contents.text_size($data_system.words.gold).width
  287.     self.contents.font.color = normal_color
  288.     self.contents.draw_text(4, 0, 120-cx-2, 42, $game_party.gold.to_s, 2)
  289.     self.contents.font.color = system_color
  290.     self.contents.draw_text(124-cx, 0, cx, 42, $data_system.words.gold, 2)
  291.   end
  292. end

  293. #==============================================================================
  294. # ■ Window_PlayTime
  295. #------------------------------------------------------------------------------
  296. #  菜单画面显示游戏时间的窗口。
  297. #==============================================================================

  298. class Window_PlayTime < Window_Base
  299.   #--------------------------------------------------------------------------
  300.   # ● 初始化对像
  301.   #--------------------------------------------------------------------------
  302.   def initialize
  303.     super(0, 0, 160, 108)
  304.     self.contents = Bitmap.new(width - 32, height - 32)
  305.     refresh
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # ● 刷新
  309.   #--------------------------------------------------------------------------
  310.   def refresh
  311.     self.contents.clear
  312.     self.contents.font.color = system_color
  313.     self.contents.draw_text(4, 0, 120, 42, "游戏时间")
  314.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  315.     hour = @total_sec / 60 / 60
  316.     min = @total_sec / 60 % 60
  317.     sec = @total_sec % 60
  318.     text = sprintf("%02d:%02d:%02d", hour, min, sec)
  319.     self.contents.font.color = normal_color
  320.     self.contents.draw_text(4, 32, 120, 32, text, 2)
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 刷新画面
  324.   #--------------------------------------------------------------------------
  325.   def update
  326.     super
  327.     if Graphics.frame_count / Graphics.frame_rate != @total_sec
  328.       refresh
  329.     end
  330.   end
  331. end
复制代码





搞定。
使用之前 把 Game_Character 1 中的
attr_reader   :character_name

改为
attr_accessor   :character_name
和记忆一起封存着的ID...
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-7-26
帖子
49
2
 楼主| 发表于 2007-7-26 00:09:38 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2025-9-22 16:52

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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