public override void Init()
        {
            base.Init();

            buttons = new ButtonWidget[] {
                Make( -140, -150, "Clouds colour", Anchor.Centre, OnWidgetClick,
                     g => g.Map.CloudsCol.ToRGBHexString(),
                     (g, v) => g.Map.SetCloudsColour( FastColour.Parse( v ) ) ),

                Make( -140, -100, "Sky colour", Anchor.Centre, OnWidgetClick,
                     g => g.Map.SkyCol.ToRGBHexString(),
                     (g, v) => g.Map.SetSkyColour( FastColour.Parse( v ) ) ),

                Make( -140, -50, "Fog colour", Anchor.Centre, OnWidgetClick,
                     g => g.Map.FogCol.ToRGBHexString(),
                     (g, v) => g.Map.SetFogColour( FastColour.Parse( v ) ) ),

                Make( -140, 0, "Clouds speed", Anchor.Centre, OnWidgetClick,
                     g => g.Map.CloudsSpeed.ToString(),
                     (g, v) => g.Map.SetCloudsSpeed( Single.Parse( v ) ) ),

                Make( -140, 50, "Clouds height", Anchor.Centre, OnWidgetClick,
                     g => g.Map.CloudHeight.ToString(),
                     (g, v) => g.Map.SetCloudsLevel( Int32.Parse( v ) ) ),

                Make( 140, -150, "Sunlight colour", Anchor.Centre, OnWidgetClick,
                     g => g.Map.Sunlight.ToRGBHexString(),
                     (g, v) => g.Map.SetSunlight( FastColour.Parse( v ) ) ),

                Make( 140, -100, "Shadow colour", Anchor.Centre, OnWidgetClick,
                     g => g.Map.Shadowlight.ToRGBHexString(),
                     (g, v) => g.Map.SetShadowlight( FastColour.Parse( v ) ) ),

                Make( 140, -50, "Weather", Anchor.Centre, OnWidgetClick,
                     g => ((int)g.Map.Weather).ToString(),
                     (g, v) => g.Map.SetWeather( (Weather)Int32.Parse( v ) ) ),

                Make( 140, 0, "Water level", Anchor.Centre, OnWidgetClick,
                     g => g.Map.EdgeHeight.ToString(),
                     (g, v) => g.Map.SetEdgeLevel( Int32.Parse( v ) ) ),

                Make( 0, 5, "Back to menu", Anchor.BottomOrRight,
                     (g, w) => g.SetNewScreen( new PauseScreen( g ) ), null, null ),
                null,
            };

            validators = new MenuInputValidator[] {
                new HexColourValidator(),
                new HexColourValidator(),
                new HexColourValidator(),
                new RealValidator( 0, 1000 ),
                new IntegerValidator( -10000, 10000 ),
                new HexColourValidator(),
                new HexColourValidator(),
                new IntegerValidator( 0, 2 ),
                new IntegerValidator( -2048, 2048 ),
            };
            okayIndex = buttons.Length - 1;
        }
Exemplo n.º 2
0
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;

            buttons = new ButtonWidget[] {
                Make( -140, -50, "Show FPS", Anchor.Centre, OnWidgetClick,
                     g => g.ShowFPS ? "yes" : "no",
                     (g, v) => g.ShowFPS = v == "yes" ),

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

                Make( -140, 50, "VSync active", Anchor.Centre, OnWidgetClick,
                     g => g.VSync ? "yes" : "no",
                     (g, v) => g.Graphics.SetVSync( g, v == "yes" ) ),

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

                Make( 140, 0, "Chat font size", Anchor.Centre, OnWidgetClick,
                     g => g.Chat.FontSize.ToString(),
                     (g, v) => { g.Chat.FontSize = Int32.Parse( v );
                     	Options.Set( OptionsKey.FontSize, v ); } ),

                Make( 140, 50, "Key mappings", Anchor.Centre,
                     (g, w) => g.SetNewScreen( new KeyMappingsScreen( g ) ), null, null ),

                !network.IsSinglePlayer ? null :
                    Make( -140, -100, "Singleplayer physics", Anchor.Centre, OnWidgetClick,
                         g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no",
                         (g, v) => ((SinglePlayerServer)network).physics.Enabled = (v == "yes") ),

                Make( 0, 5, "Back to menu", Anchor.BottomOrRight,
                     (g, w) => g.SetNewScreen( new PauseScreen( g ) ), null, null ),
                null,
            };
            validators = new MenuInputValidator[] {
                new BooleanValidator(),
                new IntegerValidator( 16, 4096 ),
                new BooleanValidator(),
                new IntegerValidator( 1, 100 ),
                new IntegerValidator( 6, 30 ),
                network.IsSinglePlayer ? new BooleanValidator() : null,
            };
            okayIndex = buttons.Length - 1;
        }
Exemplo n.º 3
0
        public static MenuInputWidget Create( Game game, int x, int y, int width, int height, string text, Anchor horizontal,
            Anchor vertical, Font font, Font tildeFont, Font hintFont, MenuInputValidator validator)
        {
            MenuInputWidget widget = new MenuInputWidget( game, font, tildeFont, hintFont );

            widget.HorizontalAnchor = horizontal;
            widget.VerticalAnchor = vertical;
            widget.XOffset = x;
            widget.YOffset = y;
            widget.DesiredMaxWidth = width;
            widget.DesiredMaxHeight = height;
            widget.chatInputText.Append( 0, text );
            widget.Validator = validator;
            widget.Init();
            return widget;
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
0
        public override void Init()
        {
            base.Init();

            buttons = new ButtonWidget[] {
                Make(-140, -150, "Clouds colour", OnWidgetClick,
                     g => g.Map.CloudsCol.ToRGBHexString(),
                     (g, v) => g.Map.SetCloudsColour(FastColour.Parse(v))),

                Make(-140, -100, "Sky colour", OnWidgetClick,
                     g => g.Map.SkyCol.ToRGBHexString(),
                     (g, v) => g.Map.SetSkyColour(FastColour.Parse(v))),

                Make(-140, -50, "Fog colour", OnWidgetClick,
                     g => g.Map.FogCol.ToRGBHexString(),
                     (g, v) => g.Map.SetFogColour(FastColour.Parse(v))),

                Make(-140, 0, "Clouds speed", OnWidgetClick,
                     g => g.Map.CloudsSpeed.ToString(),
                     (g, v) => g.Map.SetCloudsSpeed(Single.Parse(v))),

                Make(-140, 50, "Clouds height", OnWidgetClick,
                     g => g.Map.CloudHeight.ToString(),
                     (g, v) => g.Map.SetCloudsLevel(Int32.Parse(v))),

                Make(140, -150, "Sunlight colour", OnWidgetClick,
                     g => g.Map.Sunlight.ToRGBHexString(),
                     (g, v) => g.Map.SetSunlight(FastColour.Parse(v))),

                Make(140, -100, "Shadow colour", OnWidgetClick,
                     g => g.Map.Shadowlight.ToRGBHexString(),
                     (g, v) => g.Map.SetShadowlight(FastColour.Parse(v))),

                Make(140, -50, "Weather", OnWidgetClick,
                     g => g.Map.Weather.ToString(),
                     (g, v) => g.Map.SetWeather((Weather)Enum.Parse(typeof(Weather), v))),

                Make(140, 0, "Water level", OnWidgetClick,
                     g => g.Map.EdgeHeight.ToString(),
                     (g, v) => g.Map.SetEdgeLevel(Int32.Parse(v))),

                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new PauseScreen(g))),
                null,
                null,
            };
            buttons[7].Metadata = typeof(Weather);
            defaultIndex        = buttons.Length - 2;
            okayIndex           = buttons.Length - 1;

            defaultValues = new [] {
                Map.DefaultCloudsColour.ToRGBHexString(),
                    Map.DefaultSkyColour.ToRGBHexString(),
                    Map.DefaultFogColour.ToRGBHexString(),
                (1).ToString(),
                (game.Map.Height + 2).ToString(),

                Map.DefaultSunlight.ToRGBHexString(),
                Map.DefaultShadowlight.ToRGBHexString(),
                Weather.Sunny.ToString(),
                (game.Map.Height / 2).ToString(),
            };

            validators = new MenuInputValidator[] {
                new HexColourValidator(),
                new HexColourValidator(),
                new HexColourValidator(),
                new RealValidator(0, 1000),
                new IntegerValidator(-10000, 10000),

                new HexColourValidator(),
                new HexColourValidator(),
                new EnumValidator(),
                new IntegerValidator(-2048, 2048),
            };
        }
Exemplo n.º 6
0
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;

            buttons = new ButtonWidget[] {
                // Column 1
                Make( -140, -100, "Speed multiplier", Anchor.Centre, OnWidgetClick,
                     g => g.LocalPlayer.SpeedMultiplier.ToString(),
                     (g, v) => { g.LocalPlayer.SpeedMultiplier = Int32.Parse( v );
                     	Options.Set( OptionsKey.Speed, v ); } ),

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

                Make( -140, 0, "VSync active", Anchor.Centre, OnWidgetClick,
                     g => g.VSync ? "yes" : "no",
                     (g, v) => { g.Graphics.SetVSync( g, v == "yes" );
                     	Options.Set( OptionsKey.VSync, v == "yes" ); } ),

                Make( -140, 50, "View distance", Anchor.Centre, OnWidgetClick,
                     g => g.ViewDistance.ToString(),
                     (g, v) => g.SetViewDistance( Int32.Parse( v ) ) ),
                // Column 2
                Make( 140, -100, "Mouse sensitivity", Anchor.Centre, OnWidgetClick,
                     g => g.MouseSensitivity.ToString(),
                     (g, v) => { g.MouseSensitivity = Int32.Parse( v );
                     	Options.Set( OptionsKey.Sensitivity, v ); } ),

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

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

                Make( 140, 50, "Arial chat font", Anchor.Centre, 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();
                     } ),

                // Extra stuff
                !network.IsSinglePlayer ? null :
                    Make( -140, -200, "Singleplayer physics", Anchor.Centre, 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, "Pushback block placing", Anchor.Centre, OnWidgetClick,
                     g => g.LocalPlayer.PushbackBlockPlacing
                     && g.LocalPlayer.CanPushbackBlocks ? "yes" : "no",
                     (g, v) => {
                     	if( g.LocalPlayer.CanPushbackBlocks)
                     		g.LocalPlayer.PushbackBlockPlacing = v == "yes";
                     }),

                Make( -140, -150, "Show hover names", Anchor.Centre, OnWidgetClick,
                     g => g.Players.ShowHoveredNames ? "yes" : "no",
                     (g, v) => {
                     	g.Players.ShowHoveredNames = v == "yes";
                     	Options.Set( OptionsKey.ShowHoveredNames, v == "yes" );
                     }),

                Make( 0, 5, "Back to menu", Anchor.BottomOrRight,
                     (g, w) => g.SetNewScreen( new PauseScreen( g ) ), null, null ),
                null,
            };
            validators = new MenuInputValidator[] {
                new IntegerValidator( 1, 50 ),
                new BooleanValidator(),
                new BooleanValidator(),
                new IntegerValidator( 16, 4096 ),

                new IntegerValidator( 1, 100 ),
                new RealValidator( 0.5f, 2f ),
                new IntegerValidator( 1, 30 ),
                new BooleanValidator(),

                network.IsSinglePlayer ? new BooleanValidator() : null,
                new BooleanValidator(),
                new BooleanValidator(),
            };
            okayIndex = buttons.Length - 1;
        }
Exemplo n.º 7
0
        public override void Init()
        {
            base.Init();

            buttons = new ButtonWidget[] {
                Make( -140, -150, "Clouds colour", Docking.Centre, OnWidgetClick,
                     g => g.Map.CloudsCol.ToRGBHexString(),
                     (g, v) => g.Map.SetCloudsColour( FastColour.Parse( v ) ) ),

                Make( -140, -100, "Sky colour", Docking.Centre, OnWidgetClick,
                     g => g.Map.SkyCol.ToRGBHexString(),
                     (g, v) => g.Map.SetSkyColour( FastColour.Parse( v ) ) ),

                Make( -140, -50, "Fog colour", Docking.Centre, OnWidgetClick,
                     g => g.Map.FogCol.ToRGBHexString(),
                     (g, v) => g.Map.SetFogColour( FastColour.Parse( v ) ) ),

                Make( -140, 0, "Clouds speed", Docking.Centre, OnWidgetClick,
                     g => { StandardEnvRenderer env = game.EnvRenderer as StandardEnvRenderer;
                     	return env == null ? "(not active)" : env.CloudsSpeed.ToString(); },
                     (g, v) => { StandardEnvRenderer env = game.EnvRenderer as StandardEnvRenderer;
                     	if( env != null )
                     		env.CloudsSpeed = Single.Parse( v ); } ),

                Make( -140, 50, "Clouds offset", Docking.Centre, OnWidgetClick,
                     g => { StandardEnvRenderer env = game.EnvRenderer as StandardEnvRenderer;
                     	return env == null ? "(not active)" : env.CloudsOffset.ToString(); },
                     (g, v) => { StandardEnvRenderer env = game.EnvRenderer as StandardEnvRenderer;
                     	if( env != null )
                     		env.SetCloudsOffset( Int32.Parse( v ) ); } ),

                Make( 140, -150, "Sunlight colour", Docking.Centre, OnWidgetClick,
                     g => g.Map.Sunlight.ToRGBHexString(),
                     (g, v) => g.Map.SetSunlight( FastColour.Parse( v ) ) ),

                Make( 140, -100, "Shadow colour", Docking.Centre, OnWidgetClick,
                     g => g.Map.Shadowlight.ToRGBHexString(),
                     (g, v) => g.Map.SetShadowlight( FastColour.Parse( v ) ) ),

                Make( 140, -50, "Weather", Docking.Centre, OnWidgetClick,
                     g => ((int)g.Map.Weather).ToString(),
                     (g, v) => g.Map.SetWeather( (Weather)Int32.Parse( v ) ) ),

                Make( 140, 0, "Water level", Docking.Centre, OnWidgetClick,
                     g => g.Map.WaterHeight.ToString(),
                     (g, v) => g.Map.SetWaterLevel( Int32.Parse( v ) ) ),

                Make( 0, 5, "Back to menu", Docking.BottomOrRight,
                     (g, w) => g.SetNewScreen( new PauseScreen( g ) ), null, null ),
                null,
            };

            validators = new MenuInputValidator[] {
                new HexColourValidator(),
                new HexColourValidator(),
                new HexColourValidator(),
                new RealValidator( 0, 1000 ),
                new IntegerValidator( -1000, 1000 ),
                new HexColourValidator(),
                new HexColourValidator(),
                new IntegerValidator( 0, 2 ),
                new IntegerValidator( -2048, 2048 ),
            };
            okayIndex = buttons.Length - 1;
        }
Exemplo n.º 8
0
        public static MenuInputWidget Create(Game game, int x, int y, int width, int height, string text, Anchor horizontal,
                                             Anchor vertical, Font font, Font tildeFont, MenuInputValidator validator)
        {
            MenuInputWidget widget = new MenuInputWidget(game, font, tildeFont);

            widget.HorizontalAnchor = horizontal;
            widget.VerticalAnchor   = vertical;
            widget.XOffset          = x;
            widget.YOffset          = y;
            widget.DesiredMaxWidth  = width;
            widget.DesiredMaxHeight = height;
            widget.chatInputText.Append(0, text);
            widget.Validator = validator;
            widget.Init();
            return(widget);
        }
Exemplo n.º 9
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;
        }
Exemplo n.º 10
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);
        }