/**
         * <summary>Recalculates the element's size.
         * This should be called whenever a Menu's shape is changed.</summary>
         * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param>
         */
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (!_menu.IsClickable())
            {
                return;
            }

            if (uiToggle != null)
            {
                isOn = uiToggle.isOn;
            }
            else
            {
                if (isOn)
                {
                    isOn = false;
                }
                else
                {
                    isOn = true;
                }
            }

            if (toggleType == AC_ToggleType.Subtitles)
            {
                Options.SetSubtitles(isOn);
            }
            else if (toggleType == AC_ToggleType.Variable)
            {
                if (varID >= 0)
                {
                    GVar var = GlobalVariables.GetVariable(varID);
                    if (var.type == VariableType.Boolean)
                    {
                        if (isOn)
                        {
                            var.val = 1;
                        }
                        else
                        {
                            var.val = 0;
                        }
                        var.Upload(VariableLocation.Global);
                    }
                }
            }

            if (toggleType == AC_ToggleType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
            }

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }

            base.ProcessClick(_menu, _slot, _mouseState);
        }
Exemple #2
0
        public override bool ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (!_menu.IsClickable())
            {
                return(false);
            }

            if (uiToggle)
            {
                isOn = uiToggle.isOn;
            }
            else
            {
                if (isOn)
                {
                    isOn = false;
                }
                else
                {
                    isOn = true;
                }
            }

            switch (toggleType)
            {
            case AC_ToggleType.Subtitles:
                Options.SetSubtitles(isOn);
                break;

            case AC_ToggleType.Variable:
                if (varID >= 0)
                {
                    GVar var = GlobalVariables.GetVariable(varID);
                    if (var.type == VariableType.Boolean)
                    {
                        var.IntegerValue = (isOn) ? 1 : 0;
                        var.Upload(VariableLocation.Global);
                    }
                }
                break;

            case AC_ToggleType.CustomScript:
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
                break;

            default:
                break;
            }

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }

            return(base.ProcessClick(_menu, _slot, _mouseState));
        }
Exemple #3
0
        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);
        }