示例#1
0
        public OptionsState(GuiPanoramaSkyBox skyBox) : base(skyBox)
        {
            TitleTranslationKey = "options.title";

            AddGuiRow(CreateSlider("FOV: {0}", o => o.FieldOfVision, 30, 120, 1), CreateLinkButton <VideoOptionsState>("options.video"));

            AddGuiRow(CreateLinkButton <ResourcePackOptionsState>("options.resourcepack"), CreateLinkButton <SoundOptionsState>("options.sounds"));
            AddGuiRow(CreateLinkButton <LanguageOptionsState>("options.language"), CreateLinkButton <ControlOptionsState>("options.controls"));
        }
 public MultiplayerAddEditServerState(SavedServerEntry entry, Action <SavedServerEntry> callbackAction,
                                      GuiPanoramaSkyBox skyBox) : this(entry.ServerType, entry.Name, entry.Host + ":" + entry.Port,
                                                                       callbackAction, skyBox)
 {
     if (entry != null)
     {
         _entry = entry;
     }
 }
示例#3
0
        /// <inheritdoc />
        public override async Task Authenticate(GuiPanoramaSkyBox skyBox, PlayerProfile existingProfile, Action <bool> callBack)
        {
            BedrockLoginState loginState = new BedrockLoginState(
                skyBox, (profile) =>
            {
                callBack(true);
            }, XboxAuthService);

            Alex.GameStateManager.SetActiveState(loginState, true);
        }
示例#4
0
        protected BaseLoginState(string title, GuiPanoramaSkyBox skyBox)
        {
            Title = title;

            _backgroundSkyBox = skyBox;
            Background        = new GuiTexture2D(_backgroundSkyBox, TextureRepeatMode.Stretch);
            BackgroundOverlay = Color.Transparent;

            Initialize();
        }
        public MultiplayerServerSelectionState(GuiPanoramaSkyBox skyBox) : base()
        {
            _skyBox = skyBox;
            CancellationTokenSource = new CancellationTokenSource();

            _listProvider = GetService <IListStorageProvider <SavedServerEntry> >();

            Title = "Multiplayer";
            TitleTranslationKey = "multiplayer.title";

            Footer.AddRow(row =>
            {
                row.AddChild(JoinServerButton = new GuiButton("Join Server",
                                                              OnJoinServerButtonPressed)
                {
                    TranslationKey = "selectServer.select",
                    Enabled        = false
                });
                row.AddChild(DirectConnectButton = new GuiButton("Direct Connect",
                                                                 () => Alex.GameStateManager.SetActiveState <MultiplayerConnectState>())
                {
                    TranslationKey = "selectServer.direct",
                    Enabled        = false
                });
                row.AddChild(AddServerButton = new GuiButton("Add Server",
                                                             OnAddItemButtonPressed)
                {
                    TranslationKey = "selectServer.add"
                });
            });
            Footer.AddRow(row =>
            {
                row.AddChild(EditServerButton = new GuiButton("Edit", OnEditItemButtonPressed)
                {
                    TranslationKey = "selectServer.edit",
                    Enabled        = false
                });
                row.AddChild(DeleteServerButton = new GuiButton("Delete", OnDeleteItemButtonPressed)
                {
                    TranslationKey = "selectServer.delete",
                    Enabled        = false
                });
                row.AddChild(new GuiButton("Refresh", OnRefreshButtonPressed)
                {
                    TranslationKey = "selectServer.refresh"
                });
                row.AddChild(new GuiBackButton()
                {
                    TranslationKey = "gui.cancel"
                });
            });

            Background = new GuiTexture2D(_skyBox, TextureRepeatMode.Stretch);
        }
示例#6
0
 public NetworkOptionsState(GuiPanoramaSkyBox skyBox) : base(skyBox)
 {
     Title = "Networking";
     Header.AddChild(new GuiTextElement()
     {
         Anchor    = Alignment.BottomCenter,
         Text      = "WARNING: These settings might break your game!",
         TextColor = TextColor.Yellow
     });
     // TitleTranslationKey = "options.videoTitle";
 }
示例#7
0
        public ProfileSelectionState(GuiPanoramaSkyBox skyBox, Alex alex)
        {
            Alex           = alex;
            _skyBox        = skyBox;
            ProfileService = GetService <IPlayerProfileService>();

            Title = "Select Profile";

            Background = new GuiTexture2D(_skyBox, TextureRepeatMode.Stretch);

            base.ListContainer.ChildAnchor = Alignment.MiddleCenter;
            base.ListContainer.Orientation = Orientation.Horizontal;

            Footer.AddRow(row =>
            {
                row.AddChild(_addBtn = new GuiButton("Add", AddClicked)
                {
                });
                row.AddChild(_editBtn = new GuiButton("Edit", EditClicked)
                {
                    Enabled = false
                });
                row.AddChild(_deleteBtn = new GuiButton("Delete", DeleteClicked)
                {
                    Enabled = false
                });
            });

            Footer.AddRow(row =>
            {
                //   row.ChildAnchor = Alignment.CenterX;
                row.AddChild(_selectBtn = new GuiButton("Select Profile", OnProfileSelect)
                {
                    Enabled = false
                });

                row.AddChild(_cancelBtn = new GuiButton("Cancel", OnCancelButtonPressed)
                {
                });
            });

            if (_defaultSkin == null)
            {
                Alex.Instance.Resources.ResourcePack.TryGetBitmap("entity/alex", out var rawTexture);
                _defaultSkin = new Skin()
                {
                    Slim    = true,
                    Texture = TextureUtils.BitmapToTexture2D(Alex.Instance.GraphicsDevice, rawTexture)
                };
            }

            Reload();
        }
示例#8
0
        public BEDeviceCodeLoginState(GuiPanoramaSkyBox skyBox, Action <PlayerProfile> readyAction)
        {
            Title = "Bedrock Login";
            AuthenticationService = GetService <XBLMSAService>();
            _backgroundSkyBox     = skyBox;
            Background            = new GuiTexture2D(_backgroundSkyBox, TextureRepeatMode.Stretch);
            BackgroundOverlay     = Color.Transparent;
            Ready = readyAction;

            ConnectResponse = AuthenticationService.StartDeviceAuthConnect().Result;

            Initialize();
        }
示例#9
0
        public OptionsStateBase(GuiPanoramaSkyBox skyBox)
        {
            _skyBox          = skyBox;
            _optionsProvider = GetService <IOptionsProvider>();

            Footer.AddChild(new GuiBackButton()
            {
                TranslationKey = "gui.done",
                Anchor         = Alignment.TopFill,
                Modern         = false
            });

            Background = new GuiTexture2D(_skyBox, TextureRepeatMode.Stretch);
        }
示例#10
0
        public SoundOptionsState(GuiPanoramaSkyBox skyBox) : base(skyBox)
        {
            TitleTranslationKey = "options.sounds.title";

            var masterSlider = CreateSlider(v => $"{GuiRenderer.GetTranslation("soundCategory.master")}: {((int)(v * 100)).ToString(CultureInfo.InvariantCulture)}", options => options.SoundOptions.GlobalVolume, 0, 1D,
                                            0.01D);

            var musicSlider  = CreateSlider(v => $"{GuiRenderer.GetTranslation("soundCategory.music")}: {((int)(v * 100)).ToString(CultureInfo.InvariantCulture)}", options => options.SoundOptions.MusicVolume, 0, 1D, 0.01);
            var effectSlider = CreateSlider(v => $"{GuiRenderer.GetTranslation("soundCategory.ambient")}: {((int)(v * 100)).ToString(CultureInfo.InvariantCulture)}", options => options.SoundOptions.SoundEffectsVolume, 0, 1D,
                                            0.01);

            AddGuiRow(masterSlider);
            AddGuiRow(musicSlider, effectSlider);
        }
示例#11
0
        /// <inheritdoc />
        public override Task Authenticate(GuiPanoramaSkyBox skyBox, PlayerProfile activeProfile, Action <bool> callBack)
        {
            JavaLoginState loginState = new JavaLoginState(
                skyBox,
                () =>
            {
                callBack(true);
            }, activeProfile);


            Alex.GameStateManager.SetActiveState(loginState, true);

            return(Task.CompletedTask);
        }
示例#12
0
        public BedrockLoginState(GuiPanoramaSkyBox skyBox, Action <PlayerProfile> readyAction, XboxAuthService xboxAuthService)
        {
            Title = "Bedrock Login";
            AuthenticationService = xboxAuthService;
            _backgroundSkyBox     = skyBox;
            Background            = new GuiTexture2D(_backgroundSkyBox, TextureRepeatMode.Stretch);
            BackgroundOverlay     = Color.Transparent;
            Ready = readyAction;

            CanUseClipboard = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

            ConnectResponse = AuthenticationService.StartDeviceAuthConnect().Result;

            Initialize();
        }
示例#13
0
        public VideoOptionsState(GuiPanoramaSkyBox skyBox) : base(skyBox)
        {
            TitleTranslationKey = "options.videoTitle";

            AddGuiRow(CreateSlider("Render Distance: {0} chunks", o => Options.VideoOptions.RenderDistance, 2, 32, 1),
                      GuiScaleGlider = CreateSlider("GUI Scale: {0}", options => options.VideoOptions.GuiScale, 0, 3, 1));

            AddGuiRow(CreateSlider("Chunk Processing Threads: {0}", o => Options.VideoOptions.ChunkThreads, 1, Environment.ProcessorCount, 1),
                      CreateSlider("Brightness: {0}%", o => Options.VideoOptions.Brightness, 0,
                                   100, 1) /*,
                                            * CreateSlider("Max Framerate: {0} fps", o => Options.VideoOptions.MaxFramerate, 1, 120, 1)*/);

            AddGuiRow(CreateToggle("Use VSync: {0}", o => { return(Options.VideoOptions.UseVsync); }),
                      CreateToggle("Fullscreen: {0}", o => { return(Options.VideoOptions.Fullscreen); }));
        }
示例#14
0
        public ResourcePackOptionsState(GuiPanoramaSkyBox skyBox) : base(skyBox)
        {
            TitleTranslationKey = "resourcePack.title";

            Body.BackgroundOverlay = new Color(Color.Black, 0.35f);
            Body.ChildAnchor       = Alignment.FillCenter;

            AddGuiElement(ListContainer = new GuiSelectionList()
            {
                Anchor      = Alignment.Fill,
                ChildAnchor = Alignment.TopFill,
            });
            ListContainer.SelectedItemChanged += HandleSelectedItemChanged;

            var footerChildren = Footer.ChildElements.ToArray();

            foreach (var child in footerChildren)
            {
                Footer.RemoveChild(child);
            }

            Footer.AddRow(row =>
            {
                row.AddChild(_loadBtn = new GuiButton(LoadBtnClicked)
                {
                    Text    = "Load Resource pack",
                    Modern  = false,
                    Enabled = false
                });

                row.AddChild(new GuiButton(BackButtonPressed)
                {
                    TranslationKey = "gui.done",
                    Modern         = false
                });
            });

            Footer.AddRow(row =>
            {
                row.ChildAnchor = Alignment.BottomCenter;
                row.AddChild(new GuiButton("resourcePack.openFolder", OpenResourcePackFolderClicked, true)
                {
                    Modern = false
                });
            });

            Reload();
        }
示例#15
0
        public VersionSelectionState(GuiPanoramaSkyBox skyBox, Action onJavaConfirmed, Action <PlayerProfile> onBedrockConfirmed)
        {
            _skyBox          = skyBox;
            JavaConfirmed    = onJavaConfirmed;
            BedrockConfirmed = onBedrockConfirmed;

            Background = new GuiTexture2D(_skyBox, TextureRepeatMode.Stretch);

            _mainMenu = new GuiStackMenu()
            {
                Margin = new Thickness(15, 0, 15, 0),
                Width  = 125,
                Anchor = Alignment.MiddleCenter,

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

            _mainMenu.AddMenuItem($"Java - Version {JavaProtocol.FriendlyName}", JavaEditionButtonPressed);
            _mainMenu.AddMenuItem($"Bedrock - Version {McpeProtocolInfo.GameVersion}", BedrockEditionButtonPressed);

            _mainMenu.AddSpacer();

            _mainMenu.AddMenuItem($"Go Back", SinglePlayerButtonPressed);

            AddChild(_mainMenu);

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

            AddChild(_textElement = new GuiTextElement()
            {
                TextColor = TextColor.Yellow,

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

                Text  = "Select the edition you want to play on...",
                Scale = 1f
            });
        }
示例#16
0
        public BedrockLoginState(GuiPanoramaSkyBox skyBox, Action <PlayerProfile> readyAction, XboxAuthService xboxAuthService)
        {
            Title = "Bedrock Login";
            AuthenticationService = xboxAuthService;
            _backgroundSkyBox     = skyBox;
            Background            = new GuiTexture2D(_backgroundSkyBox, TextureRepeatMode.Stretch);
            BackgroundOverlay     = Color.Transparent;
            Ready = readyAction;

            _authCodeElement = new GuiTextElement()
            {
                TextColor = TextColor.Cyan,
                Text      = "Please wait...\nStarting authentication process...",
                FontStyle = FontStyle.Italic,
                Scale     = 1.1f
            };

            CanUseClipboard = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

            Initialize();
        }
示例#17
0
        public SkinSelectionState(GuiPanoramaSkyBox skyBox, Alex alex)
        {
            Alex    = alex;
            _skyBox = skyBox;
            Storage = GetService <IStorageSystem>();

            Title = "Select Skin";

            Background = new GuiTexture2D(_skyBox, TextureRepeatMode.Stretch);

            base.ListContainer.ChildAnchor = Alignment.MiddleCenter;
            base.ListContainer.Orientation = Orientation.Horizontal;

            Footer.AddRow(row =>
            {
                //   row.ChildAnchor = Alignment.CenterX;
                row.AddChild(_selectBtn = new GuiButton("Select Skin", OnSkinSelect)
                {
                    Enabled = false
                });

                row.AddChild(_cancelBtn = new GuiButton("Cancel", OnCancelButtonPressed)
                {
                });
            });

            Footer.AddRow(row =>
            {
                row.ChildAnchor = Alignment.BottomCenter;
                row.AddChild(new GuiButton("Open SkinPack folder", OpenSkinPackFOlder, false)
                {
                    Modern = true
                });
            });

            Reload();
        }
示例#18
0
        public TitleState()
        {
            FpsMonitor        = new FpsMonitor();
            _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("Multiplayer", JavaEditionButtonPressed, EnableMultiplayer);
            _mainMenu.AddMenuItem("SinglePlayer", OnSinglePlayerPressed);

            _mainMenu.AddMenuItem("Options", () => { Alex.GameStateManager.SetActiveState("options"); });
            _mainMenu.AddMenuItem("Exit", () => { Alex.Exit(); });
            #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("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(_logo = 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?!",
            });

            _debugInfo = new GuiDebugInfo();
            _debugInfo.AddDebugRight(() => $"GPU Memory: {API.Extensions.GetBytesReadable(GpuResourceManager.GetMemoryUsage)}");
            _debugInfo.AddDebugLeft(() => $"FPS: {FpsMonitor.Value:F0}");

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

            Alex.GameStateManager.AddState("options", new OptionsState(_backgroundSkyBox));
        }
示例#19
0
 public ControlOptionsState(GuiPanoramaSkyBox skyBox) : base(skyBox)
 {
     TitleTranslationKey = "controls.title";
 }
示例#20
0
 public VideoOptionsState(GuiPanoramaSkyBox skyBox) : base(skyBox)
 {
     TitleTranslationKey = "options.videoTitle";
 }
示例#21
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;
        }
示例#22
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");*/
        }
 public MultiplayerAddEditServerState(Action <AddOrEditCallback> callbackAction, GuiPanoramaSkyBox skyBox) :
     this("java", null, null, callbackAction, skyBox)
 {
 }
 public MultiplayerAddEditServerState(Action <SavedServerEntry> callbackAction, GuiPanoramaSkyBox skyBox) :
     this(ServerType.Bedrock, null, null, callbackAction, skyBox)
 {
 }
示例#25
0
 public SoundOptionsState(GuiPanoramaSkyBox skyBox) : base(skyBox)
 {
     TitleTranslationKey = "options.sounds.title";
 }
        public MultiplayerAddEditServerState(ServerType serverType, string name, string address,
                                             Action <SavedServerEntry> callbackAction,
                                             GuiPanoramaSkyBox skyBox) :
            base(callbackAction)
        {
            _savedServersStorage = GetService <IListStorageProvider <SavedServerEntry> >();
            _skyBox = skyBox;

            Title = "Add Server";
            TitleTranslationKey = "addServer.title";

            base.HeaderTitle.Anchor    = Alignment.MiddleCenter;
            base.HeaderTitle.FontStyle = FontStyle.Bold | FontStyle.DropShadow;
            Body.BackgroundOverlay     = new Color(Color.Black, 0.5f);

            Body.ChildAnchor = Alignment.MiddleCenter;

            var usernameRow = AddGuiRow(new GuiTextElement()
            {
                Text           = "Server Name:",
                TranslationKey = "addServer.enterName",
                Margin         = new Thickness(0, 0, 5, 0)
            }, _nameInput = new GuiTextInput()
            {
                TabIndex = 1,

                Width = 200,

                PlaceHolder = "Name of the server",
                Margin      = new Thickness(23, 5, 5, 5),
            });

            usernameRow.ChildAnchor = Alignment.MiddleCenter;
            usernameRow.Orientation = Orientation.Horizontal;

            var hostnameRow = AddGuiRow(new GuiTextElement()
            {
                Text           = "Server Address:",
                TranslationKey = "addServer.enterIp",
                Margin         = new Thickness(0, 0, 5, 0)
            }, _hostnameInput = new GuiTextInput()
            {
                TabIndex = 2,

                Width = 200,

                PlaceHolder = "Hostname or IP",
                Margin      = new Thickness(5),
            });

            hostnameRow.ChildAnchor = Alignment.MiddleCenter;
            hostnameRow.Orientation = Orientation.Horizontal;

            var typeLabelRow = AddGuiRow(_serverTypeLabel = new GuiTextElement()
            {
                Text   = "Server Type:",
                Margin = new Thickness(0, 0, 5, 0)
            });

            typeLabelRow.ChildAnchor = Alignment.MiddleCenter;
            typeLabelRow.Orientation = Orientation.Horizontal;

            AddGuiRow(_serverTypeGroup = new GuiButtonGroup()
            {
                Orientation = Orientation.Horizontal,
                ChildAnchor = Alignment.MiddleCenter
            });
            _serverTypeGroup.AddChild(_javaEditionButton = new GuiToggleButton("Java")
            {
                Margin  = new Thickness(5),
                Modern  = true,
                Width   = 50,
                Checked = serverType == ServerType.Java,
                CheckedOutlineThickness = new Thickness(1),
                DisplayFormat           = new ValueFormatter <bool>((val) => $"Java {(val ? "[Active]" : "")}"),
                TabIndex = 3
            });
            _serverTypeGroup.AddChild(_bedrockEditionButton = new GuiToggleButton("Bedrock")
            {
                Margin  = new Thickness(5),
                Modern  = true,
                Width   = 50,
                Checked = serverType == ServerType.Bedrock,
                CheckedOutlineThickness = new Thickness(1),
                DisplayFormat           = new ValueFormatter <bool>((val) => $"Bedrock {(val ? "[Active]" : "")}"),
                TabIndex = 4
            });

            //	var portRow = AddGuiRow();
            //  portRow.ChildAnchor = Alignment.MiddleCenter;

            var buttonRow = AddGuiRow(_saveButton = new GuiButton(OnSaveButtonPressed)
            {
                AccessKey = Keys.Enter,

                TranslationKey = "addServer.add",
                Margin         = new Thickness(5),
                Modern         = false,
                Width          = 100,
                TabIndex       = 5
            }, new GuiButton(OnCancelButtonPressed)
            {
                AccessKey = Keys.Escape,

                TranslationKey = "gui.cancel",
                Margin         = new Thickness(5),
                Modern         = false,
                Width          = 100,
                TabIndex       = 6
            });

            buttonRow.ChildAnchor = Alignment.MiddleCenter;


            AddGuiElement(_errorMessage = new GuiTextElement()
            {
                TextColor = TextColor.Red
            });

            if (!string.IsNullOrWhiteSpace(name))
            {
                _nameInput.Value = name;
            }

            if (!string.IsNullOrWhiteSpace(address))
            {
                _hostnameInput.Value = address;
            }

            if (_entry != null)
            {
                //EnableButtonsFor(_entry.ServerType);
            }

            Background = new GuiTexture2D(_skyBox, TextureRepeatMode.Stretch);
        }
        public MultiplayerAddEditServerState(string serverType, string name, string address,
                                             Action <AddOrEditCallback> callbackAction,
                                             GuiPanoramaSkyBox skyBox) :
            base(callbackAction)
        {
            _serverTypeManager = GetService <ServerTypeManager>();
            _skyBox            = skyBox;

            Title = "Add Server";
            TitleTranslationKey = "addServer.title";

            base.HeaderTitle.Anchor    = Alignment.MiddleCenter;
            base.HeaderTitle.FontStyle = FontStyle.Bold | FontStyle.DropShadow;
            Body.BackgroundOverlay     = new Color(Color.Black, 0.5f);

            Body.ChildAnchor = Alignment.MiddleCenter;

            var usernameRow = AddGuiRow(new GuiTextElement()
            {
                Text           = "Server Name:",
                TranslationKey = "addServer.enterName",
                Margin         = new Thickness(0, 0, 5, 0)
            }, _nameInput = new GuiTextInput()
            {
                TabIndex = 1,

                Width = 200,

                PlaceHolder = "Name of the server",
                Margin      = new Thickness(23, 5, 5, 5),
            });

            usernameRow.ChildAnchor = Alignment.MiddleCenter;
            usernameRow.Orientation = Orientation.Horizontal;

            var hostnameRow = AddGuiRow(new GuiTextElement()
            {
                Text           = "Server Address:",
                TranslationKey = "addServer.enterIp",
                Margin         = new Thickness(0, 0, 5, 0)
            }, _hostnameInput = new GuiTextInput()
            {
                TabIndex = 2,

                Width = 200,

                PlaceHolder = "Hostname or IP",
                Margin      = new Thickness(5),
            });

            hostnameRow.ChildAnchor = Alignment.MiddleCenter;
            hostnameRow.Orientation = Orientation.Horizontal;

            var typeLabelRow = AddGuiRow(_serverTypeLabel = new GuiTextElement()
            {
                Text   = "Server Type:",
                Margin = new Thickness(0, 0, 5, 0)
            });

            typeLabelRow.ChildAnchor = Alignment.MiddleCenter;
            typeLabelRow.Orientation = Orientation.Horizontal;

            AddGuiRow(_serverTypeGroup = new GuiButtonGroup()
            {
                Orientation = Orientation.Horizontal,
                ChildAnchor = Alignment.MiddleCenter
            });

            int tabIndex = 3;

            foreach (var type in _serverTypeManager.GetAll())
            {
                if (_selectedImplementation == null)
                {
                    _selectedImplementation = type;
                }

                GuiToggleButton element;
                _serverTypeGroup.AddChild(
                    element = new GuiToggleButton(type.DisplayName)
                {
                    Margin  = new Thickness(5),
                    Modern  = true,
                    Width   = 50,
                    Checked = serverType == type.Id,
                    CheckedOutlineThickness = new Thickness(1),
                    DisplayFormat           = new ValueFormatter <bool>((val) => $"{type.DisplayName} {(val ? "[Active]" : "")}"),
                    TabIndex = tabIndex++
                });

                element.ValueChanged += (sender, value) =>
                {
                    if (value)
                    {
                        _selectedImplementation = type;
                    }
                };
            }

            var buttonRow = AddGuiRow(_saveButton = new GuiButton(OnSaveButtonPressed)
            {
                AccessKey = Keys.Enter,

                TranslationKey = "addServer.add",
                Margin         = new Thickness(5),
                Modern         = false,
                Width          = 100,
                TabIndex       = 5
            }, new GuiButton(OnCancelButtonPressed)
            {
                AccessKey = Keys.Escape,

                TranslationKey = "gui.cancel",
                Margin         = new Thickness(5),
                Modern         = false,
                Width          = 100,
                TabIndex       = 6
            });

            buttonRow.ChildAnchor = Alignment.MiddleCenter;


            AddGuiElement(_errorMessage = new GuiTextElement()
            {
                TextColor = TextColor.Red
            });

            if (!string.IsNullOrWhiteSpace(name))
            {
                _nameInput.Value = name;
            }

            if (!string.IsNullOrWhiteSpace(address))
            {
                _hostnameInput.Value = address;
            }

            if (_entry != null)
            {
                //EnableButtonsFor(_entry.ServerType);
            }

            Background = new GuiTexture2D(_skyBox, TextureRepeatMode.Stretch);
        }
示例#28
0
 public JavaLoginState(GuiPanoramaSkyBox skyBox, Action loginSuccesAction, PlayerProfile activeProfile = null) : base("Minecraft Login", skyBox)
 {
     _loginSuccesAction = loginSuccesAction;
     _activeProfile     = activeProfile;
 }
示例#29
0
 public virtual Task Authenticate(GuiPanoramaSkyBox skyBox, PlayerProfile profile, Action <bool> callBack)
 {
     return(Task.CompletedTask);
 }
示例#30
0
 public LanguageOptionsState(GuiPanoramaSkyBox skyBox) : base(skyBox)
 {
     TitleTranslationKey = "options.language";
 }