本帖最后由 KB.Driver 于 2019-9-28 14:55 编辑
#encoding:utf-8 module CLD99 module GOLD_AND_EXP_WINDOW_ON_MAP class << self attr_accessor :need_refresh end GOLD_WINDOW_WIDTH = 240 EXP_WINDOW_WIDTH = 240 end end class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ● 生成所有窗口 #-------------------------------------------------------------------------- alias create_all_windows_for_gold_and_exp_window create_all_windows def create_all_windows create_all_windows_for_gold_and_exp_window create_gold_window create_exp_window end def create_gold_window @gold_window = (Class.new(Window_Gold) do def window_width CLD99::GOLD_AND_EXP_WINDOW_ON_MAP::GOLD_WINDOW_WIDTH end end).new @gold_window.x = Graphics.width - @gold_window.width end def create_exp_window w = CLD99::GOLD_AND_EXP_WINDOW_ON_MAP::EXP_WINDOW_WIDTH h = $game_party.battle_members.size * 33 + 24 x = Graphics.width - w y = @gold_window.height @exp_window = Window_Base.new(x, y, w, h) $game_party.battle_members.each_with_index do |actor, i| x, y = 12, 12 + i * 33 name, index = actor.character_name, actor.character_index @exp_window.draw_character(name, index, x, y + 20) text = "Exp. #{actor.exp}/#{actor.next_level_exp}" @exp_window.draw_text(x + 20, y - 8, w - 24, 24, text) end end #-------------------------------------------------------------------------- # ● 更新画面 #-------------------------------------------------------------------------- alias update_for_gold_and_exp_window update def update if CLD99::GOLD_AND_EXP_WINDOW_ON_MAP.need_refresh || $game_map.need_refresh @gold_window.refresh @exp_window.dispose create_exp_window CLD99::GOLD_AND_EXP_WINDOW_ON_MAP.need_refresh = false end update_for_gold_and_exp_window end end class Game_Interpreter #-------------------------------------------------------------------------- # ● 增减经验值 #-------------------------------------------------------------------------- alias command_315_for_gold_and_exp_window command_315 def command_315 command_315_for_gold_and_exp_window CLD99::GOLD_AND_EXP_WINDOW_ON_MAP.need_refresh = true end #-------------------------------------------------------------------------- # ● 增减持有金钱 #-------------------------------------------------------------------------- alias command_125_for_gold_and_exp_window command_125 def command_125 command_125_for_gold_and_exp_window CLD99::GOLD_AND_EXP_WINDOW_ON_MAP.need_refresh = true end end
#encoding:utf-8
module CLD99
module GOLD_AND_EXP_WINDOW_ON_MAP
class << self
attr_accessor :need_refresh
end
GOLD_WINDOW_WIDTH = 240
EXP_WINDOW_WIDTH = 240
end
end
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 生成所有窗口
#--------------------------------------------------------------------------
alias create_all_windows_for_gold_and_exp_window create_all_windows
def create_all_windows
create_all_windows_for_gold_and_exp_window
create_gold_window
create_exp_window
end
def create_gold_window
@gold_window = (Class.new(Window_Gold) do
def window_width
CLD99::GOLD_AND_EXP_WINDOW_ON_MAP::GOLD_WINDOW_WIDTH
end
end).new
@gold_window.x = Graphics.width - @gold_window.width
end
def create_exp_window
w = CLD99::GOLD_AND_EXP_WINDOW_ON_MAP::EXP_WINDOW_WIDTH
h = $game_party.battle_members.size * 33 + 24
x = Graphics.width - w
y = @gold_window.height
@exp_window = Window_Base.new(x, y, w, h)
$game_party.battle_members.each_with_index do |actor, i|
x, y = 12, 12 + i * 33
name, index = actor.character_name, actor.character_index
@exp_window.draw_character(name, index, x, y + 20)
text = "Exp. #{actor.exp}/#{actor.next_level_exp}"
@exp_window.draw_text(x + 20, y - 8, w - 24, 24, text)
end
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
alias update_for_gold_and_exp_window update
def update
if CLD99::GOLD_AND_EXP_WINDOW_ON_MAP.need_refresh || $game_map.need_refresh
@gold_window.refresh
@exp_window.dispose
create_exp_window
CLD99::GOLD_AND_EXP_WINDOW_ON_MAP.need_refresh = false
end
update_for_gold_and_exp_window
end
end
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 增减经验值
#--------------------------------------------------------------------------
alias command_315_for_gold_and_exp_window command_315
def command_315
command_315_for_gold_and_exp_window
CLD99::GOLD_AND_EXP_WINDOW_ON_MAP.need_refresh = true
end
#--------------------------------------------------------------------------
# ● 增减持有金钱
#--------------------------------------------------------------------------
alias command_125_for_gold_and_exp_window command_125
def command_125
command_125_for_gold_and_exp_window
CLD99::GOLD_AND_EXP_WINDOW_ON_MAP.need_refresh = true
end
end
|