Project1

标题: 战斗前总是先出现菜单页面的背景图案??? [打印本页]

作者: 狼人弟弟    时间: 2016-6-20 11:41
标题: 战斗前总是先出现菜单页面的背景图案???
如题,我在主菜单页面添加了背景UI,但不知什么原因,在战斗开始时总会先出现这张UI背景图,然后才进入战斗流程。
所以在此想请教下有没有人知道这是什么原因?

具体脚本贴在下面(请各位高手不吝赐教){:2_284:} :
RUBY 代码复制
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Scene_Menu
  4. #------------------------------------------------------------------------------
  5. #  菜单画面
  6. #==============================================================================
  7.  
  8. class Scene_Menu < Scene_MenuBase
  9.   #--------------------------------------------------------------------------
  10.   # ● 开始处理
  11.   #--------------------------------------------------------------------------
  12.   def start
  13.     super
  14.     create_command_window
  15.     create_gold_window
  16.     create_status_window
  17.     create_item_bg
  18.   end
  19.   #--------------------------------------------------------------------------
  20.   # ☆ 生背景图形
  21.   #--------------------------------------------------------------------------
  22.   def create_item_bg
  23.     @menuback_sprite = Sprite.new
  24.     @menuback_sprite.bitmap = Cache.system("男主_back")
  25.   end
  26.   #--------------------------------------------------------------------------
  27.   # ● 生成指令窗口
  28.   #--------------------------------------------------------------------------
  29.   def create_command_window
  30.     @command_window = Window_MenuCommand.new
  31.     @command_window.set_handler(:item,      method(:command_item))
  32.     @command_window.set_handler(:skill,     method(:command_skill))
  33.     @command_window.set_handler(:equip,     method(:command_equip))
  34.     @command_window.set_handler(:status,    method(:command_status))
  35. #    @command_window.set_handler(:formation, method(:command_formation))
  36.     @command_window.set_handler(:save,      method(:command_save))
  37.     @command_window.set_handler(:game_end,  method(:command_game_end))
  38.     @command_window.set_handler(:cancel,    method(:return_scene))
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● 生成金钱窗口
  42.   #--------------------------------------------------------------------------
  43.   def create_gold_window
  44.     @gold_window = Window_Gold.new
  45.     @gold_window.x = 42
  46.     @gold_window.y = Graphics.height - @gold_window.height - 312
  47.     @gold_window.opacity = 0
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ● 生成状态窗口
  51.   #--------------------------------------------------------------------------
  52.   def create_status_window
  53.     @status_window = Window_MenuStatus.new(160,0)#@command_window.y, 0)
  54.     @status_window.opacity = 0
  55.     @command_window.x = 40      #主页选项框X
  56.     @command_window.y = 180      #主页选项框Y
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 指令“物品”
  60.   #--------------------------------------------------------------------------
  61.   def command_item
  62.     SceneManager.call(Scene_Item)
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● 指令“技能”
  66.   #--------------------------------------------------------------------------
  67.   def command_skill
  68.     SceneManager.call(Scene_Skill)
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 指令“装备”
  72.   #--------------------------------------------------------------------------
  73.   def command_equip
  74.     SceneManager.call(Scene_Equip)
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 指令“状态”
  78.   #--------------------------------------------------------------------------
  79.   def command_status
  80.     SceneManager.call(Scene_Status)
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 指令“技能”“装备”“状态”
  84.   #--------------------------------------------------------------------------
  85. # def command_personal
  86. #   @status_window.select_last
  87. #   @status_window.activate
  88.   #  @status_window.set_handler(:ok,     method(:on_personal_ok))
  89. #   @status_window.set_handler(:cancel, method(:on_personal_cancel))
  90. # end
  91.   #--------------------------------------------------------------------------
  92.   # ● 指令“整队”
  93.   #--------------------------------------------------------------------------
  94. # def command_formation
  95. #   @status_window.select_last
  96. #   @status_window.activate
  97. #   @status_window.set_handler(:ok,     method(:on_formation_ok))
  98. #   @status_window.set_handler(:cancel, method(:on_formation_cancel))
  99. # end
  100.   #--------------------------------------------------------------------------
  101.   # ● 指令“存档”
  102.   #--------------------------------------------------------------------------
  103.   def command_save
  104.     SceneManager.call(Scene_Save)
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 指令“结束游戏”
  108.   #--------------------------------------------------------------------------
  109.   def command_game_end
  110.     SceneManager.call(Scene_End)
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ● 个人指令“确定”
  114.   #--------------------------------------------------------------------------
  115.   def on_personal_ok
  116.     case @command_window.current_symbol
  117.     when :skill
  118.       SceneManager.call(Scene_Skill)
  119.     when :equip
  120.       SceneManager.call(Scene_Equip)
  121.    when :status
  122.       SceneManager.call(Scene_Status)
  123.     end
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● 个人指令“取消”
  127.   #--------------------------------------------------------------------------
  128.   def on_personal_cancel
  129.     @status_window.unselect
  130.     @command_window.activate
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ☆ 刷新
  134.   #--------------------------------------------------------------------------
  135.   def update
  136.     if @command_window.x <= 0
  137.        @command_window.x += 2
  138.     end
  139.     super
  140.   end
  141.   #GSR 1.5
  142.   alias gsr_terminate terminate
  143.   def terminate
  144.       super
  145.       $menuback_sprite.dispose if $menuback_sprite
  146.   end
  147. end
  148.  
  149.   #--------------------------------------------------------------------------
  150.   # ● 整队“确定”
  151.   #--------------------------------------------------------------------------
  152. # def on_formation_ok
  153. #   if @status_window.pending_index >= 0
  154. #     $game_party.swap_order(@status_window.index,
  155. #                            @status_window.pending_index)
  156.   #    @status_window.pending_index = -1
  157.   #    @status_window.redraw_item(@status_window.index)
  158.   #  else
  159.   #    @status_window.pending_index = @status_window.index
  160. #   end
  161.   #  @status_window.activate
  162. # end
  163.   #--------------------------------------------------------------------------
  164.   # ● 整队“取消”
  165.   #--------------------------------------------------------------------------
  166. #  def on_formation_cancel
  167. #   if @status_window.pending_index >= 0
  168. #     @status_window.pending_index = -1
  169.   #    @status_window.activate
  170.   #  else
  171. #     @status_window.unselect
  172. #     @command_window.activate
  173. #   end
  174. # end
  175. #end

作者: 喵呜喵5    时间: 2016-6-24 09:21
释放的时候要释放的是 @menuback_sprite
不是 $menuback_sprite
作者: 狼人弟弟    时间: 2016-6-24 17:18
喵呜喵5 发表于 2016-6-24 09:21
释放的时候要释放的是 @menuback_sprite
不是 $menuback_sprite

哈哈,完美解决,谢谢大大啦!!!




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