赞 | 1 |
VIP | 0 |
好人卡 | 0 |
积分 | 2 |
经验 | 3518 |
最后登录 | 2020-12-28 |
在线时间 | 78 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 152
- 在线时间
- 78 小时
- 注册时间
- 2012-8-16
- 帖子
- 44
|
3楼
楼主 |
发表于 2017-7-15 10:08:58
|
只看该作者
- class Window_MenuCommand < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # width : 窗口的宽
- # commands : 命令字符串序列
- #--------------------------------------------------------------------------
- def initialize(commands,height)
- super(0, 0, 356,height)
- @item_max = commands.size
- @column_max = 9
- @commands = commands
- @can_look = [8,0,1]
- self.contents = Bitmap.new( @item_max * 90,height - 32)
- self.index = 0
- end
- #---------------------------------------------------------------------------
- # ● 删除光标
- #---------------------------------------------------------------------------
- def update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @can_look[0] = self.index
- @can_look[0] -= 1
- @can_look[0] %= 9
- @can_look[1] = self.index
- @can_look[2] = self.index
- @can_look[2] += 1
- @can_look[2] %= 9
- for i in 0..@item_max
- choose_color = Color.new(100, 0, 0, 255)
- draw_item(i, normal_color, choose_color)
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- # color : 文字色
- #--------------------------------------------------------------------------
- def draw_item(index, color,color_choose)
- for c in @can_look
- if c == self.index
- self.contents.font.color = color_choose
- self.contents.font.size = 25
- else
- self.contents.font.color = color
- self.contents.font.size = 15
- end
- b = @can_look.index(c)
- rect = Rect.new(122 * b,4, 80, self.contents.height - 8)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[c],1)
- end
- end
- #--------------------------------------------------------------------------
- # ● 项目无效化
- # index : 项目编号
- #--------------------------------------------------------------------------
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- update_my
- # 可以移动光标的情况下
- if self.active and @item_max > 0 and @index >= 0
- # 方向键右被按下的情况下
- if Input.repeat?(Input::RIGHT)
- # 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
- if @column_max >= 2 and @index < @item_max - 1
- # 光标向右移动
- $game_system.se_play($data_system.cursor_se)
- @index += 1
- #===================
- elsif @column_max >= 2 and @index + 1 == @item_max
- @index = 0
- #===================
- end
- end
- # 方向键左被按下的情况下
- if Input.repeat?(Input::LEFT)
- # 列数为 2 以上并且、光标位置在 0 之后的情况下
- if @column_max >= 2 and @index > 0
- # 光标向左移动
- $game_system.se_play($data_system.cursor_se)
- @index -= 1
- #===================
- elsif @column_max >= 2 and @index + 1 == 1
- @index = @item_max - 1
- #===================
- end
- end
- end
- # 刷新帮助文本 (update_help 定义了继承目标)
- if self.active and @help_window != nil
- update_help
- end
- end
- end
复制代码
脚本发上来了,请各位轻喷 |
|