Ejemplo n.º 1
0
 protected override void TextButtonClick( Game game, Widget widget, MouseButton mouseBtn )
 {
     if( mouseBtn != MouseButton.Left ) return;
     string path = Path.Combine( Program.AppDirectory, "maps" );
     path = Path.Combine( path, ((ButtonWidget)widget).Text );
     if( File.Exists( path ) )
         LoadMap( path );
 }
Ejemplo n.º 2
0
 protected override void TextButtonClick( Game game, Widget widget, MouseButton mouseBtn )
 {
     if( mouseBtn != MouseButton.Left ) return;
     string text = ((ButtonWidget)widget).Text;
     Hotkey original = default(Hotkey);
     if( text != "-----" )
         original = Parse( text );
     game.SetNewScreen( new EditHotkeyScreen( game, original ) );
 }
        public override void Init()
        {
            base.Init();

            widgets = new Widget[] {
                // Column 1
                MakeBool( -1, -150, "Hacks enabled", OptionsKey.HacksEnabled,
                     OnWidgetClick, g => g.LocalPlayer.Hacks.Enabled,
                     (g, v) => { g.LocalPlayer.Hacks.Enabled = v;
                     	g.LocalPlayer.CheckHacksConsistency(); } ),

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

                MakeBool( -1, -50, "Camera clipping", OptionsKey.CameraClipping,
                     OnWidgetClick, g => g.CameraClipping, (g, v) => g.CameraClipping = v ),

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

                MakeBool( -1, 50, "Double jump", OptionsKey.DoubleJump,
                     OnWidgetClick, g => g.LocalPlayer.Hacks.DoubleJump,
                     (g, v) => g.LocalPlayer.Hacks.DoubleJump = v ),

                // Column 2
                MakeBool( 1, -100, "Modifiable liquids", OptionsKey.ModifiableLiquids,
                         OnWidgetClick, g => g.ModifiableLiquids, (g, v) => g.ModifiableLiquids = v ),

                MakeBool( 1, -50, "Pushback placing", OptionsKey.PushbackPlacing,
                     OnWidgetClick, g => g.LocalPlayer.Hacks.PushbackPlacing,
                     (g, v) => g.LocalPlayer.Hacks.PushbackPlacing = v ),

                MakeBool( 1, 0, "Noclip slide", OptionsKey.NoclipSlide,
                     OnWidgetClick, g => g.LocalPlayer.Hacks.NoclipSlide,
                     (g, v) => g.LocalPlayer.Hacks.NoclipSlide = v ),

                Make2( 1, 50, "Field of view", OnWidgetClick,
                     g => g.Fov.ToString(),
                     (g, v) => { g.Fov = 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 );
        }
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;

            widgets = new Widget[] {
                // Column 1
                MakeBool( -1, -150, "Music", OptionsKey.UseMusic,
                     OnWidgetClick, g => g.UseMusic,
                     (g, v) => { g.UseMusic = v; g.AudioPlayer.SetMusic( g.UseMusic ); }),

                MakeBool( -1, -100, "Invert mouse", OptionsKey.InvertMouse,
                         OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v ),

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

                !network.IsSinglePlayer ? null :
                    MakeBool( -1, 0, "Block physics", OptionsKey.SingleplayerPhysics, OnWidgetClick,
                         g => ((SinglePlayerServer)network).physics.Enabled,
                         (g, v) => ((SinglePlayerServer)network).physics.Enabled = v),

                // Column 2
                MakeBool( 1, -150, "Sound", OptionsKey.UseSound,
                     OnWidgetClick, g => g.UseSound,
                     (g, v) => { g.UseSound = v; g.AudioPlayer.SetSound( g.UseSound ); }),

                MakeBool( 1, -100, "Show FPS", OptionsKey.ShowFPS,
                     OnWidgetClick, g => g.ShowFPS, (g, v) => g.ShowFPS = v ),

                MakeBool( 1, -50, "View bobbing", OptionsKey.ViewBobbing,
                     OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v ),

                Make2( 1, 0, "FPS mode", OnWidgetClick,
                     g => g.FpsLimit.ToString(),
                     (g, v) => { object raw = Enum.Parse( typeof(FpsLimitMethod), v );
                     	g.SetFpsLimitMethod( (FpsLimitMethod)raw );
                     	Options.Set( OptionsKey.FpsLimit, v ); } ),

                !game.ClassicHacks ? null :
                    MakeBool( 0, 60, "Hacks enabled", OptionsKey.HacksEnabled,
                         OnWidgetClick, g => g.LocalPlayer.Hacks.Enabled,
                         (g, v) => { g.LocalPlayer.Hacks.Enabled = v;
                         	g.LocalPlayer.CheckHacksConsistency(); } ),

                MakeControlsWidget(),

                MakeBack( "Done", 25, titleFont, (g, w) => g.SetNewScreen( new PauseScreen( g ) ) ),
                null, null,
            };
            MakeValidators();
        }
 protected bool HandleMouseClick( Widget[] widgets, int mouseX, int mouseY, MouseButton button )
 {
     // iterate backwards (because last elements rendered are shown over others)
     for( int i = widgets.Length - 1; i >= 0; i-- ) {
         Widget widget = widgets[i];
         if( widget != null && widget.Bounds.Contains( mouseX, mouseY ) ) {
             if( widget.OnClick != null && !widget.Disabled )
                 widget.OnClick( game, widget, button );
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 6
0
        protected override void WidgetSelected( Widget widget )
        {
            ButtonWidget button = widget as ButtonWidget;
            if( selectedWidget == widget || button == null ||
               button == widgets[widgets.Length - 1] ) return;

            selectedWidget = button;
            if( descWidget != null ) descWidget.Dispose();
            if( button == null ) return;

            string text = descriptions[Array.IndexOf<Widget>(widgets, button)];
            descWidget = ChatTextWidget.Create( game, 0, 100, text, Anchor.Centre, Anchor.Centre, regularFont );
        }
        public override void Init()
        {
            base.Init();
            descriptions = normDescriptions;
            originKey = KeyBinding.Forward;
            widgets = new Widget[descriptions.Length + 7];
            MakeKeys( KeyBinding.Forward, 0, 8, -150, -220 );
            MakeKeys( KeyBinding.OpenInventory, 8, 2, 150, -220 );
            index += 3; // Skip SendChat, PauseOrExit, PlayerList
            MakeKeys( KeyBinding.Speed, 13, 5, 150, -220 + 2 * btnDistance );

            widgets[index++] = MakeBack( false, titleFont,
                                        (g, w) => g.SetNewScreen( new ClassicOptionsScreen( g ) ) );
        }
 public override void Init()
 {
     base.Init();
     descriptions = normDescriptions;
     originKey = KeyBinding.Speed;
     widgets = new Widget[descriptions.Length + 2];
     MakeKeys( KeyBinding.Speed, 0, 7, -150, -180 );
     MakeKeys( KeyBinding.Screenshot, 7, 7, 150, -180 );
     widgets[index++] = MakeBack( "Back to menu", 5, titleFont,
                                 (g, w) => g.SetNewScreen( new OptionsGroupScreen( g ) ) );
     widgets[index++] = ButtonWidget.Create(
         game, 0, 170, 300, 35, "Mouse key bindings",
         Anchor.Centre, Anchor.Centre, titleFont, NextClick );
 }
        public override void Init()
        {
            base.Init();

            widgets = new Widget[] {
                // Column 1
                Make2( -1, -150, "Clouds col", OnWidgetClick,
                     g => g.World.CloudsCol.ToRGBHexString(),
                     (g, v) => g.World.SetCloudsColour( FastColour.Parse( v ) ) ),

                Make2( -1, -100, "Sky col", OnWidgetClick,
                     g => g.World.SkyCol.ToRGBHexString(),
                     (g, v) => g.World.SetSkyColour( FastColour.Parse( v ) ) ),

                Make2( -1, -50, "Fog col", OnWidgetClick,
                     g => g.World.FogCol.ToRGBHexString(),
                     (g, v) => g.World.SetFogColour( FastColour.Parse( v ) ) ),

                Make2( -1, 0, "Clouds speed", OnWidgetClick,
                     g => g.World.CloudsSpeed.ToString( "F2" ),
                     (g, v) => g.World.SetCloudsSpeed( Single.Parse( v ) ) ),

                Make2( -1, 50, "Clouds height", OnWidgetClick,
                     g => g.World.CloudHeight.ToString(),
                     (g, v) => g.World.SetCloudsLevel( Int32.Parse( v ) ) ),

                // Column 2
                Make2( 1, -100, "Sunlight col", OnWidgetClick,
                     g => g.World.Sunlight.ToRGBHexString(),
                     (g, v) => g.World.SetSunlight( FastColour.Parse( v ) ) ),

                Make2( 1, -50, "Shadow col", OnWidgetClick,
                     g => g.World.Shadowlight.ToRGBHexString(),
                     (g, v) => g.World.SetShadowlight( FastColour.Parse( v ) ) ),

                Make2( 1, 0, "Weather", OnWidgetClick,
                     g => g.World.Weather.ToString(),
                     (g, v) => g.World.SetWeather( (Weather)Enum.Parse( typeof(Weather), v ) ) ),

                Make2( 1, 50, "Water level", OnWidgetClick,
                     g => g.World.EdgeHeight.ToString(),
                     (g, v) => g.World.SetEdgeLevel( Int32.Parse( v ) ) ),

                MakeBack( false, titleFont,
                         (g, w) => g.SetNewScreen( new OptionsGroupScreen( g ) ) ),
                null, null, null,
            };
            MakeDefaultValues();
            MakeValidators();
        }
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;

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

                MakeBool( -1, -50, "Music", OptionsKey.UseMusic,
                     OnWidgetClick, g => g.UseMusic,
                     (g, v) => { g.UseMusic = v; g.AudioPlayer.SetMusic( g.UseMusic ); }),

                MakeBool( -1, 0, "Sound", OptionsKey.UseSound,
                     OnWidgetClick, g => g.UseSound,
                     (g, v) => { g.UseSound = v; g.AudioPlayer.SetSound( g.UseSound ); }),

                MakeBool( -1, 50, "View bobbing", OptionsKey.ViewBobbing,
                         OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v ),

                // Column 2
                !network.IsSinglePlayer ? null :
                    MakeBool( 1, -100, "Block physics", OptionsKey.SingleplayerPhysics, OnWidgetClick,
                             g => ((SinglePlayerServer)network).physics.Enabled,
                             (g, v) => ((SinglePlayerServer)network).physics.Enabled = v ),

                MakeBool( 1, -50, "Auto close launcher", OptionsKey.AutoCloseLauncher, OnWidgetClick,
                         g => Options.GetBool( OptionsKey.AutoCloseLauncher, false ),
                         (g, v) => Options.Set( OptionsKey.AutoCloseLauncher, v ) ),

                MakeBool( 1, 0, "Invert mouse", OptionsKey.InvertMouse,
                         OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v ),

                Make2( 1, 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();
        }
        protected override void TextButtonClick( Game game, Widget widget, MouseButton mouseBtn )
        {
            if( mouseBtn != MouseButton.Left ) return;
            string file = ((ButtonWidget)widget).Text;
            string dir = Path.Combine( Program.AppDirectory, TexturePackExtractor.Dir );
            string path = Path.Combine( dir, file );
            if( !File.Exists( path ) ) return;

            int index = currentIndex;
            game.DefaultTexturePack = file;
            game.World.TextureUrl = null;
            TexturePackExtractor extractor = new TexturePackExtractor();
            extractor.Extract( path, game );
            Recreate();
            SetCurrentIndex( index );
        }
        public override void Init()
        {
            base.Init();

            widgets = new Widget[] {
                // Column 1
                MakeBool( -1, -100, "Simple arms anim", OptionsKey.SimpleArmsAnim,
                         OnWidgetClick, g => g.SimpleArmsAnim, (g, v) => g.SimpleArmsAnim = v ),

                MakeBool( -1, -50, "Classic gui textures", OptionsKey.UseClassicGui,
                         OnWidgetClick, g => g.UseClassicGui, (g, v) => g.UseClassicGui = v ),

                MakeBool( -1, 0, "Classic player list", OptionsKey.UseClassicTabList,
                         OnWidgetClick, g => g.UseClassicTabList, (g, v) => g.UseClassicTabList = v ),

                MakeBool( -1, 50, "Classic options", OptionsKey.UseClassicOptions,
                         OnWidgetClick, g => g.UseClassicOptions, (g, v) => g.UseClassicOptions = v ),

                // Column 2
                MakeBool( 1, -100, "Allow custom blocks", OptionsKey.AllowCustomBlocks,
                         OnWidgetClick, g => g.AllowCustomBlocks, (g, v) => g.AllowCustomBlocks = v ),

                MakeBool( 1, -50, "Use CPE", OptionsKey.UseCPE,
                         OnWidgetClick, g => g.UseCPE, (g, v) => g.UseCPE = v ),

                MakeBool( 1, 0, "Use server textures", OptionsKey.AllowServerTextures,
                         OnWidgetClick, g => g.AllowServerTextures, (g, v) => g.AllowServerTextures = v ),

                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 = ChatTextWidget.Create( game, 0, 100, "&eButtons on the right require a client restart",
                                           Anchor.Centre, Anchor.Centre, regularFont );
        }
        protected bool HandleMouseMove( Widget[] widgets, int mouseX, int mouseY )
        {
            if( lastX == mouseX && lastY == mouseY )
                return true;
            for( int i = 0; i < widgets.Length; i++ ) {
                if( widgets[i] == null || !widgets[i].Active ) continue;
                widgets[i].Active = false;
            }

            for( int i = widgets.Length - 1; i >= 0; i-- ) {
                Widget widget = widgets[i];
                if( widget != null && widget.Bounds.Contains( mouseX, mouseY ) ) {
                    widget.Active = true;
                    lastX = mouseX; lastY = mouseY;
                    WidgetSelected( widget );
                    return true;
                }
            }
            lastX = mouseX; lastY = mouseY;
            WidgetSelected( null );
            return false;
        }
        public override void Init()
        {
            base.Init();
            INetworkProcessor network = game.Network;
            extHelpY = 50;

            widgets = new Widget[] {

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

                Make2( -1, 0, "View distance", OnWidgetClick,
                     g => g.ViewDistance.ToString(),
                     (g, v) => g.SetViewDistance( Int32.Parse( v ), true ) ),

                Make2( 1, -50, "Names", 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 ); } ),

                Make2( 1, 0, "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,
            };
            MakeValidators();
            MakeDescriptions();
        }
Ejemplo n.º 15
0
        void MakeNormal()
        {
            widgets = new Widget[] {
                Make( -1, -100, "Misc options",
                     (g, w) => g.SetNewScreen( new MiscOptionsScreen( g ) ) ),
                Make( -1, -50, "Gui options",
                     (g, w) => g.SetNewScreen( new GuiOptionsScreen( g ) ) ),
                Make( -1, 0, "Graphics options",
                     (g, w) => g.SetNewScreen( new GraphicsOptionsScreen( g ) ) ),
                Make( -1, 50, "Key bindings",
                     (g, w) => g.SetNewScreen( new NormalKeyBindingsScreen( g ) ) ),
                Make( 1, -50, "Hacks settings",
                     (g, w) => g.SetNewScreen( new HacksSettingsScreen( g ) ) ),
                Make( 1, 0, "Env settings",
                     (g, w) => g.SetNewScreen( new EnvSettingsScreen( g ) ) ),
                Make( 1, 50, "Nostalgia options",
                     (g, w) => g.SetNewScreen( new NostalgiaScreen( g ) ) ),

                MakeBack( false, titleFont,
                         (g, w) => g.SetNewScreen( new PauseScreen( g ) ) ),
            };
        }
Ejemplo n.º 16
0
 void OnYesClick( Game g, Widget w, MouseButton mouseBtn )
 {
     if( mouseBtn != MouseButton.Left ) return;
     if( yesClick != null )
         yesClick( this );
     Dispose();
     CloseScreen();
 }
Ejemplo n.º 17
0
 void OnYesAlwaysClick( Game g, Widget w, MouseButton mouseBtn )
 {
     if( mouseBtn != MouseButton.Left ) return;
     OnYesClick( g, w, mouseBtn );
     string url = ((string)Metadata).Substring( 3 );
     if( !game.AcceptedUrls.HasEntry( url ) )
         game.AcceptedUrls.AddEntry( url );
 }
Ejemplo n.º 18
0
        void OnNoClick( Game g, Widget w, MouseButton mouseBtn )
        {
            if( mouseBtn != MouseButton.Left ) return;
            if( confirmNo && !confirmMode ) {
                InitConfirmButtons( false ); return;
            }

            if( noClick != null )
                noClick( this );
            Dispose();
            CloseScreen();
        }
Ejemplo n.º 19
0
        void OnNoAlwaysClick( Game g, Widget w, MouseButton mouseBtn )
        {
            if( mouseBtn != MouseButton.Left ) return;
            if( confirmNo && !confirmMode ) {
                InitConfirmButtons( true ); return;
            }

            OnNoClick( g, w, mouseBtn );
            string url = ((string)Metadata).Substring( 3 );
            if( !game.DeniedUrls.HasEntry( url ) )
                game.DeniedUrls.AddEntry( url );
        }
Ejemplo n.º 20
0
 void GoBackClick( Game g, Widget w, MouseButton mouseBtn )
 {
     if( mouseBtn != MouseButton.Left ) return;
     InitStandardButtons();
     confirmMode = false;
     SetText( lastTitle, lastBody );
 }
Ejemplo n.º 21
0
        public override void Init()
        {
            game.Keyboard.KeyRepeat = true;
            base.Init();
            regularFont = new Font( game.FontName, 16, FontStyle.Regular );

            inputWidget = MenuInputWidget.Create(
                game, 0, -30, 500, 30, "", Anchor.Centre, Anchor.Centre,
                regularFont, titleFont, new PathValidator() );

            widgets = new Widget[] {
                ButtonWidget.Create( game, 0, 20, 301, 40, "Save", Anchor.Centre,
                                    Anchor.Centre, titleFont, SaveClassic ),
                ButtonWidget.Create( game, -150, 120, 201, 40, "Save schematic", Anchor.Centre,
                                    Anchor.Centre, titleFont, SaveSchematic ),
                ChatTextWidget.Create( game, 110, 120, "&eCan be imported into MCEdit", Anchor.Centre,
                                    Anchor.Centre, regularFont ),
                null,
                MakeBack( false, titleFont,
                         (g, w) => g.SetNewScreen( new PauseScreen( g ) ) ),
            };
        }
Ejemplo n.º 22
0
 void SaveSchematic( Game game, Widget widget, MouseButton mouseBtn )
 {
     DoSave( widget, mouseBtn, ".schematic" );
 }
Ejemplo n.º 23
0
 protected abstract void TextButtonClick( Game game, Widget widget, MouseButton mouseBtn );
        void OkButtonClick( Game game, Widget widget, MouseButton mouseBtn )
        {
            if( mouseBtn != MouseButton.Left ) return;
            string text = inputWidget.GetText();
            if( text.Length == 0 ) {
                MakeDescWidget( "Please enter a filename" );
                return;
            }
            string file = Path.ChangeExtension( text, ".cw" );
            text = Path.Combine( Program.AppDirectory, "maps" );
            text = Path.Combine( text, file );

            if( File.Exists( text ) ) {
                widgets[1] = ButtonWidget.Create( game, 0, 90, 260, 30, "Overwrite existing?",
                                                 Anchor.Centre, Anchor.Centre, titleFont, OverwriteButtonClick );
            } else {
                // NOTE: We don't immediately save here, because otherwise the 'saving...'
                // will not be rendered in time because saving is done on the main thread.
                MakeDescWidget( "Saving.." );
                textPath = text;
                RemoveOverwriteButton();
            }
        }
 void DefaultButtonClick( Game game, Widget widget, MouseButton mouseBtn )
 {
     if( mouseBtn != MouseButton.Left ) return;
     int index = Array.IndexOf<Widget>( widgets, targetWidget );
     string defValue = defaultValues[index];
     inputWidget.SetText( defValue );
 }
        void OverwriteButtonClick( Game game, Widget widget, MouseButton mouseBtn )
        {
            if( mouseBtn != MouseButton.Left ) return;
            string text = inputWidget.GetText();
            string file = Path.ChangeExtension( text, ".cw" );
            text = Path.Combine( Program.AppDirectory, "maps" );
            text = Path.Combine( text, file );

            MakeDescWidget( "Saving.." );
            textPath = text;
            RemoveOverwriteButton();
        }
Ejemplo n.º 27
0
        void ReconnectClick( Game g, Widget w, MouseButton mouseBtn )
        {
            if( mouseBtn != MouseButton.Left ) return;
            string connectString = "Connecting to " + game.IPAddress + ":" + game.Port +  "..";
            foreach( IGameComponent comp in game.Components )
                comp.Reset( game );
            game.BlockInfo.Reset( game );

            game.SetNewScreen( new LoadingMapScreen( game, connectString, "Waiting for handshake" ) );
            game.Network.Connect( game.IPAddress, game.Port );
        }
Ejemplo n.º 28
0
        void MakeNormal()
        {
            widgets = new Widget[] {
                Make( -1, -50, "Options",
                     (g, w) => g.SetNewScreen( new OptionsGroupScreen( g ) ) ),
                Make( 1, -50, "Generate level",
                         (g, w) => g.SetNewScreen( new GenLevelScreen( g ) ) ),
                Make( 1, 0, "Load level",
                         (g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ),
                Make( 1, 50, "Save level",
                     (g, w) => g.SetNewScreen( new SaveLevelScreen( g ) ) ),
                Make( -1, 0, "Select texture pack",
                     (g, w) => g.SetNewScreen( new TexturePackScreen( g ) ) ),
                Make( -1, 50, "Hotkeys",
                     (g, w) => g.SetNewScreen( new HotkeyScreen( g ) ) ),

                // Other
                ButtonWidget.Create( game, 5, 5, 120, 40, "Quit game",
                                    Anchor.BottomOrRight, Anchor.BottomOrRight,
                                    titleFont, LeftOnly( (g, w) => g.Exit() ) ),
                MakeBack( true, titleFont, (g, w) => g.SetNewScreen( null ) ),
            };
        }
        public override void Init()
        {
            base.Init();

            widgets = new Widget[] {
                // Column 1
                MakeBool( -1, -150, "Block in hand", OptionsKey.ShowBlockInHand,
                     OnWidgetClick, g => g.ShowBlockInHand, (g, v) => g.ShowBlockInHand = v ),

                MakeBool( -1, -100, "Show FPS", OptionsKey.ShowFPS,
                         OnWidgetClick, g => g.ShowFPS, (g, v) => g.ShowFPS = v ),

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

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

                MakeBool( -1, 50, "Tab auto-complete", OptionsKey.TabAutocomplete,
                         OnWidgetClick, g => g.TabAutocomplete, (g, v) => g.TabAutocomplete = v ),

                // Column 2
                MakeBool( 1, -150, "Clickable chat", OptionsKey.ClickableChat,
                     OnWidgetClick, g => g.ClickableChat, (g, v) => g.ClickableChat = v ),

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

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

                MakeBool( 1, 0, "Use font", OptionsKey.ArialChatFont,
                     OnWidgetClick, g => !g.Drawer2D.UseBitmappedChat,
                     (g, v) => { g.Drawer2D.UseBitmappedChat = !v; HandleFontChange(); } ),

                Make2( 1, 50, "Font", 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();
            MakeDescriptions();
        }
Ejemplo n.º 30
0
        void MakeClassic()
        {
            widgets = new Widget[] {
                MakeClassic( 0, -100, "Options",
                            (g, w) => g.SetNewScreen( new ClassicOptionsScreen( g ) ) ),
                MakeClassic( 0, -50, "Generate level",
                            (g, w) => g.SetNewScreen( new GenLevelScreen( g ) ) ),
                MakeClassic( 0, 0, "Load level",
                            (g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ),
                MakeClassic( 0, 50, "Save level",
                            (g, w) => g.SetNewScreen( new SaveLevelScreen( g ) ) ),

                MakeBack( true, titleFont, (g, w) => g.SetNewScreen( null ) ),

                game.ClassicMode ? null :
                    MakeClassic( 0, 150, "Nostalgia options",
                                (g, w) => g.SetNewScreen( new NostalgiaScreen( g ) ) ),
            };
        }