public virtual void Awake () { #if UNITY_EDITOR if (!Application.isPlaying) return; #endif toggle.isOn = SaveAndLoadManager.GetValue<bool>(playerPrefsKey, toggle.isOn); }
public override void Awake() { #if UNITY_EDITOR if (!Application.isPlaying) { return; } #endif slider.value = SaveAndLoadManager.GetValue <float>(playerPrefsKey, slider.value); base.Awake(); }
public virtual void ToggleEvent() { string windEventEnabledPlayerPrefsKey = "Wind Event enabled"; string scoreMultiplierEventEnabledPlayerPrefsKey = "Bounty Multiplier Event enabled"; if (Menus.Instance.toggleAllEventsTextMeshes.Contains(textMesh)) { bool newEnabledValue = !(SaveAndLoadManager.GetValue <bool>(windEventEnabledPlayerPrefsKey, true) && SaveAndLoadManager.GetValue <bool>(scoreMultiplierEventEnabledPlayerPrefsKey, true)); SaveAndLoadManager.SetValue(windEventEnabledPlayerPrefsKey, newEnabledValue); SaveAndLoadManager.SetValue(scoreMultiplierEventEnabledPlayerPrefsKey, newEnabledValue); } else if (Menus.Instance.toggleWindEventTextMeshes.Contains(textMesh)) { SaveAndLoadManager.SetValue(windEventEnabledPlayerPrefsKey, !SaveAndLoadManager.GetValue <bool>(windEventEnabledPlayerPrefsKey, true)); } else if (Menus.Instance.toggleScoreMultiplierEventTextMeshes.Contains(textMesh)) { SaveAndLoadManager.SetValue(scoreMultiplierEventEnabledPlayerPrefsKey, !SaveAndLoadManager.GetValue <bool>(scoreMultiplierEventEnabledPlayerPrefsKey, true)); } Menus.Instance.UpdateToggleEventTextMeshes(); }
public virtual void UpdateToggleEventTextMeshes() { bool windEventEnabled = SaveAndLoadManager.GetValue <bool>("Wind Event enabled", true); bool scoreMultiplierEventEnabled = SaveAndLoadManager.GetValue <bool>("Bounty Multiplier Event enabled", true); bool anyEventEnabled = windEventEnabled || scoreMultiplierEventEnabled; for (int i = 0; i < toggleAllEventsTextMeshes.Length; i++) { if (anyEventEnabled) { toggleAllEventsTextMeshes[i].text = "Disable"; } else { toggleAllEventsTextMeshes[i].text = "Enable"; } if (windEventEnabled) { toggleWindEventTextMeshes[i].text = "Disable Wind Event"; toggleWindEventTextMeshes[i].GetComponent <Transform>().localScale = new Vector3(0.0001f, 0.0001f, 1); } else { toggleWindEventTextMeshes[i].text = "Enable Wind Event"; toggleWindEventTextMeshes[i].GetComponent <Transform>().localScale = new Vector3(0.0001f, 0.0001f, 1); } if (scoreMultiplierEventEnabled) { toggleScoreMultiplierEventTextMeshes[i].text = "Disable Score Multiplier Event"; toggleScoreMultiplierEventTextMeshes[i].GetComponent <Transform>().localScale = new Vector3(0.0000625f, 0.0000625f, 1); } else { toggleScoreMultiplierEventTextMeshes[i].text = "Enable Score Multiplier Event"; toggleScoreMultiplierEventTextMeshes[i].GetComponent <Transform>().localScale = new Vector3(0.0000625f, 0.0000625f, 1); } } }