예제 #1
0
 void ConstructWidgets()
 {
     textInput         = new TextInputWidget(game, chatFont);
     textInput.YOffset = 5;
     status            = new TextGroupWidget(game, 5, chatFont, chatUrlFont,
                                             Anchor.BottomOrRight, Anchor.LeftOrTop);
     status.Init();
     status.SetUsePlaceHolder(0, false);
     status.SetUsePlaceHolder(1, false);
     bottomRight = new TextGroupWidget(game, 3, chatFont, chatUrlFont,
                                       Anchor.BottomOrRight, Anchor.BottomOrRight);
     bottomRight.YOffset = blockSize * 3 / 2;
     bottomRight.Init();
     normalChat = new TextGroupWidget(game, chatLines, chatFont, chatUrlFont,
                                      Anchor.LeftOrTop, Anchor.BottomOrRight);
     normalChat.XOffset = 10;
     normalChat.YOffset = blockSize + 15;
     normalChat.Init();
     clientStatus = new TextGroupWidget(game, game.Chat.ClientStatus.Length, chatFont,
                                        chatUrlFont, Anchor.LeftOrTop, Anchor.BottomOrRight);
     clientStatus.XOffset = 10;
     clientStatus.YOffset = blockSize + 15;
     clientStatus.Init();
     announcement = ChatTextWidget.Create(game, 0, 0, null,
                                          Anchor.Centre, Anchor.Centre, announcementFont);
     announcement.YOffset = -game.Height / 4;
 }
예제 #2
0
        public override void Init()
        {
            game.Keyboard.KeyRepeat = true;
            base.Init();
            titleFont   = new Font(game.FontName, 16, FontStyle.Bold);
            regularFont = new Font(game.FontName, 16, FontStyle.Regular);

            inputs = new [] {
                MakeInput(-80, false, game.World.Width.ToString()),
                MakeInput(-40, false, game.World.Height.ToString()),
                MakeInput(0, false, game.World.Length.ToString()),
                MakeInput(40, true, "")
            };
            labels = new [] {
                MakeLabel(-150, -80, "Width:"), MakeLabel(-150, -40, "Height:"),
                MakeLabel(-150, 0, "Length:"), MakeLabel(-140, 40, "Seed:"),
                ChatTextWidget.Create(game, 0, -130, "Generate new level",
                                      Anchor.Centre, Anchor.Centre, regularFont),
            };
            widgets = new [] {
                ButtonWidget.Create(game, -120, 100, 201, 40, "Flatgrass", Anchor.Centre,
                                    Anchor.Centre, titleFont, GenFlatgrassClick),
                ButtonWidget.Create(game, 120, 100, 201, 40, "Vanilla", Anchor.Centre,
                                    Anchor.Centre, titleFont, GenNotchyClick),
                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new PauseScreen(g))),
            };
        }
예제 #3
0
        public override void Init()
        {
            font    = new Font(game.FontName, 14);
            posFont = new Font(game.FontName, 14, FontStyle.Italic);
            game.Events.ChatFontChanged += ChatFontChanged;

            fpsText               = new ChatTextWidget(game, font);
            fpsText.XOffset       = 2;
            fpsText.YOffset       = 2;
            fpsText.ReducePadding = true;
            fpsText.Init();

            string msg = text.Length > 0 ? text.GetString() :
                         "FPS: no data yet";

            fpsText.SetText(msg);
            MakePosTextWidget();

            hackStates               = new ChatTextWidget(game, posFont);
            hackStates.XOffset       = 2;
            hackStates.YOffset       = fpsText.Height + posTex.Height + 2;
            hackStates.ReducePadding = true;
            hackStates.Init();
            UpdateHackState(true);
        }
 public void SetMessage(string message)
 {
     if (messageWidget != null)
     {
         messageWidget.Dispose();
     }
     messageWidget = ChatTextWidget.Create(game, 0, -30, message, Anchor.Centre, Anchor.Centre, font);
 }
 public void SetTitle(string title)
 {
     if (titleWidget != null)
     {
         titleWidget.Dispose();
     }
     titleWidget = ChatTextWidget.Create(game, 0, -80, title, Anchor.Centre, Anchor.Centre, font);
 }
 public static new ChatTextWidget Create( Game game, int x, int y, string text, Anchor horizontal, Anchor vertical, Font font )
 {
     ChatTextWidget widget = new ChatTextWidget( game, font );
     widget.Init();
     widget.HorizontalAnchor = horizontal; widget.VerticalAnchor = vertical;
     widget.XOffset = x; widget.YOffset = y;
     widget.SetText( text );
     return widget;
 }
        public static new ChatTextWidget Create(Game game, int x, int y, string text, Anchor horizontal, Anchor vertical, Font font)
        {
            ChatTextWidget widget = new ChatTextWidget(game, font);

            widget.Init();
            widget.HorizontalAnchor = horizontal; widget.VerticalAnchor = vertical;
            widget.XOffset          = x; widget.YOffset = y;
            widget.SetText(text);
            return(widget);
        }
예제 #8
0
        TextWidget MakeLabel(int x, int y, string text)
        {
            TextWidget widget = ChatTextWidget.Create(game, x, y, text,
                                                      Anchor.Centre, Anchor.Centre, regularFont);
            int start = game.Width / 2 - 110;

            widget.MoveTo(start - widget.Width, widget.Y);
            widget.Colour = new FastColour(224, 224, 224);
            return(widget);
        }
 public override void Init()
 {
     base.Init();
     if (keyNames == null)
     {
         keyNames = Enum.GetNames(typeof(Key));
     }
     keyFont      = new Font(game.FontName, 16, FontStyle.Bold);
     regularFont  = new Font(game.FontName, 16, FontStyle.Italic);
     statusWidget = ChatTextWidget.Create(game, 0, 130, "",
                                          Anchor.Centre, Anchor.Centre, regularFont);
 }
예제 #10
0
 public override void Init()
 {
     api.ClearColour(new FastColour(65, 31, 31));
     widgets = new Widget[] {
         ChatTextWidget.Create(game, 0, -30, title, Anchor.Centre, Anchor.Centre, titleFont),
         ChatTextWidget.Create(game, 0, 10, message, Anchor.Centre, Anchor.Centre, messageFont),
         ButtonWidget.Create(game, 0, 80, 301, 40, "Try to reconnect.. " + delay,
                             Anchor.Centre, Anchor.Centre, titleFont, ReconnectClick),
     };
     initTime     = DateTime.UtcNow;
     lastSecsLeft = delay;
 }
 void MakeOthers()
 {
     widgets[index++] = ChatTextWidget.Create(game, 0, -180, title,
                                              Anchor.Centre, Anchor.Centre, keyFont);
     if (game.ClassicMode)
     {
         widgets[index++] = MakeBack(false, titleFont,
                                     (g, w) => g.SetNewScreen(new ClassicOptionsScreen(g)));
     }
     else
     {
         widgets[index++] = MakeBack("Back to menu", 5, titleFont,
                                     (g, w) => g.SetNewScreen(new OptionsGroupScreen(g)));
     }
 }
예제 #12
0
        public override void Init()
        {
            base.Init();
            left     = new KeyBind[3];
            left[0]  = KeyBind.MouseLeft; left[1] = KeyBind.MouseMiddle; left[2] = KeyBind.MouseRight;
            leftDesc = new[] { "Left mouse", "Middle mouse", "Right mouse" };

            widgets  = new Widget[left.Length + 5];
            title    = "Mouse key bindings";
            leftPage = (g, w) => g.SetNewScreen(new HacksKeyBindingsScreen(g));
            MakeWidgets(-50);

            widgets[index++] = ChatTextWidget.Create(
                game, 0, 80, "&eRight click to remove the key binding",
                Anchor.Centre, Anchor.Centre, regularFont);
        }
예제 #13
0
        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);
        }
        void SetTextImpl(string title, params string[] body)
        {
            if (labels != null)
            {
                for (int i = 0; i < labels.Length; i++)
                {
                    labels[i].Dispose();
                }
            }
            this.title = title;
            this.body  = body;

            labels    = new TextWidget[body.Length + 1];
            labels[0] = TextWidget.Create(game, 0, -120, title,
                                          Anchor.Centre, Anchor.Centre, titleFont);
            for (int i = 0; i < body.Length; i++)
            {
                labels[i + 1] = ChatTextWidget.Create(game, 0, -70 + 20 * i, body[i],
                                                      Anchor.Centre, Anchor.Centre, regularFont);
                labels[i + 1].Colour = new FastColour(224, 224, 224);
            }
        }
예제 #15
0
        public override void Init()
        {
            textFont  = new Font(game.FontName, 16, FontStyle.Bold);
            arrowFont = new Font(game.FontName, 18, FontStyle.Bold);
            titleFont = new Font(game.FontName, 16, FontStyle.Bold);
            title     = ChatTextWidget.Create(game, 0, -155, titleText,
                                              Anchor.Centre, Anchor.Centre, titleFont);

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

                Make(-220, 0, "<", (g, w) => PageClick(false)),
                Make(220, 0, ">", (g, w) => PageClick(true)),
                MakeBack(false, titleFont,
                         (g, w) => g.SetNewScreen(new PauseScreen(g))),
            };
            UpdateArrows();
        }
예제 #16
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))),
            };
        }
예제 #17
0
        public override void Init()
        {
            font = new Font( game.FontName, 14 );
            posFont = new Font( game.FontName, 14, FontStyle.Italic );
            game.Events.ChatFontChanged += ChatFontChanged;

            fpsText = new ChatTextWidget( game, font );
            fpsText.XOffset = 2;
            fpsText.YOffset = 2;
            fpsText.ReducePadding = true;
            fpsText.Init();

            string msg = text.Length > 0 ? text.GetString() :
                "FPS: no data yet";
            fpsText.SetText( msg );
            MakePosTextWidget();

            hackStates = new ChatTextWidget( game, posFont );
            hackStates.XOffset = 2;
            hackStates.YOffset = fpsText.Height + posTex.Height + 2;
            hackStates.ReducePadding = true;
            hackStates.Init();
            UpdateHackState( true );
        }
예제 #18
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);
        }
예제 #19
0
 void MakeDescWidget(string text)
 {
     DisposeDescWidget();
     descWidget = ChatTextWidget.Create(game, 0, 65, text,
                                        Anchor.Centre, Anchor.Centre, regularFont);
 }
예제 #20
0
 public override void Init()
 {
     overview = ChatTextWidget.Create(game, 0, 0, "Connected players:",
                                      Anchor.Centre, Anchor.Centre, font);
     base.Init();
 }
 public void SetTitle( string title )
 {
     if( titleWidget != null )
         titleWidget.Dispose();
     titleWidget = ChatTextWidget.Create( game, 0, -80, title, Anchor.Centre, Anchor.Centre, font );
 }
예제 #22
0
 void ConstructWidgets()
 {
     textInput = new TextInputWidget( game, chatFont, chatBoldFont );
     textInput.YOffset = blockSize + 5;
     status = new TextGroupWidget( game, 5, chatFont, chatUnderlineFont,
                                  Anchor.BottomOrRight, Anchor.LeftOrTop );
     status.Init();
     status.SetUsePlaceHolder( 0, false );
     status.SetUsePlaceHolder( 1, false );
     bottomRight = new TextGroupWidget( game, 3, chatFont, chatUnderlineFont,
                                       Anchor.BottomOrRight, Anchor.BottomOrRight );
     bottomRight.YOffset = blockSize * 3 / 2;
     bottomRight.Init();
     normalChat = new TextGroupWidget( game, chatLines, chatFont, chatUnderlineFont,
                                      Anchor.LeftOrTop, Anchor.BottomOrRight );
     normalChat.XOffset = 10;
     normalChat.YOffset = blockSize * 2 + 15;
     normalChat.Init();
     clientStatus = new TextGroupWidget( game, game.Chat.ClientStatus.Length, chatFont,
                                        chatUnderlineFont, Anchor.LeftOrTop, Anchor.BottomOrRight );
     clientStatus.XOffset = 10;
     clientStatus.YOffset = blockSize * 2 + 15;
     clientStatus.Init();
     announcement = ChatTextWidget.Create( game, 0, 0, null,
                                          Anchor.Centre, Anchor.Centre, announcementFont );
     announcement.YOffset = -game.Height / 4;
 }