| 赞 | 0 |
| VIP | 47 |
| 好人卡 | 14 |
| 积分 | 1 |
| 经验 | 6342 |
| 最后登录 | 2015-10-31 |
| 在线时间 | 466 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 466 小时
- 注册时间
- 2006-2-25
- 帖子
- 1863
|
- #==============================================================================
- # ■ Window_Command
- #------------------------------------------------------------------------------
- # 一般的命令选择行窗口。
- #==============================================================================
- class Window_Command < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # width : 窗口的宽
- # commands : 命令字符串序列
- #--------------------------------------------------------------------------
- def initialize(width, commands)
- # 由命令的个数计算出窗口的高
- super(0, 0, width, commands.size * 32 + 32)
- @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- # color : 文字色
- #--------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[index])
- end
- #--------------------------------------------------------------------------
- # ● 项目无效化
- # index : 项目编号
- #--------------------------------------------------------------------------
- def disable_item(index)
- draw_item(index, disabled_color)
- end
-
- def update_help
- @help_window.set_text("哈"*self.index,align=1)
- end
- end
复制代码
- class Scene_Test
- def main
- # 生成对象
- @command_window = Window_Command.new(160,["T1","T2","T3","T4"])
- @help_window = Window_Help.new
- @help_window.x = 160
- @help_window.width = 480
- # 设置关联
- @command_window.help_window = @help_window
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @command_window.dispose
- @help_window.dispose
- end
-
- def update
- @command_window.update
- @help_window.update
- end
- end
复制代码
复制第1个窗口完全覆盖掉原Window_Command脚本.
然后复制第2个脚本插到main前面
然后直接开个NPC.
选择脚本.
输入 $scene = Scene_Test.new 就可以了
PS:第1个修改的Window_Command脚本其实只加入了描绘帮助内容的方法而已{/gg} |
|