using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using GCGame.Table; public class BtnInteraction : MonoBehaviour { public GameObject _ItemIcon; public GameObject _redIcon; public static BtnInteraction Instance; private LayoutElement _LayoutElement; private void Awake() { Instance = this; } private void OnDestroy() { Instance = null; } private void OnEnable() { //if (_ItemIcon.activeInHierarchy) // _ItemIcon.SetActive(false); //ReqInteractionState(); if (_LayoutElement == null) _LayoutElement = gameObject.GetComponent(); gameObject.SetActive(false); _LayoutElement.ignoreLayout = true; } public void ReqInteractionState() { ReqInteractionActivityState req = new ReqInteractionActivityState(); req._flag = 1; req.SendMsg(); } public void OnPacket(int state, int _isShow) { _redIcon.SetActive(_isShow == 1); if (_LayoutElement == null) _LayoutElement = gameObject.GetComponent(); if (state == 1) { var functionTab = TableManager.GetFunctionOpenByID(104, 0); if(functionTab == null) { _ItemIcon.SetActive(false); _LayoutElement.ignoreLayout = true; return; } if(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < functionTab.ShowLevel) { gameObject.SetActive(false); _LayoutElement.ignoreLayout = true; return; } gameObject.SetActive(true); _ItemIcon.SetActive(true); _LayoutElement.ignoreLayout = false; } else { gameObject.SetActive(false); _LayoutElement.ignoreLayout = true; } } public void ShowRedIcon(bool isShow) { _redIcon.SetActive(isShow); } public void OnItemClick() { UIManager.ShowUI(UIInfo.InteractionPanel); } }