/// <summary> /// 刷新UI /// </summary> /// <param name="hero">传入的刷新数据</param> public override void RefreshUI(HeroMono hero, Global.BuffType type, ValueUnit old_value, ValueUnit new_value) { if (_HeroUI.ContainsKey(hero)) { _HeroUI[hero].Init(hero); } }
/// <summary> /// 显示一个英雄Hub /// </summary> /// <param name="type">Hub类型</param> public void ShowHeroHub(HubType type, ValueUnit value = null) { BaseBattleHeroHub hub = ObjectPool.Instance.GetComponentFromPool <BaseBattleHeroHub>(Name + "_Hub"); if (hub != null) { hub.ShowHubInfo(this, type, value); } }
/// <summary> /// 复制构造函数 /// </summary> /// <param name="property"></param> public HeroProperty(HeroProperty property) { this.MaxLife = property.MaxLife; this.MaxMagic = property.MaxMagic; this.CurrentLife = property.CurrentLife; this.CurrentMagic = property.CurrentMagic; this.Attack = property.Attack; this.Defense = property.Defense; this.MagicAttack = property.MagicAttack; this.MagicDefense = property.MagicDefense; this.Speed = property.Speed; this.Turn = property.Turn; }
/// <summary> /// 空的构造函数 /// </summary> public HeroProperty() { MaxLife = new ValueUnit(); MaxMagic = new ValueUnit(); CurrentLife = new ValueUnit(); CurrentMagic = new ValueUnit(); Attack = new ValueUnit(); Defense = new ValueUnit(); MagicAttack = new ValueUnit(); MagicDefense = new ValueUnit(); Speed = new ValueUnit(); Turn = 0; }
public HeroProperty(Hero hero, float speedMix) { MaxLife = new ValueUnit(hero.BaseLife, Global.UnitType.Value); MaxMagic = new ValueUnit(hero.BaseMagic, Global.UnitType.Value); CurrentLife = new ValueUnit(hero.BaseLife, Global.UnitType.Value); CurrentMagic = new ValueUnit(hero.BaseMagic, Global.UnitType.Value); Attack = new ValueUnit(hero.BaseAttack, Global.UnitType.Value); Defense = new ValueUnit(hero.BaseDefense, Global.UnitType.Value); MagicAttack = new ValueUnit(hero.BaseMagicAttack, Global.UnitType.Value); MagicDefense = new ValueUnit(hero.BaseMagicDefense, Global.UnitType.Value); Speed = new ValueUnit(Mathf.RoundToInt(hero.BaseSpeed * Random.Range(speedMix, 1f)), Global.UnitType.Value); Turn = 0; }
/// <summary> /// 通过读取数据使用的构造函数 /// </summary> /// <param name="temp">读取到的数据</param> public HeroProperty(string temp) { string[] strs = temp.Split(':'); if (strs.Length == 10) { int offset = 0; MaxLife = new ValueUnit(strs[offset]); offset++; MaxMagic = new ValueUnit(strs[offset]); offset++; CurrentLife = new ValueUnit(strs[offset]); offset++; CurrentMagic = new ValueUnit(strs[offset]); offset++; Attack = new ValueUnit(strs[offset]); offset++; Defense = new ValueUnit(strs[offset]); offset++; MagicAttack = new ValueUnit(strs[offset]); offset++; MagicDefense = new ValueUnit(strs[offset]); offset++; Speed = new ValueUnit(strs[offset]); offset++; Turn = int.Parse(strs[offset]); offset++; } }
/// <summary> /// 显示一个Hub /// </summary> /// <param name="hero">为哪个英雄显示</param> /// <param name="type">Hub类型</param> /// <param name="life">生命值变化</param> /// <param name="magic">魔力值变化</param> public override void ShowHubInfo(HeroMono hero, HubType type, ValueUnit value = null) { HeroHubInfo info = GetHubInfoByType(type); if (info == null) { return; } TextHub.color = info.TextColor; TextHub.text = info.Name.Replace("[CRITICAL]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[LIFE]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[MAGIC]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[ATTACK]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[DEFENSE]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[MAGIC ATTACK]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[MAGIC DEFENSE]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[MAX LIFE]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[MAX MAGIC]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[SPEED]", value.RealTempValue(0).ToString()); this.transform.position = hero.HeroPosition; this.gameObject.SetActive(true); StartCoroutine(Show(this.transform.position)); }
/// <summary> /// 显示一个Hub /// </summary> /// <param name="hero">为哪个英雄显示</param> /// <param name="type">Hub类型</param> /// <param name="value">数值变化</param> public virtual void ShowHubInfo(HeroMono hero, HubType type, ValueUnit value = null) { }
/// <summary> /// 复制构造函数 /// </summary> /// <param name="value"></param> public ValueUnit(ValueUnit value) { this.Value = value.Value; this.Unit = value.Unit; }
/// <summary> /// 刷新UI /// </summary> /// <param name="hero">传入的刷新数据</param> public virtual void RefreshUI(HeroMono hero, Global.BuffType type, ValueUnit old_value, ValueUnit new_value) { }