本帖最后由 345912390 于 2014-11-4 21:47 编辑
RM无节操小分队 发表于 2014-11-4 19:13
我是新手哦,不会搞,能给个例子吗?告诉我怎样的命令能实现这效果
在默认工程里加入以下脚本class Scene_Equip < Scene_MenuBase #-------------------------------------------------------------------------- # ● 生成物品視窗 #-------------------------------------------------------------------------- alias create_item_window_A create_item_window#alias 语法自己看帮助 def create_item_window wx = @status_window.width wy = @command_window.y + @command_window.height ww = Graphics.width - @status_window.width wh = @slot_window.height #wx,wy,ww,wh为描绘窗口大小,下面是默认的@item_window设置部分 @item_window = Window_EquipItem.new(wx, wy, ww, wh) @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.status_window = @status_window @item_window.actor = @actor @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) @slot_window.item_window = @item_window @item_window.visible =false#设置窗口不可见 end #-------------------------------------------------------------------------- # ● 裝備欄“確定” #-------------------------------------------------------------------------- alias on_slot_ok_A on_slot_ok#alias 语法自己看帮助 def on_slot_ok @item_window.visible =true @slot_window.visible =false #上面为窗口显隐切换,下为默认的功能脚本 on_slot_ok_A end #-------------------------------------------------------------------------- # ● 物品“確定” #-------------------------------------------------------------------------- alias on_item_ok_A on_item_ok#alias 语法自己看帮助 def on_item_ok @item_window.visible =false @slot_window.visible =true #上面为窗口显隐切换,下为默认的功能脚本 on_item_ok_A end #-------------------------------------------------------------------------- # ● 物品“取消” #-------------------------------------------------------------------------- alias on_item_cancel_A on_item_cancel#alias 语法自己看帮助 def on_item_cancel @item_window.visible =false @slot_window.visible =true #上面为窗口显隐切换,下为默认的功能脚本 on_item_cancel_A end end
class Scene_Equip < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 生成物品視窗
#--------------------------------------------------------------------------
alias create_item_window_A create_item_window#alias 语法自己看帮助
def create_item_window
wx = @status_window.width
wy = @command_window.y + @command_window.height
ww = Graphics.width - @status_window.width
wh = @slot_window.height
#wx,wy,ww,wh为描绘窗口大小,下面是默认的@item_window设置部分
@item_window = Window_EquipItem.new(wx, wy, ww, wh)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.status_window = @status_window
@item_window.actor = @actor
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:on_item_cancel))
@slot_window.item_window = @item_window
@item_window.visible =false#设置窗口不可见
end
#--------------------------------------------------------------------------
# ● 裝備欄“確定”
#--------------------------------------------------------------------------
alias on_slot_ok_A on_slot_ok#alias 语法自己看帮助
def on_slot_ok
@item_window.visible =true
@slot_window.visible =false
#上面为窗口显隐切换,下为默认的功能脚本
on_slot_ok_A
end
#--------------------------------------------------------------------------
# ● 物品“確定”
#--------------------------------------------------------------------------
alias on_item_ok_A on_item_ok#alias 语法自己看帮助
def on_item_ok
@item_window.visible =false
@slot_window.visible =true
#上面为窗口显隐切换,下为默认的功能脚本
on_item_ok_A
end
#--------------------------------------------------------------------------
# ● 物品“取消”
#--------------------------------------------------------------------------
alias on_item_cancel_A on_item_cancel#alias 语法自己看帮助
def on_item_cancel
@item_window.visible =false
@slot_window.visible =true
#上面为窗口显隐切换,下为默认的功能脚本
on_item_cancel_A
end
end
效果如下
|