Пример #1
0
        public override void Init()
        {
            base.Init();

            widgets = new Widget[] {
                // Column 1
                Make(-140, -100, "Simple arms anim", OnWidgetClick,
                     g => g.SimpleArmsAnim? "yes" : "no",
                     (g, v) => { g.SimpleArmsAnim = v == "yes";
                                 Options.Set(OptionsKey.SimpleArmsAnim, v == "yes"); }),

                Make(-140, -50, "Classic gui textures", OnWidgetClick,
                     g => g.UseClassicGui ? "yes" : "no",
                     (g, v) => { g.UseClassicGui = v == "yes";
                                 Options.Set(OptionsKey.UseClassicGui, v == "yes"); }),

                Make(-140, 0, "Classic player list", OnWidgetClick,
                     g => g.UseClassicTabList ? "yes" : "no",
                     (g, v) => { g.UseClassicTabList = v == "yes";
                                 Options.Set(OptionsKey.UseClassicTabList, v == "yes"); }),

                Make(-140, 50, "Classic options menu", OnWidgetClick,
                     g => g.UseClassicOptions ? "yes" : "no",
                     (g, v) => { g.UseClassicOptions = v == "yes";
                                 Options.Set(OptionsKey.UseClassicOptions, v == "yes"); }),

                // Column 2
                Make(140, -100, "Allow custom blocks", OnWidgetClick,
                     g => g.AllowCustomBlocks ? "yes" : "no",
                     (g, v) => { g.AllowCustomBlocks = v == "yes";
                                 Options.Set(OptionsKey.AllowCustomBlocks, v == "yes"); }),

                Make(140, -50, "Use CPE", OnWidgetClick,
                     g => g.UseCPE ? "yes" : "no",
                     (g, v) => { g.UseCPE = v == "yes";
                                 Options.Set(OptionsKey.UseCPE, v == "yes"); }),

                Make(140, 0, "Allow server textures", OnWidgetClick,
                     g => g.AllowServerTextures ? "yes" : "no",
                     (g, v) => { g.AllowServerTextures = v == "yes";
                                 Options.Set(OptionsKey.AllowServerTextures, v == "yes"); }),

                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new PauseScreen(g))),
                null, null,
            };

            validators = new MenuInputValidator[] {
                new BooleanValidator(),
                new BooleanValidator(),
                new BooleanValidator(),
                new BooleanValidator(),

                new BooleanValidator(),
                new BooleanValidator(),
                new BooleanValidator(),
            };
            infoWidget = TextWidget.Create(game, 0, 150, "&eButtons on the right require a client restart.",
                                           Anchor.Centre, Anchor.Centre, regularFont);
        }
Пример #2
0
        void LoadOptions()
        {
            ClassicMode       = Options.GetBool("mode-classic", false);
            ClassicHacks      = Options.GetBool(OptionsKey.AllowClassicHacks, false);
            AllowCustomBlocks = Options.GetBool(OptionsKey.AllowCustomBlocks, true);
            UseCPE            = Options.GetBool(OptionsKey.UseCPE, true);
            SimpleArmsAnim    = Options.GetBool(OptionsKey.SimpleArmsAnim, false);

            ViewBobbing = Options.GetBool(OptionsKey.ViewBobbing, true);
            FpsLimitMethod method = Options.GetEnum(OptionsKey.FpsLimit, FpsLimitMethod.LimitVSync);

            SetFpsLimitMethod(method);
            ViewDistance     = Options.GetInt(OptionsKey.ViewDist, 16, 4096, 512);
            UserViewDistance = ViewDistance;
            SmoothLighting   = Options.GetBool(OptionsKey.SmoothLighting, false);

            DefaultFov        = Options.GetInt(OptionsKey.FieldOfView, 1, 150, 70);
            Fov               = DefaultFov;
            ZoomFov           = DefaultFov;
            ModifiableLiquids = !ClassicMode && Options.GetBool(OptionsKey.ModifiableLiquids, false);
            CameraClipping    = Options.GetBool(OptionsKey.CameraClipping, true);

            AllowServerTextures = Options.GetBool(OptionsKey.AllowServerTextures, true);
            MouseSensitivity    = Options.GetInt(OptionsKey.Sensitivity, 1, 100, 30);
            ShowBlockInHand     = Options.GetBool(OptionsKey.ShowBlockInHand, true);
            InvertMouse         = Options.GetBool(OptionsKey.InvertMouse, false);

            bool skipSsl = Options.GetBool("skip-ssl-check", false);

            if (skipSsl)
            {
                ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
                Options.Set("skip-ssl-check", false);
            }
        }
Пример #3
0
        void LoadGuiOptions()
        {
            ChatLines      = Options.GetInt(OptionsKey.ChatLines, 0, 30, 12);
            ClickableChat  = Options.GetBool(OptionsKey.ClickableChat, false);
            InventoryScale = Options.GetFloat(OptionsKey.InventoryScale, 0.25f, 5f, 1f);
            HotbarScale    = Options.GetFloat(OptionsKey.HotbarScale, 0.25f, 5f, 1f);
            ChatScale      = Options.GetFloat(OptionsKey.ChatScale, 0.35f, 5f, 1f);
            ShowFPS        = Options.GetBool(OptionsKey.ShowFPS, true);

            UseClassicGui     = Options.GetBool(OptionsKey.ClassicGui, true) || ClassicMode;
            UseClassicTabList = Options.GetBool(OptionsKey.ClassicTabList, false) || ClassicMode;
            UseClassicOptions = Options.GetBool(OptionsKey.ClassicOptions, false) || ClassicMode;

            TabAutocomplete = Options.GetBool(OptionsKey.TabAutocomplete, false);
            FontName        = Options.Get(OptionsKey.FontName, "Arial");
            if (ClassicMode)
            {
                FontName = "Arial";
            }

            try {
                using (Font f = new Font(FontName, 16)) { }
            } catch (Exception) {
                FontName = "Arial";
                Options.Set(OptionsKey.FontName, "Arial");
            }
        }
Пример #4
0
 public bool SetRenderType(string type)
 {
     if (Utils.CaselessEquals(type, "legacyfast"))
     {
         SetNewRenderType(true, true);
     }
     else if (Utils.CaselessEquals(type, "legacy"))
     {
         SetNewRenderType(true, false);
     }
     else if (Utils.CaselessEquals(type, "normal"))
     {
         SetNewRenderType(false, false);
     }
     else if (Utils.CaselessEquals(type, "normalfast"))
     {
         SetNewRenderType(false, true);
     }
     else
     {
         return(false);
     }
     Options.Set(OptionsKey.RenderType, type);
     return(true);
 }
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;

            widgets = new Widget[] {
                // Column 1
                !network.IsSinglePlayer ? null :
                Make(-140, -100, "Click distance", OnWidgetClick,
                     g => g.LocalPlayer.ReachDistance.ToString(),
                     (g, v) => g.LocalPlayer.ReachDistance = Single.Parse(v)),

                Make(-140, -50, "Music", OnWidgetClick,
                     g => g.UseMusic ? "yes" : "no",
                     (g, v) => { g.UseMusic = v == "yes";
                                 g.AudioPlayer.SetMusic(g.UseMusic);
                                 Options.Set(OptionsKey.UseMusic, v == "yes"); }),

                Make(-140, 0, "Sound", OnWidgetClick,
                     g => g.UseSound ? "yes" : "no",
                     (g, v) => { g.UseSound = v == "yes";
                                 g.AudioPlayer.SetSound(g.UseSound);
                                 Options.Set(OptionsKey.UseSound, v == "yes"); }),

                Make(-140, 50, "View bobbing", OnWidgetClick,
                     g => g.ViewBobbing ? "yes" : "no",
                     (g, v) => { g.ViewBobbing = v == "yes";
                                 Options.Set(OptionsKey.ViewBobbing, v == "yes"); }),

                // Column 2
                !network.IsSinglePlayer ? null :
                Make(140, -100, "Block physics", OnWidgetClick,
                     g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no",
                     (g, v) => {
                    ((SinglePlayerServer)network).physics.Enabled = v == "yes";
                    Options.Set(OptionsKey.SingleplayerPhysics, v == "yes");
                }),

                Make(140, -50, "Auto close launcher", OnWidgetClick,
                     g => Options.GetBool(OptionsKey.AutoCloseLauncher, false) ? "yes" : "no",
                     (g, v) => Options.Set(OptionsKey.AutoCloseLauncher, v == "yes")),

                Make(140, 0, "Invert mouse", OnWidgetClick,
                     g => g.InvertMouse ? "yes" : "no",
                     (g, v) => { g.InvertMouse = v == "yes";
                                 Options.Set(OptionsKey.InvertMouse, v == "yes"); }),

                Make(140, 50, "Mouse sensitivity", OnWidgetClick,
                     g => g.MouseSensitivity.ToString(),
                     (g, v) => { g.MouseSensitivity = Int32.Parse(v);
                                 Options.Set(OptionsKey.Sensitivity, v); }),

                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new OptionsGroupScreen(g))),
                null, null,
            };
            MakeValidators();
            MakeDescriptions();
        }
Пример #6
0
 void SaveKeyBindings()
 {
     string[] names = KeyBinding.GetNames(typeof(KeyBinding));
     for (int i = 0; i < names.Length; i++)
     {
         Options.Set("key-" + names[i], keys[i]);
     }
 }
Пример #7
0
        public void SetViewDistance(float distance, bool save)
        {
            distance = Math.Min(distance, MaxViewDistance);
            if (distance == ViewDistance)
            {
                return;
            }
            ViewDistance = distance;

            if (save)
            {
                UserViewDistance = distance;
                Options.Set(OptionsKey.ViewDist, distance);
            }
            Events.RaiseViewDistanceChanged();
            UpdateProjection();
        }
Пример #8
0
        public void SetViewDistance(int distance, bool save)
        {
            ViewDistance = distance;
            if (ViewDistance > MaxViewDistance)
            {
                ViewDistance = MaxViewDistance;
            }
            Utils.LogDebug("setting view distance to: {0} ({1})", distance, ViewDistance);

            if (save)
            {
                UserViewDistance = distance;
                Options.Set(OptionsKey.ViewDist, distance);
            }
            Events.RaiseViewDistanceChanged();
            UpdateProjection();
        }
Пример #9
0
        void LoadGui()
        {
            Chat           = new Chat(this);
            InventoryScale = Options.GetFloat(OptionsKey.InventoryScale, 0.25f, 5f, 1f);
            HotbarScale    = Options.GetFloat(OptionsKey.HotbarScale, 0.25f, 5f, 1f);
            ChatScale      = Options.GetFloat(OptionsKey.ChatScale, 0.35f, 5f, 1f);
            ShowFPS        = Options.GetBool(OptionsKey.ShowFPS, true);

            TabAutocomplete = Options.GetBool(OptionsKey.TabAutocomplete, false);
            FontName        = Options.Get(OptionsKey.FontName) ?? "Arial";
            try {
                using (Font f = new Font(FontName, 16)) { }
            } catch (Exception) {
                FontName = "Arial";
                Options.Set(OptionsKey.FontName, "Arial");
            }
        }
Пример #10
0
        public static T GetEnum <T>(string key, T defValue)
        {
            string value = Options.Get(key.ToLower());

            if (value == null)
            {
                Set(key, defValue);
                return(defValue);
            }

            T mapping;

            if (!Utils.TryParseEnum(value, defValue, out mapping))
            {
                Options.Set(key, defValue);
            }
            return(mapping);
        }
Пример #11
0
        public void SetViewDistance(int distance, bool userDist)
        {
            if (userDist)
            {
                UserViewDistance = distance;
                Options.Set(OptionsKey.ViewDist, distance);
            }

            distance = Math.Min(distance, MaxViewDistance);
            if (distance == ViewDistance)
            {
                return;
            }
            ViewDistance = distance;

            Events.RaiseViewDistanceChanged();
            UpdateProjection();
        }
Пример #12
0
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;

            widgets = new Widget[] {
                Make(-140, 0, "FPS limit mode", OnWidgetClick,
                     g => g.FpsLimit.ToString(),
                     (g, v) => { object raw = Enum.Parse(typeof(FpsLimitMethod), v);
                                 g.SetFpsLimitMethod((FpsLimitMethod)raw);
                                 Options.Set(OptionsKey.FpsLimit, v); }),

                Make(-140, 50, "View distance", OnWidgetClick,
                     g => g.ViewDistance.ToString(),
                     (g, v) => g.SetViewDistance(Int32.Parse(v), true)),

                Make(140, 0, "Names mode", OnWidgetClick,
                     g => g.Players.NamesMode.ToString(),
                     (g, v) => { object raw          = Enum.Parse(typeof(NameMode), v);
                                 g.Players.NamesMode = (NameMode)raw;
                                 Options.Set(OptionsKey.NamesMode, v); }),

                Make(140, 50, "Entity shadows", OnWidgetClick,
                     g => g.Players.ShadowMode.ToString(),
                     (g, v) => { object raw           = Enum.Parse(typeof(EntityShadow), v);
                                 g.Players.ShadowMode = (EntityShadow)raw;
                                 Options.Set(OptionsKey.EntityShadow, v); }),

                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new OptionsGroupScreen(g))),
                null, null,
            };
            widgets[0].Metadata = typeof(FpsLimitMethod);
            widgets[2].Metadata = typeof(NameMode);
            widgets[3].Metadata = typeof(EntityShadow);
            MakeValidators();
            MakeDescriptions();
        }
Пример #13
0
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;

            widgets = new Widget[] {
                // Column 1
                MakeClassic(-165, -200, "Music", OnWidgetClick,
                            g => g.UseMusic ? "yes" : "no",
                            (g, v) => { g.UseMusic = v == "yes";
                                        g.AudioPlayer.SetMusic(g.UseMusic);
                                        Options.Set(OptionsKey.UseMusic, v == "yes"); }),

                MakeClassic(-165, -150, "Invert mouse", OnWidgetClick,
                            g => g.InvertMouse ? "yes" : "no",
                            (g, v) => { g.InvertMouse = v == "yes";
                                        Options.Set(OptionsKey.InvertMouse, v == "yes"); }),

                MakeClassic(-165, -100, "View distance", OnWidgetClick,
                            g => g.ViewDistance.ToString(),
                            (g, v) => g.SetViewDistance(Int32.Parse(v), true)),

                !network.IsSinglePlayer ? null :
                MakeClassic(-165, -50, "Block physics", OnWidgetClick,
                            g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no",
                            (g, v) => {
                    ((SinglePlayerServer)network).physics.Enabled = v == "yes";
                    Options.Set(OptionsKey.SingleplayerPhysics, v == "yes");
                }),

                // Column 2
                MakeClassic(165, -200, "Sound", OnWidgetClick,
                            g => g.UseSound ? "yes" : "no",
                            (g, v) => { g.UseSound = v == "yes";
                                        g.AudioPlayer.SetSound(g.UseSound);
                                        Options.Set(OptionsKey.UseSound, v == "yes"); }),

                MakeClassic(165, -150, "Show FPS", OnWidgetClick,
                            g => g.ShowFPS ? "yes" : "no",
                            (g, v) => { g.ShowFPS = v == "yes";
                                        Options.Set(OptionsKey.ShowFPS, v == "yes"); }),

                MakeClassic(165, -100, "View bobbing", OnWidgetClick,
                            g => g.ViewBobbing ? "yes" : "no",
                            (g, v) => { g.ViewBobbing = v == "yes";
                                        Options.Set(OptionsKey.ViewBobbing, v == "yes"); }),

                MakeClassic(165, -50, "FPS limit mode", OnWidgetClick,
                            g => g.FpsLimit.ToString(),
                            (g, v) => { object raw = Enum.Parse(typeof(FpsLimitMethod), v);
                                        g.SetFpsLimitMethod((FpsLimitMethod)raw);
                                        Options.Set(OptionsKey.FpsLimit, v); }),

                MakeClassic(0, 50, "Controls", LeftOnly(
                                (g, w) => g.SetNewScreen(new ClassicKeyBindingsScreen(g))), null, null),

                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new PauseScreen(g))),
                null, null,
            };
            widgets[7].Metadata = typeof(FpsLimitMethod);
            MakeValidators();
        }
Пример #14
0
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;

            buttons = new ButtonWidget[] {
                // Column 1
                Make(-140, -150, "Block in hand", OnWidgetClick,
                     g => g.ShowBlockInHand ? "yes" : "no",
                     (g, v) => { g.ShowBlockInHand = v == "yes";
                                 Options.Set(OptionsKey.ShowBlockInHand, v == "yes"); }),

                Make(-140, -100, "Show FPS", OnWidgetClick,
                     g => g.ShowFPS ? "yes" : "no",
                     (g, v) => g.ShowFPS = v == "yes"),

                Make(-140, -50, "Hud scale", OnWidgetClick,
                     g => g.HudScale.ToString(),
                     (g, v) => { g.HudScale = Single.Parse(v);
                                 Options.Set(OptionsKey.HudScale, v);
                                 g.RefreshHud(); }),

                Make(-140, 0, "Use classic gui", OnWidgetClick,
                     g => g.UseClassicGui ? "yes" : "no",
                     (g, v) => { g.UseClassicGui = v == "yes";
                                 Options.Set(OptionsKey.UseClassicGui, v == "yes"); }),

                // Column 2
                Make(140, -150, "Clickable chat", OnWidgetClick,
                     g => g.ClickableChat ? "yes" : "no",
                     (g, v) => { g.ClickableChat = v == "yes";
                                 Options.Set(OptionsKey.ClickableChat, v == "yes"); }),

                Make(140, -100, "Chat scale", OnWidgetClick,
                     g => g.ChatScale.ToString(),
                     (g, v) => { g.ChatScale = Single.Parse(v);
                                 Options.Set(OptionsKey.ChatScale, v);
                                 g.RefreshHud(); }),

                Make(140, -50, "Chat lines", OnWidgetClick,
                     g => g.ChatLines.ToString(),
                     (g, v) => { g.ChatLines = Int32.Parse(v);
                                 Options.Set(OptionsKey.ChatLines, v);
                                 g.RefreshHud(); }),

                Make(140, 0, "Arial chat font", OnWidgetClick,
                     g => g.Drawer2D.UseBitmappedChat ? "no" : "yes",
                     (g, v) => {
                    g.Drawer2D.UseBitmappedChat = v == "no";
                    Options.Set(OptionsKey.ArialChatFont, v == "yes");
                    game.Events.RaiseChatFontChanged();
                    g.RefreshHud();
                    Recreate();
                }),


                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new PauseScreen(g))),
                null,
            };
            validators = new MenuInputValidator[] {
                new BooleanValidator(),
                new BooleanValidator(),
                new RealValidator(0.25f, 5f),
                new BooleanValidator(),

                new BooleanValidator(),
                new RealValidator(0.25f, 5f),
                new IntegerValidator(1, 30),
                new BooleanValidator(),
            };
            okayIndex = buttons.Length - 1;
        }
Пример #15
0
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;

            buttons = new ButtonWidget[] {
                // Column 1
                Make(-140, -100, "Hacks enabled", OnWidgetClick,
                     g => g.LocalPlayer.HacksEnabled ? "yes" : "no",
                     (g, v) => { g.LocalPlayer.HacksEnabled = v == "yes";
                                 Options.Set(OptionsKey.HacksEnabled, v == "yes");
                                 g.LocalPlayer.CheckHacksConsistency(); }),

                Make(-140, -50, "Speed multiplier", OnWidgetClick,
                     g => g.LocalPlayer.SpeedMultiplier.ToString(),
                     (g, v) => { g.LocalPlayer.SpeedMultiplier = Single.Parse(v);
                                 Options.Set(OptionsKey.Speed, v); }),

                Make(-140, 0, "Camera clipping", OnWidgetClick,
                     g => g.CameraClipping ? "yes" : "no",
                     (g, v) => { g.CameraClipping = v == "yes";
                                 Options.Set(OptionsKey.CameraClipping, v == "yes"); }),

                Make(-140, 50, "Jump height", OnWidgetClick,
                     g => g.LocalPlayer.JumpHeight.ToString(),
                     (g, v) => g.LocalPlayer.CalculateJumpVelocity(Single.Parse(v))),

                // Column 2
                Make(140, -100, "Liquids breakable", OnWidgetClick,
                     g => g.LiquidsBreakable ? "yes" : "no",
                     (g, v) => { g.LiquidsBreakable = v == "yes";
                                 Options.Set(OptionsKey.LiquidsBreakable, v == "yes"); }),

                Make(140, -50, "Pushback placing", OnWidgetClick,
                     g => g.LocalPlayer.PushbackPlacing ? "yes" : "no",
                     (g, v) => { g.LocalPlayer.PushbackPlacing = v == "yes";
                                 Options.Set(OptionsKey.PushbackPlacing, v == "yes"); }),

                Make(140, 0, "Noclip slide", OnWidgetClick,
                     g => g.LocalPlayer.NoclipSlide ? "yes" : "no",
                     (g, v) => { g.LocalPlayer.NoclipSlide = v == "yes";
                                 Options.Set(OptionsKey.NoclipSlide, v == "yes"); }),

                Make(140, 50, "Field of view", OnWidgetClick,
                     g => g.FieldOfView.ToString(),
                     (g, v) => { g.FieldOfView = Int32.Parse(v);
                                 Options.Set(OptionsKey.FieldOfView, v);
                                 g.UpdateProjection(); }),

                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new PauseScreen(g))),
                null,
            };

            validators = new MenuInputValidator[] {
                new BooleanValidator(),
                new RealValidator(0.1f, 50),
                new BooleanValidator(),
                new RealValidator(0.1f, 1024f),

                new BooleanValidator(),
                new BooleanValidator(),
                new BooleanValidator(),
                new IntegerValidator(1, 150),
            };
            okayIndex = buttons.Length - 1;
            game.Events.HackPermissionsChanged += CheckHacksAllowed;
            CheckHacksAllowed(null, null);
        }
Пример #16
0
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;

            buttons = new ButtonWidget[] {
                // Column 1
                !network.IsSinglePlayer ? null :
                Make(-140, -200, "Click distance", OnWidgetClick,
                     g => g.LocalPlayer.ReachDistance.ToString(),
                     (g, v) => g.LocalPlayer.ReachDistance = Single.Parse(v)),

                Make(-140, -150, "Use sound", OnWidgetClick,
                     g => g.UseSound ? "yes" : "no",
                     (g, v) => { g.UseSound = v == "yes";
                                 g.AudioPlayer.SetSound(g.UseSound);
                                 Options.Set(OptionsKey.UseSound, v == "yes"); }),

                Make(-140, -100, "Simple arms anim", OnWidgetClick,
                     g => g.SimpleArmsAnim? "yes" : "no",
                     (g, v) => { g.SimpleArmsAnim = v == "yes";
                                 Options.Set(OptionsKey.SimpleArmsAnim, v == "yes"); }),

                Make(-140, -50, "Names mode", OnWidgetClick,
                     g => g.Players.NamesMode.ToString(),
                     (g, v) => { object raw          = Enum.Parse(typeof(NameMode), v);
                                 g.Players.NamesMode = (NameMode)raw;
                                 Options.Set(OptionsKey.NamesMode, v); }),

                Make(-140, 0, "FPS limit", OnWidgetClick,
                     g => g.FpsLimit.ToString(),
                     (g, v) => { object raw = Enum.Parse(typeof(FpsLimitMethod), v);
                                 g.SetFpsLimitMethod((FpsLimitMethod)raw);
                                 Options.Set(OptionsKey.FpsLimit, v); }),

                Make(-140, 50, "View distance", OnWidgetClick,
                     g => g.ViewDistance.ToString(),
                     (g, v) => g.SetViewDistance(Int32.Parse(v), true)),

                // Column 2
                !network.IsSinglePlayer ? null :
                Make(140, -200, "Block physics", OnWidgetClick,
                     g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no",
                     (g, v) => {
                    ((SinglePlayerServer)network).physics.Enabled = v == "yes";
                    Options.Set(OptionsKey.SingleplayerPhysics, v == "yes");
                }),

                Make(140, -150, "Use music", OnWidgetClick,
                     g => g.UseMusic ? "yes" : "no",
                     (g, v) => { g.UseMusic = v == "yes";
                                 g.AudioPlayer.SetMusic(g.UseMusic);
                                 Options.Set(OptionsKey.UseMusic, v == "yes"); }),

                Make(140, -100, "View bobbing", OnWidgetClick,
                     g => g.ViewBobbing ? "yes" : "no",
                     (g, v) => { g.ViewBobbing = v == "yes";
                                 Options.Set(OptionsKey.ViewBobbing, v == "yes"); }),

                Make(140, -50, "Auto close launcher", OnWidgetClick,
                     g => Options.GetBool(OptionsKey.AutoCloseLauncher, false) ? "yes" : "no",
                     (g, v) => Options.Set(OptionsKey.AutoCloseLauncher, v == "yes")),

                Make(140, 0, "Invert mouse", OnWidgetClick,
                     g => g.InvertMouse ? "yes" : "no",
                     (g, v) => { g.InvertMouse = v == "yes";
                                 Options.Set(OptionsKey.InvertMouse, v == "yes"); }),

                Make(140, 50, "Mouse sensitivity", OnWidgetClick,
                     g => g.MouseSensitivity.ToString(),
                     (g, v) => { g.MouseSensitivity = Int32.Parse(v);
                                 Options.Set(OptionsKey.Sensitivity, v); }),

                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new PauseScreen(g))),
                null,
            };
            buttons[3].Metadata = typeof(NameMode);
            buttons[4].Metadata = typeof(FpsLimitMethod);

            validators = new MenuInputValidator[] {
                network.IsSinglePlayer ? new RealValidator(1, 1024) : null,
                new BooleanValidator(),
                new BooleanValidator(),
                new EnumValidator(),
                new EnumValidator(),
                new IntegerValidator(16, 4096),

                network.IsSinglePlayer ? new BooleanValidator() : null,
                new BooleanValidator(),
                new BooleanValidator(),
                new BooleanValidator(),
                new BooleanValidator(),
                new IntegerValidator(1, 100),
            };
            okayIndex = buttons.Length - 1;
        }
        public override void Init()
        {
            base.Init();

            widgets = new Widget[] {
                // Column 1
                Make(-140, -150, "Hacks enabled", OnWidgetClick,
                     g => g.LocalPlayer.Hacks.Enabled ? "yes" : "no",
                     (g, v) => { g.LocalPlayer.Hacks.Enabled = v == "yes";
                                 Options.Set(OptionsKey.HacksEnabled, v == "yes");
                                 g.LocalPlayer.CheckHacksConsistency(); }),

                Make(-140, -100, "Speed multiplier", OnWidgetClick,
                     g => g.LocalPlayer.Hacks.SpeedMultiplier.ToString(),
                     (g, v) => { g.LocalPlayer.Hacks.SpeedMultiplier = Single.Parse(v);
                                 Options.Set(OptionsKey.Speed, v); }),

                Make(-140, -50, "Camera clipping", OnWidgetClick,
                     g => g.CameraClipping ? "yes" : "no",
                     (g, v) => { g.CameraClipping = v == "yes";
                                 Options.Set(OptionsKey.CameraClipping, v == "yes"); }),

                Make(-140, 0, "Jump height", OnWidgetClick,
                     g => g.LocalPlayer.JumpHeight.ToString("F3"),
                     (g, v) => g.LocalPlayer.CalculateJumpVelocity(Single.Parse(v))),

                Make(-140, 50, "Double jump", OnWidgetClick,
                     g => g.LocalPlayer.Hacks.DoubleJump ? "yes" : "no",
                     (g, v) => { g.LocalPlayer.Hacks.DoubleJump = v == "yes";
                                 Options.Set(OptionsKey.DoubleJump, v == "yes"); }),

                // Column 2
                Make(140, -100, "Modifiable liquids", OnWidgetClick,
                     g => g.ModifiableLiquids ? "yes" : "no",
                     (g, v) => { g.ModifiableLiquids = v == "yes";
                                 Options.Set(OptionsKey.ModifiableLiquids, v == "yes"); }),

                Make(140, -50, "Pushback placing", OnWidgetClick,
                     g => g.LocalPlayer.Hacks.PushbackPlacing ? "yes" : "no",
                     (g, v) => { g.LocalPlayer.Hacks.PushbackPlacing = v == "yes";
                                 Options.Set(OptionsKey.PushbackPlacing, v == "yes"); }),

                Make(140, 0, "Noclip slide", OnWidgetClick,
                     g => g.LocalPlayer.Hacks.NoclipSlide ? "yes" : "no",
                     (g, v) => { g.LocalPlayer.Hacks.NoclipSlide = v == "yes";
                                 Options.Set(OptionsKey.NoclipSlide, v == "yes"); }),

                Make(140, 50, "Field of view", OnWidgetClick,
                     g => g.FieldOfView.ToString(),
                     (g, v) => { g.FieldOfView = Int32.Parse(v);
                                 Options.Set(OptionsKey.FieldOfView, v);
                                 g.UpdateProjection(); }),

                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new OptionsGroupScreen(g))),
                null, null,
            };

            MakeValidators();
            MakeDescriptions();
            game.Events.HackPermissionsChanged += CheckHacksAllowed;
            CheckHacksAllowed(null, null);
        }
Пример #18
0
        public override void Init()
        {
            base.Init();

            widgets = new Widget[] {
                // Column 1
                Make(-140, -150, "Block in hand", OnWidgetClick,
                     g => g.ShowBlockInHand ? "yes" : "no",
                     (g, v) => { g.ShowBlockInHand = v == "yes";
                                 Options.Set(OptionsKey.ShowBlockInHand, v == "yes"); }),

                Make(-140, -100, "Show FPS", OnWidgetClick,
                     g => g.ShowFPS ? "yes" : "no",
                     (g, v) => { g.ShowFPS = v == "yes";
                                 Options.Set(OptionsKey.ShowFPS, v == "yes"); }),

                Make(-140, -50, "Hotbar scale", OnWidgetClick,
                     g => g.HotbarScale.ToString(),
                     (g, v) => { g.HotbarScale = Single.Parse(v);
                                 Options.Set(OptionsKey.HotbarScale, v);
                                 g.RefreshHud(); }),

                Make(-140, 0, "Inventory scale", OnWidgetClick,
                     g => g.InventoryScale.ToString(),
                     (g, v) => { g.InventoryScale = Single.Parse(v);
                                 Options.Set(OptionsKey.InventoryScale, v);
                                 g.RefreshHud(); }),

                Make(-140, 50, "Tab auto-complete", OnWidgetClick,
                     g => g.TabAutocomplete ? "yes" : "no",
                     (g, v) => { g.TabAutocomplete = v == "yes";
                                 Options.Set(OptionsKey.TabAutocomplete, v == "yes"); }),

                // Column 2
                Make(140, -150, "Clickable chat", OnWidgetClick,
                     g => g.ClickableChat ? "yes" : "no",
                     (g, v) => { g.ClickableChat = v == "yes";
                                 Options.Set(OptionsKey.ClickableChat, v == "yes"); }),

                Make(140, -100, "Chat scale", OnWidgetClick,
                     g => g.ChatScale.ToString(),
                     (g, v) => { g.ChatScale = Single.Parse(v);
                                 Options.Set(OptionsKey.ChatScale, v);
                                 g.RefreshHud(); }),

                Make(140, -50, "Chat lines", OnWidgetClick,
                     g => g.ChatLines.ToString(),
                     (g, v) => { g.ChatLines = Int32.Parse(v);
                                 Options.Set(OptionsKey.ChatLines, v);
                                 g.RefreshHud(); }),

                Make(140, 0, "Arial chat font", OnWidgetClick,
                     g => g.Drawer2D.UseBitmappedChat ? "no" : "yes",
                     (g, v) => { g.Drawer2D.UseBitmappedChat = v == "no";
                                 Options.Set(OptionsKey.ArialChatFont, v == "yes");
                                 HandleFontChange(); }),

                Make(140, 50, "Chat font name", OnWidgetClick,
                     g => g.FontName,
                     (g, v) => { g.FontName = v;
                                 Options.Set(OptionsKey.FontName, v);
                                 HandleFontChange(); }),

                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new OptionsGroupScreen(g))),
                null, null,
            };
            MakeValidators();
        }
Пример #19
0
 public void UserSetViewDistance(int distance)
 {
     UserViewDistance = distance;
     Options.Set(OptionsKey.ViewDist, distance);
     SetViewDistance(distance);
 }