override public float Run() { switch (method) { case OptionSetMethod.Language: if (index >= 0 && KickStarter.speechManager != null && index < KickStarter.speechManager.languages.Count) { if (KickStarter.speechManager != null && KickStarter.speechManager.separateVoiceAndTextLanguages) { switch (splitLanguageType) { case SplitLanguageType.TextAndVoice: Options.SetLanguage(index); Options.SetVoiceLanguage(index); break; case SplitLanguageType.TextOnly: Options.SetLanguage(index); break; case SplitLanguageType.VoiceOnly: Options.SetVoiceLanguage(index); break; } } else { Options.SetLanguage(index); } } else { LogWarning("Could not set language to index: " + index + " - does this language exist?"); } break; case OptionSetMethod.Subtitles: Options.SetSubtitles((index == 1)); break; case OptionSetMethod.SpeechVolume: Options.SetSpeechVolume(volume); break; case OptionSetMethod.SFXVolume: Options.SetSFXVolume(volume); break; case OptionSetMethod.MusicVolume: Options.SetMusicVolume(volume); break; } return(0f); }
/** * <summary>Performs what should happen when the element is clicked on.</summary> * <param name = "_menu">The element's parent Menu</param> * <param name = "_slot">Ignored by this subclass</param> * <param name = "_mouseState">The state of the mouse button</param> */ public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState) { if (!_menu.IsClickable()) { return; } if (uiDropdown != null) { selected = uiDropdown.value; } else { CycleOption(); } if (cycleType == AC_CycleType.Language) { if (selected == 0 && KickStarter.speechManager.ignoreOriginalText && KickStarter.runtimeLanguages.Languages.Count > 1) { // Ignore original text by skipping to first language selected = 1; } if (KickStarter.speechManager != null && KickStarter.speechManager.separateVoiceAndTextLanguages) { switch (splitLanguageType) { case SplitLanguageType.TextAndVoice: Options.SetLanguage(selected); Options.SetVoiceLanguage(selected); break; case SplitLanguageType.TextOnly: Options.SetLanguage(selected); break; case SplitLanguageType.VoiceOnly: Options.SetVoiceLanguage(selected); break; } } else { Options.SetLanguage(selected); } } else if (cycleType == AC_CycleType.Variable) { if (linkedVariable != null) { linkedVariable.IntegerValue = selected; linkedVariable.Upload(); } } if (cycleType == AC_CycleType.CustomScript) { MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState); } if (actionListOnClick) { AdvGame.RunActionListAsset(actionListOnClick); } base.ProcessClick(_menu, _slot, _mouseState); }
/** * <summary>Performs what should happen when the element is clicked on.</summary> * <param name = "_menu">The element's parent Menu</param> * <param name = "_slot">Ignored by this subclass</param> * <param name = "_mouseState">The state of the mouse button</param> */ public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState) { if (!_menu.IsClickable()) { return; } #if UNITY_5_3_OR_NEWER if (uiDropdown != null) { selected = uiDropdown.value; } else { selected++; if (selected > optionsArray.Count - 1) { selected = 0; } } #else selected++; if (selected > optionsArray.Count - 1) { selected = 0; } #endif if (cycleType == AC_CycleType.Language) { if (selected == 0 && KickStarter.speechManager.ignoreOriginalText && KickStarter.runtimeLanguages.Languages.Count > 1) { // Ignore original text by skipping to first language selected = 1; } if (KickStarter.speechManager != null && KickStarter.speechManager.separateVoiceAndTextLanguages) { switch (splitLanguageType) { case SplitLanguageType.TextAndVoice: Options.SetLanguage(selected); Options.SetVoiceLanguage(selected); break; case SplitLanguageType.TextOnly: Options.SetLanguage(selected); break; case SplitLanguageType.VoiceOnly: Options.SetVoiceLanguage(selected); break; } } else { Options.SetLanguage(selected); } } else if (cycleType == AC_CycleType.Variable) { if (varID >= 0) { GVar var = GlobalVariables.GetVariable(varID); if (var.type == VariableType.Integer) { var.val = selected; var.Upload(VariableLocation.Global); } } } if (cycleType == AC_CycleType.CustomScript) { MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState); } if (actionListOnClick) { AdvGame.RunActionListAsset(actionListOnClick); } base.ProcessClick(_menu, _slot, _mouseState); }