查看: 3279|回复: 10

[已经过期] 關於新式菜單調整視窗大小問題

[复制链接]
梦石
0
星屑
50
在线时间
24 小时
注册时间
2012-10-27
回帖
7
发表于 2012-12-30 15:57:49 | 显示全部楼层 |阅读模式

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

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

×
前幾天我用了沉影不器大大提供的新式菜單腳本→(http://www.66rpg.com/articles/3043)
可是因為我有把視窗調整成640X480的大小,
導致裡面很多視窗都顯示在左上角,看起來相當奇怪
我有自己試著調調看了,但還是有些視窗還是不會調
請教教我要怎麼調,還有可以順便問一下嗎?
存檔截圖可不可以用大一點呀?
如果不需要存檔功能要怎麼弄掉?
(因為原本SAVE攻能已經去掉了.
但是用這個腳本SAVE功能又跑出來了)

圈起來的地方是不會調的部分

圈起來的地方是不會調的部分



  1. #==============================================================================
  2. MAX_SAVE_ID = 20                            # 最大存档数
  3. MENU_ICON = [144, 128, 52, 137, 133, 112]   # 菜单图标id
  4. SAVE_DIR = "Saves/"                         # 改变的存档目录(不希望改变目录请删)
  5. #==============================================================================
  6. # (快速存储Bitmap的Marshal 作者: 柳之一) 强大啊
  7. #==============================================================================

  8. class Bitmap
  9.   # 传送到内存的API函数
  10.   RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  11.   RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  12.   def _dump(limit)
  13.     data = "rgba" * width * height
  14.     RtlMoveMemory_pi.call(data, address, data.length)
  15.     [width, height, Zlib::Deflate.deflate(data)].pack("LLa*") # 压缩
  16.   end
  17.   def self._load(str)
  18.     w, h, zdata = str.unpack("LLa*")
  19.     b = self.new(w, h)
  20.     RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
  21.     return b
  22.   end
  23. # [[[bitmap.object_id * 2 + 16] + 8] + 16] == 数据的开头
  24.   def address
  25.     buffer, ad = "rgba", object_id * 2 + 16
  26.     RtlMoveMemory_pi.call(buffer, ad, 4)
  27.     ad = buffer.unpack("L")[0] + 8
  28.     RtlMoveMemory_pi.call(buffer, ad, 4)
  29.     ad = buffer.unpack("L")[0] + 16
  30.     RtlMoveMemory_pi.call(buffer, ad, 4)
  31.     return buffer.unpack("L")[0]
  32.   end
  33. end
  34. #==============================================================================
  35. # ■ Game_Temp
  36. #==============================================================================
  37. class Game_Temp
  38.   #--------------------------------------------------------------------------
  39.   # ● 定义实例变量
  40.   #--------------------------------------------------------------------------
  41.   attr_accessor :menu_bitmap              # 菜单背景位图
  42.   attr_accessor :sub_menu_bitmap          # 子菜单背景位图
  43.   attr_accessor :save_bitmap              # 存档位图
  44.   #--------------------------------------------------------------------------
  45.   # ● 初始化对象
  46.   #--------------------------------------------------------------------------
  47.   alias ini initialize
  48.   def initialize
  49.     ini
  50.     @menu_bitmap = Bitmap.new(1, 1)
  51.     @sub_menu_bitmap = Bitmap.new(1, 1)
  52.     @save_bitmap = Bitmap.new(1, 1)
  53.   end
  54. end
  55. #==============================================================================
  56. # ■ Window_MenuTarget
  57. #==============================================================================
  58. class Window_MenuTarget < Window_Selectable
  59.   #--------------------------------------------------------------------------
  60.   # ● 初始化对像
  61.   #     x : 窗口的 X 坐标
  62.   #     y : 窗口的 Y 坐标
  63.   #--------------------------------------------------------------------------
  64.   def initialize(x, y)
  65.     super(x, y, 510, 128)
  66.     self.contents.font.size = 18
  67.     refresh
  68.     self.active = false
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 释放
  72.   #--------------------------------------------------------------------------
  73.   def dispose
  74.     super
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 刷新
  78.   #--------------------------------------------------------------------------
  79.   def refresh
  80.     self.contents.clear
  81.     @item_max = $game_party.members.size
  82.     for i in 0...@item_max
  83.       draw_item(i)
  84.     end
  85.     draw_6Rface(@index) if @index >= 0
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 描绘项目
  89.   #     index : 项目编号
  90.   #--------------------------------------------------------------------------
  91.   def draw_item(index)
  92.     rect = item_rect(index)
  93.     rect.x += 4
  94.     rect.width -= 8
  95.     self.contents.clear_rect(rect)
  96.     self.contents.font.color = normal_color
  97.     actor = $game_party.members[index]
  98.     draw_actor_name(actor, 124, rect.y + 2)
  99.     begin_x = self.contents.text_size(actor.name).width + 4
  100.     draw_actor_state(actor, begin_x, rect.y, 24)
  101.     draw_actor_hp(actor, 230, rect.y, 65)
  102.     draw_actor_mp(actor, 310, rect.y, 65)
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ● 描绘人物头像
  106.   #     index : 项目编号
  107.   #--------------------------------------------------------------------------
  108.   def draw_6Rface(index)
  109.     rect = Rect.new(0, 0, 96, 96)
  110.     self.contents.clear_rect(rect)
  111.     actor = $game_party.members[index]
  112.     draw_actor_face(actor, 0, 0, 96)
  113.   end  
  114.   #--------------------------------------------------------------------------
  115.   # ● 设置光标的位置
  116.   #     index : 新的光标位置
  117.   #--------------------------------------------------------------------------
  118.   def index=(index)
  119.     @index = index
  120.     update_cursor
  121.     refresh
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 获取项目描画矩形
  125.   #     index : 项目编号
  126.   #--------------------------------------------------------------------------
  127.   def item_rect(index)
  128.     rect = Rect.new(0, 0, 0, 0)
  129.     rect.width = contents.width - 113
  130.     rect.height = WLH
  131.     rect.x = 113
  132.     rect.y = index / @column_max * WLH
  133.     return rect
  134.   end  
  135.   #--------------------------------------------------------------------------
  136.   # ● 更新光标矩形
  137.   #--------------------------------------------------------------------------
  138.   def update_cursor
  139.     if @index < 0                   # 光标位置不满 0 的情况下
  140.       self.cursor_rect.empty        # 光标无效
  141.     else                            # 光标位 0 以上的情况下
  142.       row = @index / @column_max    # 获取当前的行
  143.       if row < top_row              # 当前行被显示开头行前面的情况下
  144.         self.top_row = row          # 从当前行向开头行滚动
  145.       end
  146.       if row > bottom_row           # 当前行被显示末尾行之后的情况下
  147.         self.bottom_row = row       # 从当前行向末尾滚动
  148.       end
  149.       rect = item_rect(@index)      # 获取选择项的矩形
  150.       rect.y -= self.oy             # 矩形滚动的位置加起来
  151.       self.cursor_rect = rect       # 更新光标矩形
  152.     end
  153.   end
  154. end
  155. #==============================================================================
  156. # ■ Window_EquipItem
  157. #==============================================================================
  158. class Window_EquipItem < Window_Item
  159.   #--------------------------------------------------------------------------
  160.   # ● 初始化对象
  161.   #     x          : 窗口的 X 坐标
  162.   #     y          : 窗口的 Y 坐标
  163.   #     width      : 窗口的宽
  164.   #     height     : 窗口的高
  165.   #     actor      : 角色
  166.   #     equip_type : 装备部位 (0~4)
  167.   #--------------------------------------------------------------------------
  168.   def initialize(x, y, width, height, actor, equip_type)
  169.     [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  170.     if equip_type == 1 and actor.two_swords_style     # 二刀流
  171.       equip_type = 0                                  # 将盾更改为武器
  172.     end
  173.     @equip_type = equip_type
  174.     super(x, y, width, height)
  175.     @column_max = 1
  176.     self.index = 0
  177.     refresh
  178.   end
  179. end
  180. #==============================================================================
  181. # ■ Window_Equip
  182. #==============================================================================
  183. class Window_Equip < Window_Selectable
  184.   #--------------------------------------------------------------------------
  185.   # ● 初始化对象
  186.   #     x     : 窗口的 X 坐标
  187.   #     y     : 窗口的 Y 坐标
  188.   #     actor : 角色
  189.   #--------------------------------------------------------------------------
  190.   def initialize(x, y, actor)
  191.     super(x, y, 510, WLH * 5 + 32)
  192.     @actor = actor
  193.     refresh
  194.     self.index = 0
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● 刷新
  198.   #--------------------------------------------------------------------------
  199.   alias old_refresh refresh
  200.   def refresh
  201.     old_refresh
  202.     draw_actor_face(@actor, 278, 16, size = 96)
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ● 获取项目要描画的矩形
  206.   #     index : 项目编号
  207.   #--------------------------------------------------------------------------
  208.   def item_rect(index)
  209.     rect = Rect.new(0, 0, 0, 0)
  210.     rect.width = (contents.width + @spacing) / @column_max - @spacing - 112
  211.     rect.height = WLH
  212.     rect.x = index % @column_max * (rect.width + @spacing)
  213.     rect.y = index / @column_max * WLH
  214.     return rect
  215.   end
  216. end
  217. #==============================================================================
  218. # ■ Window_Status
  219. #==============================================================================
  220. class Window_Status < Window_Base
  221.   #--------------------------------------------------------------------------
  222.   # ● 初始化对象
  223.   #     actor : 角色
  224.   #--------------------------------------------------------------------------
  225.   def initialize(actor)
  226.     super(32, 56, 510, 304)
  227.     @actor = actor
  228.     refresh
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ● 刷新
  232.   #--------------------------------------------------------------------------
  233.   def refresh
  234.     self.contents.clear
  235.     draw_actor_name(@actor, 4, 0)
  236.     draw_actor_class(@actor, 128, 0)
  237.     draw_actor_face(@actor, 8, 32)
  238.     draw_basic_info(128, 32)
  239.     draw_parameters(32, 160)
  240.     draw_exp_info(264, 0)
  241.     draw_equipments(264, 128)
  242.   end
  243. end

  244. #==============================================================================
  245. # ■ Window_SaveFile
  246. #==============================================================================

  247. class Window_SaveFile < Window_Base
  248.   #--------------------------------------------------------------------------
  249.   # ● 定义实例变量
  250.   #--------------------------------------------------------------------------
  251.   attr_reader   :filename                 # 文件名
  252.   attr_reader   :file_exist               # 文件存在标志
  253.   #--------------------------------------------------------------------------
  254.   # ● 初始化对象
  255.   #     file_index : 存档文件索引 (0~3)
  256.   #     filename   : 文件名
  257.   #--------------------------------------------------------------------------
  258.   def initialize(file_index, filename)
  259.     super(179, 59, 416, 298)
  260.     @file_index = file_index
  261.     @filename = filename
  262.     load_gamedata
  263.     refresh(@file_index)
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # ● 读取部分游戏数据
  267.   #--------------------------------------------------------------------------
  268.   def load_gamedata
  269.     @file_exist = FileTest.exist?(SAVE_DIR + @filename)
  270.     if @file_exist
  271.       file = File.open(SAVE_DIR + @filename, "r")
  272.       begin
  273.         @characters     = Marshal.load(file)
  274.         @frame_count    = Marshal.load(file)
  275.         @last_bgm       = Marshal.load(file)
  276.         @last_bgs       = Marshal.load(file)
  277.         @game_system    = Marshal.load(file)
  278.         @game_message   = Marshal.load(file)
  279.         @game_switches  = Marshal.load(file)
  280.         @game_variables = Marshal.load(file)
  281.         @total_sec = @frame_count / Graphics.frame_rate
  282.       rescue
  283.         @file_exist = false
  284.       ensure
  285.         file.close
  286.       end
  287.     end
  288.   end
  289.   #--------------------------------------------------------------------------
  290.   # ● 刷新
  291.   #     index : 索引
  292.   #--------------------------------------------------------------------------
  293.   def refresh(index)
  294.     file_index = index
  295.     self.contents.clear
  296.     self.contents.font.color = normal_color
  297.     if @file_exist
  298.       self.contents.fill_rect(0, 0, 272,208+2, Color.new(0,0,64))
  299.       if FileTest.exist?(SAVE_DIR + @filename.split(/\./)[0] + ".png")
  300.         self.contents.blur
  301.         draw_save_bitmap(0,0)
  302.       else
  303.         self.contents.draw_text(0, 64, 304-32, 24, "找不到截图文件!", 1)
  304.       end
  305.       draw_party_characters(108, 288-30)
  306.       draw_playtime(0, 288+8-56, contents.width-4, 2)
  307.     else
  308.       self.contents.draw_text(0, 288-56, contents.width-4, 24, "无此存档!", 1)
  309.     end
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ● 更改索引
  313.   #     index : 索引
  314.   #--------------------------------------------------------------------------
  315.   def file_index=(file_index)
  316.     @file_index = file_index
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   # ● 描绘截图
  320.   #     x : 描画先 X 座標
  321.   #     y : 描画先 Y 座標
  322.   #--------------------------------------------------------------------------
  323.   def draw_party_characters(x, y)
  324.     for i in [url=mailto:0...@characters.size]0...@characters.size[/url]
  325.       name = @characters[i][0]
  326.       index = @characters[i][1]
  327.       draw_character(name, index, x + i * 48, y)
  328.     end
  329.   end
  330.   #--------------------------------------------------------------------------
  331.   # ● パーティキャラの描画
  332.   #     x : 描画先 X 座標
  333.   #     y : 描画先 Y 座標
  334.   #--------------------------------------------------------------------------
  335.   def draw_save_bitmap(x, y)
  336.     bitmap = Bitmap.new(SAVE_DIR + @filename.split(/\./)[0] + ".png")
  337.     rect = Rect.new(0, 0, 0, 0)
  338.     rect.width = bitmap.width
  339.     rect.height = bitmap.height
  340.     self.contents.blt(x, y, bitmap, rect)
  341.     bitmap.dispose
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ● 描绘游戏时间
  345.   #     x     : 描绘目标 X 坐标
  346.   #     y     : 描绘目标 Y 坐标
  347.   #     width : 宽
  348.   #     align : 配置
  349.   #--------------------------------------------------------------------------
  350.   def draw_playtime(x, y, width, align)
  351.     hour = @total_sec / 60 / 60
  352.     min = @total_sec / 60 % 60
  353.     sec = @total_sec % 60
  354.     time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  355.     self.contents.font.color = normal_color
  356.     self.contents.draw_text(x, y, width, WLH, time_string, 2)
  357.   end
  358. end
  359. #==============================================================================
  360. # ■ Window_Menu_Command
  361. #==============================================================================
  362. class Window_Menu_Command < Window_Selectable
  363.   #--------------------------------------------------------------------------
  364.   # ● 定义实例变量
  365.   #--------------------------------------------------------------------------
  366.   attr_reader   :commands                 # 命令
  367.   #--------------------------------------------------------------------------
  368.   # ● 初始化对象
  369.   #     width      : 窗口宽
  370.   #     commands   : 命令字符串列表
  371.   #     column_max : 行数 (2 以上横向选择)
  372.   #     row_max    : 列数 (0:与命令数一致)
  373.   #     spacing    : 项目横向的空白空间
  374.   #--------------------------------------------------------------------------
  375.   def initialize(width, commands, column_max = 16, row_max = 0, spacing = 8)
  376.     if row_max == 0
  377.       row_max = (commands.size + column_max - 1) / column_max
  378.     end
  379.     super(0, 416-54, width, row_max * WLH + 32, spacing)
  380.     @commands = commands
  381.     @item_max = commands.size
  382.     @column_max = column_max
  383.     self.index = 0
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # ● 刷新
  387.   #--------------------------------------------------------------------------
  388.   def refresh
  389.     self.contents.clear
  390.     for i in 0...@item_max
  391.       draw_item(i)
  392.     end
  393.   end
  394.   #--------------------------------------------------------------------------
  395.   # ● 描绘项目
  396.   #     index   : 项目编号
  397.   #     enabled : 有效标志。false 为半透明描绘。
  398.   #--------------------------------------------------------------------------
  399.   def draw_item(index, enabled = true)
  400.     rect = item_rect(index)
  401.     rect.width -= 8
  402.     self.contents.clear_rect(rect)
  403.     self.contents.font.color = normal_color
  404.     self.contents.font.color.alpha = enabled ? 255 : 128
  405.     draw_icon(MENU_ICON[index], rect.x, rect.y, index == self.index)
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● 更新帮助文本
  409.   #--------------------------------------------------------------------------
  410.   def update_help
  411.     text = $data_system.game_title
  412.     if @commands[self.index] != nil
  413.       text += ": " + @commands[self.index]
  414.     end
  415.     @help_window.set_text(text)
  416.   end
  417. end

  418. #==============================================================================
  419. # ■ Scene_Base
  420. #==============================================================================
  421. class Scene_Base
  422.   #--------------------------------------------------------------------------
  423.   # ● 生成菜单画面背景
  424.   #--------------------------------------------------------------------------
  425.   def create_menu_background
  426.     @menuback_sprite = Sprite.new
  427.     @menuback_sprite.bitmap = $game_temp.background_bitmap
  428.     update_menu_background
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # ● 生成子菜单画面背景
  432.   #--------------------------------------------------------------------------
  433.   def create_sub_menu_background
  434.     @menuback_sprite = Sprite.new
  435.     @menuback_sprite.bitmap = $game_temp.sub_menu_bitmap
  436.     update_menu_background
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # ● 生成存档位图快照
  440.   #--------------------------------------------------------------------------
  441.   def snapshot_for_save
  442.     d_rect = Rect.new(0, 0, 272, 208)
  443.     s_rect = Rect.new(0, 0, 640, 480)
  444.     save_bitmap = Graphics.snap_to_bitmap
  445.     $game_temp.save_bitmap.dispose
  446.     $game_temp.save_bitmap = Bitmap.new(272, 208)
  447.     $game_temp.save_bitmap.stretch_blt(d_rect, save_bitmap, s_rect)
  448.   end
  449. end

  450. #==============================================================================
  451. # ■ Scene_Map
  452. #==============================================================================
  453. class Scene_Map < Scene_Base
  454.   #--------------------------------------------------------------------------
  455.   # ● 结束处理
  456.   #--------------------------------------------------------------------------
  457.   def terminate
  458.     super
  459.     snapshot_for_save                 # 截图存档
  460.     if $scene.is_a?(Scene_Battle)     # 正在切换战斗画面的情况下
  461.       @spriteset.dispose_characters   # 为了生成背景隐藏角色
  462.     end
  463.     snapshot_for_background           # 背景图快照
  464.     snapshot_for_menu                 # 菜单背景图快照
  465.     @spriteset.dispose
  466.     @message_window.dispose
  467.     if $scene.is_a?(Scene_Battle)     # 正在切换战斗画面的情况下
  468.       perform_battle_transition       # 执行战斗前变换
  469.     end
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ● 菜单背景快照
  473.   #--------------------------------------------------------------------------
  474.   def snapshot_for_menu
  475.     $game_temp.menu_bitmap.dispose
  476.     $game_temp.menu_bitmap = Graphics.snap_to_bitmap
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # ● 切换至菜单画面
  480.   #--------------------------------------------------------------------------
  481.   def call_menu
  482.     if $game_temp.menu_beep
  483.       Sound.play_decision
  484.       $game_temp.menu_beep = false
  485.     end
  486.     $game_temp.next_scene = nil
  487.     $scene = Scene_Menu.new(0, true)
  488.   end
  489. end

  490. #==============================================================================
  491. # ■ Scene_Title
  492. #==============================================================================
  493. class Scene_Title < Scene_Base
  494.   #--------------------------------------------------------------------------
  495.   # ● 判断继续是否有效
  496.   #--------------------------------------------------------------------------
  497.   def check_continue
  498.     @continue_enabled = (Dir.glob(SAVE_DIR + 'Save*.rvdata').size > 0)
  499.   end
  500. end
  501. #==============================================================================
  502. # ■ Scene_Menu
  503. #==============================================================================
  504. class Scene_Menu < Scene_Base
  505.   #--------------------------------------------------------------------------
  506.   # ● 初始化对象
  507.   #     menu_index : 指令光标初期位置
  508.   #     show       : 是否动态出现菜单
  509.   #--------------------------------------------------------------------------
  510.   def initialize(menu_index = 0, show = false)
  511.     @menu_index = menu_index
  512.     @status_index = 0
  513.     [url=home.php?mod=space&uid=32215]@show[/url] = show
  514.   end
  515.   #--------------------------------------------------------------------------
  516.   # ● 开始处理
  517.   #--------------------------------------------------------------------------
  518.   def start
  519.     super
  520.     create_menu_background
  521.     create_command_window
  522.     @gold_window = Window_Gold.new(384, 360)
  523.     @gold_window.opacity = 0
  524.     @gold_window.y = @show ? 416 : 360
  525.     @status_window = Window_MenuTarget.new(64, 144)
  526.     @status_window.visible = false
  527.     @status_window.openness = 0
  528.     @help_window = Window_Help.new
  529.     @help_window.y = @show ? -56 : 0
  530.     @command_window.help_window = @help_window
  531.   end
  532.   #--------------------------------------------------------------------------
  533.   # ● 结束处理
  534.   #--------------------------------------------------------------------------
  535.   def terminate
  536.     super
  537.     dispose_menu_background
  538.     @command_window.dispose
  539.     @gold_window.dispose
  540.     @status_window.dispose
  541.     @help_window.dispose
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # ● 更新画面
  545.   #--------------------------------------------------------------------------
  546.   def update
  547.     super
  548.     update_menu_background
  549.     @command_window.update
  550.     @gold_window.update
  551.     @status_window.update
  552.     @help_window.update
  553.     loop do
  554.       break if @help_window.y >= 0
  555.       @help_window.y += 8
  556.       @gold_window.y -= 8
  557.       @command_window.y -= 8
  558.       Graphics.update
  559.     end
  560.     @help_window.y = 0
  561.     @command_window.y = 360
  562.     if @command_window.active
  563.       update_command_selection
  564.       if @menu_index != @command_window.index
  565.         @menu_index = @command_window.index
  566.         @command_window.refresh
  567.       end
  568.     elsif @status_window.active
  569.       update_actor_selection
  570.       if @status_index != @status_window.index
  571.         @status_index = @status_window.index
  572.         @status_window.refresh
  573.       end
  574.     end
  575.   end
  576.   #--------------------------------------------------------------------------
  577.   # ● 打开指令窗口
  578.   #--------------------------------------------------------------------------
  579.   def show_status_window
  580.     @status_window.open
  581.     begin
  582.       @status_window.update
  583.       Graphics.update
  584.     end until @status_window.openness == 255
  585.   end
  586.   #--------------------------------------------------------------------------
  587.   # ● 关闭指令窗口
  588.   #--------------------------------------------------------------------------
  589.   def hide_status_window
  590.     @status_window.close
  591.     begin
  592.       @status_window.update
  593.       Graphics.update
  594.     end until @status_window.openness == 0
  595.   end
  596.   #--------------------------------------------------------------------------
  597.   # ● 菜单背景快照
  598.   #--------------------------------------------------------------------------
  599.   def snapshot_for_sub_menu
  600.     $game_temp.sub_menu_bitmap.dispose
  601.     $game_temp.sub_menu_bitmap = Graphics.snap_to_bitmap
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # ● 生成菜单画面背景
  605.   #--------------------------------------------------------------------------
  606.   def create_menu_background
  607.     @menuback_sprite = Sprite.new
  608.     @menuback_sprite.bitmap = $game_temp.menu_bitmap
  609.     update_menu_background
  610.   end
  611.   #--------------------------------------------------------------------------
  612.   # ● 生成指令窗口
  613.   #--------------------------------------------------------------------------
  614.   def create_command_window
  615.     s1 = Vocab::item
  616.     s2 = Vocab::skill
  617.     s3 = Vocab::equip
  618.     s4 = Vocab::status
  619.     s5 = Vocab::save
  620.     s6 = Vocab::game_end
  621.     @command_window = Window_Menu_Command.new(640, [s1, s2, s3, s4, s5, s6])
  622.     @command_window.y = @show ? 510 : 360
  623.     @command_window.index = @menu_index
  624.     @command_window.refresh
  625.     if $game_party.members.size == 0          # 同伴人数为 0 的情况下
  626.       @command_window.draw_item(0, false)     # 物品无效化
  627.       @command_window.draw_item(1, false)     # 特技无效化
  628.       @command_window.draw_item(2, false)     # 装备无效化
  629.       @command_window.draw_item(3, false)     # 状态无效化
  630.     end
  631.     if $game_system.save_disabled             # 禁止存档的情况下
  632.       @command_window.draw_item(4, false)     # 存档无效化
  633.     end
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ● 更新指令选择
  637.   #--------------------------------------------------------------------------
  638.   def update_command_selection
  639.     if Input.trigger?(Input::B)
  640.       loop do
  641.         break if @help_window.y <= -56
  642.         @help_window.y -= 8
  643.         @gold_window.y += 8
  644.         @command_window.y += 8
  645.         Graphics.update
  646.       end
  647.       Sound.play_cancel
  648.       $scene = Scene_Map.new
  649.     elsif Input.trigger?(Input::C)
  650.       if $game_party.members.size == 0 and @command_window.index < 4
  651.         Sound.play_buzzer
  652.         return
  653.       elsif $game_system.save_disabled and @command_window.index == 4
  654.         Sound.play_buzzer
  655.         return
  656.       end
  657.       Sound.play_decision
  658.       case @command_window.index
  659.       when 0      # 物品
  660.         @help_window.set_text("")
  661.         snapshot_for_sub_menu
  662.         $scene = Scene_Item.new
  663.       when 1,2,3  # 特技、装备、状态
  664.         @help_window.set_text("")
  665.         snapshot_for_sub_menu
  666.         start_actor_selection
  667.       when 4      # 存档
  668.         @help_window.set_text("")
  669.         snapshot_for_sub_menu
  670.         $scene = Scene_File.new(true, false, false)
  671.       when 5      # 游戏结束
  672.         @help_window.set_text("")
  673.         snapshot_for_sub_menu
  674.         $scene = Scene_End.new
  675.       end
  676.     end
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # ● アクター選択の開始
  680.   #--------------------------------------------------------------------------
  681.   def start_actor_selection
  682.     @command_window.active = false
  683.     @status_window.active = true
  684.     @status_window.visible = true
  685.     show_status_window
  686.     if $game_party.last_actor_index < @status_window.item_max
  687.       @status_window.index = $game_party.last_actor_index
  688.     else
  689.       @status_window.index = 0
  690.     end
  691.   end
  692.   #--------------------------------------------------------------------------
  693.   # ● アクター選択の終了
  694.   #--------------------------------------------------------------------------
  695.   def end_actor_selection
  696.     @command_window.active = true
  697.     @status_window.active = false
  698.     hide_status_window
  699.     @status_window.visible = false
  700.     @status_window.index = -1
  701.   end
  702.   #--------------------------------------------------------------------------
  703.   # ● アクター選択の更新
  704.   #--------------------------------------------------------------------------
  705.   def update_actor_selection
  706.     if Input.trigger?(Input::B)
  707.       Sound.play_cancel
  708.       end_actor_selection
  709.     elsif Input.trigger?(Input::C)
  710.       $game_party.last_actor_index = @status_window.index
  711.       Sound.play_decision
  712.       case @command_window.index
  713.       when 1  # スキル
  714.         $scene = Scene_Menu_Skill.new(@status_window.index)
  715.       when 2  # 装備
  716.         $scene = Scene_Equip.new(@status_window.index)
  717.       when 3  # ステータス
  718.         $scene = Scene_Status.new(@status_window.index)
  719.       end
  720.     end
  721.   end
  722. end
  723. #==============================================================================
  724. # ■ Scene_Item
  725. #==============================================================================
  726. class Scene_Item < Scene_Base
  727.   #--------------------------------------------------------------------------
  728.   # ● 开始处理
  729.   #--------------------------------------------------------------------------
  730.   def start
  731.     super
  732.     create_sub_menu_background
  733.     @viewport = Viewport.new(0, 0, 640, 480)
  734.     @help_window = Window_Help.new
  735.     @help_window.opacity = 0
  736.     @help_window.viewport = @viewport
  737.     @item_window = Window_Item.new(64, 112, 510, 176)
  738.     @item_window.viewport = @viewport
  739.     @item_window.help_window = @help_window
  740.     @item_window.openness = 0
  741.     @item_window.active = false
  742.     @target_window = Window_MenuTarget.new(64, 232)
  743.     @actor_index = 0
  744.     hide_target_window
  745.   end
  746.   #--------------------------------------------------------------------------
  747.   # ● 更新画面
  748.   #--------------------------------------------------------------------------
  749.   def update
  750.     super
  751.     update_menu_background
  752.     @help_window.update
  753.     @item_window.update
  754.     @target_window.update
  755.     if @item_window.active
  756.       update_item_selection
  757.     elsif @target_window.active
  758.       if @actor_index != @target_window.index
  759.         @actor_index = @target_window.index
  760.         @target_window.refresh
  761.       end
  762.       update_target_selection
  763.     end
  764.   end
  765.   #--------------------------------------------------------------------------
  766.   # ● 开始后处理
  767.   #--------------------------------------------------------------------------
  768.   def post_start
  769.     super
  770.     open_item_window
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # ● 结束前处理
  774.   #--------------------------------------------------------------------------
  775.   def pre_terminate
  776.     super
  777.     close_item_window
  778.   end
  779.   #--------------------------------------------------------------------------
  780.   # ● 打开指令窗口
  781.   #--------------------------------------------------------------------------
  782.   def open_item_window
  783.     @item_window.open
  784.     begin
  785.       @item_window.update
  786.       Graphics.update
  787.     end until @item_window.openness == 255
  788.   end
  789.   #--------------------------------------------------------------------------
  790.   # ● 关闭指令窗口
  791.   #--------------------------------------------------------------------------
  792.   def close_item_window
  793.     @item_window.close
  794.     begin
  795.       @item_window.update
  796.       Graphics.update
  797.     end until @item_window.openness == 0
  798.   end
  799.   #--------------------------------------------------------------------------
  800.   # ● 确定物品
  801.   #--------------------------------------------------------------------------
  802.   def determine_item
  803.     if @item.for_friend?
  804.       show_target_window
  805.       if @item.for_all?
  806.         @target_window.index = 99
  807.       else
  808.         if $game_party.last_target_index < @target_window.item_max
  809.           @target_window.index = $game_party.last_target_index
  810.         else
  811.           @target_window.index = 0
  812.         end
  813.       end
  814.     else
  815.       use_item_nontarget
  816.     end
  817.   end
  818.   #--------------------------------------------------------------------------
  819.   # ● 显示目标窗口
  820.   #--------------------------------------------------------------------------
  821.   def show_target_window
  822.     loop do
  823.       @item_window.y -= 8
  824.       Graphics.update
  825.       break if @item_window.y <= 56
  826.     end
  827.     @item_window.active = false
  828.     @target_window.visible = true
  829.     @target_window.active = true
  830.   end
  831.   #--------------------------------------------------------------------------
  832.   # ● 不显示目标窗口
  833.   #--------------------------------------------------------------------------
  834.   def hide_target_window
  835.     @target_window.visible = false
  836.     loop do
  837.       @item_window.y += 8
  838.       Graphics.update
  839.       break if @item_window.y >= 112
  840.     end
  841.     @item_window.active = true
  842.     @target_window.active = false
  843.     @viewport.rect.set(0, 0, 640, 480)
  844.     @viewport.ox = 0
  845.   end
  846. end
  847. #==============================================================================
  848. # ■ Scene_Menu_Skill
  849. #==============================================================================
  850. class Scene_Menu_Skill < Scene_Base
  851.   #--------------------------------------------------------------------------
  852.   # ● 初始化对象
  853.   #     actor_index : 角色索引
  854.   #--------------------------------------------------------------------------
  855.   def initialize(actor_index = 0, equip_index = 0)
  856.     @actor_index = actor_index
  857.   end
  858.   #--------------------------------------------------------------------------
  859.   # ● 开始处理
  860.   #--------------------------------------------------------------------------
  861.   def start
  862.     super
  863.     create_sub_menu_background
  864.     @actor = $game_party.members[@actor_index]
  865.     @viewport = Viewport.new(0, 0, 640, 480)
  866.     @help_window = Window_Help.new
  867.     @help_window.opacity = 0
  868.     @help_window.viewport = @viewport
  869.     @skill_window = Window_Skill.new(64, 112, 510, 176, @actor)
  870.     @skill_window.viewport = @viewport
  871.     @skill_window.help_window = @help_window
  872.     @skill_window.openness = 0
  873.     @skill_window.open
  874.     @target_window = Window_MenuTarget.new(64, 232)
  875.     hide_target_window
  876.   end
  877.   #--------------------------------------------------------------------------
  878.   # ● 结束处理
  879.   #--------------------------------------------------------------------------
  880.   def terminate
  881.     super
  882.     dispose_menu_background
  883.     @help_window.dispose
  884.     @skill_window.dispose
  885.     @target_window.dispose
  886.   end
  887.   #--------------------------------------------------------------------------
  888.   # ● 开始后处理
  889.   #--------------------------------------------------------------------------
  890.   def post_start
  891.     super
  892.     open_skill_window
  893.   end
  894.   #--------------------------------------------------------------------------
  895.   # ● 结束前处理
  896.   #--------------------------------------------------------------------------
  897.   def pre_terminate
  898.     super
  899.     close_skill_window
  900.   end
  901.   #--------------------------------------------------------------------------
  902.   # ● 打开指令窗口
  903.   #--------------------------------------------------------------------------
  904.   def open_skill_window
  905.     @skill_window.open
  906.     begin
  907.       @skill_window.update
  908.       Graphics.update
  909.     end until @skill_window.openness == 255
  910.   end
  911.   #--------------------------------------------------------------------------
  912.   # ● 关闭指令窗口
  913.   #--------------------------------------------------------------------------
  914.   def close_skill_window
  915.     @skill_window.close
  916.     begin
  917.       @skill_window.update
  918.       Graphics.update
  919.     end until @skill_window.openness == 0
  920.   end
  921.   #--------------------------------------------------------------------------
  922.   # ● 还原至原来的画面
  923.   #--------------------------------------------------------------------------
  924.   def return_scene
  925.     $scene = Scene_Menu.new(1)
  926.   end
  927.   #--------------------------------------------------------------------------
  928.   # ● 切换至下一名角色的画面
  929.   #--------------------------------------------------------------------------
  930.   def next_actor
  931.     @actor_index += 1
  932.     @actor_index %= $game_party.members.size
  933.     $scene = Scene_Skill.new(@actor_index)
  934.   end
  935.   #--------------------------------------------------------------------------
  936.   # ● 切换至上一名角色的画面
  937.   #--------------------------------------------------------------------------
  938.   def prev_actor
  939.     @actor_index += $game_party.members.size - 1
  940.     @actor_index %= $game_party.members.size
  941.     $scene = Scene_Skill.new(@actor_index)
  942.   end
  943.   #--------------------------------------------------------------------------
  944.   # ● 更新画面
  945.   #--------------------------------------------------------------------------
  946.   def update
  947.     super
  948.     update_menu_background
  949.     @help_window.update
  950.     @skill_window.update
  951.     @target_window.update
  952.     if @skill_window.active
  953.       update_skill_selection
  954.     elsif @target_window.active
  955.       if @actor_index != @target_window.index
  956.         @actor_index = @target_window.index
  957.         @target_window.refresh
  958.       end
  959.       update_target_selection
  960.     end
  961.   end
  962.   #--------------------------------------------------------------------------
  963.   # ● 更新选择特技
  964.   #--------------------------------------------------------------------------
  965.   def update_skill_selection
  966.     if Input.trigger?(Input::B)
  967.       Sound.play_cancel
  968.       return_scene
  969.     elsif Input.trigger?(Input::R)
  970.       Sound.play_cursor
  971.       next_actor
  972.     elsif Input.trigger?(Input::L)
  973.       Sound.play_cursor
  974.       prev_actor
  975.     elsif Input.trigger?(Input::C)
  976.       @skill = @skill_window.skill
  977.       if @skill != nil
  978.         @actor.last_skill_id = @skill.id
  979.       end
  980.       if @actor.skill_can_use?(@skill)
  981.         Sound.play_decision
  982.         determine_skill
  983.       else
  984.         Sound.play_buzzer
  985.       end
  986.     end
  987.   end
  988.   #--------------------------------------------------------------------------
  989.   # ● 确定特技
  990.   #--------------------------------------------------------------------------
  991.   def determine_skill
  992.     if @skill.for_friend?
  993.       show_target_window
  994.       if @skill.for_all?
  995.         @target_window.index = 99
  996.       elsif @skill.for_user?
  997.         @target_window.index = @actor_index + 100
  998.       else
  999.         if $game_party.last_target_index < @target_window.item_max
  1000.           @target_window.index = $game_party.last_target_index
  1001.         else
  1002.           @target_window.index = 0
  1003.         end
  1004.       end
  1005.     else
  1006.       use_skill_nontarget
  1007.     end
  1008.   end
  1009.   #--------------------------------------------------------------------------
  1010.   # ● 更新选择目标
  1011.   #--------------------------------------------------------------------------
  1012.   def update_target_selection
  1013.     if Input.trigger?(Input::B)
  1014.       Sound.play_cancel
  1015.       hide_target_window
  1016.     elsif Input.trigger?(Input::C)
  1017.       if not @actor.skill_can_use?(@skill)
  1018.         Sound.play_buzzer
  1019.       else
  1020.         determine_target
  1021.       end
  1022.     end
  1023.   end
  1024.   #--------------------------------------------------------------------------
  1025.   # ● 确定目标
  1026.   #    无效的情况下 (在不能战斗的情况下使用恢复剂) 播放 buzzer 的 SE。
  1027.   #--------------------------------------------------------------------------
  1028.   def determine_target
  1029.     used = false
  1030.     if @skill.for_all?
  1031.       for target in $game_party.members
  1032.         target.skill_effect(@actor, @skill)
  1033.         used = true unless target.skipped
  1034.       end
  1035.     elsif @skill.for_user?
  1036.       target = $game_party.members[@target_window.index - 100]
  1037.       target.skill_effect(@actor, @skill)
  1038.       used = true unless target.skipped
  1039.     else
  1040.       $game_party.last_target_index = @target_window.index
  1041.       target = $game_party.members[@target_window.index]
  1042.       target.skill_effect(@actor, @skill)
  1043.       used = true unless target.skipped
  1044.     end
  1045.     if used
  1046.       use_skill_nontarget
  1047.     else
  1048.       Sound.play_buzzer
  1049.     end
  1050.   end
  1051.   #--------------------------------------------------------------------------
  1052.   # ● 显示目标窗口
  1053.   #--------------------------------------------------------------------------
  1054.   def show_target_window
  1055.     loop do
  1056.       @skill_window.y -= 8
  1057.       Graphics.update
  1058.       break if @skill_window.y <= 56
  1059.     end
  1060.     @skill_window.active = false
  1061.     @target_window.visible = true
  1062.     @target_window.active = true
  1063.   end
  1064.   #--------------------------------------------------------------------------
  1065.   # ● 不显示目标窗口
  1066.   #--------------------------------------------------------------------------
  1067.   def hide_target_window
  1068.     @target_window.visible = false
  1069.     loop do
  1070.       @skill_window.y += 8
  1071.       Graphics.update
  1072.       break if @skill_window.y >= 112
  1073.     end
  1074.     @skill_window.active = true
  1075.     @target_window.active = false
  1076.     @viewport.rect.set(0, 0, 640, 480)
  1077.     @viewport.ox = 0
  1078.   end
  1079.   #--------------------------------------------------------------------------
  1080.   # ● 使用特技 (也适用于我方对象以外的效果)
  1081.   #--------------------------------------------------------------------------
  1082.   def use_skill_nontarget
  1083.     Sound.play_use_skill
  1084.     @actor.mp -= @actor.calc_mp_cost(@skill)
  1085.     @skill_window.refresh
  1086.     @target_window.refresh
  1087.     if $game_party.all_dead?
  1088.       $scene = Scene_Gameover.new
  1089.     elsif @skill.common_event_id > 0
  1090.       $game_temp.common_event_id = @skill.common_event_id
  1091.       $scene = Scene_Map.new
  1092.     end
  1093.   end
  1094. end
  1095. #==============================================================================
  1096. # ■ Scene_Equip
  1097. #==============================================================================
  1098. class Scene_Equip < Scene_Base
  1099.   #--------------------------------------------------------------------------
  1100.   # ● 开始处理
  1101.   #--------------------------------------------------------------------------
  1102.   def start
  1103.     super
  1104.     create_sub_menu_background
  1105.     @actor = $game_party.members[@actor_index]
  1106.     @help_window = Window_Help.new
  1107.     @help_window.opacity = 0
  1108.     create_item_windows
  1109.     @equip_window = Window_Equip.new(64, 56, @actor)
  1110.     @equip_window.help_window = @help_window
  1111.     @equip_window.index = @equip_index
  1112.     @equip_window.openness = 0
  1113.     @status_window = Window_EquipStatus.new(64, 208, @actor)
  1114.     @status_window.openness = 0
  1115.   end
  1116.   #--------------------------------------------------------------------------
  1117.   # ● 生成物品窗口
  1118.   #--------------------------------------------------------------------------
  1119.   def create_item_windows
  1120.     @item_windows = []
  1121.     for i in 0...EQUIP_TYPE_MAX
  1122.       @item_windows[i] = Window_EquipItem.new(272, 208, 208, 152, @actor, i)
  1123.       @item_windows[i].help_window = @help_window
  1124.       @item_windows[i].visible = (@equip_index == i)
  1125.       @item_windows[i].y = 208
  1126.       @item_windows[i].height = 152
  1127.       @item_windows[i].active = false
  1128.       @item_windows[i].index = -1
  1129.     end
  1130.     @item_windows[@equip_index].openness = 0
  1131.   end
  1132.   #--------------------------------------------------------------------------
  1133.   # ● 开始后处理
  1134.   #--------------------------------------------------------------------------
  1135.   def post_start
  1136.     super
  1137.     open_equip_window
  1138.   end
  1139.   #--------------------------------------------------------------------------
  1140.   # ● 结束前处理
  1141.   #--------------------------------------------------------------------------
  1142.   def pre_terminate
  1143.     super
  1144.     close_equip_window
  1145.   end
  1146.   #--------------------------------------------------------------------------
  1147.   # ● 打开指令窗口
  1148.   #--------------------------------------------------------------------------
  1149.   def open_equip_window
  1150.     @item_windows[@equip_window.index].open
  1151.     @status_window.open
  1152.     @equip_window.open
  1153.     begin
  1154.       @item_windows[@equip_window.index].update
  1155.       @status_window.update
  1156.       @equip_window.update
  1157.       Graphics.update
  1158.     end until @equip_window.openness == 255
  1159.   end
  1160.   #--------------------------------------------------------------------------
  1161.   # ● 关闭指令窗口
  1162.   #--------------------------------------------------------------------------
  1163.   def close_equip_window
  1164.     @item_windows[@equip_window.index].close
  1165.     @status_window.close
  1166.     @equip_window.close
  1167.     begin
  1168.       @item_windows[@equip_window.index].update
  1169.       @status_window.update
  1170.       @equip_window.update
  1171.       Graphics.update
  1172.     end until @equip_window.openness == 0
  1173.   end
  1174. end
  1175. #==============================================================================
  1176. # ■ Scene_Status
  1177. #==============================================================================
  1178. class Scene_Status < Scene_Base
  1179.   #--------------------------------------------------------------------------
  1180.   # ● 开始处理
  1181.   #--------------------------------------------------------------------------
  1182.   def start
  1183.     super
  1184.     create_sub_menu_background
  1185.     @actor = $game_party.members[@actor_index]
  1186.     @status_window = Window_Status.new(@actor)
  1187.     @status_window.openness = 0
  1188.   end
  1189.   #--------------------------------------------------------------------------
  1190.   # ● 开始后处理
  1191.   #--------------------------------------------------------------------------
  1192.   def post_start
  1193.     super
  1194.     open_status_window
  1195.   end
  1196.   #--------------------------------------------------------------------------
  1197.   # ● 结束前处理
  1198.   #--------------------------------------------------------------------------
  1199.   def pre_terminate
  1200.     super
  1201.     close_status_window
  1202.   end
  1203.   #--------------------------------------------------------------------------
  1204.   # ● 打开指令窗口
  1205.   #--------------------------------------------------------------------------
  1206.   def open_status_window
  1207.     @status_window.open
  1208.     begin
  1209.       @status_window.update
  1210.       Graphics.update
  1211.     end until @status_window.openness == 255
  1212.   end
  1213.   #--------------------------------------------------------------------------
  1214.   # ● 关闭指令窗口
  1215.   #--------------------------------------------------------------------------
  1216.   def close_status_window
  1217.     @status_window.close
  1218.     begin
  1219.       @status_window.update
  1220.       Graphics.update
  1221.     end until @status_window.openness == 0
  1222.   end
  1223. end

  1224. #==============================================================================
  1225. # ■ Scene_File
  1226. #------------------------------------------------------------------------------
  1227. #  处理文件的类。
  1228. #==============================================================================
  1229. class Scene_File < Scene_Base
  1230.   #--------------------------------------------------------------------------
  1231.   # ● 初始化对象
  1232.   #     saving     : 存档标志 (false 为载入画面)
  1233.   #     from_title : 调用标题画面的 "继续" 标志
  1234.   #     from_event : 事件的 "调用存档画面" 的调用标志
  1235.   #--------------------------------------------------------------------------
  1236.   def initialize(saving, from_title, from_event)
  1237.     @saving = saving
  1238.     @from_title = from_title
  1239.     @from_event = from_event
  1240.   end
  1241.   #--------------------------------------------------------------------------
  1242.   # ● 开始处理
  1243.   #--------------------------------------------------------------------------
  1244.   def start
  1245.     super
  1246.     @help_window = Window_Help.new
  1247.     unless $game_temp.sub_menu_bitmap.width == 1
  1248.       @help_window.opacity = 0
  1249.       create_sub_menu_background
  1250.     else
  1251.       create_title_graphic
  1252.     end
  1253.     create_command_window
  1254.     if @saving
  1255.       @index = $game_temp.last_file_index
  1256.       @help_window.set_text(Vocab::SaveMessage)
  1257.     else
  1258.       @index = self.latest_file_index
  1259.       @help_window.set_text(Vocab::LoadMessage)
  1260.     end
  1261.     @refresh_index = @command_window.index = @index
  1262.     @item_max = MAX_SAVE_ID
  1263.     create_savefile_window
  1264.     @savefile_window.openness = 0
  1265.   end
  1266.   #--------------------------------------------------------------------------
  1267.   # ● 结束处理
  1268.   #--------------------------------------------------------------------------
  1269.   def terminate
  1270.     super
  1271.     dispose_menu_background
  1272.     @help_window.dispose
  1273.     dispose_item_windows
  1274.   end
  1275.   #--------------------------------------------------------------------------
  1276.   # ● 还原至原先的画面
  1277.   #--------------------------------------------------------------------------
  1278.   def return_scene
  1279.     if @from_title
  1280.       $scene = Scene_Title.new
  1281.     elsif @from_event
  1282.       $scene = Scene_Map.new
  1283.     else
  1284.       $scene = Scene_Menu.new(4)
  1285.     end
  1286.   end
  1287.   #--------------------------------------------------------------------------
  1288.   # ● 更新画面
  1289.   #--------------------------------------------------------------------------
  1290.   def update
  1291.     super
  1292.     update_menu_background
  1293.     @help_window.update
  1294.     update_savefile_windows
  1295.     update_savefile_selection
  1296.   end
  1297.   #--------------------------------------------------------------------------
  1298.   # ● 开始后处理
  1299.   #--------------------------------------------------------------------------
  1300.   def post_start
  1301.     super
  1302.     open_savefile_window
  1303.   end
  1304.   #--------------------------------------------------------------------------
  1305.   # ● 结束前处理
  1306.   #--------------------------------------------------------------------------
  1307.   def pre_terminate
  1308.     super
  1309.     close_savefile_window
  1310.   end
  1311.   #--------------------------------------------------------------------------
  1312.   # ● 生成标题画面背景
  1313.   #--------------------------------------------------------------------------
  1314.   def create_title_graphic
  1315.     @menuback_sprite = Sprite.new
  1316.     @menuback_sprite.bitmap = Cache.system("Title")
  1317.   end
  1318.   #--------------------------------------------------------------------------
  1319.   # ● 生成存档文件列表窗口
  1320.   #--------------------------------------------------------------------------
  1321.   def create_command_window
  1322.     file_names = []
  1323.     for i in 0...MAX_SAVE_ID
  1324.       id = sprintf("%02d", i+1)
  1325.       file_names.push(Vocab::File + "\s" + id)
  1326.     end
  1327.     @command_window = Window_Command.new(112, file_names)
  1328.     @command_window.height = 298
  1329.     @command_window.x = 64
  1330.     @command_window.y = 59
  1331.     @command_window.openness = 0
  1332.   end
  1333.   #--------------------------------------------------------------------------
  1334.   # ● 生成存档文件窗口
  1335.   #--------------------------------------------------------------------------
  1336.   def create_savefile_window
  1337.     @savefile_window = Window_SaveFile.new(@command_window.index, make_filename(@command_window.index))
  1338.   end
  1339.   #--------------------------------------------------------------------------
  1340.   # ● 释放存档文件
  1341.   #--------------------------------------------------------------------------
  1342.   def dispose_item_windows
  1343.     @command_window.dispose
  1344.     @savefile_window.dispose
  1345.   end
  1346.   #--------------------------------------------------------------------------
  1347.   # ● 打开指令窗口
  1348.   #--------------------------------------------------------------------------
  1349.   def open_savefile_window
  1350.     @command_window.open
  1351.     @savefile_window.open
  1352.     begin
  1353.       @command_window.update
  1354.       @savefile_window.update
  1355.       Graphics.update
  1356.     end until @savefile_window.openness == 255
  1357.   end
  1358.   #--------------------------------------------------------------------------
  1359.   # ● 关闭指令窗口
  1360.   #--------------------------------------------------------------------------
  1361.   def close_savefile_window
  1362.     @command_window.close
  1363.     @savefile_window.close
  1364.     begin
  1365.       @command_window.update
  1366.       @savefile_window.update
  1367.       Graphics.update
  1368.     end until @savefile_window.openness == 0
  1369.   end
  1370.   #--------------------------------------------------------------------------
  1371.   # ● 更新存档文件窗口
  1372.   #--------------------------------------------------------------------------
  1373.   def update_savefile_windows
  1374.     @command_window.update
  1375.     @savefile_window.update
  1376.   end
  1377.   #--------------------------------------------------------------------------
  1378.   # ● 更新存档文件选择
  1379.   #--------------------------------------------------------------------------
  1380.   def update_savefile_selection
  1381.     if Input.trigger?(Input::C)
  1382.       determine_savefile
  1383.     end
  1384.     if Input.trigger?(Input::B)
  1385.       Sound.play_cancel
  1386.       return_scene
  1387.     end
  1388.     if @refresh_index != @command_window.index
  1389.       @refresh_index = @command_window.index
  1390.       @savefile_window.dispose
  1391.       create_savefile_window
  1392.       end
  1393.   end
  1394.   #--------------------------------------------------------------------------
  1395.   # ● 确定存档文件
  1396.   #--------------------------------------------------------------------------
  1397.   def determine_savefile
  1398.     if @saving
  1399.       Sound.play_save
  1400.       do_save
  1401.     else
  1402.       if @savefile_window.file_exist
  1403.         Sound.play_load
  1404.         do_load
  1405.       else
  1406.         Sound.play_buzzer
  1407.         return
  1408.       end
  1409.     end
  1410.     $game_temp.last_file_index = @index
  1411.   end
  1412.   #--------------------------------------------------------------------------
  1413.   # ● 生成文件名
  1414.   #     file_index : 存档文件索引 (0~3)
  1415.   #--------------------------------------------------------------------------
  1416.   def make_filename(file_index)
  1417.     return "Save#{file_index + 1}.rvdata"
  1418.   end
  1419.   #--------------------------------------------------------------------------
  1420.   # ● 按时间戳选择最新的文件
  1421.   #--------------------------------------------------------------------------
  1422.   def latest_file_index
  1423.     index = 0
  1424.     latest_time = Time.at(0) # 时间戳
  1425.     for i in 0...MAX_SAVE_ID
  1426.       file_name = make_filename(i)
  1427.       if FileTest.exist?(SAVE_DIR + file_name)
  1428.         file = File.open(SAVE_DIR + file_name, "r")
  1429.         if file.mtime > latest_time
  1430.           latest_time = file.mtime
  1431.           index = i
  1432.         end
  1433.       end
  1434.     end
  1435.     return index
  1436.   end
  1437.   #--------------------------------------------------------------------------
  1438.   # ● 执行存档
  1439.   #--------------------------------------------------------------------------
  1440.   def do_save
  1441.     file_name = make_filename(@command_window.index)
  1442.     $game_temp.save_bitmap.make_png(file_name.split(/\./)[0], SAVE_DIR)
  1443.     file = File.open(SAVE_DIR + file_name, "wb")
  1444.     write_save_data(file)
  1445.     file.close
  1446.     return_scene
  1447.   end
  1448.   #--------------------------------------------------------------------------
  1449.   # ● 执行载入
  1450.   #--------------------------------------------------------------------------
  1451.   def do_load
  1452.     file_name = make_filename(@command_window.index)
  1453.     file = File.open(SAVE_DIR + file_name, "rb")
  1454.     read_save_data(file)
  1455.     file.close
  1456.     $scene = Scene_Map.new
  1457.     RPG::BGM.fade(1500)
  1458.     Graphics.fadeout(60)
  1459.     Graphics.wait(40)
  1460.     @last_bgm.play
  1461.     @last_bgs.play
  1462.   end
  1463. end
  1464. #==============================================================================
  1465. #               本脚本出自[url=http://www.66rpg.com]www.66rpg.com[/url],转载请注明。
  1466. #==============================================================================
  1467. #                        Bitmap to PNG By 轮回者
  1468. #==============================================================================
  1469. # 对Bitmap对象直接使用
  1470. # bitmap_obj.make_png(name[, path])
  1471. # name:保存文件名
  1472. # path:保存路径
  1473. # 感谢66、夏娜、金圭子的提醒和帮助!
  1474. #==============================================================================
  1475. module Zlib
  1476.   class Png_File < GzipWriter
  1477.     #--------------------------------------------------------------------------
  1478.     # ● 主处理
  1479.     #--------------------------------------------------------------------------
  1480.     def make_png(bitmap_Fx)
  1481.       @bitmap_Fx = bitmap_Fx
  1482.       self.write(make_header)
  1483.       self.write(make_ihdr)
  1484.       self.write(make_idat)
  1485.       self.write(make_iend)
  1486.     end
  1487.     #--------------------------------------------------------------------------
  1488.     # ● PNG文件头数据块
  1489.     #--------------------------------------------------------------------------
  1490.     def make_header
  1491.       return [0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a].pack("C*")
  1492.     end
  1493.     #--------------------------------------------------------------------------
  1494.     # ● PNG文件情报头数据块(IHDR)
  1495.     #--------------------------------------------------------------------------
  1496.     def make_ihdr
  1497.       ih_size = [13].pack("N")
  1498.       ih_sign = "IHDR"
  1499.       ih_width = [@bitmap_Fx.width].pack("N")
  1500.       ih_height = [@bitmap_Fx.height].pack("N")
  1501.       ih_bit_depth = [8].pack("C")
  1502.       ih_color_type = [6].pack("C")
  1503.       ih_compression_method = [0].pack("C")
  1504.       ih_filter_method = [0].pack("C")
  1505.       ih_interlace_method = [0].pack("C")
  1506.       string = ih_sign + ih_width + ih_height + ih_bit_depth + ih_color_type +
  1507.                ih_compression_method + ih_filter_method + ih_interlace_method
  1508.       ih_crc = [Zlib.crc32(string)].pack("N")
  1509.       return ih_size + string + ih_crc
  1510.     end
  1511.     #--------------------------------------------------------------------------
  1512.     # ● 生成图像数据(IDAT)
  1513.     #--------------------------------------------------------------------------
  1514.     def make_idat
  1515.       header = "\x49\x44\x41\x54"
  1516.       data = make_bitmap_data
  1517.       data = Zlib::Deflate.deflate(data, 8)
  1518.       crc = [Zlib.crc32(header + data)].pack("N")
  1519.       size = [data.length].pack("N")
  1520.       return size + header + data + crc
  1521.     end
  1522.     #--------------------------------------------------------------------------
  1523.     # ● 从Bitmap对象中生成图像数据 mode
  1524.     #--------------------------------------------------------------------------
  1525.     def make_bitmap_data
  1526.       gz = Zlib::GzipWriter.open('hoge.gz')
  1527.       t_Fx = 0
  1528.       w = @bitmap_Fx.width
  1529.       h = @bitmap_Fx.height
  1530.       data = []
  1531.       for y in 0...h
  1532.         data.push(0)
  1533.         for x in 0...w
  1534.           t_Fx += 1
  1535.           if t_Fx % 10000 == 0
  1536.             Graphics.update
  1537.           end
  1538.           if t_Fx % 100000 == 0
  1539.             s = data.pack("C*")
  1540.             gz.write(s)
  1541.             data.clear
  1542.           end
  1543.           color = @bitmap_Fx.get_pixel(x, y)
  1544.           red = color.red
  1545.           green = color.green
  1546.           blue = color.blue
  1547.           alpha = color.alpha
  1548.           data.push(red)
  1549.           data.push(green)
  1550.           data.push(blue)
  1551.           data.push(alpha)
  1552.         end
  1553.       end
  1554.       s = data.pack("C*")
  1555.       gz.write(s)
  1556.       gz.close   
  1557.       data.clear
  1558.       gz = Zlib::GzipReader.open('hoge.gz')
  1559.       data = gz.read
  1560.       gz.close
  1561.       File.delete('hoge.gz')
  1562.       return data
  1563.     end
  1564.     #--------------------------------------------------------------------------
  1565.     # ● PNG文件尾数据块(IEND)
  1566.     #--------------------------------------------------------------------------
  1567.     def make_iend
  1568.       ie_size = [0].pack("N")
  1569.       ie_sign = "IEND"
  1570.       ie_crc = [Zlib.crc32(ie_sign)].pack("N")
  1571.       return ie_size + ie_sign + ie_crc
  1572.     end
  1573.   end
  1574. end

  1575. #==============================================================================
  1576. # ■ Bitmap
  1577. #------------------------------------------------------------------------------
  1578. #  关联到Bitmap。
  1579. #==============================================================================
  1580. class Bitmap
  1581.   #--------------------------------------------------------------------------
  1582.   # ● 关联
  1583.   #--------------------------------------------------------------------------
  1584.   def make_png(name="like", path="",mode=0)
  1585.     make_dir(path) if path != ""
  1586.     Zlib::Png_File.open("temp.gz") {|gz|
  1587.       gz.make_png(self)
  1588.     }
  1589.     Zlib::GzipReader.open("temp.gz") {|gz|
  1590.       $read = gz.read
  1591.     }
  1592.     f = File.open(path + name + ".png","wb")
  1593.     f.write($read)
  1594.     f.close
  1595.     File.delete('temp.gz')
  1596.     end
  1597.   #--------------------------------------------------------------------------
  1598.   # ● 生成保存路径
  1599.   #--------------------------------------------------------------------------
  1600.   def make_dir(path)
  1601.     dir = path.split("/")
  1602.     for i in 0...dir.size
  1603.       unless dir == "."
  1604.         add_dir = dir[0..i].join("/")
  1605.         begin
  1606.           Dir.mkdir(add_dir)
  1607.         rescue
  1608.         end
  1609.       end
  1610.     end
  1611.   end
  1612. end
复制代码



因為不知道要調哪邊,所以就全貼上來了



梦石
0
星屑
663
在线时间
750 小时
注册时间
2012-11-10
回帖
903
发表于 2012-12-30 16:10:24 | 显示全部楼层
改了大小的话可能就要把X,Y轴高度什么的给重新改了吧?

评分

参与人数 1星屑 +30 收起 理由
咕噜 + 30 我很赞同

查看全部评分

有本事就来阻止我啊,主体单元『天照』!
回复

使用道具 举报

梦石
0
星屑
97
在线时间
2462 小时
注册时间
2011-12-18
回帖
1419
发表于 2012-12-30 17:07:19 | 显示全部楼层
将窗口填满的话,会有很多地方留空,不美观的。
不过如果你确实想这么改的话,把范例发上来吧,我帮你改一下
这是一个深不见底的坑,这是一个广袤无边的坑,我才刚刚放上了一抔泥土……

《六道·陈国篇》开坑了……↓点我
回复

使用道具 举报

梦石
0
星屑
50
在线时间
24 小时
注册时间
2012-10-27
回帖
7
 楼主| 发表于 2012-12-30 19:46:49 | 显示全部楼层
结城照美 发表于 2012-12-30 16:10
改了大小的话可能就要把X,Y轴高度什么的给重新改了吧?

是啊.我就是找X.Y來改.可是還是有些地方不大對
數字的地方我也不敢亂改.因為我怕腳本會出現錯誤
回复

使用道具 举报

梦石
0
星屑
50
在线时间
24 小时
注册时间
2012-10-27
回帖
7
 楼主| 发表于 2012-12-30 19:49:39 | 显示全部楼层
a364774426 发表于 2012-12-30 17:07
将窗口填满的话,会有很多地方留空,不美观的。
不过如果你确实想这么改的话,把范例发上来吧,我帮你改一 ...

腳本貼在上面了
範本..是指我的專案擋嗎?↓
Project1.rar (865.36 KB, 下载次数: 48)

還是沉影不器大大的腳本專案擋?
回复

使用道具 举报

梦石
0
星屑
97
在线时间
2462 小时
注册时间
2011-12-18
回帖
1419
发表于 2012-12-30 20:06:23 | 显示全部楼层
我发觉窗口填满整个界面不美观,你真的确定吗?
这是一个深不见底的坑,这是一个广袤无边的坑,我才刚刚放上了一抔泥土……

《六道·陈国篇》开坑了……↓点我
回复

使用道具 举报

梦石
0
星屑
50
在线时间
24 小时
注册时间
2012-10-27
回帖
7
 楼主| 发表于 2012-12-30 20:18:50 | 显示全部楼层
a364774426 发表于 2012-12-30 20:06
我发觉窗口填满整个界面不美观,你真的确定吗?

因為靠左上角也不好看呀
所以才會希望符合一下640X480的規格
恩.還是拜託你了{:2_249:}
回复

使用道具 举报

梦石
0
星屑
97
在线时间
2462 小时
注册时间
2011-12-18
回帖
1419
发表于 2012-12-30 20:53:59 | 显示全部楼层
既然你坚持,如你所愿。界面已经被填满了。
Project1.rar (865.23 KB, 下载次数: 56)

评分

参与人数 1星屑 +120 收起 理由
咕噜 + 120 精品文章

查看全部评分

这是一个深不见底的坑,这是一个广袤无边的坑,我才刚刚放上了一抔泥土……

《六道·陈国篇》开坑了……↓点我
回复

使用道具 举报

梦石
0
星屑
50
在线时间
24 小时
注册时间
2012-10-27
回帖
7
 楼主| 发表于 2012-12-31 10:33:19 | 显示全部楼层
a364774426 发表于 2012-12-30 20:53
既然你坚持,如你所愿。界面已经被填满了。

太謝謝謝妳了!!!{:2_267:}
真是辛苦你了,也幫我用好去掉存檔的部分了
不過我想問一下
存檔截圖大小有辦法修到填滿嗎?
1.PNG
&
框框部分是...??
2.PNG
真是謝謝你

点评

会不会是繁体系统识别不了简体什么的?  发表于 2012-12-31 12:52
回复

使用道具 举报

梦石
0
星屑
50
在线时间
24 小时
注册时间
2012-10-27
回帖
7
 楼主| 发表于 2012-12-31 13:05:49 | 显示全部楼层
可是不管我用ntlea開簡體、日文都一樣有那個框框
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部