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

Project1

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

[已经过期] 指令图标化案件修改

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2263
在线时间
176 小时
注册时间
2018-5-11
帖子
144
跳转到指定楼层
1
发表于 2020-9-6 19:57:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我用的是这个脚本,能不能把按左按右修改选项改为按上按下修改选项呢?
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5. module Momo_IconCommand
  6.   # 图标名称设定
  7.   ATTACK_ICON_NAME = "攻击" # 攻撃
  8.   SKILL_ICON_NAME = "技能"   # 特技
  9.   GUARD_ICON_NAME = "防御"  # 防御
  10.   ITEM_ICON_NAME = "物品"     # 物品
  11.   ESCAPE_ICON_NAME = "逃跑"  # 逃跑
  12.   # X坐标修正
  13.   X_PLUS = 20#-120
  14.   # Y坐标修正
  15.   Y_PLUS = -60#10
  16.   # 选择时图标的动作
  17.   # 0:静止 1:放大
  18.   SELECT_TYPE = 0
  19.   # 闪烁时光芒的颜色
  20.   FLASH_COLOR = Color.new(255, 255, 255, 128)
  21.   # 闪烁时间
  22.   FLASH_DURATION = 10
  23.   # 闪烁间隔
  24.   FLASH_INTERVAL = 20
  25.   # 是否写出文字的名称
  26.   COM_NAME_DROW = true
  27.   # 文字名称是否移动
  28.   COM_NAME_MOVE = true
  29.   # 文字内容
  30.   ATTACK_NAME = "攻击"    # 攻击
  31.   SKILL_NAME = "特技"   # 特技
  32.   GUARD_NAME = "防御"     # 防御
  33.   ITEM_NAME = "物品"  # 物品
  34.   ESCAPE_NAME = "逃跑"  # 逃跑
  35.   # 文字颜色
  36.   COM_NAME_COLOR = Color.new(255, 255, 255, 255)
  37.   # 文字坐标修正
  38.   COM_NAME_X_PLUS = 0
  39.   COM_NAME_Y_PLUS = 0
  40. end
  41.  
  42. class Window_CommandIcon < Window_Selectable
  43.   attr_accessor :last_index
  44.   #--------------------------------------------------------------------------
  45.   # ● オブジェクト初期化
  46.   #--------------------------------------------------------------------------
  47.   def initialize(x, y, commands)
  48.     super(x, y, 32, 32)
  49.     # ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
  50.     self.windowskin = RPG::Cache.windowskin("")
  51.     @item_max = commands.size
  52.     @commands = commands
  53.     @column_max = commands.size
  54.     @index = 0
  55.     @last_index = nil
  56.     @name_sprite = nil
  57.     @sprite = []
  58.     refresh
  59.   end
  60.   def dispose
  61.     super
  62.     for sprite in @sprite
  63.       sprite.dispose unless sprite.nil?
  64.     end
  65.     @name_sprite.dispose unless @name_sprite.nil?
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # ● リフレッシュ
  69.   #--------------------------------------------------------------------------
  70.   def refresh
  71.     @name_sprite.dispose unless @name_sprite.nil?
  72.     for sprite in @sprite
  73.       sprite.dispose unless sprite.nil?
  74.     end
  75.     @name_sprite = nil
  76.     draw_com_name if Momo_IconCommand::COM_NAME_DROW
  77.     @sprite = []
  78.     for i in 0...@item_max
  79.       draw_item(i)
  80.     end
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 項目の描画
  84.   #--------------------------------------------------------------------------
  85.   def draw_item(index)
  86.     @sprite[index] = Sprite_Icon.new(nil, @commands[index])
  87.     @sprite[index].z = self.z + 100##########################
  88.   end
  89.   def draw_com_name
  90.     @name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
  91.  
  92.   end
  93.  
  94.   # 更新
  95.   def update
  96.     super
  97.     icon_update
  98.     com_name_update if Momo_IconCommand::COM_NAME_DROW
  99.     if move_index?
  100.       @last_index = self.index
  101.     end
  102.   end
  103.   # アイコンの更新
  104.   def icon_update
  105.     for i in 0...@sprite.size
  106.       @sprite[i].active = (self.index == i)
  107.       @sprite[i].x = self.x  + i * 24
  108.       @sprite[i].y = self.y  + 0
  109.       @sprite[i].z = (self.index == i) ? self.z + 2 : self.z + 1
  110.       @sprite[i].visible = self.visible
  111.       @sprite[i].update
  112.     end
  113.   end
  114.   # コマンドネームの更新
  115.   def com_name_update
  116.     if move_index?
  117.       @name_sprite.name = get_com_name
  118.     end
  119.     @name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
  120.     @name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
  121.     @name_sprite.z = self.z + 1
  122.     @name_sprite.active = self.active
  123.     @name_sprite.visible = self.visible
  124.     @name_sprite.update
  125.   end
  126.   def get_com_name
  127.     make_name_set if @name_set.nil?
  128.     name = @name_set[self.index]
  129.     name = "" if name.nil?
  130.     return name
  131.   end
  132.   def make_name_set
  133.     @name_set = []
  134.     @name_set[0] = Momo_IconCommand::ATTACK_NAME
  135.     @name_set[1] = Momo_IconCommand::SKILL_NAME
  136.     @name_set[2] = Momo_IconCommand::GUARD_NAME
  137.     @name_set[3] = Momo_IconCommand::ITEM_NAME
  138.     @name_set[4] = Momo_IconCommand::ESCAPE_NAME
  139.   end
  140.   def move_index?
  141.     return self.index != @last_index
  142.   end
  143.   def need_reset
  144.     @name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
  145.   end
  146. end
  147.  
  148. # アイコン用スプライト
  149. class Sprite_Icon < Sprite
  150.   attr_accessor :active
  151.   attr_accessor :icon_name
  152.   #--------------------------------------------------------------------------
  153.   # ● オブジェクト初期化
  154.   #--------------------------------------------------------------------------
  155.   def initialize(viewport, icon_name)
  156.     super(viewport)
  157.     @icon_name = icon_name
  158.     @last_icon = @icon_name
  159.     @count = 0
  160.     self.bitmap = RPG::Cache.icon(@icon_name)
  161.     self.ox = self.bitmap.width / 2
  162.     self.oy = self.bitmap.height / 2
  163.     @active = false
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 解放
  167.   #--------------------------------------------------------------------------
  168.   def dispose
  169.     if self.bitmap != nil
  170.       self.bitmap.dispose
  171.     end
  172.     super
  173.   end
  174.   #--------------------------------------------------------------------------
  175.   # ● フレーム更新
  176.   #--------------------------------------------------------------------------
  177.   def update
  178.     super
  179.     if @icon_name != @last_icon
  180.       @last_icon = @icon_name
  181.       self.bitmap = RPG::Cache.icon(@icon_name)
  182.     end
  183.     if @active
  184.       @count += 1
  185.       case Momo_IconCommand::SELECT_TYPE
  186.       when 0
  187.         icon_flash
  188.       when 1
  189.         icon_zoom
  190.       end
  191.       @count = 0 if @count == 20
  192.     else
  193.       icon_reset
  194.     end
  195.   end
  196.   def icon_flash
  197.     if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 1
  198.       self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
  199.     end
  200.   end
  201.   def icon_zoom
  202.     case @count
  203.     when 1..10
  204.       zoom = 1.0 + @count / 10.0
  205.     when 11..20
  206.       zoom = 2.0 - (@count - 10) / 10.0
  207.     end
  208.     self.zoom_x = zoom
  209.     self.zoom_y = zoom
  210.   end
  211.   def icon_reset
  212.     @count = 0
  213.     self.zoom_x = 1.0
  214.     self.zoom_y = 1.0
  215.   end
  216. end
  217.  
  218. # コマンドネーム用スプライト
  219. class Sprite_Comm_Name < Sprite
  220.   attr_accessor :active
  221.   attr_accessor :name
  222.   attr_accessor :need_reset
  223.   #--------------------------------------------------------------------------
  224.   # ● オブジェクト初期化
  225.   #--------------------------------------------------------------------------
  226.   def initialize(viewport, name)
  227.     super(viewport)
  228.     @name = name
  229.     @last_name = nil
  230.     @count = 0
  231.     @x_plus = 0
  232.     @opa_plus = 0
  233.     @need_reset = false
  234.     @active = false
  235.     self.bitmap = Bitmap.new(160, 32)
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ● 解放
  239.   #--------------------------------------------------------------------------
  240.   def dispose
  241.     if self.bitmap != nil
  242.       self.bitmap.dispose
  243.     end
  244.     super
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ● フレーム更新
  248.   #--------------------------------------------------------------------------
  249.   def update
  250.     super
  251.     if @active
  252.       if need_reset?
  253.         @need_reset = false
  254.         @last_name = @name
  255.         text_reset
  256.       end
  257.       move_text if Momo_IconCommand::COM_NAME_MOVE
  258.     end
  259.   end
  260.   def move_text
  261.     @count += 1
  262.     @x_plus = [@count * 8, 80].min
  263.     self.x = self.x - 80 + @x_plus
  264.     self.opacity = @count * 25
  265.   end
  266.   def text_reset
  267.     @count = 0
  268.     @x_plus = 0
  269.     self.bitmap.clear
  270.     self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
  271.     self.bitmap.draw_text(0, 0, 160, 32, @name)
  272.   end
  273.   def need_reset?
  274.     return (@name != @last_name or @need_reset)
  275.   end
  276. end
  277.  
  278. class Scene_Battle
  279.   #--------------------------------------------------------------------------
  280.   # ● プレバトルフェーズ開始
  281.   #--------------------------------------------------------------------------
  282.   alias scene_battle_icon_command_start_phase1 start_phase1
  283.   def start_phase1
  284.     com1 = Momo_IconCommand::ATTACK_ICON_NAME
  285.     com2 = Momo_IconCommand::SKILL_ICON_NAME
  286.     com3 = Momo_IconCommand::GUARD_ICON_NAME
  287.     com4 = Momo_IconCommand::ITEM_ICON_NAME
  288.     com5 = Momo_IconCommand::ESCAPE_ICON_NAME
  289.     @actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4, com5])
  290.     @actor_command_window.y = 160
  291.     @actor_command_window.back_opacity = 160
  292.     @actor_command_window.active = false
  293.     @actor_command_window.visible = false
  294.     @actor_command_window.update
  295.     scene_battle_icon_command_start_phase1
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ● アクターコマンドウィンドウのセットアップ
  299.   #--------------------------------------------------------------------------
  300.   alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
  301.   def phase3_setup_command_window
  302.     scene_battle_icon_command_phase3_setup_command_window
  303.     # アクターコマンドウィンドウの位置を設定
  304.     @actor_command_window.x = command_window_actor_x(@actor_index)
  305.     @actor_command_window.y = command_window_actor_y(@actor_index)
  306.     @actor_command_window.need_reset
  307.   end
  308.   def command_window_actor_x(index)
  309.     #$game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
  310.     index * 160 + Momo_IconCommand::X_PLUS
  311.   end
  312.   def command_window_actor_y(index)
  313.     #$game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
  314.     390 + Momo_IconCommand::Y_PLUS
  315.   end
  316. end
  317.  
  318. #==============================================================================
  319. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  320. #==============================================================================
人生总会有中二的时候,比如现在
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-11-10 17:24

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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