赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2853 |
最后登录 | 2019-1-8 |
在线时间 | 107 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 144
- 在线时间
- 107 小时
- 注册时间
- 2012-5-16
- 帖子
- 69
|
本帖最后由 raymondyrf 于 2013-5-8 18:40 编辑
j433463 发表于 2013-5-8 08:47
就像您前面说的,不同的窗口用不同的变量.visible 为 true 或 false,来决定窗口的显示或隐藏,两个窗口和 ...
请问我这样写有没有问题呢??我知道方法,却不知道怎么写···
#encoding:utf-8 #============================================================================== # ■ Window_Variables #------------------------------------------------------------------------------ # 地图上显示变量窗口 #============================================================================== # 在不想要显示的地图备注栏中放上 <NOHPHUB> 就可以隐藏。 #============================================================================== HPHUB_X = 100 #显示变量窗口的 X 座标 HPHUB_Y = 0 #显示变量窗口的 Y 座标 HPHUB_SWITCH = 100 #切换 显示 / 隐藏 窗口的开关ID HPHUB_SWITCH1 = 99 #切换 显示 / 隐藏 窗口的开关ID class Window_Variables < Window_Base #-------------------------------------------------------------------------- # ● 初始化 #-------------------------------------------------------------------------- def initialize super(100, 120, 740, 600) self.opacity = 0 refresh end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh draw_background draw_actor_name($game_actors[1], 330, 140) draw_actor_nickname($game_actors[1], 300, 210) draw_actor_level($game_actors[1], 330, 177) draw_actor_exp($game_actors[1], 520, 177) draw_actor_param($game_actors[1], 230, 335, 0) draw_actor_param($game_actors[1], 230, 304, 1) draw_actor_param($game_actors[1], 230, 245, 2) draw_actor_param($game_actors[1], 230, 275, 3) draw_actor_param($game_actors[1], 230, 364, 4) draw_actor_param($game_actors[1], 230, 395, 5) draw_actor_param($game_actors[1], 230, 426, 6) draw_actor_param($game_actors[1], 230, 455, 7) draw_actor_hp($game_actors[1], 520, 237) draw_actor_mp($game_actors[1], 520, 267) draw_text(283, 50, 300, 200,$game_variables[4995], 2) #生日月 draw_text(335, 50, 300, 200,$game_variables[4994], 2) #生日日 change_color(text_color(6)) draw_text(250, 385, 300, 300,$game_party.gold, 2) end #-------------------------------------------------------------------------- # ● 绘制背景 #-------------------------------------------------------------------------- def draw_background bitmap = Cache.picture("plain") #背景图 rect = Rect.new(0, 0, bitmap.width, bitmap.height) contents.blt(contents_width - bitmap.width, contents_height - bitmap.height, bitmap, rect, 255) bitmap.dispose end end class Window_Variables2 < Window_Base #-------------------------------------------------------------------------- # ● 初始化 #-------------------------------------------------------------------------- def initialize super(0, 0, 1024, 768) self.opacity = 0 refresh end #-------------------------------------------------------------------------- # ● 获取日期 #-------------------------------------------------------------------------- def date return $game_variables[4994] end #-------------------------------------------------------------------------- # ● 获取月份 #-------------------------------------------------------------------------- def month return $game_variables[4995] end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh contents.clear draw_background draw_text(800, 0, 100, 100, "年", 2) draw_text(845, 0, 100, 100, "月", 2) draw_text(890, 0, 100, 100, "日", 2) draw_text(775, 0, 100, 100, "2000", 2) draw_text(818, 0, 100, 100, month, 2) draw_text(868, 0, 100, 100, date, 2) end #-------------------------------------------------------------------------- # ● 绘制背景 #-------------------------------------------------------------------------- def draw_background bitmap = Cache.picture("date") #背景图 rect = Rect.new(-800, -20, 1024, 768) contents.blt(x, y, bitmap, rect, 255) bitmap.dispose end end #============================================================================== # ■ Scene_Map #------------------------------------------------------------------------------ # 地图生成窗口 #============================================================================== class Scene_Map < Scene_Base alias new_start start def start new_start @varia_window = Window_Variables.new @varia_window.x = HPHUB_X @varia_window.y = HPHUB_Y @varia_window.visible = false @varia_window2 = Window_Variables2.new @varia_window2.x = 0 @varia_window2.y = 0 @varia_window2.visible = true end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- alias new_update update def update new_update #初始值 return if @show_hp_hud == $game_switches[HPHUB_SWITCH] p $game_switches[HPHUB_SWITCH].to_s + "=>" + @show_hp_hud.to_s if $game_switches[HPHUB_SWITCH] != true @show_hp_hud = false else @show_hp_hud = true end #显示/隐藏执行 if @show_hp_hud == true @varia_window.refresh @varia_window.visible = true else @varia_window.visible = false end return else @show_hp_hud1 == $game_switches[HPHUB_SWITCH1] p $game_switches[HPHUB_SWITCH1].to_s + "=>" + @show_hp_hud1.to_s if $game_switches[HPHUB_SWITCH1] != true @show_hp_hud1 = false else @show_hp_hud1 = true end #显示/隐藏执行 if @show_hp_hud1 == true @varia_window2.refresh @varia_window2.visible = true else @varia_window2.visible = false end end #-------------------------------------------------------------------------- # ● 释放 #-------------------------------------------------------------------------- alias new_terminate terminate def terminate @varia_window.dispose new_terminate end #-------------------------------------------------------------------------- # ● 关闭 #-------------------------------------------------------------------------- def close_varia_window @varia_window.close update until @varia_window.close? end def close_varia_window_1 @varia_window1.close update until @varia_window1.close? end end
#encoding:utf-8
#==============================================================================
# ■ Window_Variables
#------------------------------------------------------------------------------
# 地图上显示变量窗口
#==============================================================================
# 在不想要显示的地图备注栏中放上 <NOHPHUB> 就可以隐藏。
#==============================================================================
HPHUB_X = 100 #显示变量窗口的 X 座标
HPHUB_Y = 0 #显示变量窗口的 Y 座标
HPHUB_SWITCH = 100 #切换 显示 / 隐藏 窗口的开关ID
HPHUB_SWITCH1 = 99 #切换 显示 / 隐藏 窗口的开关ID
class Window_Variables < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(100, 120, 740, 600)
self.opacity = 0
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
draw_background
draw_actor_name($game_actors[1], 330, 140)
draw_actor_nickname($game_actors[1], 300, 210)
draw_actor_level($game_actors[1], 330, 177)
draw_actor_exp($game_actors[1], 520, 177)
draw_actor_param($game_actors[1], 230, 335, 0)
draw_actor_param($game_actors[1], 230, 304, 1)
draw_actor_param($game_actors[1], 230, 245, 2)
draw_actor_param($game_actors[1], 230, 275, 3)
draw_actor_param($game_actors[1], 230, 364, 4)
draw_actor_param($game_actors[1], 230, 395, 5)
draw_actor_param($game_actors[1], 230, 426, 6)
draw_actor_param($game_actors[1], 230, 455, 7)
draw_actor_hp($game_actors[1], 520, 237)
draw_actor_mp($game_actors[1], 520, 267)
draw_text(283, 50, 300, 200,$game_variables[4995], 2) #生日月
draw_text(335, 50, 300, 200,$game_variables[4994], 2) #生日日
change_color(text_color(6))
draw_text(250, 385, 300, 300,$game_party.gold, 2)
end
#--------------------------------------------------------------------------
# ● 绘制背景
#--------------------------------------------------------------------------
def draw_background
bitmap = Cache.picture("plain") #背景图
rect = Rect.new(0, 0, bitmap.width, bitmap.height)
contents.blt(contents_width - bitmap.width, contents_height - bitmap.height, bitmap, rect, 255)
bitmap.dispose
end
end
class Window_Variables2 < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 1024, 768)
self.opacity = 0
refresh
end
#--------------------------------------------------------------------------
# ● 获取日期
#--------------------------------------------------------------------------
def date
return $game_variables[4994]
end
#--------------------------------------------------------------------------
# ● 获取月份
#--------------------------------------------------------------------------
def month
return $game_variables[4995]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_background
draw_text(800, 0, 100, 100, "年", 2)
draw_text(845, 0, 100, 100, "月", 2)
draw_text(890, 0, 100, 100, "日", 2)
draw_text(775, 0, 100, 100, "2000", 2)
draw_text(818, 0, 100, 100, month, 2)
draw_text(868, 0, 100, 100, date, 2)
end
#--------------------------------------------------------------------------
# ● 绘制背景
#--------------------------------------------------------------------------
def draw_background
bitmap = Cache.picture("date") #背景图
rect = Rect.new(-800, -20, 1024, 768)
contents.blt(x, y, bitmap, rect, 255)
bitmap.dispose
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 地图生成窗口
#==============================================================================
class Scene_Map < Scene_Base
alias new_start start
def start
new_start
@varia_window = Window_Variables.new
@varia_window.x = HPHUB_X
@varia_window.y = HPHUB_Y
@varia_window.visible = false
@varia_window2 = Window_Variables2.new
@varia_window2.x = 0
@varia_window2.y = 0
@varia_window2.visible = true
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
alias new_update update
def update
new_update
#初始值
return if @show_hp_hud == $game_switches[HPHUB_SWITCH]
p $game_switches[HPHUB_SWITCH].to_s + "=>" + @show_hp_hud.to_s
if $game_switches[HPHUB_SWITCH] != true
@show_hp_hud = false
else
@show_hp_hud = true
end
#显示/隐藏执行
if @show_hp_hud == true
@varia_window.refresh
@varia_window.visible = true
else
@varia_window.visible = false
end
return else @show_hp_hud1 == $game_switches[HPHUB_SWITCH1]
p $game_switches[HPHUB_SWITCH1].to_s + "=>" + @show_hp_hud1.to_s
if $game_switches[HPHUB_SWITCH1] != true
@show_hp_hud1 = false
else
@show_hp_hud1 = true
end
#显示/隐藏执行
if @show_hp_hud1 == true
@varia_window2.refresh
@varia_window2.visible = true
else
@varia_window2.visible = false
end
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
alias new_terminate terminate
def terminate
@varia_window.dispose
new_terminate
end
#--------------------------------------------------------------------------
# ● 关闭
#--------------------------------------------------------------------------
def close_varia_window
@varia_window.close
update until @varia_window.close?
end
def close_varia_window_1
@varia_window1.close
update until @varia_window1.close?
end
end
|
|