这个类基本是重写的,要改只能自己改。
试着写了一段,尚未测试,LZ可以试试。
class Window_NameInput ITEM_MAX = 80 # 项目数 自己根据表里的项目数量修改 # 以下部分请不要修改 OK_INDEX = ITEM_MAX - 1 CHANGE_INDEX = ITEM_MAX - 2 #-------------------------------------------------------------------------- # ● 获取文字 #-------------------------------------------------------------------------- def character @index < CHANGE_INDEX ? table[@page][@index] : "" end #-------------------------------------------------------------------------- # ● 判定光标位置是否在“切换”上(平假/片假) #-------------------------------------------------------------------------- def is_page_change? @index == CHANGE_INDEX end #-------------------------------------------------------------------------- # ● 判定光标位置是否在“确定”上 #-------------------------------------------------------------------------- def is_ok? @index == OK_INDEX end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh contents.clear change_color(normal_color) ITEM_MAX.times {|i| draw_text(item_rect(i), table[@page][i], 1) } end #-------------------------------------------------------------------------- # ● 光标向下移动 # wrap : 允许循环 #-------------------------------------------------------------------------- def cursor_down(wrap) if @index < ITEM_MAX - 10 or wrap @index = (index + 10) % ITEM_MAX end end #-------------------------------------------------------------------------- # ● 光标向上移动 # wrap : 允许循环 #-------------------------------------------------------------------------- def cursor_up(wrap) if @index >= 10 or wrap @index = (index + ITEM_MAX - 10) % ITEM_MAX end end #-------------------------------------------------------------------------- # ● 光标向右移动 # wrap : 允许循环 #-------------------------------------------------------------------------- def cursor_right(wrap) if @index % 10 < ITEM_MAX / 10 @index += 1 elsif wrap @index -= 9 end end #-------------------------------------------------------------------------- # ● 跳转“确定” #-------------------------------------------------------------------------- def process_jump if @index != OK_INDEX @index = OK_INDEX Sound.play_cursor end end end
class Window_NameInput
ITEM_MAX = 80 # 项目数 自己根据表里的项目数量修改
# 以下部分请不要修改
OK_INDEX = ITEM_MAX - 1
CHANGE_INDEX = ITEM_MAX - 2
#--------------------------------------------------------------------------
# ● 获取文字
#--------------------------------------------------------------------------
def character
@index < CHANGE_INDEX ? table[@page][@index] : ""
end
#--------------------------------------------------------------------------
# ● 判定光标位置是否在“切换”上(平假/片假)
#--------------------------------------------------------------------------
def is_page_change?
@index == CHANGE_INDEX
end
#--------------------------------------------------------------------------
# ● 判定光标位置是否在“确定”上
#--------------------------------------------------------------------------
def is_ok?
@index == OK_INDEX
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
change_color(normal_color)
ITEM_MAX.times {|i| draw_text(item_rect(i), table[@page][i], 1) }
end
#--------------------------------------------------------------------------
# ● 光标向下移动
# wrap : 允许循环
#--------------------------------------------------------------------------
def cursor_down(wrap)
if @index < ITEM_MAX - 10 or wrap
@index = (index + 10) % ITEM_MAX
end
end
#--------------------------------------------------------------------------
# ● 光标向上移动
# wrap : 允许循环
#--------------------------------------------------------------------------
def cursor_up(wrap)
if @index >= 10 or wrap
@index = (index + ITEM_MAX - 10) % ITEM_MAX
end
end
#--------------------------------------------------------------------------
# ● 光标向右移动
# wrap : 允许循环
#--------------------------------------------------------------------------
def cursor_right(wrap)
if @index % 10 < ITEM_MAX / 10
@index += 1
elsif wrap
@index -= 9
end
end
#--------------------------------------------------------------------------
# ● 跳转“确定”
#--------------------------------------------------------------------------
def process_jump
if @index != OK_INDEX
@index = OK_INDEX
Sound.play_cursor
end
end
end
|