查看: 3201|回复: 4

[已经过期] 关于RGSS3窗口消除的问题

[复制链接]
梦石
0
星屑
235
在线时间
78 小时
注册时间
2010-7-1
回帖
46
发表于 2012-7-11 12:06:44 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 abc1236762 于 2012-7-11 12:12 编辑

要如何在选择装备、技能选项时或取消选择技能、装备选项时消除Window_MenuStutasBody窗口?

[pre lang="ruby" line="1"]#encoding:utf-8
#==============================================================================
# ■ Cache
#------------------------------------------------------------------------------
#  此模块加载所有图像,建立并储存 Bitmap 对象。为加快加载速度并节省内存,
#  此模块将以建立的 bitmap 对象储存在内定哈希表中,使得程序在需要已存在
#  的图像时能快速读取 bitmap 对象。
#==============================================================================
module Cache
  #--------------------------------------------------------------------------
  # ● 取得角色全身像图
  #--------------------------------------------------------------------------
  def self.body(filename)
    load_bitmap("Graphics/Bodies/", filename)
  end
end

#encoding:utf-8
#==============================================================================
# ■ Window_MenuStutasBody
#------------------------------------------------------------------------------
#  选单画面中,显示队伍成员全身像的窗口
#==============================================================================

class Window_MenuStutasBody < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化物件
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(x, y, windows_width, windows_height)
    @actor = actor
    @graphic = Sprite.new(self.viewport)
    @graphic.x = 960
    @graphic.y = 544
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 取得窗口的坐标与大小
  #--------------------------------------------------------------------------
  def x
    return 0 - standard_padding
  end
  def y
    return 0 - standard_padding
  end
  def windows_width
    return Graphics.width + standard_padding * 2
  end
  def windows_height
    return Graphics.height + standard_padding * 2
  end
  #--------------------------------------------------------------------------
  # ● 设定角色
  #--------------------------------------------------------------------------
  def actor=(actor)
    return if @actor == actor
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    @graphic.dispose
    super
  end
  #--------------------------------------------------------------------------
  # ● 显示
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    name = "Character" + @actor.id.to_s
    begin
      @graphic.bitmap = Cache.body(name)
      @graphic.ox = @graphic.bitmap.width
      @graphic.oy = @graphic.bitmap.height
    rescue
    end
  end
end

#encoding:utf-8
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
#  选单画面
#==============================================================================

class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  def start
    super
    create_command_window
    create_information_window
    create_status_window
  end
  #--------------------------------------------------------------------------
  # ● 生成指令窗口
  #--------------------------------------------------------------------------
  def create_command_window
    @command_window = Window_MenuCommand.new
    @command_window.y = 2
    @command_window.opacity = 0
    @command_window.set_handler(:item,      method(:command_item))
    @command_window.set_handler(:skill,     method(:command_personal))
    @command_window.set_handler(:equip,     method(:command_personal))
    @command_window.set_handler(:status,    method(:command_personal))
    @command_window.set_handler(:formation, method(:command_formation))
    @command_window.set_handler(:save,      method(:command_save))
    @command_window.set_handler(:game_end,  method(:command_game_end))
    @command_window.set_handler(:cancel,    method(:return_scene))
  end
  #--------------------------------------------------------------------------
  # ● 切换角色
  #--------------------------------------------------------------------------
  def on_actor_change
    @menustutasbody_window.actor = @actor
    @menustutasbody_window.activate
  end
  #--------------------------------------------------------------------------
  # ● 生成游戏信息窗口
  #--------------------------------------------------------------------------
  def create_information_window #
    @gold_window = Window_Information.new
    @gold_window.x = 0
    @gold_window.y = Graphics.height - @gold_window.height - 2
    @gold_window.opacity = 0
  end #
  #--------------------------------------------------------------------------
  # ● 生成状态窗口
  #--------------------------------------------------------------------------
  def create_status_window
    @status_window = Window_MenuStatus.new(0, @command_window.height - 2 + 2)
    @status_window.opacity = 0
  end
  #--------------------------------------------------------------------------
  # ● 指令“物品”
  #--------------------------------------------------------------------------
  def command_item
    SceneManager.call(Scene_Item)
  end
  #--------------------------------------------------------------------------
  # ● 指令“技能”“装备”“状态”
  #--------------------------------------------------------------------------
  def command_personal
    @status_window.select_last
    @menustutasbody_window = Window_MenuStutasBody.new(@actor)
    @menustutasbody_window.opacity = 0
    @status_window.activate
    @menustutasbody_window.activate
    @status_window.set_handler(:ok,     method(:on_personal_ok))
    @status_window.set_handler(:cancel, method(:on_personal_cancel))
  end
  #--------------------------------------------------------------------------
  # ● 指令“整队”
  #--------------------------------------------------------------------------
  def command_formation
    @status_window.select_last
    @status_window.activate
    @status_window.set_handler(:ok,     method(:on_formation_ok))
    @status_window.set_handler(:cancel, method(:on_formation_cancel))
  end
  #--------------------------------------------------------------------------
  # ● 指令“存盘”
  #--------------------------------------------------------------------------
  def command_save
    SceneManager.call(Scene_Save)
  end
  #--------------------------------------------------------------------------
  # ● 指令“结束游戏”
  #--------------------------------------------------------------------------
  def command_game_end
    SceneManager.call(Scene_End)
  end
  #--------------------------------------------------------------------------
  # ● 个人指令“确定”
  #--------------------------------------------------------------------------
  def on_personal_ok
    case @command_window.current_symbol
    when :skill
      SceneManager.call(Scene_Skill)
    when :equip
      SceneManager.call(Scene_Equip)
    when :status
      SceneManager.call(Scene_Status)
    end
  end
  #--------------------------------------------------------------------------
  # ● 个人指令“取消”
  #--------------------------------------------------------------------------
  def on_personal_cancel
    @status_window.unselect
    @command_window.activate
  end
  #--------------------------------------------------------------------------
  # ● 整队“确定”
  #--------------------------------------------------------------------------
  def on_formation_ok
    if @status_window.pending_index >= 0
      $game_party.swap_order(@status_window.index,
                             @status_window.pending_index)
      @status_window.pending_index = -1
      @status_window.redraw_item(@status_window.index)
    else
      @status_window.pending_index = @status_window.index
    end
    @status_window.activate
  end
  #--------------------------------------------------------------------------
  # ● 整队“取消”
  #--------------------------------------------------------------------------
  def on_formation_cancel
    if @status_window.pending_index >= 0
      @status_window.pending_index = -1
      @status_window.activate
    else
      @status_window.unselect
      @command_window.activate
    end
  end
end[/pre]

http://115.com/file/an81fpn0#
Project2 .rar
梦石
0
星屑
2306
在线时间
1010 小时
注册时间
2012-4-30
回帖
1455

开拓者

发表于 2012-7-11 14:04:19 | 显示全部楼层
本帖最后由 铅笔描绘的思念 于 2012-7-11 16:41 编辑

@menustutasbody_window.dispose
回复

使用道具 举报

梦石
0
星屑
235
在线时间
78 小时
注册时间
2010-7-1
回帖
46
 楼主| 发表于 2012-7-11 14:39:02 | 显示全部楼层
补了你的代码
[pre lang="ruby" line="117"]  #--------------------------------------------------------------------------
  # ● 个人指令“确定”
  #--------------------------------------------------------------------------
  def on_personal_ok
    @menustutasbody_window.hide
    case @command_window.current_symbol
    when :skill
      SceneManager.call(Scene_Skill)
    when :equip
      SceneManager.call(Scene_Equip)
    when :status
      SceneManager.call(Scene_Status)
    end
  end
  #--------------------------------------------------------------------------
  # ● 个人指令“取消”
  #--------------------------------------------------------------------------
  def on_personal_cancel
    @menustutasbody_window.hide
    @status_window.unselect
    @command_window.activate
  end
[/pre]

还是有以下几点问题
1.        用方向键切换至别的角色时,全身像不会更新。
擷取2.PNG
2.        按esc重选择角色退回选单时,全身像还在。
擷取3.PNG
3.        进到技能画面在退出时出现错误。
擷取4.PNG
回复

使用道具 举报

梦石
0
星屑
2306
在线时间
1010 小时
注册时间
2012-4-30
回帖
1455

开拓者

发表于 2012-7-11 17:03:04 | 显示全部楼层
abc1236762 发表于 2012-7-11 14:39
补了你的代码
  #--------------------------------------------------------------------------
  # ● 个 ...

不会更新的话。。。我木有办法。。找别人吧。。b= =。。其他两个比较容易。。替换Scene_Menu
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Scene_Menu
  4. #------------------------------------------------------------------------------
  5. #  選單畫面
  6. #==============================================================================

  7. class Scene_Menu < Scene_MenuBase
  8.   #-------------------------------------------------------------------------- #
  9.   # ● 開始處理 #
  10.   #-------------------------------------------------------------------------- #
  11.   def start #
  12.     super #
  13.     create_command_window #
  14.     create_information_window #
  15.     create_status_window #
  16.   end #
  17.   #--------------------------------------------------------------------------
  18.   # ● 生成指令視窗
  19.   #--------------------------------------------------------------------------
  20.   def create_command_window
  21.     @command_window = Window_MenuCommand.new
  22.     @command_window.y = 2 #
  23.     @command_window.opacity = 0 #
  24.     @command_window.set_handler(:item,      method(:command_item))
  25.     @command_window.set_handler(:skill,     method(:command_personal))
  26.     @command_window.set_handler(:equip,     method(:command_personal))
  27.     @command_window.set_handler(:status,    method(:command_personal))
  28.     @command_window.set_handler(:formation, method(:command_formation))
  29.     @command_window.set_handler(:save,      method(:command_save))
  30.     @command_window.set_handler(:game_end,  method(:command_game_end))
  31.     @command_window.set_handler(:cancel,    method(:return_scene))
  32.   end
  33.   #-------------------------------------------------------------------------- #
  34.   # ● 生成遊戲資訊視窗 #
  35.   #-------------------------------------------------------------------------- #
  36.   def create_information_window #
  37.     @gold_window = Window_Information.new #
  38.     @gold_window.x = 0 #
  39.     @gold_window.y = Graphics.height - @gold_window.height - 2 #
  40.     @gold_window.opacity = 0 #
  41.   end #
  42.   #--------------------------------------------------------------------------
  43.   # ● 生成狀態視窗
  44.   #--------------------------------------------------------------------------
  45.   def create_status_window
  46.     @status_window = Window_MenuStatus.new(0, @command_window.height - 2 + 2) #@status_window = Window_MenuStatus.new(@command_window.width, 0)
  47.     @status_window.opacity = 0 #
  48.   end  
  49.   #--------------------------------------------------------------------------
  50.   # ● 生成body視窗 @menustutasbody_window.refresh
  51.   #--------------------------------------------------------------------------
  52.   def create_bodystatus_window
  53.     @menustutasbody_window = Window_MenuStutasBody.new(@actor)
  54.     @menustutasbody_window.opacity = 0
  55.   end  
  56.   #--------------------------------------------------------------------------
  57.   # ● 指令“物品”
  58.   #--------------------------------------------------------------------------
  59.   def command_item
  60.     SceneManager.call(Scene_Item)
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 指令“技能”“裝備”“狀態”
  64.   #--------------------------------------------------------------------------
  65.   def command_personal
  66.     @status_window.select_last
  67.     @status_window.activate
  68.     create_bodystatus_window #
  69.     @status_window.set_handler(:ok,     method(:on_personal_ok))
  70.     @status_window.set_handler(:cancel, method(:on_personal_cancel))
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 指令“整隊”
  74.   #--------------------------------------------------------------------------
  75.   def command_formation
  76.     @status_window.select_last
  77.     @status_window.activate
  78.     @status_window.set_handler(:ok,     method(:on_formation_ok))
  79.     @status_window.set_handler(:cancel, method(:on_formation_cancel))
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 指令“存檔”
  83.   #--------------------------------------------------------------------------
  84.   def command_save
  85.     SceneManager.call(Scene_Save)
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 指令“結束游戲”
  89.   #--------------------------------------------------------------------------
  90.   def command_game_end
  91.     SceneManager.call(Scene_End)
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 個人指令“確定”
  95.   #--------------------------------------------------------------------------
  96.   def on_personal_ok
  97.     case @command_window.current_symbol
  98.     when :skill
  99.       SceneManager.call(Scene_Skill)
  100.     when :equip
  101.       SceneManager.call(Scene_Equip)
  102.     when :status
  103.       SceneManager.call(Scene_Status)
  104.     end
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 個人指令“取消”
  108.   #--------------------------------------------------------------------------
  109.   def on_personal_cancel
  110.     @status_window.unselect
  111.     @command_window.activate
  112.     @menustutasbody_window.dispose
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 整隊“確定”
  116.   #--------------------------------------------------------------------------
  117.   def on_formation_ok
  118.     if @status_window.pending_index >= 0
  119.       $game_party.swap_order(@status_window.index,
  120.                              @status_window.pending_index)
  121.       @status_window.pending_index = -1
  122.       @status_window.redraw_item(@status_window.index)
  123.     else
  124.       @status_window.pending_index = @status_window.index
  125.     end
  126.     @status_window.activate
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ● 整隊“取消”
  130.   #--------------------------------------------------------------------------
  131.   def on_formation_cancel
  132.     if @status_window.pending_index >= 0
  133.       @status_window.pending_index = -1
  134.       @status_window.activate
  135.     else
  136.       @status_window.unselect
  137.       @command_window.activate
  138.     end
  139.   end
  140. end
复制代码
回复

使用道具 举报

梦石
0
星屑
235
在线时间
78 小时
注册时间
2010-7-1
回帖
46
 楼主| 发表于 2012-7-11 18:26:47 | 显示全部楼层
出现
Script '◎Windows_Base' line 84:RGSSError occurred
disposed window
这错误窗口
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部