赞 | 0 |
VIP | 0 |
好人卡 | 1 |
积分 | 1 |
经验 | 1174 |
最后登录 | 2013-8-21 |
在线时间 | 40 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 40 小时
- 注册时间
- 2005-12-30
- 帖子
- 41
|
始终搞不明白draw_text的右对齐是如何计算显示位置的……头痛,调整文字位置弄很久 OTL- #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # 這個類用來執行顯示ESC選單畫面的程式。
- #==============================================================================
- #==============================================================================
- # ■ Window_Step
- #------------------------------------------------------------------------------
- # 显示步数的窗口。
- #==============================================================================
- class Window_Step < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # x : 窗口 X 座标 w : 窗口宽度,默认160
- # y : 窗口 Y 座标 h : 窗口高度,默认是2行文字宽度
- #--------------------------------------------------------------------------
- def initialize(x, y, w=160, h=WLH*2+32)
- super(x, y, w, h)
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- step = "#{$game_party.steps}步"
-
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 0, self.width, WLH, "步数:")
- self.contents.draw_text(0, WLH, 120, WLH, step, 2)
- end
- end
- #==============================================================================
- # ■ Window_Time
- #------------------------------------------------------------------------------
- # 显示时间的窗口。
- #==============================================================================
- class Window_Time < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # x : 窗口 X 座标 w : 窗口宽度,默认160
- # y : 窗口 Y 座标 h : 窗口高度,默认是2行文字宽度
- #--------------------------------------------------------------------------
- def initialize(x, y, w=160, h=WLH*2+32)
- super(x, y, w, h)
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @total_sec = Graphics.frame_count / Graphics.frame_rate
- draw_playtime
- end
- #--------------------------------------------------------------------------
- # ● 描绘游戏时间
- #--------------------------------------------------------------------------
- def draw_playtime
- hour = @total_sec / 60 / 60
- min = @total_sec / 60 % 60
- sec = @total_sec % 60
- time_string = sprintf("%02d时%02d分%02d秒", hour, min, sec)
-
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 0, self.width, WLH, "游戏时间:")
- self.contents.draw_text(0, WLH, 160, WLH, time_string)
- end
- end
- class Scene_Menu < Scene_Base
- #--------------------------------------------------------------------------
- # * 物件初始化
- # menu_index : 命令游標的起始位置
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- @menu_index = menu_index
- end
- #--------------------------------------------------------------------------
- # * 程式開始
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- create_command_window
- #@gold_window = Window_Gold.new(0, 360)
- @status_window = Window_MenuStatus.new(160, 0)
-
- #高度累计
- h = @command_window.height
- #时间窗口
- @time_window = Window_Time.new(0, h)
- h += @time_window.height
- #步数窗口
- @step_window = Window_Step.new(0, h)
- h += @step_window.height
- #地点窗口
- @now_place_window = Window_Base.new(0, h, 160, 416-h)
- @now_place_window.contents.font.color = @now_place_window.text_color(3)
- @now_place_window.contents.draw_text(0, 0, 128, 24, "当前地点:")
- @now_place_window.contents.font.color = @now_place_window.text_color(14)
- map_name = load_data("Data/MapInfos.rvdata")[$game_map.map_id].name
- @now_place_window.contents.draw_text(0, 24, 128, 24, map_name)
- end
- #--------------------------------------------------------------------------
- # * 程式中止
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @command_window.dispose
- #@gold_window.dispose
- @status_window.dispose
- @time_window.dispose
- @step_window.dispose
- @now_place_window.dispose
- end
- #--------------------------------------------------------------------------
- # * 更新幀
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @command_window.update
- #@gold_window.update
- @status_window.update
- @time_window.refresh
- @step_window.refresh
- @now_place_window.update
- if @command_window.active
- update_command_selection
- elsif @status_window.active
- update_actor_selection
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|