Project1
标题:
请教小雪姐姐。。。
[打印本页]
作者:
heychen
时间:
2008-4-27 04:55
标题:
请教小雪姐姐。。。
class Scene_Map
def main
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
################################################小雪
if $game_switches[1] == true
@time_date_window = Window_daytime.new
@gold_window = Window_Gold.new
end
################################################小雪
Graphics.transition
loop do
Graphics.update
Input.update
update
############################################小雪
if $game_switches[1] == true
@time_date_window = Window_daytime.new if @gold_window.nil?
@gold_window = Window_Gold.new if @gold_window.nil?
end
@gold_window.update if !@gold_window.nil?
@time_date_window.update if !@gold_window.nil?
############################################小雪
if $scene != self
break
end # end if $scene != self
end # end loop do
Graphics.freeze
@spriteset.dispose
@message_window.dispose
##################################################小雪
@time_date_window.dispose if !@time_date_window.nil?
@gold_window.dispose if !@gold_window.nil?
###################################################小雪
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end # end if $scene.is_a?(Scene_Title)
end # end def main
end # end class Scene_Map
###############################################################################
#显示日期时间
#变量1,2,3,4,5,6,7分别对应分,时,日,月,年,星期,季节
###############################################################################
class Window_daytime < Window_Base
def initialize
super(0, 0, 640, 55)#(X坐标,Y坐标,宽,高)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end # end def initialize
def refresh
@total_sec = Graphics.frame_count
if @total_sec % 40 ==0
$game_variables[1] += 1
end # end if @total_sec % 40 ==0
if $game_variables[1] >= 60 + 1
$game_variables[1] = 1
$game_variables[2] += 1
end # end if $game_variables[1] >= 6 + 1
if $game_variables[2] >= 24 + 1
$game_variables[2] = 1
$game_variables[3] += 1
$game_variables[6] += 1
end # end if $game_variables[2] >= 12 + 1
if $game_variables[3] >= 30 + 1
$game_variables[3] = 1
$game_variables[4] += 1
$game_variables[7] += 1
end # end if $game_variables[3] >= 30 + 1
if $game_variables[4] >= 12 + 1
$game_variables[4] = 1
$game_variables[5] += 1
end # end if $game_variables[4] >= 12 + 1
if $game_variables[6] >= 7 + 1
$game_variables[6] = 1
end # end if $game_variables[6] >= 7 + 1
if $game_variables[7] >= 12 + 1
$game_variables[7] = 1
end # end if $game_variables[7] >= 7 + 1
text_min = [ "","00", "01", "02", "03", "04", "05", "06", "07",
"08", "09", "10", "11", "12", "13", "14", "15",
"16", "17", "18", "19", "20", "21", "22", "23",
"24", "25", "26", "27", "28", "29", "30", "31",
"32", "33", "34", "35", "36", "37", "38", "39",
"40","41", "42", "43", "44", "45", "46", "47",
"48", "49","50","51","52","53","54","55","56",
"57", "58", "59"][$game_variables[1]]
text_hour = ["", "01:", "02:", "03:", "04:", "05:", "06:",
"07:", "08:", "09:", "10:", "11:", "12:", "13:", "14:", "15:",
"16:", "17:", "18:", "19:", "20:", "21:", "22:", "23:", "24:"
][$game_variables[2]]
text_day = ["", " 1号", " 2号", " 3号", " 4号", " 5号", " 6号",
" 7号", " 8号", " 9号", "10号", "11号", "12号",
"13号", "14号", "15号", "16号", "17号", "18号",
"19号", "20号", "21号", "22号", "23号", "24号",
"25号", "26号", "27号", "28号", "29号","30号"][$game_variables[3]]
text_week = [ "","星期一", "星期二", "星期三", "星期四", "星期五", "星期六",
"星期日"][$game_variables[6]]
text_month = ["", " 1月", " 2月", " 3月", " 4月", " 5月", " 6月",
" 7月", " 8月", " 9月", "10月", "11月", "12月"][$game_variables[4]]
text_jijie = ["", "春", "春", "春", "夏", "夏", "夏", "秋", "秋",
"秋", "冬", "冬", "冬"][$game_variables[7]]
text_year = ["", "第一年", "第二年", "第三年", "第四年", "第五年", "第六年",
"第七年", "第八年", "第九年", "第十年"][$game_variables[5]]
self.contents.clear
self.contents.draw_text(10, -5, 128, 32, text_year)#X,Y,宽,高
self.contents.draw_text(130, -5, 128, 32, text_month)
self.contents.draw_text(175, -5, 128, 32, text_day)
self.contents.draw_text(280, -5, 128, 32, text_week)
self.contents.draw_text(370, -5, 128, 32, text_hour)
self.contents.draw_text(405, -5, 128, 32, text_min)
self.contents.draw_text(90, -5, 128, 32, text_jijie)
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
end # end def refresh
def update
super
refresh
end # end def update
end# end class Window_daytime
###############################################################################
#显示金钱
###############################################################################
class Window_Gold < Window_Base
def initialize
super(0, 425, 640,55)#(X坐标,Y坐标,宽,高)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end # end def initialize
def refresh
self.contents.clear
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(0,-5, 128, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(30, -5, 128, 32, $data_system.words.gold, 2)
self.contents.draw_text(220, -5, 128, 32, $game_actors[1].name )
end #def refresh
end
复制代码
首先感谢之前帮我改了这个脚本。今天我再请教一下。
if $game_switches[1] == true
@time_date_window = Window_daytime.new
@gold_window = Window_Gold.new
end
上面4句的意思是开关1打开时,变量time_date_window 和gold_window 就会分别调用Window_daytime脚本和Window_Gold脚本吧?
而后面的
@time_date_window.dispose if !@time_date_window.nil?
@gold_window.dispose if !@gold_window.nil?
这两句是释放时间窗口和金钱窗口的命令吧?
上面的脚本我把 Window_Gold 归于 Window_Base ,并多创建一个在屏幕下方的窗口,可是问题出现了,按下ESC键下面的窗口不消失,而且也不会更新数值,还有就是即使开关1没有打开时,按下ESC后也会出现下面的窗口,我要怎么加句子才能刷新与释放??能不能给我讲解一下原理。为什么现在不刷新和释放? [LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
Iselia雪
时间:
2008-4-27 05:02
提示:
作者被禁止或删除 内容自动屏蔽
作者:
heychen
时间:
2008-4-27 05:23
改了“2”后又生成了一个新的窗口,就是说没有加“2”之前调用的只是原来按下ESC后“步数”下面的那个金钱窗口?
作者:
Iselia雪
时间:
2008-4-27 05:28
提示:
作者被禁止或删除 内容自动屏蔽
作者:
heychen
时间:
2008-4-27 05:35
好,明白了。谢谢
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1