using System.Collections; using System.Collections.Generic; using UnityEngine.UI; using UnityEngine; using GCGame.Table; using Module.Log; public class MeditateCtr : MonoBehaviour { public Button _MeditateBtn; public static MeditateCtr Instance; private int _UnLockLevel = -1; private void Awake() { Instance = this; GetUnLockLevel(); } private void OnDestroy() { Instance = null; } void GetUnLockLevel() { if (!int.TryParse(TableManager.GetSystemParamByID(53, 0).StringValue, out _UnLockLevel)) { LogModule.ErrorLog("SystemParam 53 is null"); } } public void OnLevelChange(int level) { //if (_UnLockLevel == -1) // GetUnLockLevel(); //if(_UnLockLevel == -1) //{ // this.gameObject.SetActive(false); // return; //} //this.gameObject.SetActive(level >= _UnLockLevel); } public void OnMeditateBtn() { if (_UnLockLevel == -1) GetUnLockLevel(); if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level < _UnLockLevel) { GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{11101}")); return; } if (!CanChangeToMesitateState()) return; GameManager.gameManager.AutoSearch.Stop(); ReqSit req = new ReqSit(); req.flag = 1; req.SendMsg(); } bool CanChangeToMesitateState() { if (GameManager.gameManager.PlayerDataPool.InTreasureState) { GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{11103}")); return false; } if(GameManager.gameManager.PlayerDataPool.IsInWeddingCar) { GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{26013}")); return false; } return true; } #region 主界面打坐按钮高亮控制 public GameObject ButSon; public GameObject ButSon_1; public void ShowMeditateHLBtn(bool isShow) { ButSon.SetActive(!isShow); ButSon_1.SetActive(isShow); } #endregion }