赞 | 5 |
VIP | 359 |
好人卡 | 195 |
积分 | 3 |
经验 | 560179 |
最后登录 | 2024-5-17 |
在线时间 | 1373 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 275
- 在线时间
- 1373 小时
- 注册时间
- 2005-10-16
- 帖子
- 5113
|
本帖最后由 亿万星辰 于 2011-10-24 17:35 编辑
- #==============================================================================
- # ■ Title_words
- #------------------------------------------------------------------------------
- # 显示标题画面开始文字的窗口。
- #==============================================================================
- class Title_words
- def initialize(x, y, word = "按空格开始游戏", begin_opacity = 255, flash_add = 5)
- @start = Sprite.new
- @start.bitmap = Bitmap.new(544, 20)
- @start.x = x
- @start.y = y
- @start.bitmap.draw_text(0,0,544, 20,word, 1)
- @start.z = 1000
- @start.opacity = begin_opacity
- @flash_add = flash_add
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update
- @start.opacity += @flash_add
- @flash_add *= -1 if @start.opacity % 255 == 0
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- @start.bitmap.dispose
- @start.dispose
- end
- #--------------------------------------------------------------------------
- # ● 可见性控制
- #--------------------------------------------------------------------------
- def visible
- return @start.visible
- end
- def visible=(v)
- @start.visible = v
- end
- end
- class Scene_Title < Scene_Base
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- alias old_start start
- def start
- old_start
- @command_window.visible = false
- @title_word1 = Title_words.new(0, 320, "按空格开始游戏", 255, -5)
- @title_word2 = Title_words.new(0, 32, "按空格开始游戏", 0, 5)
- @title_waiting = true
- end
- #--------------------------------------------------------------------------
- # ● 结束处理
- #--------------------------------------------------------------------------
- alias old_terminate terminate
- def terminate
- old_terminate
- title_dispose
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- @title_waiting ? title_update : @command_window.update
- if Input.trigger?(Input::C)
- if @title_waiting
- Sound.play_decision
- @title_waiting = false
- @command_window.visible = true
- @title_word1.visible = false
- @title_word2.visible = false
- else
- case @command_window.index
- when 0 #New game
- command_new_game
- when 1 # Continue
- command_continue
- when 2 # Shutdown
- command_shutdown
- end
- end
- end
- if Input.trigger?(Input::B) and !@title_waiting
- Sound.play_cancel
- @title_waiting = true
- @command_window.visible = false
- @title_word1.visible = true
- @title_word2.visible = true
- end
- end
- def title_update
- @title_word1.update
- @title_word2.update
- end
- def title_dispose
- @title_word1.dispose
- @title_word2.dispose
- end
- end
复制代码 不解释 |
|