using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using GCGame.Table; using Module.Log; public class InteractionItem : UIItemBase { public Text _title; public GameObject _canBtn; public GameObject _cantBtn; public GameObject _getedBtn; public UIContainerBase _rewItemContainer; public int _interactionNodeId; private int _curType; public override void Show(Hashtable hash) { base.Show(hash); var tab = (Tab_InteractionNode)hash["InitObj"]; _interactionNodeId = tab.Id; var _interactionNodeTab = TableManager.GetInteractionNodeByID(_interactionNodeId, 0); if(_interactionNodeTab == null) { LogModule.ErrorLog("_interactionNodeTab is null : " + _interactionNodeId); gameObject.SetActive(false); return; } _curType = _interactionNodeTab.InteractiveType; _title.text = _interactionNodeTab.Title; List rewList = new List(); for(int index = 0; index < _interactionNodeTab.getRewardCount(); index++) { rewList.Add(new InteractionRewItem.InteractionRewItemData( _interactionNodeTab.GetRewardbyIndex(index), _interactionNodeTab.GetNumbyIndex(index))); } if (rewList.Count > 0) _rewItemContainer.InitContentItem(rewList); } private int _curState = 0; // 0.不可领取 1.可领取 2.已领取 public void InitState(int state) { _curState = state; _canBtn.SetActive(_curState == 1); _cantBtn.SetActive(_curState == 0); _getedBtn.SetActive(_curState == 2); } public void OnGainBtnClick() { ReqGetInteractionRew req = new ReqGetInteractionRew(); req._type = _curType; req._nodeId = _interactionNodeId; req.SendMsg(); } }