赞 | 0 |
VIP | 3 |
好人卡 | 7 |
积分 | 7 |
经验 | 34794 |
最后登录 | 2024-2-21 |
在线时间 | 684 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 719
- 在线时间
- 684 小时
- 注册时间
- 2009-5-29
- 帖子
- 461
|
6楼
楼主 |
发表于 2012-3-29 11:23:03
|
只看该作者
@hcm
其实后面两个空白位是有人的,但是描绘不出来,光标可以移动,求解……
附上脚本:- #encoding:utf-8
- #==============================================================================
- # ■ Window_MenuStatus
- #------------------------------------------------------------------------------
- # 菜单画面中,显示队伍成员状态的窗口
- #==============================================================================
- class Window_MenuStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :pending_index # 保留位置(整队用)
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, window_width, window_height)
- @pending_index = -1
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 获取一页內显示的行数
- #--------------------------------------------------------------------------
- def page_row_max
- 1
- end
- #--------------------------------------------------------------------------
- # ● 获取行数
- #--------------------------------------------------------------------------
- def row_max
- 1
- end
- #--------------------------------------------------------------------------
- # ● 获取窗口的宽度
- #--------------------------------------------------------------------------
- def window_width
- Graphics.width
- end
- #--------------------------------------------------------------------------
- # ● 获取窗口的高度
- #--------------------------------------------------------------------------
- def window_height
- Graphics.height - 96
- end
- #--------------------------------------------------------------------------
- # ● 获取项目数
- #--------------------------------------------------------------------------
- def item_max
- $game_party.members.size
- end
- def col_max
- 4
- end
- #--------------------------------------------------------------------------
- # ● 获取项目的绘制矩形
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new
- rect.width = item_width
- rect.height = item_height
- rect.x = index * (item_width + spacing)
- rect.y = index / item_max * item_height
- rect
- end
- #--------------------------------------------------------------------------
- # ● 获取项目的高度
- #--------------------------------------------------------------------------
- def item_height
- Graphics.height - 120
- end
- #--------------------------------------------------------------------------
- # ● 绘制项目
- #--------------------------------------------------------------------------
- def draw_item(index)
- actor = $game_party.members[index]
- enabled = $game_party.battle_members.include?(actor)
- rect = item_rect(index)
- draw_item_background(index)
- draw_actor_name_ms(actor, rect.x + 1, rect.y + 1)
- change_color(system_color)
- contents.fill_rect(rect.x, rect.y + 35, 120, 2, line_color)
- contents.fill_rect(rect.x, rect.y + 203, 120, 2, line_color)
- contents.fill_rect(rect.x, rect.y + 349, 120, 2, line_color)
- change_color(normal_color)
- draw_actor_class_ms(actor, rect.x + 1, rect.y + 48)
- draw_actor_face(actor, rect.x + 12, rect.y + 84, enabled)
- draw_actor_simple_status_2(actor, rect.x + 1, rect.y + 216)
- end
- #--------------------------------------------------------------------------
- # ● 获取水平线的颜色
- #--------------------------------------------------------------------------
- def line_color
- color = normal_color
- color.alpha = 48
- color
- end
- #--------------------------------------------------------------------------
- # ● 绘制简单的状态
- #--------------------------------------------------------------------------
- def draw_actor_simple_status_2(actor, x, y)
- draw_actor_level_ms(actor, x , y)
- draw_actor_icons(actor, x, y + line_height * 1, width =120)
- draw_actor_hp(actor, x, y + line_height * 2, width = 120)
- draw_actor_mp(actor, x, y + line_height * 3, width = 120)
- draw_exp_ms(actor, x, y + line_height * 4, width = 120)
- end
- #--------------------------------------------------------------------------
- # ● 経験値情報の描画
- #--------------------------------------------------------------------------
- def draw_exp_ms(actor, x, y, width)
- s_next = sprintf(Vocab::ExpNext, Vocab::level)
- change_color(normal_color)
- draw_actor_exp_gauge(actor, x, y, width)
- change_color(system_color)
- draw_text(x, y + line_height * 0, width, line_height, s_next)
- change_color(normal_color)
- draw_text(x, y + line_height * 0, width, line_height, (actor.exp_rate * 100).round.to_s + "%", 2)
- end
- #--------------------------------------------------------------------------
- # ● 绘制项目的背景
- #--------------------------------------------------------------------------
- def draw_item_background(index)
- if index == @pending_index
- contents.fill_rect(item_rect(index), pending_color)
- end
- end
- #--------------------------------------------------------------------------
- # ● 按下确定键时的处理
- #--------------------------------------------------------------------------
- def process_ok
- super
- $game_party.menu_actor = $game_party.members[index]
- end
- #--------------------------------------------------------------------------
- # ● 返回上一个选择的位置
- #--------------------------------------------------------------------------
- def select_last
- select($game_party.menu_actor.index || 0)
- end
- #--------------------------------------------------------------------------
- # ● 设置保留位置(整队用)
- #--------------------------------------------------------------------------
- def pending_index=(index)
- last_pending_index = @pending_index
- @pending_index = index
- redraw_item(@pending_index)
- redraw_item(last_pending_index)
- end
- #--------------------------------------------------------------------------
- # ● 绘制名字
- #--------------------------------------------------------------------------
- def draw_actor_name_ms(actor, x, y, width = 120)
- change_color(hp_color(actor))
- draw_text(x, y, width, line_height, actor.name, 1)
- end
- #--------------------------------------------------------------------------
- # ● 绘制职业
- #--------------------------------------------------------------------------
- def draw_actor_class_ms(actor, x, y, width = 120)
- change_color(normal_color)
- draw_text(x, y, width, line_height, actor.class.name, 1)
- end
- #--------------------------------------------------------------------------
- # ● 绘制等级
- #--------------------------------------------------------------------------
- def draw_actor_level_ms(actor, x, y)
- change_color(system_color)
- draw_text(x, y, 32, line_height, Vocab::level_a)
- change_color(normal_color)
- draw_text(x + 32, y, 88, line_height, actor.level, 2)
- end
-
- #--------------------------------------------------------------------------
- # ● 光标向下移动
- #--------------------------------------------------------------------------
- def cursor_down(wrap = false)
- if index < item_max - 1
- select(index + 1)
- else
- select(0)
- end
- end
- #--------------------------------------------------------------------------
- # ● 光标向上移动
- #--------------------------------------------------------------------------
- def cursor_up(wrap = false)
- if index == 0
- select(item_max - 1)
- else
- select(index - 1)
- end
- end
- #--------------------------------------------------------------------------
- # ● 光标向右移动
- #--------------------------------------------------------------------------
- def cursor_right(wrap = false)
- if index < item_max - 1
- select(index + 1)
- else
- select(0)
- end
- end
- #--------------------------------------------------------------------------
- # ● 光标向左移动
- #--------------------------------------------------------------------------
- def cursor_left(wrap = false)
- if index == 0
- select(item_max - 1)
- else
- select(index - 1)
- end
- end
- #--------------------------------------------------------------------------
- # ● 光标移至下一页
- #--------------------------------------------------------------------------
- def cursor_pagedown
- if top_row + page_row_max < row_max
- self.top_row += page_row_max
- select([@index + page_item_max, item_max - 1].min)
- end
- end
- #--------------------------------------------------------------------------
- # ● 光标移至上一页
- #--------------------------------------------------------------------------
- def cursor_pageup
- if top_row > 0
- self.top_row -= page_row_max
- select([@index - page_item_max, 0].max)
- end
- end
- #===============================================================================
- #--------------------------------------------------------------------------
- # ● 获取当前行
- #--------------------------------------------------------------------------
- def col
- index
- end
- #--------------------------------------------------------------------------
- # ● 获取顶行位置
- #--------------------------------------------------------------------------
- def top_col
- ox / item_width
- end
- #--------------------------------------------------------------------------
- # ● 设置顶行位置
- #--------------------------------------------------------------------------
- def top_col=(col)
- col = 0 if col < 0
- col = col_max - 1 if col > col_max - 1
- self.ox = col * (item_width + spacing)
- end
- #--------------------------------------------------------------------------
- # ● 获取末行位置
- #--------------------------------------------------------------------------
- def bottom_col
- top_col + 3
- end
- #--------------------------------------------------------------------------
- # ● 设置末行位置
- #--------------------------------------------------------------------------
- def bottom_col=(col)
- self.top_col = col - 3
- end
- #--------------------------------------------------------------------------
- # ● 确保光标在画面范围内滚动
- #--------------------------------------------------------------------------
- def ensure_cursor_visible
- self.top_col = col if col < top_col
- self.bottom_col = col if col > bottom_col
- end
- end
复制代码 |
|