Example #1
0
        public static bool ShowSoundTickDropdown(DropDownButtonWidget dropdown, SoundSettings audio)
        {
            var options = new Dictionary<string, SoundCashTicks>()
            {
                { "Extreme", SoundCashTicks.Extreme },
                { "Normal", SoundCashTicks.Normal },
                { "Disabled", SoundCashTicks.Disabled },
            };

            Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
            {
                var item = ScrollItemWidget.Setup(itemTemplate,
                    () => audio.SoundCashTickType == options[o],
                    () => audio.SoundCashTickType = options[o]);
                item.Get<LabelWidget>("LABEL").GetText = () => o;
                return item;
            };

            dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
            return true;
        }
        bool ShowAudioDeviceDropdown(DropDownButtonWidget dropdown, SoundSettings s, SoundDevice[] devices)
        {
            var i = 0;
            var options = devices.ToDictionary(d => (i++).ToString(), d => d);

            Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
            {
                var item = ScrollItemWidget.Setup(itemTemplate,
                    () => soundDevice == options[o],
                    () => soundDevice = options[o]);

                item.Get<LabelWidget>("LABEL").GetText = () => options[o].Label;
                return item;
            };

            dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
            return true;
        }
Example #3
0
        public static bool ShowSoundEngineDropdown(DropDownButtonWidget dropdown, SoundSettings s)
        {
            var options = new Dictionary<string, string>()
            {
                { "OpenAL", "AL" },
                { "None", "Null" },
            };

            Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
            {
                var item = ScrollItemWidget.Setup(itemTemplate,
                    () => s.Engine == options[o],
                    () => s.Engine = options[o]);
                item.Get<LabelWidget>("LABEL").GetText = () => o;
                return item;
            };

            dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
            return true;
        }
Example #4
0
        Action ResetAudioPanel(Widget panel)
        {
            var ss = Game.Settings.Sound;
            var dss = new SoundSettings();
            return () =>
            {
                ss.MapMusic = dss.MapMusic;
                ss.SoundVolume = dss.SoundVolume;
                ss.MusicVolume = dss.MusicVolume;
                ss.VideoVolume = dss.VideoVolume;
                ss.CashTicks = dss.CashTicks;
                ss.Device = dss.Device;
                ss.Engine = dss.Engine;

                panel.Get<SliderWidget>("SOUND_VOLUME").Value = ss.SoundVolume;
                panel.Get<SliderWidget>("MUSIC_VOLUME").Value = ss.MusicVolume;
                panel.Get<SliderWidget>("VIDEO_VOLUME").Value = ss.VideoVolume;
                soundDevice = Sound.AvailableDevices().First();
            };
        }