设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 878|回复: 1
打印 上一主题 下一主题

图标式战斗选单如何改为竖向?

 关闭 [复制链接]
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-12-20
帖子
7
跳转到指定楼层
1
发表于 2008-12-20 19:16:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽

Lv1.梦旅人

梦石
0
星屑
60
在线时间
9 小时
注册时间
2006-9-7
帖子
303
2
发表于 2008-12-20 19:21:25 | 只看该作者


  1. #==========================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==========================================================================

  4. module Momo_IconCommand
  5.   # 图标名称设定
  6.   ATTACK_ICON_NAME = "atk" # 攻撃
  7.   SKILL_ICON_NAME = "mag"   # 特技
  8.   GUARD_ICON_NAME = "def"  # 防御
  9.   ITEM_ICON_NAME = "itm"     # 物品
  10.   ESCAPE_ICON_NAME = "esc"   # 逃跑
  11.   # X坐标修正
  12.   X_PLUS = - 20
  13.   # Y坐标修正
  14.   Y_PLUS = - 280
  15.   # 选择时图标的动作
  16.   # 0:静止 1:放大
  17.   SELECT_TYPE = 0
  18.   # 闪烁时光芒的颜色
  19.   FLASH_COLOR = Color.new(255, 255, 255, 128)
  20.   # 闪烁时间
  21.   FLASH_DURATION = 10
  22.   # 闪烁间隔
  23.   FLASH_INTERVAL = 20
  24.   # 是否写出文字的名称
  25.   COM_NAME_DROW = false
  26.   # 文字名称是否移动
  27.   COM_NAME_MOVE = false
  28.   # 文字内容
  29.    ATTACK_NAME = ""   # 攻击
  30.    SKILL_NAME = ""    # 仙术
  31.    GUARD_NAME = ""    # 防御
  32.    ITEM_NAME = ""     #物品
  33.    ESCAPE_NAME = ""   #逃跑
  34.   # 文字颜色
  35.    COM_NAME_COLOR = Color.new(255, 255, 255, 255)
  36.   # 文字坐标修正
  37.    COM_NAME_X_PLUS = 0
  38.    COM_NAME_Y_PLUS = 0
  39. end


  40. class Window_CommandIcon < Window_Selectable
  41.   attr_accessor :last_index
  42.   #--------------------------------------------------------------------------
  43.   # ● オブジェクト初期化
  44.   #--------------------------------------------------------------------------
  45.   def initialize(x, y, commands)
  46.     super(x, y, 32, 32)
  47.     # ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
  48.     self.windowskin = RPG::Cache.windowskin("")
  49.     self.z = 9999
  50.    @item_max = commands.size #项目数
  51.    @commands = commands #指令数
  52.     @column_max = 1
  53.     @index = 0
  54.     @last_index = nil
  55.     @name_sprite = nil
  56.     @sprite = []
  57.     refresh
  58.   end
  59.   def dispose
  60.     super
  61.     for sprite in @sprite
  62.       sprite.dispose unless sprite.nil?
  63.     end
  64.     @name_sprite.dispose unless @name_sprite.nil?
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● リフレッシュ
  68.   #--------------------------------------------------------------------------
  69.   def refresh
  70.     @name_sprite.dispose unless @name_sprite.nil?
  71.     for sprite in @sprite
  72.       sprite.dispose unless sprite.nil?
  73.     end
  74.     @name_sprite = nil
  75.     draw_com_name if Momo_IconCommand::COM_NAME_DROW
  76.     @sprite = []
  77.     for i in 0...@item_max
  78.       draw_item(i)
  79.     end
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 項目の描画
  83.   #--------------------------------------------------------------------------
  84.   def draw_item(index)
  85.     @sprite[index] = Sprite_Icon.new(nil, @commands[index])
  86.     @sprite[index].z = self.z + 1
  87.   end
  88.   def draw_com_name
  89.     @name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
  90.    
  91.   end
  92.   
  93.   # 更新
  94.   def update
  95.     super
  96.     icon_update
  97.     com_name_update if Momo_IconCommand::COM_NAME_DROW
  98.     if move_index?
  99.       @last_index = self.index
  100.     end
  101.   end
  102.   # アイコンの更新
  103.   def icon_update
  104.     for i in [email protected]
  105.       @sprite[i].active = (self.index == i)
  106.       @sprite[i].x = self.x
  107.       @sprite[i].y = self.y + i*26
  108.       @sprite[i].z = (self.index == i) ? self.z + 2 : self.z + 1
  109.       @sprite[i].visible = self.visible
  110.       @sprite[i].update
  111.     end
  112.   end
  113.   # コマンドネームの更新
  114.   def com_name_update
  115.     if move_index?
  116.       @name_sprite.name = get_com_name
  117.     end
  118.     @name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
  119.     @name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
  120.     @name_sprite.z = self.z + 1
  121.     @name_sprite.active = self.active
  122.     @name_sprite.visible = self.visible
  123.     @name_sprite.update
  124.   end
  125.   def get_com_name
  126.     make_name_set if @name_set.nil?
  127.     name = @name_set[self.index]
  128.     name = "" if name.nil?
  129.     return name
  130.   end
  131.   def make_name_set
  132.     @name_set = []
  133.     @name_set[0] = Momo_IconCommand::ATTACK_NAME
  134.     @name_set[1] = Momo_IconCommand::SKILL_NAME
  135.     @name_set[2] = Momo_IconCommand::GUARD_NAME
  136.     @name_set[3] = Momo_IconCommand::ITEM_NAME
  137.     @name_set[4] = Momo_IconCommand::ESCAPE_ICON_NAME
  138.   end
  139.   def move_index?
  140.     return self.index != @last_index
  141.   end
  142.   def need_reset
  143.     @name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
  144.   end
  145. end




  146. # アイコン用スプライト
  147. class Sprite_Icon < Sprite
  148.   attr_accessor :active
  149.   attr_accessor :icon_name
  150.   #------------------------------------------------------------------------
  151.   # ● オブジェクト初期化
  152.   #------------------------------------------------------------------------
  153.   def initialize(viewport, icon_name)
  154.     super(viewport)
  155.     @icon_name = icon_name
  156.     @last_icon = @icon_name
  157.     @count = 0
  158.     self.bitmap = RPG::Cache.icon(@icon_name)
  159.     self.ox = self.bitmap.width / 2
  160.     self.oy = self.bitmap.height / 2
  161.     @active = false
  162.   end
  163.   #------------------------------------------------------------------------
  164.   # ● 解放
  165.   #------------------------------------------------------------------------
  166.   def dispose
  167.     if self.bitmap != nil
  168.       self.bitmap.dispose
  169.     end
  170.     super
  171.   end
  172.   #------------------------------------------------------------------------
  173.   # ● フレーム更新
  174.   #------------------------------------------------------------------------
  175.   def update
  176.     super
  177.     if @icon_name != @last_icon
  178.       @last_icon = @icon_name
  179.       self.bitmap = RPG::Cache.icon(@icon_name)
  180.     end
  181.     if @active
  182.       @count += 1
  183.       case Momo_IconCommand::SELECT_TYPE
  184.       when 0
  185.         icon_flash
  186.       when 1
  187.         icon_zoom
  188.       end
  189.       @count = 0 if @count == 20
  190.     else
  191.       icon_reset
  192.     end
  193.   end
  194.   def icon_flash
  195.     if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 2
  196.       self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
  197.     end
  198.   end
  199.   def icon_zoom
  200.     case @count
  201.     when 1..10
  202.       zoom = 1.0 + @count / 10.0
  203.     when 11..20
  204.       zoom = 2.0 - (@count - 10) / 10.0
  205.     end
  206.     self.zoom_x = zoom
  207.     self.zoom_y = zoom
  208.   end
  209.   def icon_reset
  210.     @count = 0
  211.     self.zoom_x = 1.0
  212.     self.zoom_y = 1.0
  213.   end
  214. end

  215. # コマンドネーム用スプライト
  216. class Sprite_Comm_Name < Sprite
  217.   attr_accessor :active
  218.   attr_accessor :name
  219.   attr_accessor :need_reset
  220.   #------------------------------------------------------------------------
  221.   # ● オブジェクト初期化
  222.   #------------------------------------------------------------------------
  223.   def initialize(viewport, name)
  224.     super(viewport)
  225.     @name = name
  226.     @last_name = nil
  227.     @count = 0
  228.     @x_plus = 0
  229.     @opa_plus = 0
  230.     @need_reset = false
  231.     @active = false
  232.     self.bitmap = Bitmap.new(160, 32)
  233.   end
  234.   #------------------------------------------------------------------------
  235.   # ● 解放
  236.   #------------------------------------------------------------------------
  237.   def dispose
  238.     if self.bitmap != nil
  239.       self.bitmap.dispose
  240.     end
  241.     super
  242.   end

  243.   #------------------------------------------------------------------------
  244.   # ● フレーム更新
  245.   #------------------------------------------------------------------------
  246.   def update
  247.     super
  248.     if @active
  249.       if need_reset?
  250.         @need_reset = false
  251.         @last_name = @name
  252.         text_reset
  253.       end
  254.       move_text if Momo_IconCommand::COM_NAME_MOVE
  255.     end
  256.   end
  257.   def move_text
  258.     @count += 1
  259.     @x_plus = [@count * 8, 80].min
  260.     self.x = self.x - 80 + @x_plus
  261.     self.opacity = @count * 25
  262.   end
  263.   def text_reset
  264.     @count = 0
  265.     @x_plus = 0
  266.     self.bitmap.clear
  267.     self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
  268.     self.bitmap.draw_text(0, 0, 160, 32, @name)
  269.   end
  270.   def need_reset?
  271.     return (@name != @last_name or @need_reset)
  272.   end
  273. end

  274. class Scene_Battle
  275.   #------------------------------------------------------------------------
  276.   # ● プレバトルフェーズ開始
  277.   #------------------------------------------------------------------------
  278.   alias scene_battle_icon_command_start_phase1 start_phase1
  279.   def start_phase1
  280.     com1 = Momo_IconCommand::ATTACK_ICON_NAME
  281.     com2 = Momo_IconCommand::SKILL_ICON_NAME
  282.     com3 = Momo_IconCommand::GUARD_ICON_NAME
  283.     com4 = Momo_IconCommand::ITEM_ICON_NAME
  284.     com5 = Momo_IconCommand::ESCAPE_ICON_NAME
  285.     @actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4, com5])
  286.     @actor_command_window.y = 128
  287.     @actor_command_window.back_opacity = 160
  288.     @actor_command_window.active = false
  289.     @actor_command_window.visible = false
  290.     @actor_command_window.update
  291.     scene_battle_icon_command_start_phase1
  292.   end
  293.   #------------------------------------------------------------------------
  294.   # ● アクターコマンドウィンドウのセットアップ
  295.   #------------------------------------------------------------------------
  296.   alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
  297.   def phase3_setup_command_window
  298.     scene_battle_icon_command_phase3_setup_command_window
  299.     # アクターコマンドウィンドウの位置を設定
  300.     @actor_command_window.x = command_window_actor_x(@actor_index)
  301.     @actor_command_window.y = command_window_actor_y(@actor_index)
  302.     @actor_command_window.need_reset
  303.   end
  304.   def command_window_actor_x(index)
  305.     $game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
  306.   end
  307.   def command_window_actor_y(index)
  308.     $game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
  309.   end
  310. end
  311. #==========================================================================
  312. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  313. #==========================================================================

复制代码

系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
十年磨一剑,蓦然回首,年华如水,青春如歌。
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-1-20 07:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表