Ejemplo n.º 1
0
        Action ResetInputPanel(Widget panel)
        {
            var gs = Game.Settings.Game;
            var ks = Game.Settings.Keys;
            var dgs = new GameSettings();
            var dks = new KeySettings();

            return () =>
            {
                gs.UseClassicMouseStyle = dgs.UseClassicMouseStyle;
                gs.MouseScroll = dgs.MouseScroll;
                gs.ViewportEdgeScroll = dgs.ViewportEdgeScroll;
                gs.ViewportEdgeScrollStep = dgs.ViewportEdgeScrollStep;
                gs.UIScrollSpeed = dgs.UIScrollSpeed;

                foreach (var f in ks.GetType().GetFields())
                {
                    var value = (Hotkey)f.GetValue(dks);
                    f.SetValue(ks, value);
                    panel.Get(f.Name).Get<HotkeyEntryWidget>("HOTKEY").Key = value;
                }

                panel.Get<SliderWidget>("SCROLLSPEED_SLIDER").Value = gs.ViewportEdgeScrollStep;
                panel.Get<SliderWidget>("UI_SCROLLSPEED_SLIDER").Value = gs.UIScrollSpeed;
            };
        }
Ejemplo n.º 2
0
        static bool ShowMouseScrollDropdown(DropDownButtonWidget dropdown, GameSettings s)
        {
            var options = new Dictionary<string, MouseScrollType>()
            {
                { "Disabled", MouseScrollType.Disabled },
                { "Standard", MouseScrollType.Standard },
                { "Inverted", MouseScrollType.Inverted },
            };

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

            dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
            return true;
        }
Ejemplo n.º 3
0
        Action ResetDisplayPanel(Widget panel)
        {
            var ds = Game.Settings.Graphics;
            var gs = Game.Settings.Game;
            var dds = new GraphicSettings();
            var dgs = new GameSettings();
            return () =>
            {
                gs.ShowShellmap = dgs.ShowShellmap;

                ds.CapFramerate = dds.CapFramerate;
                Game.SetIdealFrameTime(ds.MaxFramerate);
                ds.MaxFramerate = dds.MaxFramerate;
                ds.Language = dds.Language;
                ds.Mode = dds.Mode;
                ds.WindowedSize = dds.WindowedSize;

                ds.PixelDouble = dds.PixelDouble;
                worldRenderer.Viewport.Zoom = ds.PixelDouble ? 2 : 1;
            };
        }