本帖最后由 j433463 于 2013-4-25 20:54 编辑
是想要加一个说明窗口吧?就像物品/技能菜单上方的说明窗口?
如果是的话,在 Scene_Menu 找到:
#-------------------------------------------------------------------------- # ● 开始处理 #-------------------------------------------------------------------------- def start super create_background create_gold_window create_coordinate_window create_command_window create_playtime_window create_mapname_window create_status_window end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_background
create_gold_window
create_coordinate_window
create_command_window
create_playtime_window
create_mapname_window
create_status_window
end
然后在 end 之前加上一行:
再找:
#-------------------------------------------------------------------------- # ● 指令“物品” #-------------------------------------------------------------------------- def command_item SceneManager.call(Scene_Item) end
#--------------------------------------------------------------------------
# ● 指令“物品”
#--------------------------------------------------------------------------
def command_item
SceneManager.call(Scene_Item)
end
在这上方加一段:
#-------------------------------------------------------------------------- # ● 生成说明视窗 #-------------------------------------------------------------------------- def create_help_window @help_window = Window_Help.new(1) @help_window.width = Graphics.width - @gold_window.width @help_window.x = @gold_window.width @help_window.y = Graphics.height - @gold_window.height @help_window.set_text("") end
#--------------------------------------------------------------------------
# ● 生成说明视窗
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_Help.new(1)
@help_window.width = Graphics.width - @gold_window.width
@help_window.x = @gold_window.width
@help_window.y = Graphics.height - @gold_window.height
@help_window.set_text("")
end
这样就会有一个说明窗口在金钱窗口右边了,但因为 Window_Help 预设是全屏宽,改小宽度后窗口右边会有一个小三角,不太好看,
您也可以另外加一个 Window_Help2 脚本:
#encoding:utf-8 #============================================================================== # ■ Window_Help2 #------------------------------------------------------------------------------ # 显示指定说明文字的视窗 #============================================================================== class Window_Help2 < Window_Base #-------------------------------------------------------------------------- # ● 初始化物件 #-------------------------------------------------------------------------- def initialize(line_number = 2) super(0, 0, window_width, fitting_height(line_number)) end #-------------------------------------------------------------------------- # ● 取得视窗的宽度 #-------------------------------------------------------------------------- def window_width return Graphics.width - 160 end #-------------------------------------------------------------------------- # ● 设定内容 #-------------------------------------------------------------------------- def set_text(text) if text != @text @text = text refresh end end #-------------------------------------------------------------------------- # ● 清除 #-------------------------------------------------------------------------- def clear set_text("") end #-------------------------------------------------------------------------- # ● 重新整理 #-------------------------------------------------------------------------- def refresh contents.clear draw_text_ex(4, 0, @text) end end
#encoding:utf-8
#==============================================================================
# ■ Window_Help2
#------------------------------------------------------------------------------
# 显示指定说明文字的视窗
#==============================================================================
class Window_Help2 < Window_Base
#--------------------------------------------------------------------------
# ● 初始化物件
#--------------------------------------------------------------------------
def initialize(line_number = 2)
super(0, 0, window_width, fitting_height(line_number))
end
#--------------------------------------------------------------------------
# ● 取得视窗的宽度
#--------------------------------------------------------------------------
def window_width
return Graphics.width - 160
end
#--------------------------------------------------------------------------
# ● 设定内容
#--------------------------------------------------------------------------
def set_text(text)
if text != @text
@text = text
refresh
end
end
#--------------------------------------------------------------------------
# ● 清除
#--------------------------------------------------------------------------
def clear
set_text("")
end
#--------------------------------------------------------------------------
# ● 重新整理
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_text_ex(4, 0, @text)
end
end
并且把原来的生成说明视窗中 Window_Help.new(1) 改成 Window_Help2.new(1)
这样,您在主菜单中就可以用
@help_window.set_text("要显示的说明文字")
@help_window.set_text("要显示的说明文字")
来控制窗口显示说明内容了,如果您是要显示一个变量的内容,"要显示的说明文字" 改为 $game_variables[变量编号] |