查看: 3496|回复: 0

[已经过期] 装备说明颜色报错啦

[复制链接]
梦石
0
星屑
704
在线时间
91 小时
注册时间
2018-9-30
回帖
43
发表于 2019-4-19 12:04:27 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 vixv 于 2019-4-19 12:11 编辑

[/pre]如下图,出现了这个英文,我百度也不知道怎么解决。
本来好好的,我再装备下面照图添加品质就报错了,
请问下是什么原因啊。是不是这个装备说明和物品颜色描绘冲突了啊
出问题是710行    color = Color.new(c[0],c[1],c[2],c[3])

[pre lang="ruby"]#encoding:utf-8
#==============================================================================
# ■ 装备说明增强 By wyongcan
#==============================================================================
module Equipplus
  CODE ={
    11 => "属性抗性",
    12 => "弱化抗性",
    13 => "状态抗性",
    14 => "状态免疫",
    21 => "普通能力",
    22 => "添加能力",
    23 => "特殊能力",
    31 => "攻击附带属性",
    32 => "攻击附带状态",
    33 => "修正攻击速度",
    34 => "添加攻击次数",
    41 => "添加技能类型",
    42 => "禁用技能类型",
    43 => "添加技能",
    44 => "禁用技能",
    51 => "可装备武器类型",
    52 => "可装备护甲类型",
    53 => "固定装备",
    54 => "禁用装备",
    55 => "装备风格",
    61 => "添加行动次数",
    62 => "特殊标志",
    63 => "消失效果",
    64 => "队伍能力"}
  #特殊标志
  FLAG ={
                0 => "自动战斗",
                1 => "擅长防御",
                2 => "保护弱者",
                3 => "技能专注"}
  #普通能力
        PARAM ={
#~                 0 => "最大HP",
#~                 1 => "最大MP",
#~                 2 => "物理攻击",
#~                 3 => "物理防御",
#~                 4 => "法术攻击",
#~                 5 => "法术防御",
#~                 6 => "敏 捷 值",
#~                 7 => "幸 运 值"}
                0 => "最大兵力",
                1 => "最大谋点",
                2 => "武  力",
                3 => "防  御",
                4 => "智  力",
                5 => "策  防",
                6 => "速  度",
                7 => "统  帅"}
  #添加能力
        XPARAM ={
                0 => "物理命中几率:",
                1 => "物理闪避几率:",
                2 => "必杀几率:",
                3 => "必杀闪避几率:",
                4 => "法术闪避几率:",
                5 => "法术反射几率:",
                6 => "物理反击几率:",
                7 => "体力值再生速度:",
                8 => "魔力值再生速度:",
                9 => "技能值再生速度:"}
  #特殊能力
        SPARAM ={
                0 => "受到攻击的几率",
                1 => "防御效果比率",
                2 => "恢复效果比率",
                3 => "药理知识",
                4 => "MP消费率",
                5 => "TP消耗率",
                6 => "物理伤害加成",
                7 => "法术伤害加成",
                8 => "地形伤害加成",
                9 => "经验获得加成"}
        @队伍能力 ={
                0 => "遇敌几率减半",
                1 => "随机遇敌无效",
                2 => "敌人偷袭无效",
                3 => "先制攻击几率上升",
                4 => "获得金钱数量双倍",
                5 => "物品掉落几率双倍"}
  def self.equiphelpready
    @状态 = {}
    @武器类型 = {}
    @防具类型 = {}
    @属性 = {}
    $data_states.each{|x| @状态[x.id] = x.name if x != nil}
    elements = $data_system.elements
    weapon_types = $data_system.weapon_types
    armor_types = $data_system.armor_types
    elements.each_with_index{|x,y| @属性[y] = x if x != ""}
    weapon_types.each_with_index{|x,y| @武器类型[y] = x if x != ""}
    armor_types.each_with_index{|x,y| @防具类型[y] = x if x != ""}
  end
  
  def self.getequiphelp(equip,actor=nil)#$game_party.leader)
    need_help = ""
    param = []
    hzhj = " "
    if equip.level_limit > 0
      hzhj = "\001[255,255,255]装备要求:\001[-1,-1,-1]"      
      need_help += hzhj# + "\n"
      color = actor ? (actor.level < equip.level_limit ? "\001[255,0,0]" : "\001[0,255,0]") : "\001[255,255,255]"
      need_help += sprintf(color+" %s %d %s\n",  Vocab.level, equip.level_limit, "\001[-1,-1,-1]")
    end
    for i in 0..7
      if equip.params_limit(i) > 0
        hzhj = "" if hzhj == "\001[255,255,255]装备要求:\001[-1,-1,-1]"
        hzhj = "\001[255,255,255]装备要求\001[-1,-1,-1]" if hzhj == " "
        need_help += hzhj# + "\n"
        color = actor ? (actor.param(i) < equip.params_limit(i) ? "\001[255,0,0]" : "\001[0,255,0]") : "\001[255,255,255]"
        need_help += sprintf(color+" %s %d %s\n", Vocab.param(i), equip.params_limit(i), "\001[-1,-1,-1]")
      end
    end
    # 基本属性
    params_help = ""
    equip.params.each_with_index do |x,y|
      text = ""
      if y >= 2 && equip.level[y-2] > 0
        text = ESTS::ESTSSetting[equip.level[y-2]][5]+"("+ESTS::ESTSSetting[equip.level[y-2]][0]+")"
      end
      param.push(["\001[255,255,255]" + PARAM[y],x,text])
      
    end
    param = param.select{|x| x[1] != 0}
    param.each_with_index do |x,i|
#~       params_help += x[0] + "+" + x[1].to_int.to_s + x[2] +"\001[-1,-1,-1]\n"
      params_help += x[0] + "   " + x[1].to_int.to_s + x[2] +"\001[-1,-1,-1]\n" if  x[1] < 0   
      params_help += x[0] + "   +" + x[1].to_int.to_s + x[2] +"\001[-1,-1,-1]\n" if   x[1] > 0        
    end
    # 特性
    features_help = ""
    features = equip.features
    features.select{|x| x.code == 55}.each{|x| features_help += CODE[x.code] + " 二刀流\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 11}.each{|x| features_help += CODE[x.code] + " " + @属性[x.data_id] + "*" + x.value.to_s  + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 12}.each{|x| features_help += CODE[x.code] + " " + PARAM[x.data_id] + "*" + x.value.to_s  + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 13}.each{|x| features_help += CODE[x.code] + " " + @状态[x.data_id] + "*" + x.value.to_s  + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 14}.each{|x| features_help += CODE[x.code] + " " + @状态[x.data_id]  + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 31}.each{|x| features_help += CODE[x.code] + " " + @属性[x.data_id]  + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 32}.each{|x| features_help += CODE[x.code] + " " + @状态[x.data_id] + "+" + x.value.to_s  + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 33}.each{|x| features_help += CODE[x.code] + " " + x.value.to_s  + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 34}.each{|x| features_help += CODE[x.code] + " " + x.value.to_s  + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 41}.each{|x| features_help += CODE[x.code] + " " + (x.data_id == 1 ? "体术" : "忍术")   + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 42}.each{|x| features_help += CODE[x.code] + " " + (x.data_id == 1 ? "体术" : "忍术")   + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 43}.each{|x| features_help += CODE[x.code] + " " + $data_skills[x.data_id].name   + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 44}.each{|x| features_help += CODE[x.code] + " " + $data_skills[x.data_id].name   + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 51}.each{|x| features_help += CODE[x.code] + " " + @武器类型[x.data_id]   + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 52}.each{|x| features_help += CODE[x.code] + " " + @防具类型[x.data_id]   + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 61}.each{|x| features_help += CODE[x.code] + " " + x.value.to_s   + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 62}.each{|x| features_help += CODE[x.code] + " " + FLAG[x.data_id]   + "\001[-1,-1,-1]\n"}
    features.select{|x| x.code == 64}.each{|x| features_help += CODE[x.code] + " " + @队伍能力[x.data_id]   + "\001[-1,-1,-1]\n"}
    featuresparam = []
    featuresparam.push features.select{|x| x.code == 21}
    featuresparam.push features.select{|x| x.code == 22}
    featuresparam.push features.select{|x| x.code == 23}
    featuresparam[0].each{|x| features_help += "\001[128,255,128]"+PARAM[x.data_id] + "* " + x.value.to_s  + "\001[-1,-1,-1]\n"}
    featuresparam[1].each{|x| features_help += "\001[255,0,255]"+XPARAM[x.data_id] + "+ " +x.value.to_s  + "\001[-1,-1,-1]\n"}
    featuresparam[2].each{|x| features_help += "\001[128,128,255]"+SPARAM[x.data_id] + "* " +x.value.to_s  + "\001[-1,-1,-1]\n"}
    strongto_help = ""
    if equip.strongto > 0
      strong = nil
      if equip.is_a?(RPG::Weapon)
        strong = $data_weapons[equip.strongto]
      elsif equip.is_a?(RPG::Armor)
        strong = $data_armors[equip.strongto]
      end
      c = ItemLevelDrawer::ColorSet[[strong.quality-1,0].max]
      strongto_help += "\001[255,128,255]可升阶到 \001["+c[0].to_s+","+c[1].to_s+","+c[2].to_s+"]" + strong.name + "\001[-1,-1,-1]"
    else
      strongto_help += "\001[255,128,255]无法升阶"
    end
    set_help = "\001[255,0,0]镶嵌:\n"
    set_text = ""
    equip.set.each do |s|
      if s
        c = ItemLevelDrawer::ColorSet[[s.quality-1,0].max]
        set_text += "\001["+c[0].to_s+","+c[1].to_s+","+c[2].to_s+"]" + s.name + "\001[-1,-1,-1]\n"
      end
    end
    set_text = "\001[228,228,228]无\n" if set_text == ""
    set_help += set_text
    help = [need_help,params_help,features_help,strongto_help,set_help]
    return help
  end
  #--------------------------------------------------------------------------
  # ● 获取升阶后装备
  #--------------------------------------------------------------------------
  def self.after_levelup_equip(equip)
    if equip.is_a?(RPG::Weapon)
      if equip.level == [0]*6 && equip.set.compact == []
        new_equip = $data_weapons[equip.strongto]
      else
        new_equip = $data_weapons[equip.strongto].dup
        new_equip.id = $data_weapons.size
        new_equip.params = $data_weapons[equip.strongto].params.dup
        new_equip.level = $data_weapons[equip.strongto].level.dup
        new_equip.set = $data_weapons[equip.strongto].set.dup
        equip.level.each_with_index {|p,id| p.times {new_equip.level_up(id)}}
        equip.set.each_with_index {|s,i| new_equip.set_item(i,s) if s}
      end
    else
      if equip.level == [0]*6 && equip.set.compact == []
        new_equip = $data_armors[equip.strongto]
      else
        new_equip = $data_armors[equip.strongto].dup
        new_equip.id = $data_armors.size
        new_equip.params = $data_armors[equip.strongto].params.dup
        new_equip.level = $data_armors[equip.strongto].level.dup
        new_equip.set = $data_armors[equip.strongto].set.dup
        equip.level.each_with_index {|p,id| p.times {new_equip.level_up(id)}}
        equip.set.each_with_index {|s,i| new_equip.set_item(i,s) if s}
      end
    end
    new_equip
  end
   
  def self.getline(text,maxtext)
    xtext = []
    line = 0
    text.each_line{|x| xtext.push x.sub(/\n/){}}
    xtext.each{|x| x.size % maxtext != 0 ? line += x.size / maxtext + 1 : line += x.size / maxtext}
    line
  end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
#  显示技能和物品等的说明、以及角色状态的窗口
#==============================================================================

class Window_Help2 < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(line_number = 0)
    super(0, 0, 210, 0) #0,0,210,0
    self.z = 150
    contents.font.size = 14
    hide
  end
  #--------------------------------------------------------------------------
  # ● 设置内容
  #--------------------------------------------------------------------------
  def set_text(text)
      @text = text
      refresh
  end
  #--------------------------------------------------------------------------
  # ● 清除
  #--------------------------------------------------------------------------
  def clear
    set_text("")
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助位置
  #--------------------------------------------------------------------------
  def uppos(index,rect,window)
    self.height = fitting_height2(Equipplus.getline(@xtext,13))
    create_contents
    contents.font.size = 14
    rect.x -= window.ox
    rect.y -= window.oy
    ax = rect.x + rect.width + 10
    ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
    ax += window.x
    ax = 0 if ax < 0
    ay = rect.y + rect.height
    ay = rect.y - self.height if ay + self.height > window.height
    ay += window.y
    ay = 0 if ay < 0
    self.x = ax
    self.y = ay
    set_text(@xtext)
    show
  end
  #--------------------------------------------------------------------------
  # ● 设置物品
  #     item : 技能、物品等
  #--------------------------------------------------------------------------
  def set_item(item)
    if item == nil
      set_text("")
      return
    end
    @xtext = ""
    @xtext = "\\c[1]名称\\c[0]:" + item.name + "\n"
    @xtext += "\\c[1]介绍\\c[0]:" + item.description + "\n"
    @xtext += "\\c[1]价格\\c[0]:" + item.price.to_s + "\n" if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
    help,set = Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)
    @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    hide if @text == ""
    draw_text_ex(4, 0, @text,width,40,false)
  end
end
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● 计算窗口显示指定行数时的应用高度2*************************
  #--------------------------------------------------------------------------
  def fitting_height2(line_number)
    line_number * contents.font.size + standard_padding * 2
  end
  #--------------------------------------------------------------------------
  # ● 文字的处理
  #     c    : 文字
  #     text : 绘制处理中的字符串缓存(字符串可能会被修改)
  #     pos  : 绘制位置 {:x, :y, :new_x, :height}
  #--------------------------------------------------------------------------
  def process_character(c, text, pos)
    case c
    when "\r"   # 回车
      return
    when "\n"   # 换行
      process_new_line(text, pos)
    when "\f"   # 翻页
      process_new_page(text, pos)
    when "\e"   # 控制符
      process_escape_character(obtain_escape_code(text), text, pos)
    else        # 普通文字
      pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
      if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
        process_new_line(text, pos)
      end
      process_normal_character(c, pos)
    end
  end
end

class Window_ItemList < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 显示窗口
  #--------------------------------------------------------------------------
  def show
    @help_window.visible = true
    super
  end
  #--------------------------------------------------------------------------
  # ● 隐藏窗口
  #--------------------------------------------------------------------------
  def hide
    @help_window.visible = false if(@help_window)
    super
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_item(item)
    @help_window.uppos(item_rect(index),self) if index != -1 && item != nil
  end
end
class Window_EquipItem < Window_ItemList
  #--------------------------------------------------------------------------
  # ● 显示窗口
  #--------------------------------------------------------------------------
  def show
    @help_window.visible=true
    super
  end
  #--------------------------------------------------------------------------
  # ● 隐藏窗口
  #--------------------------------------------------------------------------
  def hide
    @help_window.visible=false
    super
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_item(item,@actor) if @help_window
    @help_window.uppos(item_rect(index),self) if index != -1 && item != nil
    if @actor && @status_window
      temp_actor = Marshal.load(Marshal.dump(@actor))
      temp_actor.force_change_equip(@slot_id, item)
      @status_window.set_temp_actor(temp_actor)
    end
  end
end

class Window_SkillList < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 显示窗口
  #--------------------------------------------------------------------------
  def show
    @help_window.visible=true
    super
  end
  #--------------------------------------------------------------------------
  # ● 隐藏窗口
  #--------------------------------------------------------------------------
  def hide
    @help_window.visible=false
    super
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_item(item)
    @help_window.uppos(item_rect(index),self) if index != -1 && item != nil
  end
end

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 显示窗口
  #--------------------------------------------------------------------------
  def show
    @help_window.visible=true
    super
  end
  #--------------------------------------------------------------------------
  # ● 隐藏窗口
  #--------------------------------------------------------------------------
  def hide
    @help_window.visible=false
    super
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_item(item) if @help_window
    @help_window.uppos(item_rect(index),self) if index != -1 && item != nil && @help_window
    @status_window.item = item if @status_window
  end
end

class Window_EquipSlot < Window_Selectable
    #--------------------------------------------------------------------------
  # ● 显示窗口
  #--------------------------------------------------------------------------
  def show
    @help_window.visible=true
    super
  end
  #--------------------------------------------------------------------------
  # ● 隐藏窗口
  #--------------------------------------------------------------------------
  def hide
    @help_window.visible=false
    super
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助内容
  #--------------------------------------------------------------------------
  def update_help
    super
    @help_window.set_item(item,@actor) if @help_window
    @help_window.uppos(item_rect(index),self) if index != -1 && item != nil && @help_window
    @status_window.set_temp_actor(nil) if @status_window
  end
end

class Scene_Shop < Scene_MenuBase
        alias on_sell_ok_old on_sell_ok
        def on_sell_ok
                on_sell_ok_old
                @help_window.hide
        end
        alias on_buy_ok_old on_buy_ok
        def on_buy_ok
                on_buy_ok_old
                @help_window.hide
        end
        alias on_number_ok_old on_number_ok
        def on_number_ok
                on_number_ok_old
    @help_window.refresh
                @help_window.show
        end
        alias on_number_cancel_old on_number_cancel
        def on_number_cancel
                on_number_cancel_old
    @help_window.refresh
                @help_window.show
        end
end

class Scene_Title < Scene_Base
  alias start_old start
  def start
    start_old
    Equipplus.equiphelpready
  end
end

class Scene_ItemBase < Scene_MenuBase
        alias old_on_actor_cancel on_actor_cancel
  def on_actor_cancel
    old_on_actor_cancel
    @help_window.refresh
  end
        alias old_on_actor_ok on_actor_ok
  def on_actor_ok
    old_on_actor_ok
    @help_window.refresh
  end
end

class Window_Base < Window
        alias old_process_new_line process_new_line
        def process_new_line(text, pos)
    old_process_new_line(text, pos)
                pos[:height] = contents.font.size if pos[:width] != nil
        end
end

class Scene_MenuBase < Scene_Base
  def create_help_window
    @help_window = NIS_Item_Help.new(nil,0,0,156)
  end
end
class Scene_Battle < Scene_Base
  def create_help_window
    @help_window = NIS_Item_Help.new(nil,0,0,156)
  end
end

#==============================================================================
# ■ NIS_Item_Help
#------------------------------------------------------------------------------
#  显示技能和物品等的说明、以及角色状态的界面
#==============================================================================

class NIS_Item_Help < NIS_InfoContents
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------  
  def initialize(item,x,y,width,text_size=18,auto_height = true,auto_scroll = false,scroll_pix=1,scroll_space=1)
    width_help = width #加了这个作为帮助窗口的宽度 PannyDD
    width = 300        #加了这个作为帮助窗口的宽度 PannyDD
    super(0,0,Bitmap.new(width,1),auto_scroll,scroll_pix,scroll_space)   
    @visible = false
    @status = :open
    @viewport = Viewport.new(Rect.new(x,y,width,1))
    @viewport.z = 1000

    @window.viewport = @viewport
    @window.bitmap.font.size = text_size
    @auto_height = auto_height
    @item = item
    width = width_help #加了这个作为帮助窗口的宽度 PannyDD
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 出现
  #--------------------------------------------------------------------------
  def width
    @window.width
  end
  #--------------------------------------------------------------------------
  # ● 隐藏
  #--------------------------------------------------------------------------
  def height
    @window.height
  end
  #--------------------------------------------------------------------------
  # ● 出现
  #--------------------------------------------------------------------------
  def show
    self.visible2=true
  end
  #--------------------------------------------------------------------------
  # ● 隐藏
  #--------------------------------------------------------------------------
  def hide
    self.visible2=true
  end
  #--------------------------------------------------------------------------
  # ● 获取边距尺寸
  #--------------------------------------------------------------------------
  def padding
    return 4
  end
  #--------------------------------------------------------------------------
  # ● 更改可视属性(渐变操作)
  #--------------------------------------------------------------------------
  def visible2=(value)
    case value
    when true
      @viewport.visible = true
      @visible = true
      @opacity = 0
      @active = true
      @status = :show
    when false
      @opacity = 255
      @status = :hide
    end
  end
  #--------------------------------------------------------------------------
  # ● 更新
  #--------------------------------------------------------------------------
  def update
    super
    update_visible
  end
  #--------------------------------------------------------------------------
  # ● 更新渐变效果
  #--------------------------------------------------------------------------
  def update_visible
    @count += 1
    case @status
    when :show
      @window.opacity += 10
      @contents.opacity += 10
      @status = :open if @window.opacity >= 255
    when :hide
      @window.opacity -= 10
      @contents.opacity -= 10
      @count = 0
      @visible = false if @window.opacity <= 0
    end
  end
  #--------------------------------------------------------------------------
  # ● 清除
  #--------------------------------------------------------------------------
  def clear
    set_item(nil)
  end
  #--------------------------------------------------------------------------
  # ● 设置物品
  #     item : 技能、物品等
  #--------------------------------------------------------------------------
  def set_item(item,actor = nil)
    @item = item  if @item != item
    @actor = actor if @actor != actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助位置
  #--------------------------------------------------------------------------
  def uppos(rect,window)
    rect.x -= window.ox
    rect.y -= window.oy
    ax = rect.x + rect.width + 10
    ax = rect.x - @window.width + 10 if ax + @window.width > window.width + 10
    ax += window.x
    ax = 0 if ax < 0
    ay = rect.y + rect.height
    ay = rect.y - @window.height if ay + @window.height > window.height
    ay += window.y
    ay = 0 if ay < 0
    @viewport.rect.x = ax
    @viewport.rect.y = ay
  end
  #--------------------------------------------------------------------------
  # ● 获取帮助
  #--------------------------------------------------------------------------
  def get_help
    help = []
    help.push(@item.name)
    help.push(@item.description)
    help += Equipplus.getequiphelp(@item,@actor) if @item.is_a?(RPG::EquipItem)
    help.push("\001[128,128,255]价格:\001[-1,-1,-1]" + @item.price.to_s) if !@item.is_a?(RPG::Skill)
    help.delete("")
    help
  end
  #--------------------------------------------------------------------------
  # ● 获取帮助高度
  #--------------------------------------------------------------------------
  def get_help_height(help)
    help_height = [0]*help.size
    help.size.times do |i|
      @window.bitmap.font.size -= 2 if i == 1
      help_height = @window.bitmap.font.size+2 if i == 0
      help_height = get_height(help,@window.bitmap.width-padding,@window.bitmap) if i > 0
      @window.bitmap.font.size += 2 if i == 1
    end
    help_height
  end
  #--------------------------------------------------------------------------
  # ● 获取帮助高度
  #--------------------------------------------------------------------------
  def get_help_height_sum(help_height)
    sum = 0
    help_height.each{|h| sum += h + 5}
    return sum - 5
  end
  #--------------------------------------------------------------------------
  # ● 改变高度
  #--------------------------------------------------------------------------
  def change_height(height)
    if @auto_height
      @window.bitmap = Bitmap.new(@window.bitmap.width,height+2*padding)
      @window.viewport.rect.height = height+2*padding
    else
      src_height = @window.height
      @window.bitmap = Bitmap.new(@window.bitmap.width,height+2*padding)
      @window.src_rect = Rect.new(0,0,@window.bitmap.width-padding,src_height)
    end
   
  end
  #--------------------------------------------------------------------------
  # ● 绘制背景
  #--------------------------------------------------------------------------
  def draw_background(height)
    c = ItemLevelDrawer::ColorSet[[@item.quality-1,0].max]
    color = Color.new(c[0],c[1],c[2],c[3])
    font_size = @window.bitmap.font.size
   
    change_height(height)
   
    @window.bitmap.fill_rect(0,0,@window.bitmap.width,@window.bitmap.height,Color.new(25,25,25,182))
    @window.bitmap.font.color = color
    @window.bitmap.font.size = font_size
  end
  #--------------------------------------------------------------------------
  # ● 绘制内容
  #--------------------------------------------------------------------------
  def draw_contents(help,help_height)
    color = @window.bitmap.font.color.clone
    sum_height = padding
    help.each_with_index do |h,i|
      @window.bitmap.font.size -= 2 if i == 1
      draw_colorful_text(@window.bitmap,padding,sum_height,@window.bitmap.width-padding,help_height[0],h,color.clone,false,1,1) if i == 0
      draw_colorful_text(@window.bitmap,padding,sum_height,@window.bitmap.width-padding,@window.bitmap.font.size,h,color.clone) if i > 0
      @window.bitmap.font.size += 2 if i == 1
      sum_height += help_height
      draw_split_line(sum_height+2,color) if i < help.size - 1
      sum_height += 5
    end
  end
  #--------------------------------------------------------------------------
  # ● 绘制分割线
  #--------------------------------------------------------------------------
  def draw_split_line(y,color=Color.new(254,215,0))
    @window.bitmap.draw_line(padding,y,@window.bitmap.width-padding,y,color)
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    @window.bitmap.clear
    return unless @item
    help = get_help
    help_height = get_help_height(help)   
    draw_background(get_help_height_sum(help_height))
    draw_contents(help,help_height)
   
    show
  end
end


[/pre]
12345.png
想做一款 吞食天地2重制版 游戏
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部