查看: 2817|回复: 2

[已经解决] 加入立绘后玩一会儿就自动退出游戏

[复制链接]
梦石
0
星屑
7296
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
发表于 2016-3-2 07:46:41 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
[pre lang="ruby"]#==============================================================================
# ■ 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
    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
[/pre]
立绘.jpg

评分

参与人数 1星屑 +35 收起 理由
RyanBern + 35 手动认可奖励

查看全部评分

梦石
0
星屑
9716
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

发表于 2016-3-2 22:56:44 | 显示全部楼层
本帖最后由 cinderelmini 于 2016-3-2 22:58 编辑
  1. #==============================================================================
  2. # ■ Window_Character
  3. #------------------------------------------------------------------------------
  4. #  角色索引窗口
  5. #==============================================================================

  6. class Window_Character < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(0, 133, 800, 480)#(160, 84, 385, 480)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     self.z += 10
  14.     self.opacity = HS::OPACITY
  15. #    self.contents.font.size = 20
  16.     @item_max = $game_party.actors.size
  17.    # @column_max = $game_party.actors.size
  18.     @column_max = 4
  19.     @old_index = self.index
  20.     refresh
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 刷新
  24.   #--------------------------------------------------------------------------
  25.   def refresh
  26.     self.contents.clear
  27.     for i in 0...$game_party.actors.size
  28.       x = 130 + i % 4 * (53 + 32)  # 根据包裹坐标修改过来的
  29.       y = 44 +  i / 4 * 128
  30.       actor = $game_party.actors[i]
  31.       bitmap = Bitmap.new ("Graphics/Status/" + actor.id. to_s + "_h") #RPG::Cache.character(actor.character_name, actor.character_hue)
  32.       cw = bitmap.width
  33.       ch = bitmap.height
  34.       src_rect = Rect.new(0, 0, cw, ch + 50)
  35.       self.contents.blt(x - ch , y - cw/ 2, bitmap, src_rect)
  36.     end
  37.     draw_status
  38.     @old_index = self.index
  39.   end
  40.   
  41.   #--------------------------------------------------------------------------
  42.   # ● 描绘半身像
  43.   #--------------------------------------------------------------------------
  44.   def draw_status
  45.     actor = $game_party.actors[@index]
  46.     bitmap = Bitmap.new ("Graphics/Status/" + actor.id. to_s + "_b")
  47.     src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  48.     self.contents.blt(365 , 0, bitmap, src_rect,200)
  49.   end
  50.   
  51.   #--------------------------------------------------------------------------
  52.   # ● 刷新光标矩形
  53.   #--------------------------------------------------------------------------
  54.   def update_cursor_rect
  55.     # 光标位置不满 0 的情况下
  56.     if @index <= - 1
  57.       self.cursor_rect.empty
  58.       return
  59.     end
  60.     # 获取当前的行
  61.     row = @index / @column_max
  62.     # 当前行被显示开头行前面的情况下
  63.     if row < self.top_row
  64.       # 从当前行向开头行滚动
  65.       self.top_row = row
  66.    end
  67.     # 当前行被显示末尾行之后的情况下
  68.     if row > self.top_row + (self.page_row_max - 1)
  69.       # 从当前行向末尾滚动
  70.       self.top_row = row - (self.page_row_max - 1)
  71.     end
  72.     # 计算光标的宽
  73.     cursor_width = 86
  74.     #cursor_width = 536 / (@column_max + 1) + 1  #光标大小
  75.     # 计算光标坐标

  76.     x = 1 + @index % @column_max * (cursor_width - 1) - 6#光标位置调节 覆盖31行
  77.     y = @index / @column_max * 128 - self.oy - 3
  78.     # 更新国标矩形
  79.     self.cursor_rect.set(x+14, y+3, cursor_width, 123)#(x, y, cursor_width, 32)
  80.    
  81.     refresh if @old_index != self.index
  82.   end

  83. end
复制代码

评分

参与人数 1梦石 +1 收起 理由
RyanBern + 1 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
7296
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
 楼主| 发表于 2016-3-3 08:52:29 | 显示全部楼层
cinderelmini 发表于 2016-3-2 22:56

工程巨大感谢有你
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部