赞 | 227 |
VIP | 23 |
好人卡 | 14 |
积分 | 302 |
经验 | 53364 |
最后登录 | 2024-7-2 |
在线时间 | 2049 小时 |
Lv5.捕梦者 (暗夜天使)
- 梦石
- 18
- 星屑
- 12191
- 在线时间
- 2049 小时
- 注册时间
- 2012-12-12
- 帖子
- 541
|
congwsbn 发表于 2013-1-5 02:13
我之前看到一个用事件脚本做选择项的,但是英语不行,脚本又新手。怎么也改不到想要的效果……超级拙计! ...
- module Choice_Configuration
- ColorLeft = Color.new(0,0,0,0)
- ColorRight = Color.new(0,0,0,0)
- WindowHeight = 56
- WindowWidth = 170
- WindowSpacing = -1
- ColorShadow = Color.new(0,0,0,0)
- 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 = 220
- @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
通过编写“$scene=Scene_Choice.new("是","否")”脚本来用的……
这是被我稍微改过的……原本那个我没存。有两个问题,一个是“是”“否”的选项框不是在同一个框里。第二问题是没有光标框……(不太懂论坛,有格式不对的地方请原谅>_< |
评分
-
查看全部评分
|