|
@@ -348,57 +348,77 @@ namespace Fort23.Mono
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ AnimateNumber animTxtHp = new AnimateNumber(targetTextPro:txtHP);
|
|
|
|
+ AnimateNumber animTxtAtk = new AnimateNumber(targetTextPro:txtATK);
|
|
|
|
+ AnimateNumber animTxtDef = new AnimateNumber(targetTextPro:txtDEF);
|
|
|
|
+ AnimateNumber animTxtShanBi = new AnimateNumber(targetTextPro:txtSHANBI);
|
|
|
|
+
|
|
|
|
+ animateNumberList = new List<AnimateNumber>();
|
|
|
|
+ animateNumberList.Add(animTxtHp);
|
|
|
|
+ animateNumberList.Add(animTxtAtk);
|
|
|
|
+ animateNumberList.Add(animTxtDef);
|
|
|
|
+ animateNumberList.Add(animTxtShanBi);
|
|
|
|
+
|
|
UpdateAttributeUI(true);
|
|
UpdateAttributeUI(true);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private List<AnimateNumber> animateNumberList;
|
|
|
|
+
|
|
private long curHeroCount;
|
|
private long curHeroCount;
|
|
private long costHeroCount;
|
|
private long costHeroCount;
|
|
public async void UpdateAttributeUI(bool isInit = false)
|
|
public async void UpdateAttributeUI(bool isInit = false)
|
|
{
|
|
{
|
|
StarsObj.SetActive(true);
|
|
StarsObj.SetActive(true);
|
|
- if (txtHP.text != heroInfo.hp.Value.ToStringEx())
|
|
|
|
- {
|
|
|
|
- long old = long.Parse(txtHP.text);
|
|
|
|
- txtHP.text = heroInfo.hp.Value.ToStringEx();
|
|
|
|
- if(!isInit)
|
|
|
|
- await UIManager.Instance.CreateGComponent<HeroUpTxtEft>(delegate(HeroUpTxtEft heroUpTxtEft)
|
|
|
|
- {
|
|
|
|
- heroUpTxtEft.txtEft.text = "+" + (heroInfo.hp.Value - old).ToStringEx();
|
|
|
|
- },
|
|
|
|
- poolName: "HeroUpTxtEft", root: eftNumPos[0] as RectTransform);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (txtATK.text != heroInfo.attack.Value.ToStringEx())
|
|
|
|
- {
|
|
|
|
- long old = long.Parse(txtATK.text);
|
|
|
|
- txtATK.text = heroInfo.attack.Value.ToStringEx();
|
|
|
|
- if(!isInit)
|
|
|
|
- await UIManager.Instance.CreateGComponent<HeroUpTxtEft>(delegate(HeroUpTxtEft heroUpTxtEft)
|
|
|
|
- {
|
|
|
|
- heroUpTxtEft.txtEft.text = "+" + (heroInfo.attack.Value - old).ToStringEx();
|
|
|
|
- },
|
|
|
|
- poolName: "HeroUpTxtEft", root: eftNumPos[1] as RectTransform);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ PlayEft(isInit, txtHP, heroInfo.hp.Value.ToStringEx(), 0);
|
|
|
|
+
|
|
|
|
+ // if (txtHP.text != heroInfo.hp.Value.ToStringEx())
|
|
|
|
+ // {
|
|
|
|
+ // long old = long.Parse(txtHP.text);
|
|
|
|
+ // txtHP.text = heroInfo.hp.Value.ToStringEx();
|
|
|
|
+ // if(!isInit)
|
|
|
|
+ // await UIManager.Instance.CreateGComponent<HeroUpTxtEft>(delegate(HeroUpTxtEft heroUpTxtEft)
|
|
|
|
+ // {
|
|
|
|
+ // heroUpTxtEft.txtEft.text = "+" + (heroInfo.hp.Value - old).ToStringEx();
|
|
|
|
+ // },
|
|
|
|
+ // poolName: "HeroUpTxtEft", root: eftNumPos[0] as RectTransform);
|
|
|
|
+ // }
|
|
|
|
|
|
- if (txtDEF.text != heroInfo.defense.Value.ToStringEx())
|
|
|
|
- {
|
|
|
|
- long old = long.Parse(txtDEF.text);
|
|
|
|
- txtDEF.text = heroInfo.defense.Value.ToStringEx();
|
|
|
|
- if(!isInit)
|
|
|
|
- await UIManager.Instance.CreateGComponent<HeroUpTxtEft>(delegate(HeroUpTxtEft heroUpTxtEft)
|
|
|
|
- {
|
|
|
|
- heroUpTxtEft.txtEft.text = "+" + (heroInfo.defense.Value - old).ToStringEx();
|
|
|
|
- },
|
|
|
|
- poolName: "HeroUpTxtEft", root: eftNumPos[2] as RectTransform);
|
|
|
|
- }
|
|
|
|
|
|
+ PlayEft(isInit, txtATK, heroInfo.attack.Value.ToStringEx(), 1);
|
|
|
|
+
|
|
|
|
+ // if (txtATK.text != heroInfo.attack.Value.ToStringEx())
|
|
|
|
+ // {
|
|
|
|
+ // long old = long.Parse(txtATK.text);
|
|
|
|
+ // txtATK.text = heroInfo.attack.Value.ToStringEx();
|
|
|
|
+ // if(!isInit)
|
|
|
|
+ // await UIManager.Instance.CreateGComponent<HeroUpTxtEft>(delegate(HeroUpTxtEft heroUpTxtEft)
|
|
|
|
+ // {
|
|
|
|
+ // heroUpTxtEft.txtEft.text = "+" + (heroInfo.attack.Value - old).ToStringEx();
|
|
|
|
+ // },
|
|
|
|
+ // poolName: "HeroUpTxtEft", root: eftNumPos[1] as RectTransform);
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ PlayEft(isInit, txtDEF, heroInfo.defense.Value.ToStringEx(), 2);
|
|
|
|
+ // if (txtDEF.text != heroInfo.defense.Value.ToStringEx())
|
|
|
|
+ // {
|
|
|
|
+ // long old = long.Parse(txtDEF.text);
|
|
|
|
+ // txtDEF.text = heroInfo.defense.Value.ToStringEx();
|
|
|
|
+ // if(!isInit)
|
|
|
|
+ // await UIManager.Instance.CreateGComponent<HeroUpTxtEft>(delegate(HeroUpTxtEft heroUpTxtEft)
|
|
|
|
+ // {
|
|
|
|
+ // heroUpTxtEft.txtEft.text = "+" + (heroInfo.defense.Value - old).ToStringEx();
|
|
|
|
+ // },
|
|
|
|
+ // poolName: "HeroUpTxtEft", root: eftNumPos[2] as RectTransform);
|
|
|
|
+ // }
|
|
|
|
|
|
- if (txtSHANBI.text != heroInfo.shanbi.Value.ToStringEx())
|
|
|
|
- {
|
|
|
|
- txtSHANBI.text = heroInfo.shanbi.Value.ToStringEx();
|
|
|
|
- if(!isInit)
|
|
|
|
- await UIManager.Instance.CreateGComponent<HeroUpTxtEft>(null,
|
|
|
|
- poolName: "HeroUpTxtEft", root: eftNumPos[3] as RectTransform);
|
|
|
|
- }
|
|
|
|
|
|
+ PlayEft(isInit, txtSHANBI, heroInfo.shanbi.Value.ToStringEx(), 3);
|
|
|
|
+ // if (txtSHANBI.text != heroInfo.shanbi.Value.ToStringEx())
|
|
|
|
+ // {
|
|
|
|
+ // txtSHANBI.text = heroInfo.shanbi.Value.ToStringEx();
|
|
|
|
+ // if(!isInit)
|
|
|
|
+ // await UIManager.Instance.CreateGComponent<HeroUpTxtEft>(null,
|
|
|
|
+ // poolName: "HeroUpTxtEft", root: eftNumPos[3] as RectTransform);
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
|
txtLv.text = heroInfo.level.Value.ToStringEx();
|
|
txtLv.text = heroInfo.level.Value.ToStringEx();
|
|
@@ -460,5 +480,33 @@ namespace Fort23.Mono
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 当基础属性改变时,做一些表现
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="isInit">是否为首次(初始), 首次不做动画处理</param>
|
|
|
|
+ /// <param name="txtOld">当前(旧的)</param>
|
|
|
|
+ /// <param name="txtNew"></param>
|
|
|
|
+ /// <param name="eftRoot"></param>
|
|
|
|
+ private async void PlayEft(bool isInit, TextMeshProUGUI txtOld, string txtNew, int idx)
|
|
|
|
+ {
|
|
|
|
+ if (txtOld.text != txtNew)
|
|
|
|
+ {
|
|
|
|
+ long old = long.Parse(txtOld.text);
|
|
|
|
+ long newV = long.Parse(txtNew);
|
|
|
|
+ txtOld.text = txtNew;
|
|
|
|
+ if (!isInit)
|
|
|
|
+ {
|
|
|
|
+ animateNumberList[idx].Start(old, newV);
|
|
|
|
+
|
|
|
|
+ await UIManager.Instance.CreateGComponent(delegate(HeroUpTxtEft heroUpTxtEft)
|
|
|
|
+ {
|
|
|
|
+ heroUpTxtEft.txtEft.text = "+" + (newV - old).ToStringEx();
|
|
|
|
+ },
|
|
|
|
+ poolName: "HeroUpTxtEft", root: eftNumPos[idx] as RectTransform);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|