#============================================================================== # ■ Window_Character #------------------------------------------------------------------------------ # 角色索引窗口 #============================================================================== class Window_Character < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- def initialize super(0, 133, 800, 480)#(160, 84, 385, 480) self.contents = Bitmap.new(width - 32, height - 32) self.z += 10 self.opacity = HS::OPACITY # self.contents.font.size = 20 @item_max = $game_party.actors.size # @column_max = $game_party.actors.size @column_max = 4 refresh end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...$game_party.actors.size x =130 + i % 4 * (53 + 32) # 根据包裹坐标修改过来的 y = 44 + i / 4 * 128 actor = $game_party.actors[i] bitmap = Bitmap.new ("Graphics/Status/" + actor.id. to_s + "_h") #RPG::Cache.character(actor.character_name, actor.character_hue) cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch + 50) self.contents.blt(x - ch , y - cw/ 2, bitmap, src_rect) end end #-------------------------------------------------------------------------- # ● 刷新光标矩形 #-------------------------------------------------------------------------- def update_cursor_rect # 光标位置不满 0 的情况下 if @index <= - 1 self.cursor_rect.empty return end # 获取当前的行 row = @index / @column_max # 当前行被显示开头行前面的情况下 if row < self.top_row # 从当前行向开头行滚动 self.top_row = row end # 当前行被显示末尾行之后的情况下 if row > self.top_row + (self.page_row_max - 1) # 从当前行向末尾滚动 self.top_row = row - (self.page_row_max - 1) end # 计算光标的宽 cursor_width = 86 #cursor_width = 536 / (@column_max + 1) + 1 #光标大小 # 计算光标坐标 x = 1 + @index % @column_max * (cursor_width - 1) - 6#光标位置调节 覆盖31行 y = @index / @column_max * 128 - self.oy - 3 # 更新国标矩形 self.cursor_rect.set(x+14, y+3, cursor_width, 123)#(x, y, cursor_width, 32) refresh draw_status end end def draw_status actor = $game_party.actors[@index] bitmap = Bitmap.new ("Graphics/Status/" + actor.id. to_s + "_b") src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) self.contents.blt(365 , 0, bitmap, src_rect,200) end
立绘.jpg (119.14 KB, 下载次数: 21)
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |