//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, April 01, 2019 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; namespace Snxxz.UI { public class TipOperateButton : MonoBehaviour { [SerializeField] Button m_Button; [SerializeField] Image m_Icon; [SerializeField] Text m_Title; string windowName; ItemOperateType operateType; string guid; public void SetActive(bool active) { this.gameObject.SetActive(active); } public void Bind(string windowName, ItemOperateType type, string guid) { this.windowName = windowName; this.operateType = type; this.guid = guid; switch (type) { case ItemOperateType.putAway: this.m_Title.text = "上架"; break; case ItemOperateType.sell: this.m_Title.text = "出售"; break; case ItemOperateType.makeUse: this.m_Title.text = "使用"; break; case ItemOperateType.split: this.m_Title.text = "拆分"; break; case ItemOperateType.inlay: this.m_Title.text = "镶嵌"; break; case ItemOperateType.putOut: this.m_Title.text = "取出"; break; case ItemOperateType.putIn: this.m_Title.text = "放入"; break; case ItemOperateType.compose: this.m_Title.text = "合成"; break; case ItemOperateType.buy: this.m_Title.text = "购买"; break; case ItemOperateType.gotoPuton: case ItemOperateType.putOn: this.m_Title.text = "穿上"; break; case ItemOperateType.putOff: this.m_Title.text = "脱下"; break; case ItemOperateType.strength: this.m_Title.text = "强化"; break; case ItemOperateType.star: this.m_Title.text = "升星"; break; case ItemOperateType.train: this.m_Title.text = "洗炼"; break; case ItemOperateType.exchange: this.m_Title.text = "兑换"; break; case ItemOperateType.renewal: this.m_Title.text = "续费"; break; default: this.m_Title.text = ""; break; } var isBlackSkin = type == ItemOperateType.sell || type == ItemOperateType.putOff; m_Icon.SetSprite(isBlackSkin ? "UnReceiveBG" : "ReceiveBG_a"); this.m_Title.color = UIHelper.GetUIColor(isBlackSkin ? TextColType.LightYellow : TextColType.Black); m_Button.SetListener(() => { WindowCenter.Instance.Close(windowName); if (this.operateType == ItemOperateType.buy) { ItemTipUtility.GoodOperate(operateType, BuyItemController.Instance.goodId, BuyItemController.Instance.wannaBuyCount.value); } else { ItemTipUtility.Operate(operateType, this.guid); } }); } } }