赞 | 0 |
VIP | 3 |
好人卡 | 0 |
积分 | 3 |
经验 | 3830 |
最后登录 | 2016-4-14 |
在线时间 | 24 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 255
- 在线时间
- 24 小时
- 注册时间
- 2008-8-2
- 帖子
- 128
|
本帖最后由 谢谢合作 于 2009-7-3 10:59 编辑
- #==============================================================================
- # ■ 日期显示脚本
- # by 謝謝合作
- #------------------------------------------------------------------------------
- # 在Main的上方插入一个页,将本脚本复制到那页中即可
- #==============================================================================
- $abc = false
- #==============================================================================
- # ■ Window_MapDate
- #------------------------------------------------------------------------------
- # 显示日期的窗口。
- #==============================================================================
- class Window_MapDate < Window_Base
- #--------------------------------------------------------------------------
- # ● 类常量定义
- #--------------------------------------------------------------------------
- # 游戏中你设定的闰年
- LEAPYEAR = [800,804,808,812]
-
- # 开启用的开关
- SWITCH = 2
-
- # 月份变量
- VARIABLES1 = 1
-
- # 日期变量
- VARIABLES2 = 2
-
- # 年份变量
- VARIABLES3 = 3
-
- # 窗口位置设定
- NAME_X = 0 # 矩形左上顶点X坐标
- NAME_Y = 0 # 矩形左上顶点Y坐标
- NAME_W = 204 # 矩形宽
- NAME_H = 60 # 矩形高
-
- # 地图名字的颜色
- TEXT_COLOR = Color.new(255, 255, 255, 255)
-
- #--------------------------------------------------------------------------
- # ● 初始化状态
- #--------------------------------------------------------------------------
- def initialize
- super(NAME_X , NAME_Y, NAME_W, NAME_H)
- # 初始化窗口透明度
- self.opacity = 0
- self.back_opacity = 0
- self.contents_opacity = 0
- self.contents = Bitmap.new(width - 32, height - 32)
- end
- #--------------------------------------------------------------------------
- # ● 输出文字
- #--------------------------------------------------------------------------
- def setname
- unless $game_switches[SWITCH] == false
- if $game_variables[VARIABLES2] > 28
-
- if $game_variables[VARIABLES1] == 1
- if $game_variables[VARIABLES2] > 31
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 31
- end
- end
- if $game_variables[VARIABLES1] == 2
- if $game_variables[VARIABLES2] > 28
- for i in 0...LEAPYEAR.size
- if $game_variables[VARIABLES3] == LEAPYEAR[i]
- $abc = true
- if $game_variables[VARIABLES2] > 29
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 29
- end
- elsif $game_variables[VARIABLES3] != LEAPYEAR[i]
- if $abc != LEAPYEAR.size-1
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 28
- end
- end
- end
- end
- end
- if $game_variables[VARIABLES1] == 3
- if $game_variables[VARIABLES2] > 31
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 31
- end
- end
- if $game_variables[VARIABLES1] == 4
- if $game_variables[VARIABLES2] > 30
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 30
- end
- end
- if $game_variables[VARIABLES1] == 5
- if $game_variables[VARIABLES2] > 31
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 31
- end
- end
- if $game_variables[VARIABLES1] == 6
- if $game_variables[VARIABLES2] > 30
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 30
- end
- end
- if $game_variables[VARIABLES1] == 7
- if $game_variables[VARIABLES2] > 31
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 31
- end
- end
- if $game_variables[VARIABLES1] == 8
- if $game_variables[VARIABLES2] > 31
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 31
- end
- end
- if $game_variables[VARIABLES1] == 9
- if $game_variables[VARIABLES2] > 30
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 30
- end
- end
- if $game_variables[VARIABLES1] == 10
- if $game_variables[VARIABLES2] > 31
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 31
- end
- end
- if $game_variables[VARIABLES1] == 11
- if $game_variables[VARIABLES2] > 30
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 30
- end
- end
- if $game_variables[VARIABLES1] == 12
- if $game_variables[VARIABLES2] > 31
- $game_variables[VARIABLES1] += 1
- $game_variables[VARIABLES2] -= 31
- end
- end
- if $game_variables[VARIABLES1] > 12
- $game_variables[VARIABLES3] += 1
- $game_variables[VARIABLES1] -= 12
- end
- end
- if @date1 != $game_variables[VARIABLES1] or @date2 != $game_variables[VARIABLES2]
- @date1 = $game_variables[VARIABLES1]
- @date2 = $game_variables[VARIABLES2]
- return
- end
- self.contents.clear
- self.contents.font.color = TEXT_COLOR
- # 描绘日期
- self.contents.draw_text(48, 0, 32, 32, "年")
- self.contents.draw_text(0, 0, 48, 32, "#{$game_variables[VARIABLES3].to_s}")
-
- if @date1 < 10
- if @date2 < 10
- self.contents.draw_text(80, 0, width - 40, 32, " 月" + " 日")
- self.contents.draw_text(80, 0, width - 40, 32, " " + @date1.to_s + " " + @date2.to_s)
- else
- self.contents.draw_text(80, 0, width - 40, 32, " 月" + " 日")
- self.contents.draw_text(80, 0, width - 40, 32, " " + @date1.to_s + " " + @date2.to_s)
- end
- else
- if @date2 < 10
- self.contents.draw_text(80, 0, width - 40, 32, " 月" + " 日")
- self.contents.draw_text(80, 0, width - 40, 32, @date1.to_s + " " + @date2.to_s)
- else
- self.contents.draw_text(80, 0, width - 40, 32, " 月" + " 日")
- self.contents.draw_text(80, 0, width - 40, 32, @date1.to_s + " " + @date2.to_s)
- end
- end
- self.opacity = 192
- self.back_opacity = 192
- self.contents_opacity = 192
- end
- end
- end
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 处理地图画面的类。(追加定义)
- #==============================================================================
- class Scene_Map
- alias md_main main
- def main
- @mapdate = Window_MapDate.new
- md_main
- @mapdate.dispose
- end
-
- alias md_update update
- def update
- @mapdate.setname
- md_update
- end
- end
复制代码 |
|