//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; }
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 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)); }