private static void CreateMain() { WObject mainPanel = MainMenuPanel = new WObject("Main UI Panel") { Parent = MenuWobject }; Image mainPanelImg = mainPanel.AddModule <Image>(); mainPanelImg.Color = new Color256(1.0, 0.0, 1.0, 0.0); mainPanelImg.MinAnchor = new Vector2F(0.225F, 0.10F); mainPanelImg.MaxAnchor = new Vector2F(0.775F, 0.95F); mainPanelImg.MinSize = new Vector3F(400.0F, 400.0F, Single.PositiveInfinity); mainPanelImg.MaxSize = new Vector3F(800.0F, 800.0F, Single.PositiveInfinity); mainPanelImg.KeepRatio = true; WObject logo = new WObject("Game Text Logo") { Parent = mainPanel }; Image logoImage = logo.AddModule <Image>(); logoImage.Picture = new Texture("assets/textures/logo.png"); logoImage.MinAnchor = new Vector2F(0.0F, 0.8F); logoImage.MaxAnchor = new Vector2F(1.0F, 1.0F); logoImage.KeepRatio = true; Label lbTip = mainPanel.AddModule <Label>(); lbTip.ParentGUI = logoImage; lbTip.Text = "Minecraft"; lbTip.Color = new Color256(1.0, 1.0, 0.0, 1.0); lbTip.Aligns = TextAligns.Middle; lbTip.AutoSize = true; lbTip.MinAnchor = new Vector2F(0.7F, 0.0F); lbTip.MaxAnchor = new Vector2F(1.1F, 0.4F); lbTip.Rotation = -20.0D; MenuTip tip = MenuWobject.AddModule <MenuTip>(); tip.ReferenceLabel = lbTip; lbTip.Text = tip.SelectRandom(); WObject btnPanel = new WObject("Main UI Button Panel") { Parent = mainPanel }; Image btnPanelImg = btnPanel.AddModule <Image>(); btnPanelImg.Color = new Color256(1.0, 0.0, 1.0, 0.0); btnPanelImg.MinAnchor = new Vector2F(0.075F, 0.0F); btnPanelImg.MaxAnchor = new Vector2F(0.925F, 0.6F); WObject single = new WObject("Singleplayer Button") { Parent = btnPanel }; GUI.LargeButton btnSingle = single.AddModule <GUI.LargeButton>(); btnSingle.Button.MinAnchor = new Vector2F(0.0F, 0.9F); btnSingle.Button.MaxAnchor = new Vector2F(1.0F, 1.0F); btnSingle.Label.Localization = "#winecrash:ui.mainmenu.singleplayer"; btnSingle.Button.Locked = false; //btnSingle.Button.OnClick += () => { Graphics.Window.InvokeUpdate(() => Program.RunGameDebug()); }; btnSingle.Button.OnClick += () => { Game.InvokePartyJoined(PartyType.Singleplayer); Task.Run(() => { //Parallel.ForEach() //IntegratedServer server = IntegratedServer.CurrentIntegratedServer = new IntegratedServer(new Player("Arthur")); //server.Run(); }); }; WObject mult = new WObject("Multiplayer Button") { Parent = btnPanel }; GUI.LargeButton btnMult = mult.AddModule <GUI.LargeButton>(); btnMult.Button.MinAnchor = new Vector2F(0.0F, 0.7F); btnMult.Button.MaxAnchor = new Vector2F(1.0F, 0.8F); btnMult.Label.Localization = "#winecrash:ui.mainmenu.multiplayer"; btnMult.Button.Locked = true; btnMult.Button.OnClick += () => { ShowMulti(); }; WObject mods = new WObject("Mods Button") { Parent = btnPanel }; GUI.LargeButton btnMods = mods.AddModule <GUI.LargeButton>(); btnMods.Button.MinAnchor = new Vector2F(0.0F, 0.5F); btnMods.Button.MaxAnchor = new Vector2F(1.0F, 0.6F); btnMods.Label.Localization = "#winecrash:ui.mainmenu.addons"; btnMods.Button.Locked = true; WObject options = new WObject("Options Button") { Parent = btnPanel }; GUI.SmallButton btnOptions = options.AddModule <GUI.SmallButton>(); btnOptions.Button.MinAnchor = new Vector2F(0.0F, 0.2F); btnOptions.Button.MaxAnchor = new Vector2F(0.45F, 0.3F); btnOptions.Label.Localization = "#winecrash:ui.mainmenu.settings"; btnOptions.Button.OnClick += () => ShowOptions(); btnOptions.Button.Locked = false; WObject quit = new WObject("Quit Button") { Parent = btnPanel }; GUI.SmallButton btnQuit = quit.AddModule <GUI.SmallButton>(); btnQuit.Button.MinAnchor = new Vector2F(0.55F, 0.2F); btnQuit.Button.MaxAnchor = new Vector2F(1.0F, 0.3F); btnQuit.Label.Localization = "#winecrash:ui.mainmenu.quit"; btnQuit.Button.OnClick += () => Engine.Stop(); }
public static void CreateDisconnection() { WObject mainPanel = MultiDisconnectionPanel = new WObject("Multi Disconnect UI Panel") { Parent = MenuWobject }; Image mainPanelImg = mainPanel.AddModule <Image>(); mainPanelImg.Color = new Color256(1.0, 0.0, 1.0, 0.0); mainPanelImg.MinAnchor = new Vector2F(0.225F, 0.10F); mainPanelImg.MaxAnchor = new Vector2F(0.775F, 0.95F); mainPanelImg.MinSize = new Vector3F(400.0F, 400.0F, Single.PositiveInfinity); mainPanelImg.MaxSize = new Vector3F(800.0F, 800.0F, Single.PositiveInfinity); mainPanelImg.KeepRatio = true; WObject btnPanel = new WObject("Main UI Button Panel") { Parent = mainPanel }; Image btnPanelImg = btnPanel.AddModule <Image>(); btnPanelImg.Color = new Color256(1.0, 0.0, 1.0, 0.0); btnPanelImg.MinAnchor = new Vector2F(0.075F, 0.0F); btnPanelImg.MaxAnchor = new Vector2F(0.925F, 0.6F); WObject multiTitle = new WObject("Multi Main Label") { Parent = btnPanel }; LocalizedLabel mainLb = multiTitle.AddModule <LocalizedLabel>(); mainLb.Localization = "#winecrash:ui.multiplayer.disconnected"; mainLb.MinAnchor = new Vector2F(0.0F, 1.0F); mainLb.MaxAnchor = new Vector2F(1.0F, 1.1F); mainLb.AutoSize = true; mainLb.Aligns = TextAligns.Middle; WObject error = new WObject("Multi Disconnected Label") { Parent = btnPanel }; LocalizedLabel reaLb = MultiDisconnectionReason = error.AddModule <LocalizedLabel>(); reaLb.Localization = "#server_disconnection_unspecified"; reaLb.MinAnchor = new Vector2F(0.0F, 0.82F); reaLb.MaxAnchor = new Vector2F(1.0F, 0.88F); reaLb.AutoSize = true; reaLb.Aligns = TextAligns.Up | TextAligns.Vertical; WObject back = new WObject("Multi Back") { Parent = btnPanel }; GUI.LargeButton btnBack = back.AddModule <GUI.LargeButton>(); btnBack.Button.MinAnchor = new Vector2F(0.0F, 0.6F); btnBack.Button.MaxAnchor = new Vector2F(1.0F, 0.7F); btnBack.Label.Localization = "#winecrash:ui.back"; btnBack.Button.OnClick += () => { HideDisconnection(); ShowMain(); }; }