Пример #1
0
        // Start is called before the first frame update
        void Start()
        {
            sign = GetComponentInChildren <TextMesh>();
            sign.transform.SetParent(transform.parent);
            mpb = new MaterialPropertyBlock();

            UpdateBuilding();
            NipaPrefsManagerInterface.GetManager(DemoParam.ENVIROMENT_PREFS).OnPrefsUpdated += () => UpdateBuilding();
        }
Пример #2
0
 public NipaValue(string managerId, string id, T defaultValue, string tip = "")
 {
     this.id         = id;
     this.value      = this.defaultValue = defaultValue;
     this.savedValue = this.value;
     this.tip        = tip;
     this.managerId  = managerId;
     if (NipaPrefsManagerInterface.GetManager(managerId, out manager))
     {
         Initialize();
     }
     else
     {
         NipaPrefsManagerInterface.OnManagerReady += LazyInitialize;
     }
 }
Пример #3
0
        public T Get()
        {
            if (!initialized) // this can be happen, when Get() is called BEFORE the manager gets ready and LazyInitialize is called.
            {
                var mgr = NipaPrefsManagerInterface.GetManager(managerId);
                if (mgr != null)
                {
                    LazyInitialize(mgr); //call LazyInitialize to unsubscribe event
                }
                else
                {
                    Debug.LogErrorFormat("[NipaPrefs] value id {0} failed to find its manager {1}", id, managerId);
                }
            }

            return(value);
        }