Exemplo n.º 1
0
        private void UpdateValue()
        {
            if (uiSlider == null)
            {
                visualAmount = Mathf.Clamp(visualAmount, 0f, 1f);

                // Limit by steps
                if (numberOfSteps > 0)
                {
                    visualAmount = Mathf.Round(visualAmount * numberOfSteps) / numberOfSteps;
                }

                amount = (visualAmount * (maxValue - minValue)) + minValue;
            }
            else
            {
                amount = visualAmount;
            }

            switch (sliderType)
            {
            case AC_SliderType.Speech:
                Options.SetSpeechVolume(amount);
                break;

            case AC_SliderType.Music:
                Options.SetMusicVolume(amount);
                break;

            case AC_SliderType.SFX:
                Options.SetSFXVolume(amount);
                break;

            case AC_SliderType.FloatVariable:
                if (varID >= 0)
                {
                    GlobalVariables.SetFloatValue(varID, amount);
                }
                break;

            default:
                break;
            }

            if (!KickStarter.actionListAssetManager.IsListRunning(actionListOnChange))
            {
                AdvGame.RunActionListAsset(actionListOnChange);
            }
        }
Exemplo n.º 2
0
        private void UpdateValue()
        {
            if (uiSlider == null)
            {
                visualAmount = Mathf.Clamp(visualAmount, 0f, 1f);

                // Limit by steps
                if (numberOfSteps > 0)
                {
                    visualAmount = Mathf.Round(visualAmount * numberOfSteps) / numberOfSteps;
                }

                amount = (visualAmount * (maxValue - minValue)) + minValue;
            }
            else
            {
                amount = visualAmount;
            }

            if (sliderType == AC_SliderType.Speech || sliderType == AC_SliderType.SFX || sliderType == AC_SliderType.Music)
            {
                if (Options.optionsData != null)
                {
                    if (sliderType == AC_SliderType.Speech)
                    {
                        KickStarter.options.SetVolume(SoundType.Speech, amount);
                    }
                    else if (sliderType == AC_SliderType.Music)
                    {
                        KickStarter.options.SetVolume(SoundType.Music, amount);
                    }
                    else if (sliderType == AC_SliderType.SFX)
                    {
                        KickStarter.options.SetVolume(SoundType.SFX, amount);
                    }

                                        #if UNITY_5 || UNITY_2017_1_OR_NEWER
                    if (sliderType == AC_SliderType.Speech)
                    {
                        AdvGame.SetMixerVolume(KickStarter.settingsManager.speechMixerGroup, KickStarter.settingsManager.speechAttentuationParameter, amount);
                    }
                    else if (sliderType == AC_SliderType.Music)
                    {
                        AdvGame.SetMixerVolume(KickStarter.settingsManager.musicMixerGroup, KickStarter.settingsManager.musicAttentuationParameter, amount);
                    }
                    else if (sliderType == AC_SliderType.SFX)
                    {
                        AdvGame.SetMixerVolume(KickStarter.settingsManager.sfxMixerGroup, KickStarter.settingsManager.sfxAttentuationParameter, amount);
                    }
                                        #endif
                }
                else
                {
                    ACDebug.LogWarning("Could not find Options data!");
                }
            }
            else if (sliderType == AC_SliderType.FloatVariable)
            {
                if (varID >= 0)
                {
                    GlobalVariables.SetFloatValue(varID, amount);
                }
            }

            if (!KickStarter.actionListAssetManager.IsListRunning(actionListOnChange))
            {
                AdvGame.RunActionListAsset(actionListOnChange);
            }
        }