Пример #1
0
 public static TextWidget Create( Game game, int x, int y, string text, Docking horizontal, Docking vertical, Font font )
 {
     TextWidget widget = new TextWidget( game, font );
     widget.Init();
     widget.HorizontalDocking = horizontal;
     widget.VerticalDocking = vertical;
     widget.XOffset = x;
     widget.YOffset = y;
     widget.SetText( text );
     return widget;
 }
Пример #2
0
        public override void Init()
        {
            fpsTextWidget = new TextWidget( game, font );
            fpsTextWidget.Init();
            fpsTextWidget.SetText( "FPS: no data yet" );
            MakePosTextWidget();

            hackStatesWidget = new TextWidget( game, posFont );
            hackStatesWidget.YOffset = fpsTextWidget.Height + posHeight;
            hackStatesWidget.Init();
            UpdateHackState( true );
        }
Пример #3
0
        public override void Init()
        {
            if( keyNames == null )
                keyNames = Enum.GetNames( typeof( Key ) );
            keyFont = new Font( "Arial", 14, FontStyle.Bold );
            regularFont = new Font( "Arial", 14, FontStyle.Italic );
            titleFont = new Font( "Arial", 16, FontStyle.Bold );
            buttons = new ButtonWidget[descriptions.Length + 1];

            MakeKeys( 0, 11, -140 );
            MakeKeys( 11, 11, 140 );
            buttons[index] = Make( 0, 5, "Back to menu", Anchor.BottomOrRight, (g, w) => g.SetNewScreen( new OptionsScreen( g ) ) );
            statusWidget = TextWidget.Create( game, 0, 150, "", Anchor.Centre, Anchor.Centre, regularFont );
        }
Пример #4
0
        public override void Init()
        {
            graphicsApi.Fog = false;
            titleWidget = TextWidget.Create( game, 0, 30, serverName, Docking.Centre, Docking.LeftOrTop, font );
            messageWidget = TextWidget.Create( game, 0, 60, serverMotd, Docking.Centre, Docking.LeftOrTop, font );
            progX = game.Width / 2f - progWidth / 2f;

            Size size = new Size( progWidth, progHeight );
            using( Bitmap bmp = IDrawer2D.CreatePow2Bitmap( size ) ) {
                using( IDrawer2D drawer = game.Drawer2D ) {
                    drawer.SetBitmap( bmp );
                    drawer.DrawRectBounds( Color.White, 5f, 0, 0, progWidth, progHeight );
                    progressBoxTexture = drawer.Make2DTexture( bmp, size, (int)progX, (int)progY );
                }
            }
            game.Events.MapLoading += MapLoading;
        }
Пример #5
0
        public override void Init()
        {
            textFont = new Font( "Arial", 14, FontStyle.Bold );
            arrowFont = new Font( "Arial", 18, FontStyle.Bold );
            titleFont = new Font( "Arial", 16, FontStyle.Bold );
            title = TextWidget.Create( game, 0, -130, titleText, Anchor.Centre, Anchor.Centre, titleFont );
            title.Init();

            buttons = new ButtonWidget[] {
                MakeText( 0, -80, Get( 0 ) ),
                MakeText( 0, -40, Get( 1 ) ),
                MakeText( 0, 0, Get( 2 ) ),
                MakeText( 0, 40, Get( 3 ) ),
                MakeText( 0, 80, Get( 4 ) ),

                Make( -160, 0, "<", (g, w) => PageClick( false ) ),
                Make( 160, 0, ">", (g, w) => PageClick( true ) ),
                null,
            };
        }
Пример #6
0
        public override void Init()
        {
            font = new Font( "Arial", 13 );
            posFont = new Font( "Arial", 12, FontStyle.Italic );
            game.Events.ChatFontChanged += ChatFontChanged;

            fpsTextWidget = new ChatTextWidget( game, font );
            fpsTextWidget.XOffset = 2;
            fpsTextWidget.YOffset = 2;
            fpsTextWidget.Init();
            string fpsText = text.Length > 0 ? text.GetString() :
                "FPS: no data yet";
            fpsTextWidget.SetText( fpsText );
            MakePosTextWidget();

            hackStatesWidget = new ChatTextWidget( game, posFont );
            hackStatesWidget.XOffset = 2;
            hackStatesWidget.YOffset = fpsTextWidget.Height + posHeight + 2;
            hackStatesWidget.Init();
            UpdateHackState( true );
        }
Пример #7
0
 void DisposeDescWidget()
 {
     if( descWidget != null ) {
         descWidget.Dispose();
         descWidget = null;
     }
 }
Пример #8
0
 void MakeDescWidget( string text )
 {
     DisposeDescWidget();
     descWidget = TextWidget.Create( game, 0, 90, text, Anchor.Centre, Anchor.Centre, regularFont );
 }
Пример #9
0
 public override void Init()
 {
     fpsTextWidget = new TextWidget( game, font );
     fpsTextWidget.Init();
     fpsTextWidget.SetText( "FPS: no data yet" );
 }
Пример #10
0
        void OnWidgetClick( Game game, ButtonWidget widget )
        {
            this.widget = widget;
            int index = Array.IndexOf<ButtonWidget>( buttons, widget );
            statusWidget.Dispose();

            string text = "Press new key binding for " + descriptions[index] + ":";
            statusWidget = TextWidget.Create( game, 0, 150, text, Anchor.Centre, Anchor.Centre, regularFont );
        }
Пример #11
0
        protected void UpdateDescription( ButtonWidget widget )
        {
            if( descWidget != null )
                descWidget.Dispose();
            if( widget.GetValue == null ) return;

            string text = widget.Text + ": " + widget.GetValue( game );
            descWidget = TextWidget.Create( game, 0, 100, text, Anchor.Centre, Anchor.Centre, regularFont );
        }
Пример #12
0
 public override void Init()
 {
     graphicsApi.ClearColour( new FastColour( 65, 31, 31 ) );
     titleWidget = TextWidget.Create( game, 0, -30, title, Anchor.Centre, Anchor.Centre, titleFont );
     messageWidget = TextWidget.Create( game, 0, 10, message, Anchor.Centre, Anchor.Centre, messageFont );
 }
Пример #13
0
        void CreateEditingWidgets()
        {
            DisposeEditingWidgets();

            buttons[8] = Make( -140, 60, "Key: " + curHotkey.BaseKey,
                              250, 30, textFont, BaseKeyClick );
            buttons[9] = Make( 140, 60, "Modifiers: " + MakeFlagsString( curHotkey.Flags ),
                              250, 30, textFont, ModifiersClick );
            buttons[10] = Make( -10, 120, curHotkey.MoreInput ? "yes" : "no",
                               50, 25, textFont, LeaveOpenClick );
            buttons[11] = Make( -100, 160, "Save changes",
                               160, 30, textFont, SaveChangesClick );
            buttons[12] = Make( 100, 160, "Remove hotkey",
                               160, 30, textFont, RemoveHotkeyClick );

            currentAction = MenuInputWidget.Create(
                game, 0, 90, 600, 25, "", Anchor.Centre, Anchor.Centre,
                regularFont, titleFont, hintFont, new StringValidator( 64 ) );
            currentMoreInputLabel = TextWidget.Create(
                game, -170, 120, "Keep input bar open:",
                Anchor.Centre, Anchor.Centre, textFont );

            if( curHotkey.Text == null ) curHotkey.Text = "";
            currentAction.SetText( curHotkey.Text );
        }