Project1
标题:
自己乱搞了个窗口,想做其它用途,失败,求助!
[打印本页]
作者:
kvkv97
时间:
2015-8-6 14:19
标题:
自己乱搞了个窗口,想做其它用途,失败,求助!
本帖最后由 kvkv97 于 2015-8-6 14:25 编辑
#【说明】:在地图上建立一个事件调用脚本,事件脚本“$scene = My_scene.new”
#用ABC做其它作用
class My_window < Window_Selectable
def initialize(width,aaa) #aaa表示光标选项
super(0,0,100,aaa.size * 32 + 32)
@item_max = aaa.size
@aaa[/url] = aaa
self.contents = Bitmap.new(width, @item_max * 32)
refresh
self.index = 0
end
def refresh
for i in [email]
[email protected]
[/email]
draw_item(i)#
end
end
def draw_item(index)
rect = Rect.new(4, 32*index, self.contents.width, 32)
self.contents.draw_text(rect, @aaa[index])#在矩形中描绘字符串(数组)
end
end
class My_scene
def main
s1 = "A"
s2 = "B"
s3 = "C"
@my_window = My_window.new(32, [s1, s2, s3])
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@my_window.dispose
end
def update
# 刷新命令窗口
@my_window.update
if Input.trigger?(Input::C)
# 命令窗口的光标位置的分支
case @my_window.index
when 0 # A
# command_new_game
when 1 # B
# command_continue
when 2 # C
# command_shutdown
end
end
if Input.trigger?(Input::SHIFT)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
end
end
复制代码
发现初始化不了场景,急求助大神。帮解决!!
作者:
英顺的马甲
时间:
2015-8-6 16:24
继承错了,应该要继承Window_Command
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1