赞 | 0 |
VIP | 135 |
好人卡 | 6 |
积分 | 3 |
经验 | 37799 |
最后登录 | 2020-4-30 |
在线时间 | 812 小时 |
Lv2.观梦者 旅之愚者
- 梦石
- 0
- 星屑
- 275
- 在线时间
- 812 小时
- 注册时间
- 2007-7-28
- 帖子
- 2148
|
2楼
楼主 |
发表于 2010-10-13 21:17:48
|
只看该作者
- module Choice_Configuration
- ColorLeft = Color.new(255,0,0,125)
- ColorRight = Color.new(0,0,255,125)
- WindowHeight = 58
- WindowWidth = 306
- WindowSpacing = 16
- ColorShadow = Color.new(0,0,0,200)
- VariableId = 54
- end
- class Scene_Choice < Scene_Base
- include Choice_Configuration
- def initialize(*list)
- @list = list
- end
-
- def start
- @spriteset = Spriteset_Map.new
- @choice_windows = []
- @choice_number = @list.size
- start_y = (416 - @choice_number * WindowHeight - (@choice_number - 1) * WindowSpacing) / 2
- start_x = (544 - WindowWidth) / 2
- @list.each_with_index do |choice,index|
- window = Window_Base.new(start_x,start_y + index * (WindowHeight + WindowSpacing),WindowWidth,WindowHeight)
- window.contents.dispose
- window.contents = Bitmap.new(WindowWidth - 34,WindowHeight - 34)
- window.contents.gradient_fill_rect(2,2,WindowWidth - 32 - 2,22,ColorLeft,ColorRight)
- window.contents.draw_text(0,0,WindowWidth - 32,24,choice,1)
- window.opacity = 0
- @choice_windows.push(window)
- end
- for i in 0...@choice_number
- set_unactive(i)
- end
- @index = 0
- set_active(@index)
- end
-
- def terminate
- @spriteset.dispose
- @choice_windows.each{|window| window.dispose}
- end
-
- def set_unactive(index)
- target = @choice_windows[index]
- target.contents.clear_rect(0,0,WindowWidth - 32 - 2,2)
- target.contents.clear_rect(0,0,2,22)
- target.contents.fill_rect(2,22,WindowWidth - 32 - 2,2,ColorShadow)
- target.contents.fill_rect(WindowWidth - 32 - 2,2,2,22,ColorShadow)
- target.ox = -2
- target.oy = -2
- end
-
- def set_active(index)
- target = @choice_windows[index]
- target.contents.clear_rect(2,22,WindowWidth - 32 - 2,2)
- target.contents.clear_rect(WindowWidth - 32 - 2,2,2,22)
- target.contents.fill_rect(0,0,WindowWidth - 32 - 2,2,ColorShadow)
- target.contents.fill_rect(0,0,2,22,ColorShadow)
- target.ox = 0
- target.oy = 0
- end
-
- def update
- @choice_windows.each{|window| window.update}
- if Input.trigger?(Input::DOWN)
- Sound.play_cursor
- set_unactive(@index)
- @index += 1
- @index %= @choice_number
- set_active(@index)
- end
- if Input.trigger?(Input::UP)
- Sound.play_cursor
- set_unactive(@index)
- @index -= 1
- @index %= @choice_number
- set_active(@index)
- end
- if Input.trigger?(Input::C)
- Sound.play_decision
- $game_variables[VariableId] = @index + 1
- $scene = Scene_Map.new
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|