using GameLogic.Hero; namespace Fort23.Mono { [UIBinding(prefab = "FaBaoAttributeWidget")] public partial class FaBaoAttributeWidget : UIComponent { public FaBaoInfo faBaoInfo; public int key; private void Init() { } public override void AddEvent() { } public override void DelEvent() { } public override void AddButtonEvent() { } public void CusomtInit(FaBaoInfo faBaoInfo, int key) { this.faBaoInfo = faBaoInfo; this.key = key; Text_AttributeName.text = GetAttributeName(key); Text_AttributeValue.text = faBaoInfo.attriButedIC[key].ToString(); Text_NextAttributeValue.gameObject.SetActive(false); } public void StartUpGrad(FaBaoInfo nextFabaoInfo) { Text_NextAttributeValue.text = $"+{nextFabaoInfo.attriButedIC[key] - faBaoInfo.attriButedIC[key]}"; Text_NextAttributeValue.gameObject.SetActive(true); } public void EndUpGrade() { Text_NextAttributeValue.gameObject.SetActive(false); } public void StartBj(FaBaoInfo nextFabaoInfo) { if (nextFabaoInfo == null || !nextFabaoInfo.attriButedIC.ContainsKey(key) || nextFabaoInfo.attriButedIC[key] < faBaoInfo.attriButedIC[key]) { Icon_Bj.gameObject.SetActive(true); Icon_Bj.icon_name = "icon_tisheng"; } else if (nextFabaoInfo.attriButedIC[key] >faBaoInfo.attriButedIC[key]) { Icon_Bj.gameObject.SetActive(true); Icon_Bj.icon_name = "icon_xiajiang"; } else { Icon_Bj.gameObject.SetActive(false); } } public void EndBj() { Icon_Bj.gameObject.SetActive(false); } private string GetAttributeName(int type) { switch (type) { case 1: return "生命"; case 2: return "防御"; case 3: return "攻击"; } return ""; } } }