using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class CountIconCreaterCtrl : IconCreaterCtrl { public Text text_Count; int count; public override void ButtonClick() { if (count > 0) { EventCenter.Instance.EventTrigger(CreaterEventName, this); } } public override void SetUpdateIconMsg(object msg,string msgType="") { count =(int) msg; ShowCount(); } private void ShowCount() { text_Count.text = count.ToString(); } //更新数据并且 public void UpdateCount(int changeValue) { count += changeValue; ShowCount(); thisButton.interactable = (count > 0); } }