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 + 15;
     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;
 }
        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.Gui.SetNewScreen(new PauseScreen(g))),
            };
        }
Ejemplo n.º 3
0
 public void SetTitle(string title)
 {
     if (titleWidget != null)
     {
         titleWidget.Dispose();
     }
     titleWidget = ChatTextWidget.Create(game, 0, -80, title, Anchor.Centre, Anchor.Centre, font);
 }
Ejemplo n.º 4
0
 public void SetMessage(string message)
 {
     if (messageWidget != null)
     {
         messageWidget.Dispose();
     }
     messageWidget = ChatTextWidget.Create(game, 0, -30, message, Anchor.Centre, Anchor.Centre, font);
 }
        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);
 }
        public override void Init()
        {
            game.SkipClear = true;
            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),
            };

            game.Graphics.ContextRecreated += ContextRecreated;
            initTime     = DateTime.UtcNow;
            clearTime    = DateTime.UtcNow.AddSeconds(0.5);
            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.Gui.SetNewScreen(new ClassicOptionsScreen(g)));
     }
     else
     {
         widgets[index++] = MakeBack("Back to menu", 5, titleFont,
                                     (g, w) => g.Gui.SetNewScreen(new OptionsGroupScreen(g)));
     }
 }
        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.Gui.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);
        }
        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),

                ChatTextWidget.Create(game, 0, 100,
                                      "&eButtons on the right require a client restart",
                                      Anchor.Centre, Anchor.Centre, regularFont),
                MakeBack(false, titleFont,
                         (g, w) => g.Gui.SetNewScreen(PreviousScreen())),
                null, null,
            };

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

                new BooleanValidator(),
                new BooleanValidator(),
                new BooleanValidator(),
            };
        }
        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.Gui.SetNewScreen(new PauseScreen(g))),
            };
            UpdateArrows();
        }
Ejemplo n.º 12
0
        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);
            }
        }
        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.Gui.SetNewScreen(new PauseScreen(g))),
            };
        }
        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);
        }
 void MakeDescWidget(string text)
 {
     DisposeDescWidget();
     descWidget = ChatTextWidget.Create(game, 0, 65, text,
                                        Anchor.Centre, Anchor.Centre, regularFont);
 }