加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 踢腿水上飘 于 2017-3-29 14:22 编辑
意思左边是列表,右边是内容,我模仿了好几个类似模式的脚本写都失败了- -
求个教程啊
我只弄到把窗口画出来这一步……后面就抓瞎了,什么都弄不出来啊,求个教程,怎么弄
效果就是 左边的窗口是词条,右边的窗口是词条的内容
比方左边是是测试1,测试2,测试3,选到测试1 右边就是显示 测试1测试1 这样
请指教下,下面这个是我仿照别人的脚本弄的,结果我仿造别人的脚本 只弄出2个空的窗口,左边有测试1,测试2,测试3,但右边的窗口内容就不会做了……
测试内容
class Window_testa < Window_Selectable #---------------------------------------------------------------------------- # * 初始化 #---------------------------------------------------------------------------- def initialize super(160, 0, Graphics.width-160, Graphics.height) refresh activate end #---------------------------------------------------------------------------- # * 更新内容 #---------------------------------------------------------------------------- def refresh draw_text(x, y, Graphics.width, line_height, "测试1测试1", 1) draw_text(x, y, Graphics.width, line_height, "测试2测试2", 1) draw_text(x, y, Graphics.width, line_height, "测试3测试3", 1) end end
class Window_testa < Window_Selectable
#----------------------------------------------------------------------------
# * 初始化
#----------------------------------------------------------------------------
def initialize
super(160, 0, Graphics.width-160, Graphics.height)
refresh
activate
end
#----------------------------------------------------------------------------
# * 更新内容
#----------------------------------------------------------------------------
def refresh
draw_text(x, y, Graphics.width, line_height, "测试1测试1", 1)
draw_text(x, y, Graphics.width, line_height, "测试2测试2", 1)
draw_text(x, y, Graphics.width, line_height, "测试3测试3", 1)
end
end
测试列表
class Window_testleft < Window_Command def initialize super(0,0) end #宽度 def window_width return 160 end #高度 def window_height return 240 end #指令 def make_command_list add_command("测试1", :aaa) add_command("测试2", :bbb) add_command("测试3", :ccc) end end
class Window_testleft < Window_Command
def initialize
super(0,0)
end
#宽度
def window_width
return 160
end
#高度
def window_height
return 240
end
#指令
def make_command_list
add_command("测试1", :aaa)
add_command("测试2", :bbb)
add_command("测试3", :ccc)
end
end
创建测试窗口
class Testlist < Scene_Base #-------------------------------------------------------------------------- # ● 场景开始 #-------------------------------------------------------------------------- def start super create_list_window create_right_window end #-------------------------------------------------------------------------- # ● 创建列表 #-------------------------------------------------------------------------- def create_list_window @list_window = Window_testleft.new @list_window.set_handler(:ok, method(:on_category_ok)) @list_window.set_handler(:cancel, method(:return_scene)) end #-------------------------------------------------------------------------- # ● 创建内容窗口 #-------------------------------------------------------------------------- def create_right_window @right_window = Window_testa.new end #-------------------------------------------------------------------------- # ● 选择完成类型 #-------------------------------------------------------------------------- def on_category_ok @list_window.activate # @list_window.select_last end #-------------------------------------------------------------------------- # ● 更新 #-------------------------------------------------------------------------- def update super create_right_window end end
class Testlist < Scene_Base
#--------------------------------------------------------------------------
# ● 场景开始
#--------------------------------------------------------------------------
def start
super
create_list_window
create_right_window
end
#--------------------------------------------------------------------------
# ● 创建列表
#--------------------------------------------------------------------------
def create_list_window
@list_window = Window_testleft.new
@list_window.set_handler(:ok, method(:on_category_ok))
@list_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# ● 创建内容窗口
#--------------------------------------------------------------------------
def create_right_window
@right_window = Window_testa.new
end
#--------------------------------------------------------------------------
# ● 选择完成类型
#--------------------------------------------------------------------------
def on_category_ok
@list_window.activate
# @list_window.select_last
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
super
create_right_window
end
end
|