Пример #1
0
        public GuiPlayerCreativeInventoryDialog(Item[] items) : base(new InventoryBase(items.Length), GuiTextures.InventoryCreativeItemSearch, 194, 135)
        {
            MultiStackContainer = new GuiScrollableMultiStackContainer()
            {
                Anchor       = Alignment.Fill,
                Orientation  = Orientation.Vertical,
                Margin       = new Thickness(8, 17, 24, 27),
                AutoSizeMode = AutoSizeMode.None,
                Height       = 90,
                MaxHeight    = 90,
                MaxWidth     = 162,
                Width        = 162
            };

            ContentContainer.AddChild(MultiStackContainer);

            GuiStackContainer stackContainer = MultiStackContainer.AddRow(RowBuilder);
            int itemsX = 0;

            for (int i = 0; i < items.Length; i++)
            {
                var slot = CreateSlot(0, 0, i, 0);

                stackContainer.AddChild(slot);

                //x += InventoryContainerItem.ItemWidth;
                itemsX++;

                if (itemsX == 9)
                {
                    itemsX         = 0;
                    stackContainer = MultiStackContainer.AddRow(RowBuilder);
                }
            }
        }
Пример #2
0
        public PlayingHud(Alex game, Player player, TitleComponent titleComponent) : base()
        {
            Title = titleComponent;

            Alex   = game;
            Player = player;

            Player.OnInventoryChanged += OnInventoryChanged;

            Anchor  = Alignment.Fill;
            Padding = Thickness.One;

            _playerController = player.Controller;
            InputManager.AddListener(new MouseInputListener(InputManager.PlayerIndex));

            _healthAndHotbar = new GuiStackContainer()
            {
                Orientation = Orientation.Vertical,
                ChildAnchor = Alignment.Fill
            };

            _bottomContainer              = new GuiMultiStackContainer();
            _bottomContainer.ChildAnchor  = Alignment.BottomFill;
            _bottomContainer.Anchor       = Alignment.BottomCenter;
            _bottomContainer.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            _bottomContainer.Orientation  = Orientation.Vertical;

            //BottomContainer.

            _hotbar         = new GuiItemHotbar(player.Inventory);
            _hotbar.Anchor  = Alignment.BottomCenter;
            _hotbar.Padding = Thickness.Zero;

            Chat         = new ChatComponent();
            Chat.Enabled = false;
            Chat.Anchor  = Alignment.BottomLeft;

            _healthContainer        = new GuiContainer();
            _healthContainer.Anchor = Alignment.Fill;

            _healthContainer.Margin = new Thickness(0, 0, 0, 1);

            _healthComponent        = new HealthComponent(player);
            _healthComponent.Anchor = Alignment.TopLeft;

            _hungerComponent        = new HungerComponent(player);
            _hungerComponent.Anchor = Alignment.TopRight;

            _tipPopupComponent              = new TipPopupComponent();
            _tipPopupComponent.Anchor       = Alignment.BottomCenter;
            _tipPopupComponent.AutoSizeMode = AutoSizeMode.GrowAndShrink;

            Scoreboard        = new ScoreboardView();
            Scoreboard.Anchor = Alignment.MiddleRight;
        }
Пример #3
0
        public ResourcePackEntry(string path, string name, string description)
        {
            Path     = path;
            Manifest = null;

            SetFixedSize(355, 36);

            Margin  = new Thickness(5, 5, 5, 5);
            Padding = Thickness.One;
            Anchor  = Alignment.TopFill;

            AddChild(_icon = new GuiTextureElement()
            {
                Width  = 32,
                Height = 32,

                Anchor = Alignment.TopLeft,

                Background   = GuiTextures.DefaultServerIcon,
                AutoSizeMode = AutoSizeMode.None,
                RepeatMode   = TextureRepeatMode.NoRepeat
            });

            AddChild(_textWrapper = new GuiStackContainer()
            {
                ChildAnchor = Alignment.TopFill,
                Anchor      = Alignment.TopLeft
            });
            _textWrapper.Padding = new Thickness(0, 0);
            _textWrapper.Margin  = new Thickness(37, 0, 0, 0);

            _textWrapper.AddChild(new GuiTextElement()
            {
                Text   = name,
                Margin = Thickness.Zero
            });

            _textWrapper.AddChild(new GuiTextElement()
            {
                Text   = description,
                Margin = new Thickness(0, 0, 5, 0),

                //Anchor = center
            });

            AddChild(_loadedIcon = new LoadIcon()
            {
                Anchor       = Alignment.TopRight,
                AutoSizeMode = AutoSizeMode.None
            });
        }
        private GuiServerListEntryElement(IServerQueryProvider queryProvider, string serverName, string serverAddress)
        {
            QueryProvider = queryProvider;
            SetFixedSize(355, 36);

            ServerName    = serverName;
            ServerAddress = serverAddress;

            Margin  = new Thickness(5, 5, 5, 5);
            Padding = Thickness.One;
            Anchor  = Alignment.TopFill;

            AddChild(_serverIcon = new GuiTextureElement()
            {
                Width  = ServerIconSize,
                Height = ServerIconSize,

                Anchor = Alignment.TopLeft,

                Background = GuiTextures.DefaultServerIcon,
            });

            AddChild(_pingStatus = new GuiConnectionPingIcon()
            {
                Anchor = Alignment.TopRight,
            });

            AddChild(_textWrapper = new GuiStackContainer()
            {
                ChildAnchor = Alignment.TopFill,
                Anchor      = Alignment.TopLeft
            });
            _textWrapper.Padding = new Thickness(0, 0);
            _textWrapper.Margin  = new Thickness(ServerIconSize + 5, 0, 0, 0);

            _textWrapper.AddChild(_serverName = new GuiTextElement()
            {
                Text   = ServerName,
                Margin = Thickness.Zero
            });

            _textWrapper.AddChild(_serverMotd = new GuiTextElement()
            {
                TranslationKey = "multiplayer.status.pinging",
                Margin         = new Thickness(0, 0, 5, 0),

                //Anchor = center
            });
        }
Пример #5
0
        public InGameMenuState()
        {
            HeaderTitle.TranslationKey = "menu.game";
            HeaderTitle.Anchor         = Alignment.TopCenter;
            HeaderTitle.Scale          = 2f;
            HeaderTitle.FontStyle      = FontStyle.DropShadow;

            _mainMenu = new GuiStackMenu()
            {
                Margin  = new Thickness(15, 0, 15, 0),
                Padding = new Thickness(0, 50, 0, 0),
                Width   = 125,
                Anchor  = Alignment.FillY | Alignment.MinX,

                ChildAnchor       = Alignment.CenterY | Alignment.FillX,
                BackgroundOverlay = new Color(Color.Black, 0.35f)
            };

            _playerList = new GuiScrollableStackContainer()
            {
                Margin            = new Thickness(15, 0, 15, 0),
                Padding           = new Thickness(0, 0, 0, 0),
                Width             = 125,
                MinWidth          = 125,
                Anchor            = Alignment.FillRight,
                ChildAnchor       = Alignment.CenterY | Alignment.FillX,
                BackgroundOverlay = new Color(Color.Black, 0.35f)
            };
            _playerList.Orientation = Orientation.Vertical;

            /*	AddChild(new GuiTextElement()
             *      {
             *              TranslationKey = "menu.game",
             *              Anchor = Alignment.TopCenter,
             *              Scale = 2f,
             *              FontStyle = FontStyle.DropShadow
             *      });*/

            _mainMenu.AddMenuItem("menu.returnToGame", OnReturnToGameButtonPressed, isTranslationKey: true);
            _mainMenu.AddMenuItem("menu.options", OnOptionsButtonPressed, isTranslationKey: true);
            _mainMenu.AddMenuItem("menu.returnToMenu", OnQuitButtonPressed, isTranslationKey: true);

            AddChild(_mainMenu);
            AddChild(_playerList);
        }
Пример #6
0
        public GuiDebugInfo() : base()
        {
            AddChild(_leftContainer = new GuiStackContainer()
            {
                Orientation = Orientation.Vertical,

                Anchor = Alignment.TopLeft,
                ChildAnchor = Alignment.TopLeft,
            });
            
            AddChild(_rightContainer = new GuiStackContainer()
            {
                Orientation = Orientation.Vertical,

                Anchor = Alignment.TopRight,
                ChildAnchor = Alignment.TopRight,
			});
        }
Пример #7
0
        private GuiStackContainer AddRow(params GuiElement[] elements)
        {
            var stack = new GuiStackContainer()
            {
                Orientation = Orientation == Orientation.Horizontal ? Orientation.Vertical : Orientation.Horizontal,
                //Anchor = Alignment.TopLeft
            };

            AddChild(stack);

            //	stack.Anchor = Alignment.TopFill;
            foreach (var element in elements)
            {
                stack.AddChild(element);
            }

            return(stack);
        }
Пример #8
0
        public FormImageButton(string image, string text, Action action, bool isTranslationKey = false)
        {
            ImageUrl = image;

            GuiStackContainer stackContainer = new GuiStackContainer();

            stackContainer.Orientation = Orientation.Horizontal;
            stackContainer.ChildAnchor = Alignment.MiddleFill;
            stackContainer.Anchor      = Alignment.MiddleFill;

            Image        = new FormImage(ImageUrl);
            Image.Anchor = Alignment.MiddleLeft;
            Image.Width  = 16;
            Image.Height = 16;
            // Image.Margin = new Thickness(0, 0, 5, 0);

            Button        = new GuiStackMenuItem(text, action, isTranslationKey);
            Button.Anchor = Alignment.MiddleFill;

            //   GuiControl contr = new GuiControl();
            //   contr.AddChild(Button);

            GuiControl imgControl = new GuiControl();

            imgControl.AddChild(Image);

            GuiControl buttonCtr = new GuiControl();

            buttonCtr.AddChild(Button);

            stackContainer.AddChild(imgControl);
            stackContainer.AddChild(buttonCtr);

            AddChild(stackContainer);
            // Button.AddChild(Image);
            // base.TextElement.Anchor = Alignment.MiddleRight;
            //AddChild(Button);
            // AddChild(Image);
        }
Пример #9
0
        public SimpleFormDialog(uint formId, BedrockFormManager parent, SimpleForm form, InputManager inputManager) : base(formId, parent, inputManager)
        {
            StackMenu             = new GuiStackMenu();
            StackMenu.Anchor      = Alignment.Fill;
            StackMenu.ChildAnchor = Alignment.MiddleCenter;
            StackMenu.Background  = Color.Black * 0.35f;

            if (!string.IsNullOrWhiteSpace(form.Content))
            {
                StackMenu.AddLabel(FixContrast(form.Content));
                StackMenu.AddSpacer();
            }

            var btns = form.Buttons.ToArray();

            for (var index = 0; index < btns.Length; index++)
            {
                var button = btns[index];
                int idx    = index;

                Action submitAction = () =>
                {
                    var packet = McpeModalFormResponse.CreateObject();
                    packet.formId = formId;
                    packet.data   = idx.ToString();
                    //JsonConvert.SerializeObject(idx)
                    parent.SendResponse(packet);

                    parent.Hide(formId);
                };

                if (button.Image != null)
                {
                    switch (button.Image.Type)
                    {
                    case "url":
                        StackMenu.AddChild(new FormImageButton(button.Image.Url, button.Text, submitAction));
                        continue;
                        break;

                    case "path":
                        break;
                    }
                }

                var item = StackMenu.AddMenuItem(button.Text, submitAction);
            }

            Background = Color.Transparent;

            var width  = 356;
            var height = width;

            ContentContainer.Width  = ContentContainer.MinWidth = ContentContainer.MaxWidth = width;
            ContentContainer.Height = ContentContainer.MinHeight = ContentContainer.MaxHeight = height;

            SetFixedSize(width, height);

            ContentContainer.AutoSizeMode = AutoSizeMode.None;

            Container.Anchor = Alignment.MiddleCenter;

            var bodyWrapper = new GuiContainer();

            bodyWrapper.Anchor  = Alignment.Fill;
            bodyWrapper.Padding = new Thickness(5, 0);
            bodyWrapper.AddChild(StackMenu);

            Container.AddChild(bodyWrapper);

            Container.AddChild(Header = new GuiStackContainer()
            {
                Anchor      = Alignment.TopFill,
                ChildAnchor = Alignment.BottomCenter,
                Height      = 32,
                Padding     = new Thickness(3),
                Background  = Color.Black * 0.5f
            });

            Header.AddChild(new GuiTextElement()
            {
                Text      = FixContrast(form.Title),
                TextColor = TextColor.White,
                Scale     = 2f,
                FontStyle = FontStyle.DropShadow,

                Anchor = Alignment.BottomCenter,
            });

            StackMenu.Margin = new Thickness(0, Header.Height, 0, 0);
        }
Пример #10
0
        public LoadingWorldState(IGameState parent = null)
        {
            GuiStackContainer progressBarContainer;

            AddChild(progressBarContainer = new GuiStackContainer()
            {
                //Width  = 300,
                //Height = 35,
                //Margin = new Thickness(12),

                Anchor            = Alignment.MiddleCenter,
                Background        = Color.Transparent,
                BackgroundOverlay = Color.Transparent,
                Orientation       = Orientation.Vertical
            });

            if (parent == null)
            {
                Background = new GuiTexture2D
                {
                    TextureResource = GuiTextures.OptionsBackground,
                    RepeatMode      = TextureRepeatMode.Tile,
                    Scale           = new Vector2(2f, 2f),
                };

                BackgroundOverlay = new Color(Color.Black, 0.65f);
            }
            else
            {
                ParentState           = parent;
                HeaderTitle.IsVisible = false;
            }

            progressBarContainer.AddChild(_textDisplay = new GuiTextElement()
            {
                Text      = Text,
                TextColor = TextColor.White,

                Anchor    = Alignment.TopCenter,
                HasShadow = false,
                Scale     = 1.5f
            });

            GuiElement element;

            progressBarContainer.AddChild(element = new GuiElement()
            {
                Width  = 300,
                Height = 35,
                Margin = new Thickness(12),
            });

            element.AddChild(_percentageDisplay = new GuiTextElement()
            {
                Text      = Text,
                TextColor = TextColor.White,

                Anchor    = Alignment.TopRight,
                HasShadow = false
            });

            element.AddChild(_progressBar = new GuiProgressBar()
            {
                Width  = 300,
                Height = 9,

                Anchor = Alignment.MiddleCenter,
            });

            progressBarContainer.AddChild(
                _subTextDisplay = new GuiTextElement()
            {
                Text = Text, TextColor = TextColor.White, Anchor = Alignment.BottomLeft, HasShadow = false
            });

            HeaderTitle.TranslationKey = "menu.loadingLevel";

            UpdateProgress(LoadingState.ConnectingToServer, 10);
        }
Пример #11
0
        public TitleState()
        {
            _backgroundSkyBox = new GuiPanoramaSkyBox(Alex);

            Background.Texture    = _backgroundSkyBox;
            Background.RepeatMode = TextureRepeatMode.Stretch;

            MenuItem baseMenu = new MenuItem(MenuType.Menu)
            {
                Children =
                {
                    new MenuItem()
                    {
                        Title          = "menu.multiplayer",
                        OnClick        = MultiplayerButtonPressed,
                        IsTranslatable = true
                    },
                    new MenuItem(MenuType.SubMenu)
                    {
                        Title          = "Debugging",
                        IsTranslatable = false,
                        Children       =
                        {
                            new MenuItem()
                            {
                                Title   = "Blockstates",
                                OnClick = (sender, args) =>
                                {
                                    Debug(new DebugWorldGenerator());
                                }
                            },
                            new MenuItem()
                            {
                                Title   = "Demo",
                                OnClick = (sender, args) =>
                                {
                                    Debug(new DemoGenerator());
                                }
                            },
                            new MenuItem()
                            {
                                Title   = "Flatland",
                                OnClick = (sender, args) =>
                                {
                                    Debug(new FlatlandGenerator());
                                }
                            },
                            new MenuItem()
                            {
                                Title   = "Chunk Debug",
                                OnClick = (sender, args) =>
                                {
                                    Debug(new ChunkDebugWorldGenerator());
                                }
                            }
                        }
                    },
                    new MenuItem()
                    {
                        Title   = "menu.options",
                        OnClick = (sender, args) =>
                        {
                            Alex.GameStateManager.SetActiveState("options");
                        },
                        IsTranslatable = true
                    },
                    new MenuItem()
                    {
                        Title   = "menu.quit",
                        OnClick = (sender, args) =>
                        {
                            Alex.Exit();
                        },
                        IsTranslatable = true
                    },
                }
            };

            #region Create MainMenu

            _mainMenu = new GuiStackMenu()
            {
                Margin  = new Thickness(15, 0, 15, 0),
                Padding = new Thickness(0, 50, 0, 0),
                Width   = 125,
                Anchor  = Alignment.FillY | Alignment.MinX,

                ChildAnchor       = Alignment.CenterY | Alignment.FillX,
                BackgroundOverlay = new Color(Color.Black, 0.35f)
            };

            ShowMenu(baseMenu);

            AddChild(_mainMenu);

            #endregion

            AddChild(new GuiImage(GuiTextures.AlexLogo)
            {
                Margin = new Thickness(95, 25, 0, 0),
                Anchor = Alignment.TopCenter
            });

            AddChild(_splashText = new GuiTextElement()
            {
                TextColor = TextColor.Yellow,
                Rotation  = 17.5f,

                Margin = new Thickness(240, 15, 0, 0),
                Anchor = Alignment.TopCenter,

                Text = "Who liek minecwaf?!",
            });

            var guiItemStack = new GuiStackContainer()
            {
                Anchor      = Alignment.CenterX | Alignment.CenterY,
                Orientation = Orientation.Vertical
            };

            AddChild(guiItemStack);

            var row = new GuiStackContainer()
            {
                Orientation = Orientation.Horizontal,
                Anchor      = Alignment.TopFill,
                ChildAnchor = Alignment.FillCenter,
                Margin      = Thickness.One
            };
            guiItemStack.AddChild(row);

            _playerProfileService = Alex.Services.GetService <IPlayerProfileService>();
            _playerProfileService.ProfileChanged += PlayerProfileServiceOnProfileChanged;

            /*ScoreboardView scoreboardView;
             * AddChild(scoreboardView = new ScoreboardView());
             * scoreboardView.Anchor = Alignment.MiddleRight;
             *
             * scoreboardView.AddString("Title");
             * scoreboardView.AddRow("Key", "200");
             * scoreboardView.AddRow("Key 2", "200");*/
        }
Пример #12
0
        /// <inheritdoc />
        public ModalFormDialog(uint formId, BedrockFormManager parent, ModalForm form, InputManager inputManager) : base(
                formId, parent, inputManager)
        {
            Background = Color.Transparent;

            var width  = 356;
            var height = width;

            ContentContainer.Width  = ContentContainer.MinWidth = ContentContainer.MaxWidth = width;
            ContentContainer.Height = ContentContainer.MinHeight = ContentContainer.MaxHeight = height;

            SetFixedSize(width, height);

            ContentContainer.AutoSizeMode = AutoSizeMode.None;

            Container.Anchor = Alignment.MiddleCenter;

            Container.AddChild(Footer = new GuiMultiStackContainer(row =>
            {
                row.Anchor = Alignment.BottomFill;
                //row.Orientation = Orientation.Horizontal;
                row.ChildAnchor = Alignment.BottomFill;
                //row.Margin = new Thickness(3);
                row.Width    = 356;
                row.MaxWidth = 356;
            })
            {
                Height = 24,

                Orientation = Orientation.Vertical,
                Anchor      = Alignment.BottomFill,
                ChildAnchor = Alignment.BottomCenter,
                Background  = Color.Black * 0.5f
            });

            Footer.AddRow(row =>
            {
                row.AddChild(new GuiButton(form.Button1, () =>
                {
                    var packet    = McpeModalFormResponse.CreateObject();
                    packet.formId = formId;
                    packet.data   = "true";
                    //JsonConvert.SerializeObject(idx)
                    parent.SendResponse(packet);

                    parent.Hide(formId);
                })
                {
                    Enabled = true,
                });
                row.AddChild(new GuiButton(form.Button2, () =>
                {
                    var packet    = McpeModalFormResponse.CreateObject();
                    packet.formId = formId;
                    packet.data   = "false";
                    //JsonConvert.SerializeObject(idx)
                    parent.SendResponse(packet);

                    parent.Hide(formId);
                })
                {
                    Enabled = true
                });
            });

            Container.AddChild(Body = new GuiStackContainer()
            {
                //Margin = new Thickness(0, Header.Height, 0, Footer.Height),
                //AutoSizeMode = AutoSizeMode.None,
                //Height = 100,
                //MaxHeight = 100,
                Orientation = Orientation.Vertical,
                Anchor      = Alignment.Fill,
                ChildAnchor = Alignment.MiddleCenter,
                Background  = Color.Black * 0.35f
                              //HorizontalScrollMode = ScrollMode.Hidden
            });

            var text = form.Content;

            var newString = "";

            //	char[] help = new[] { '.', '?', '!' };
            for (int i = 0; i < text.Length - 1; i++)
            {
                var c = text[i];
                newString += c;

                if (c == '.' || c == '?' || c == '!')
                {
                    //newString += "\n";

                    Body.AddChild(new GuiTextElement(newString));

                    /*row.AddChild(new GuiTextElement(form.Content)
                     * {
                     *      Wrap = true,
                     *      MaxWidth = 320
                     * });*/


                    newString = "";

                    if (i != text.Length - 1 && text[i + 1] == ' ')
                    {
                        i++;
                    }
                }
            }

            if (newString.Length > 0)
            {
                Body.AddChild(new GuiTextElement(newString));
            }

            Container.AddChild(Header = new GuiStackContainer()
            {
                Anchor      = Alignment.TopFill,
                ChildAnchor = Alignment.BottomCenter,
                Height      = 32,
                Padding     = new Thickness(3),
                Background  = Color.Black * 0.5f
            });

            Header.AddChild(new GuiTextElement()
            {
                Text      = form.Title,
                TextColor = TextColor.White,
                Scale     = 2f,
                FontStyle = FontStyle.DropShadow,

                Anchor = Alignment.BottomCenter,
            });

            Body.Margin = new Thickness(0, Header.Height, 0, Footer.Height);
            //	Body.MaxHeight = Body.Height = height - 64;
        }
Пример #13
0
        public CustomFormDialog(uint formId, BedrockFormManager parent, CustomForm form, InputManager inputManager) : base(formId, parent, inputManager)
        {
            Form = form;

            GuiScrollableStackContainer stackContainer = new GuiScrollableStackContainer();

            stackContainer.Orientation = Orientation.Vertical;
            stackContainer.Anchor      = Alignment.Fill;
            stackContainer.ChildAnchor = Alignment.MiddleFill;
            stackContainer.Background  = Color.Black * 0.35f;
            var margin = new Thickness(5, 5);

            foreach (var element in form.Content)
            {
                switch (element)
                {
                case Label label:
                {
                    stackContainer.AddChild(new GuiTextElement()
                        {
                            Text   = label.Text,
                            Margin = margin
                        });
                }
                break;

                case Input input:
                {
                    GuiTextInput guiInput = new GuiTextInput()
                    {
                        Value       = input.Value,
                        PlaceHolder = !string.IsNullOrWhiteSpace(input.Placeholder) ? input.Placeholder : input.Text,
                        Margin      = margin
                    };

                    guiInput.ValueChanged += (sender, s) => { input.Value = s; };

                    stackContainer.AddChild(guiInput);
                }
                break;

                case Toggle toggle:
                {
                    GuiToggleButton guiToggle;
                    stackContainer.AddChild(guiToggle = new GuiToggleButton(toggle.Text)
                        {
                            Margin = margin,
                            Value  = !toggle.Value
                        });

                    guiToggle.DisplayFormat = new ValueFormatter <bool>((val) =>
                        {
                            return($"{toggle.Text}: {val.ToString()}");
                        });

                    guiToggle.Value = toggle.Value;

                    guiToggle.ValueChanged += (sender, b) => { toggle.Value = b; };
                }
                break;

                case Slider slider:
                {
                    GuiSlider guiSlider;
                    stackContainer.AddChild(guiSlider = new GuiSlider()
                        {
                            Label        = { Text = slider.Text },
                            Value        = slider.Value,
                            MaxValue     = slider.Max,
                            MinValue     = slider.Min,
                            StepInterval = slider.Step,
                            Margin       = margin
                        });

                    guiSlider.ValueChanged += (sender, d) => { slider.Value = (float)d; };
                }
                break;

                case StepSlider stepSlider:
                {
                    stackContainer.AddChild(new GuiTextElement()
                        {
                            Text      = "Unsupported stepslider",
                            TextColor = TextColor.Red,
                            Margin    = margin
                        });
                }
                break;

                case Dropdown dropdown:
                {
                    stackContainer.AddChild(new GuiTextElement()
                        {
                            Text      = "Unsupported dropdown",
                            TextColor = TextColor.Red,
                            Margin    = margin
                        });
                }
                break;
                }
            }

            SubmitButton = new GuiButton("Submit", SubmitPressed);

            stackContainer.AddChild(SubmitButton);

            Background = Color.Transparent;

            var width  = 356;
            var height = width;

            ContentContainer.Width  = ContentContainer.MinWidth = ContentContainer.MaxWidth = width;
            ContentContainer.Height = ContentContainer.MinHeight = ContentContainer.MaxHeight = height;

            SetFixedSize(width, height);

            ContentContainer.AutoSizeMode = AutoSizeMode.None;

            Container.Anchor = Alignment.MiddleCenter;

            var bodyWrapper = new GuiContainer();

            bodyWrapper.Anchor  = Alignment.Fill;
            bodyWrapper.Padding = new Thickness(5, 0);
            bodyWrapper.AddChild(stackContainer);

            Container.AddChild(bodyWrapper);

            Container.AddChild(Header = new GuiStackContainer()
            {
                Anchor      = Alignment.TopFill,
                ChildAnchor = Alignment.BottomCenter,
                Height      = 32,
                Padding     = new Thickness(3),
                Background  = Color.Black * 0.5f
            });

            Header.AddChild(new GuiTextElement()
            {
                Text      = FixContrast(form.Title),
                TextColor = TextColor.White,
                Scale     = 2f,
                FontStyle = FontStyle.DropShadow,

                Anchor = Alignment.BottomCenter,
            });

            stackContainer.Margin = new Thickness(0, Header.Height, 0, 0);
        }
Пример #14
0
        //private GuiItem _guiItem;
        //private GuiItem _guiItem2;
        public TitleState()
        {
            _backgroundSkyBox = new GuiPanoramaSkyBox(Alex);

            Background.Texture    = _backgroundSkyBox;
            Background.RepeatMode = TextureRepeatMode.Stretch;

            #region Create MainMenu

            _mainMenu = new GuiStackMenu()
            {
                Margin  = new Thickness(15, 0, 15, 0),
                Padding = new Thickness(0, 50, 0, 0),
                Width   = 125,
                Anchor  = Alignment.FillY | Alignment.MinX,

                ChildAnchor       = Alignment.CenterY | Alignment.FillX,
                BackgroundOverlay = new Color(Color.Black, 0.35f)
            };

            _mainMenu.AddMenuItem("menu.multiplayer", JavaEditionButtonPressed, EnableMultiplayer, true);
            _mainMenu.AddMenuItem("menu.singleplayer", OnSinglePlayerPressed, true, true);

            _mainMenu.AddMenuItem("menu.options", () => { Alex.GameStateManager.SetActiveState("options"); }, true, true);
            _mainMenu.AddMenuItem("menu.quit", () => { Alex.Exit(); }, true, true);
            #endregion

            #region Create DebugMenu

            _debugMenu = new GuiStackMenu()
            {
                Margin  = new Thickness(15, 0, 15, 0),
                Padding = new Thickness(0, 50, 0, 0),
                Width   = 125,
                Anchor  = Alignment.FillY | Alignment.MinX,

                ChildAnchor       = Alignment.CenterY | Alignment.FillX,
                BackgroundOverlay = new Color(Color.Black, 0.35f),
            };

            _debugMenu.AddMenuItem("Debug Blockstates", DebugWorldButtonActivated);
            _debugMenu.AddMenuItem("Demo", DemoButtonActivated);
            _debugMenu.AddMenuItem("Debug Flatland", DebugFlatland);
            //_debugMenu.AddMenuItem("Debug Anvil", DebugAnvil);
            _debugMenu.AddMenuItem("Debug Chunk", DebugChunkButtonActivated);
            //	_debugMenu.AddMenuItem("Debug XBL Login", BedrockEditionButtonPressed);
            _debugMenu.AddMenuItem("Go Back", DebugGoBackPressed);

            #endregion

            #region Create SPMenu

            _spMenu = new GuiStackMenu()
            {
                Margin  = new Thickness(15, 0, 15, 0),
                Padding = new Thickness(0, 50, 0, 0),
                Width   = 125,
                Anchor  = Alignment.FillY | Alignment.MinX,

                ChildAnchor       = Alignment.CenterY | Alignment.FillX,
                BackgroundOverlay = new Color(Color.Black, 0.35f),
            };

            _spMenu.AddMenuItem("SinglePlayer", () => {}, false);
            _spMenu.AddMenuItem("Debug Worlds", OnDebugPressed);

            _spMenu.AddMenuItem("Return to main menu", SpBackPressed);

            #endregion

            CreateProtocolMenu();

            AddChild(_mainMenu);

            AddChild(new GuiImage(GuiTextures.AlexLogo)
            {
                Margin = new Thickness(95, 25, 0, 0),
                Anchor = Alignment.TopCenter
            });

            AddChild(_splashText = new GuiTextElement()
            {
                TextColor = TextColor.Yellow,
                Rotation  = 17.5f,

                Margin = new Thickness(240, 15, 0, 0),
                Anchor = Alignment.TopCenter,

                Text = "Who liek minecwaf?!",
            });

            var guiItemStack = new GuiStackContainer()
            {
                Anchor      = Alignment.CenterX | Alignment.CenterY,
                Orientation = Orientation.Vertical
            };

            AddChild(guiItemStack);

            var row = new GuiStackContainer()
            {
                Orientation = Orientation.Horizontal,
                Anchor      = Alignment.TopFill,
                ChildAnchor = Alignment.FillCenter,
                Margin      = Thickness.One
            };
            guiItemStack.AddChild(row);

            /*row.AddChild(_guiItem = new GuiItem()
             * {
             *      Height = 24,
             *      Width = 24,
             *      Background = new Color(Color.Black, 0.2f)
             * });
             * row.AddChild(_guiItem2 = new GuiItem()
             * {
             *      Height = 24,
             *      Width = 24,
             *      Background = new Color(Color.Black, 0.2f)
             * });
             */
            /*	guiItemStack.AddChild(new GuiVector3Control(() => _guiItem.Camera.Position, newValue =>
             *      {
             *              if (_guiItem.Camera != null)
             *              {
             *                      _guiItem.Camera.Position = newValue;
             *              }
             *              if(_guiItem2.Camera != null)
             *              {
             *                      _guiItem2.Camera.Position = newValue;
             *              }
             *      }, 0.25f)
             *      {
             *              Margin = new Thickness(2)
             *      });*/

            // guiItemStack.AddChild(new GuiVector3Control(() => _guiItem.Camera.TargetPositionOffset, newValue =>
            // {
            //  if (_guiItem.Camera != null)
            //  {
            //      _guiItem.Camera.Target = newValue;
            //  }
            //  if(_guiItem2.Camera != null)
            //  {
            //      _guiItem2.Camera.Target = newValue;
            //  }
            // }, 0.25f)
            // {
            //  Margin = new Thickness(2)
            // });

            _playerProfileService = Alex.Services.GetService <IPlayerProfileService>();
            _playerProfileService.ProfileChanged += PlayerProfileServiceOnProfileChanged;
        }
Пример #15
0
 private void RowBuilder(GuiStackContainer obj)
 {
     obj.Orientation = Orientation.Horizontal;
 }