Project1
标题:
如何进入某一个场景后地图上显示金钱
[打印本页]
作者:
qingfengjian
时间:
2013-1-22 14:50
标题:
如何进入某一个场景后地图上显示金钱
本帖最后由 qingfengjian 于 2013-1-24 17:43 编辑
如题,并不是全局都显示金钱,是进入某一个特定的场景里面才显示?
作者:
Sion
时间:
2013-1-22 16:20
# 说明:在地图备注里加入<ShowGold>可以在该地图显示金钱。
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
alias old_create_all_windows create_all_windows
def create_all_windows
old_create_all_windows
creat_gold_window
@gold_window.open if show_gold_window?
end
alias old_pre_transfer pre_transfer
def pre_transfer
@gold_window.close
old_pre_transfer
end
alias old_post_transfer post_transfer
def post_transfer
old_post_transfer
@gold_window.open if show_gold_window?
end
#--------------------------------------------------------------------------
# ● 创建金钱窗口,跟默认菜单中的一样
#--------------------------------------------------------------------------
def creat_gold_window
@gold_window = Window_Map_Gold.new
@gold_window.x = 0
@gold_window.y = Graphics.height - @gold_window.height
end
def show_gold_window?
map = load_data(sprintf("Data/Map%03d.rvdata2", $game_map.map_id))
map.note.each_line do |line|
return true if line.include?("<ShowGold>")
end
return false
end
alias old_update update
def update
old_update
@gold_window.refresh if show_gold_window?
end
end
#==============================================================================
# ■ Window_Map_Gold
#==============================================================================
class Window_Map_Gold < Window_Gold
def initialize
super
self.opacity = 0;self.contents_opacity = 0
end
def open
self.opacity = 255;self.contents_opacity = 255
super
end
def close
self.opacity = 0;self.contents_opacity = 0
end
end
复制代码
作者:
qingfengjian
时间:
2013-1-22 18:14
Sion 发表于 2013-1-22 16:20
谢谢,成功了{:2_275:}
感谢感谢感谢!!!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1