| using System; | 
| using System.Collections; | 
| using System.Collections.Generic; | 
|   | 
| using UnityEngine; | 
|     public class FuncEnable : MonoBehaviour | 
|     { | 
|         [SerializeField] int funcOpenKey; | 
|   | 
|         private void Awake() | 
|         { | 
|             FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; | 
|         } | 
|   | 
|         private void OnEnable() | 
|         { | 
|             SetState(); | 
|         } | 
|   | 
|         private void OnFuncStateChangeEvent(int _key) | 
|         { | 
|             if (funcOpenKey == _key) | 
|             { | 
|                 SetState(); | 
|             } | 
|         } | 
|   | 
|         void SetState() | 
|         { | 
|             var _funcOpenCfg = FuncOpenLVConfig.Get(funcOpenKey); | 
|             if (_funcOpenCfg != null && _funcOpenCfg.open == 0) | 
|             { | 
|                 gameObject.SetActive(false); | 
|                 return; | 
|             } | 
|   | 
|             gameObject.SetActive(true); | 
|         } | 
|     } |