コード例 #1
0
 internal GameOptionToggle(GameObject parent, GameObject target, string prefKey, Sprite icon, string text, bool defaultValue)
 {
     this.Value                   = defaultValue;
     this._prefKey                = prefKey;
     this.gameObject              = NGUIUtil.SetCloneChild(parent, target, prefKey);
     this._toggle                 = gameObject.GetComponentInChildren <HMUI.Toggle>();
     this._toggle.isOn            = this.Value;
     this._nameText               = gameObject.GetComponentInChildren <TextMeshProUGUI>();
     this.NameText                = text;
     this._toggle.didSwitchEvent += new Action <HMUI.Toggle, bool>(this.HandleNoEnergyToggleDidSwitch);
     foreach (MonoBehaviour obj in gameObject.GetComponentsInChildren <UnityEngine.UI.Image>())
     {
         if ("Image".Equals(obj.name))
         {
             ((UnityEngine.UI.Image)obj).sprite = icon;
             return;
         }
     }
 }
コード例 #2
0
 public virtual void HandleNoEnergyToggleDidSwitch(HMUI.Toggle toggle, bool isOn)
 {
     this.Value = isOn;
     ModPrefs.SetBool(Plugin.PluginName, _prefKey, isOn);
     OnToggle?.Invoke(isOn);
 }
コード例 #3
0
 public virtual void HandleNoEnergyToggleDidSwitch(HMUI.Toggle toggle, bool isOn)
 {
     this.Value = isOn;
     //Plugin.enableHiddenBlocks = isOn;
     Plugin.Instance.ShouldWriteConfig = true;
 }