Project1

标题: 游戏菜单窗口 [打印本页]

作者: 败笔    时间: 2007-8-2 01:53
标题: 游戏菜单窗口
我使用的是轩辕的美化菜单系统:以下发一段脚本(经过大量修改.)求各位高手们帮小弟再修改下,修改成当选择了某角色后才显示角色的头像和HP,SP,要没选择那就隐藏或透明掉.
脚本:
  1. #==============================================================================
  2. # ■ Window_MenuStatus
  3. #------------------------------------------------------------------------------
  4. #  显示菜单画面和同伴状态的窗口。
  5. #==============================================================================

  6. class Window_MenuStatus < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化目标
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(0, 0, 160, 352)#(0, 0, 160, 352)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     refresh
  14.     self.active = false
  15.     self.index = -2
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # ● 刷新
  19.   #--------------------------------------------------------------------------
  20.   def refresh
  21.     self.contents.clear
  22.     @item_max = $game_party.actors.size
  23.     for i in 0...$game_party.actors.size
  24.       x = 30#64
  25.       y = 0#i * 160#80
  26.       actor = $game_party.actors[i]
  27.       bitmap = Bitmap.new("Graphics/System/menu/headp/" + actor.name + ".png")
  28.       #头像大小
  29.       src_rect = Rect.new(0, 0, 500, 500)#(0, 0, 42, 66)
  30.       self.contents.blt(x - 30, y + 10, bitmap, src_rect)#(x - 64, y + 10, bitmap, src_rect)
  31.       self.draw_actor_state(actor, x - 60, y + 34 + 17)#(actor, x - 60, y + 34 + 17)
  32.       # 我全写成散的!                  =。=
  33.       self.contents.font.color = normal_color
  34.       self.contents.font.size = 20#字体大小
  35.       #角色名坐标
  36.       self.contents.draw_text(x - 130, y, 120, 300, actor.name)#(x - 30, y, 120, 32, actor.name)
  37.       self.contents.font.color = system_color
  38.       self.contents.font.color = normal_color
  39.       self.contents.font.size = 18#16字体大小
  40.       self.contents.font.color = system_color
  41.       #HP坐标
  42.       self.contents.draw_text(x - 30, y + 535 + 17 , 32, 32, $data_system.words.hp)#(x - 30, y + 17 + 17, 32, 32, $data_system.words.hp)
  43.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  44.         actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  45.       self.contents.draw_text(x + 6, y + 135 + 17 +13, 32, 32, actor.hp.to_s, 2)#(x - 6, y + 17 + 17, 32, 32, actor.hp.to_s, 2)
  46.       self.contents.font.color = normal_color
  47.       self.contents.draw_text(x - 0 + 40, y + 135 + 17 +13, 12, 32, "/", 1)#(x - 26 + 48, y + 17 + 17, 12, 32, "/", 1)
  48.    
  49.       self.contents.draw_text(x + 0 + 56, y + 135 + 17 +13, 32, 32, actor.maxhp.to_s)
  50.       self.contents.font.color = system_color
  51.       #SP坐标
  52.       self.contents.draw_text(x - 30, y + 550 +17, 32, 32, $data_system.words.sp)#(x - 30, y + 34 +17, 32, 32, $data_system.words.sp)
  53.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  54.         actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  55.       self.contents.draw_text(x + 6, y + 150 + 17 +13, 32, 32, actor.sp.to_s, 2)#(x - 6, y + 34 + 17, 32, 32, actor.sp.to_s, 2)
  56.       self.contents.font.color = normal_color
  57.       self.contents.draw_text(x - 6 + 48, y + 150 + 17 +13, 12, 32, "/", 1)#(x - 26 + 48, y + 34 + 17, 12, 32, "/", 1)
  58.       self.contents.draw_text(x + 2 + 56, y + 150 + 17 +13, 32, 32, actor.maxsp.to_s)#(x - 24 + 56, y + 34 + 17, 32, 32, actor.maxsp.to_s)
  59.     end
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ● 刷新光标矩形
  63.   #--------------------------------------------------------------------------
  64.   def update_cursor_rect
  65.     if @index <= -2
  66.       self.cursor_rect.empty
  67.     elsif @index == -1
  68.       self.cursor_rect.set(50, 0, self.width - 32, @item_max * 80)#(0, 0, self.width - 32, @item_max * 80)
  69.     else
  70.       self.cursor_rect.set(0, 0, 0, 0)#(0, @index * 80, self.width - 32, 80)
  71.     end
  72.   end
  73. end
复制代码


载图

作者: 败笔    时间: 2007-8-2 01:53
标题: 游戏菜单窗口
我使用的是轩辕的美化菜单系统:以下发一段脚本(经过大量修改.)求各位高手们帮小弟再修改下,修改成当选择了某角色后才显示角色的头像和HP,SP,要没选择那就隐藏或透明掉.
脚本:
  1. #==============================================================================
  2. # ■ Window_MenuStatus
  3. #------------------------------------------------------------------------------
  4. #  显示菜单画面和同伴状态的窗口。
  5. #==============================================================================

  6. class Window_MenuStatus < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化目标
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(0, 0, 160, 352)#(0, 0, 160, 352)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     refresh
  14.     self.active = false
  15.     self.index = -2
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # ● 刷新
  19.   #--------------------------------------------------------------------------
  20.   def refresh
  21.     self.contents.clear
  22.     @item_max = $game_party.actors.size
  23.     for i in 0...$game_party.actors.size
  24.       x = 30#64
  25.       y = 0#i * 160#80
  26.       actor = $game_party.actors[i]
  27.       bitmap = Bitmap.new("Graphics/System/menu/headp/" + actor.name + ".png")
  28.       #头像大小
  29.       src_rect = Rect.new(0, 0, 500, 500)#(0, 0, 42, 66)
  30.       self.contents.blt(x - 30, y + 10, bitmap, src_rect)#(x - 64, y + 10, bitmap, src_rect)
  31.       self.draw_actor_state(actor, x - 60, y + 34 + 17)#(actor, x - 60, y + 34 + 17)
  32.       # 我全写成散的!                  =。=
  33.       self.contents.font.color = normal_color
  34.       self.contents.font.size = 20#字体大小
  35.       #角色名坐标
  36.       self.contents.draw_text(x - 130, y, 120, 300, actor.name)#(x - 30, y, 120, 32, actor.name)
  37.       self.contents.font.color = system_color
  38.       self.contents.font.color = normal_color
  39.       self.contents.font.size = 18#16字体大小
  40.       self.contents.font.color = system_color
  41.       #HP坐标
  42.       self.contents.draw_text(x - 30, y + 535 + 17 , 32, 32, $data_system.words.hp)#(x - 30, y + 17 + 17, 32, 32, $data_system.words.hp)
  43.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  44.         actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  45.       self.contents.draw_text(x + 6, y + 135 + 17 +13, 32, 32, actor.hp.to_s, 2)#(x - 6, y + 17 + 17, 32, 32, actor.hp.to_s, 2)
  46.       self.contents.font.color = normal_color
  47.       self.contents.draw_text(x - 0 + 40, y + 135 + 17 +13, 12, 32, "/", 1)#(x - 26 + 48, y + 17 + 17, 12, 32, "/", 1)
  48.    
  49.       self.contents.draw_text(x + 0 + 56, y + 135 + 17 +13, 32, 32, actor.maxhp.to_s)
  50.       self.contents.font.color = system_color
  51.       #SP坐标
  52.       self.contents.draw_text(x - 30, y + 550 +17, 32, 32, $data_system.words.sp)#(x - 30, y + 34 +17, 32, 32, $data_system.words.sp)
  53.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  54.         actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  55.       self.contents.draw_text(x + 6, y + 150 + 17 +13, 32, 32, actor.sp.to_s, 2)#(x - 6, y + 34 + 17, 32, 32, actor.sp.to_s, 2)
  56.       self.contents.font.color = normal_color
  57.       self.contents.draw_text(x - 6 + 48, y + 150 + 17 +13, 12, 32, "/", 1)#(x - 26 + 48, y + 34 + 17, 12, 32, "/", 1)
  58.       self.contents.draw_text(x + 2 + 56, y + 150 + 17 +13, 32, 32, actor.maxsp.to_s)#(x - 24 + 56, y + 34 + 17, 32, 32, actor.maxsp.to_s)
  59.     end
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ● 刷新光标矩形
  63.   #--------------------------------------------------------------------------
  64.   def update_cursor_rect
  65.     if @index <= -2
  66.       self.cursor_rect.empty
  67.     elsif @index == -1
  68.       self.cursor_rect.set(50, 0, self.width - 32, @item_max * 80)#(0, 0, self.width - 32, @item_max * 80)
  69.     else
  70.       self.cursor_rect.set(0, 0, 0, 0)#(0, @index * 80, self.width - 32, 80)
  71.     end
  72.   end
  73. end
复制代码


载图





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1