public override void Body() { RootUI.Background(Color.Transparent); RootUI.Hstack(h1 => { h1.Spacer(); h1.Vstack(v1 => { v1.Spacer(); v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Text(displayText); }) .Height(0.7f) .Width(0.7f) .Center(); }) .Grow(3); v1.Spacer(3); }) .Grow(3); h1.Spacer(); }) .Background(new Color(0, 0, 0, 100)); }
Application() : base(VideoMode.DesktopMode, nameof(EchoRenderer), Styles.Default, new ContextSettings(0, 0) { SRgbCapable = true }) { Closed += (_, _) => Close(); stopwatch = Stopwatch.StartNew(); root = new RootUI(this); root.Add ( new AreaUI { transform = { BottomMargin = Theme.Current.LayoutHeight } }.Add(new HierarchyUI()) .Add(new SceneViewUI()) .Add(new InspectorUI()) .Add(new ProfileUI()) ); root.Add ( new AutoLayoutAreaUI { transform = { TopMargin = -Theme.Current.LayoutHeight, TopPercent = 1f }, Horizontal = true, Margins = false }.Add(new ApplicationStatusUI()) .Add(new ExitButtonUI()) ); }
public override void Body() { RootUI.Hstack(h1 => { h1.Spacer(); h1.Vstack(v1 => { v1.Spacer(); v1.Spacer(); v1.Spacer(); v1.TextFor(this, x => x.LoadStatus) .Color(Color.White) .Grow(2); v1.Spacer(); v1.Button("Cancel", clickAction: (e, a) => { SceneManager.StartScene(nameof(MainMenuScene)); }); v1.Spacer(); v1.Spacer(); }) .Grow(2); h1.Spacer(); }).Background(new Color(43, 45, 47)); }
public override void Body() { RootUI.Background(Color.Transparent); RootUI.Hstack(h1 => { h1.Spacer(); h1.Vstack(v2 => { for (int i = 3; i >= 0; i--) { if (i == 0) { v2.Spacer(2); } int i2 = i; v2.Hstack(h2 => { for (int j = 0; j < 7; j++) { int i1 = i2; int j1 = j; h2.InventorySlot(Inventory, (byte)(i1 * 7 + j1), clickAction: (e, slotId) => { ParentScene.Client.Emit("/inventory/select", new InventoryActionMessage { LeftClick = e.Mouse.LeftButton == ButtonState.Pressed, RightClick = e.Mouse.RightButton == ButtonState.Pressed, SlotId = slotId }); e.StopPropagation(); }, enterAction: (e, slotId) => { if (e.Mouse.RightButton == ButtonState.Pressed) { ParentScene.Client.Emit("/inventory/select", new InventoryActionMessage { LeftClick = e.Mouse.LeftButton == ButtonState.Pressed, RightClick = e.Mouse.RightButton == ButtonState.Pressed, SlotId = slotId }); } }); } }) .Grow(10); } }) .AspectRatio(1.78f) .Center() .Grow(4); h1.Spacer(); }) .Background(new Color(0, 0, 0, 0.4f)); }
public override void Body() { RootUI.Hstack(h1 => { h1.Spacer(); h1.Vstack(v1 => { v1.Spacer(); v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Text("Help") .Color(Color.White) .FontSize(2f); }) .Height(0.7f) .Width(0.7f) .Center(); }) .Grow(3); v1.ScrollableContainer(s1 => { s1.Text( "This is where we can explain how to play or other useful stuff that is similar. The text will scale to fit and we could also load the description from a json file or another source"); }).Grow(3); v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Button("Back", clickAction: (e, a) => { UIManager.StartLayer(nameof(MainMenuUI), ParentScene); }) .Height(0.8f) .Width(0.8f) .Center(); }); }); v1.Spacer(); }) .Grow(3); h1.Spacer(); }) .AspectRatio(1.78f) .Center(); }
/// <summary> /// 是否全部UI已关闭 /// </summary> /// <returns><c>true</c>, if is active was user interfaced, <c>false</c> otherwise.</returns> public bool IsAllUIClosed() { for (int _i = 0; _i < RootUI.childCount; _i++) { if (RootUI.GetChild(_i).gameObject.activeSelf) { return(false); } } return(true); }
public override void Body() { RootUI.Background(Color.Transparent); RootUI.Hstack(h1 => { h1.Spacer(); h1.Vstack(v1 => { v1.Spacer(); v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Text("Menu"); }) .Height(0.7f) .Width(0.7f) .Center(); }) .Grow(3); v1.Hstack(h2 => { h2.Button("Main Menu", clickAction: (e, a) => { SceneManager.StartScene(nameof(MainMenuScene)); }) .Height(0.8f) .Width(0.8f) .Center(); }); v1.Hstack(h2 => { h2.Button("Back to Game", clickAction: (e, a) => { UIManager.StartLayer(nameof(HudUI), ParentScene); }) .Height(0.8f) .Width(0.8f) .Center(); }); v1.Spacer(3); }) .Grow(3); h1.Spacer(); }) .Background(new Color(0, 0, 0, 100)); }
public override void Body() { RootUI.Hstack(h1 => { h1.Spacer(); h1.Vstack(v1 => { v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Text( "Your Transaction has been completed. The items have been added to your account. Happy Hunting!"); }) .Height(1.5f) .Width(1.75f) .Left(480); }) .Grow(10); v1.Spacer(); v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Button("Menu", clickAction: (e, a) => { UIManager.StartLayer(nameof(MainMenuUI), ParentScene); }) .Height(0.8f) .Width(0.6f) .Center(); }); }); v1.Spacer(); }) .Grow(3); h1.Spacer(); }) .AspectRatio(1.78f) .Center(); }
public override void Body() { RootUI.Background(Color.Transparent); RootUI.Vstack(v1 => { v1.ScrollableContainer(s1 => { }).Grow(12); v1.TextBoxFor(Model, x => x.TextBoxText) .Background(new Color(0, 0, 0, 0.5f)) .Color(Color.White); }) .Width(0.4f) .Height(0.7f) .Bottom(0) .Right(0); }
public override void Body() { RootUI.Background(Color.Transparent); RootUI.Zstack(z1 => { z1.Vstack(h2 => { //Health Bar h2.HudMeter(ClientData, x => x.Client.Meta); //Mana Bar h2.HudMeter(ClientData, x => x.Client.Meta, true); }) .Position(Position.Absolute) .Width(0.3f) .Height(0.1f) .Right(0) .Top(0); //Hotbar z1.Hstack(h2 => { for (byte i = 0; i < 7; i++) { h2.InventorySlot(ClientData.Inventory, i, hotBarMode: true, clickAction: (e, slotId) => { if (e.Mouse.LeftButton == ButtonState.Pressed) { ClientData.Inventory.ActiveSlot = slotId; } }); } }) .Position(Position.Absolute) .Height(0.1f) .Width(0.4f) .Bottom(0); }); }
public override void Body() { RootUI.Hstack(h1 => { h1.Spacer(); h1.Vstack(v1 => { v1.Spacer(); //Game title v1.Hstack(h2 => { h2.Text("Boss Fight Battlegrounds") .Color(Color.White) .FontSize(1.5f); }) .Grow(2); //Username v1.Hstack(h2 => { h2.Spacer(); h2.Text("Username or email:") .Color(Color.White) .JustifyText(JustifyText.Start) .Grow(9); }); //Username text box v1.Hstack(h2 => { h2.TextBoxFor(this, x => x.Username) .Width(0.8f) .Height(0.8f) .Center() .Background(Color.White) .Color(Color.Black); }); //Password v1.Hstack(h2 => { h2.Spacer(); h2.Text("Password:"******"Login!", clickAction: (e, a) => { UIManager.StartLayer(nameof(MainMenuUI), ParentScene); }) .Width(0.8f) .Height(0.8f) .Center(); }); v1.Spacer(); }) .Grow(3) .Center(); h1.Spacer(); }); }
public override void Body() { Color bgColor = new Color(130, 131, 129); bool bg = false; RootUI.Vstack(v1 => { v1.Text("Edit Servers").FontSize(1.6f).Color(Color.White); v1.Spacer(); v1.Hstack(h2 => { h2.ScrollableContainer(s3 => { int counter = 0; s3.ListFor(Model, x => x.Servers, (stack4, item) => { var counter3 = counter; stack4.Hstack(h5 => { h5.Spacer(); h5.Vstack(v6 => { v6.Text(item.Name).JustifyText(JustifyText.Start); v6.Text(item.Ip).JustifyText(JustifyText.Start).FontSize(0.75f); }) .Grow(30); var counter4 = counter3; h5.Vstack(v6 => { v6.Spacer(); var counter1 = counter4; v6.Button("Favorite", clickAction: (e, a) => { int index = counter1; var existingServers = ClientSettings.GetSettings(); existingServers.ServerSettings.DirectConnect = existingServers.ServerSettings.Servers[index].Ip; ClientSettings.SaveSettings(existingServers); }) .Center() .Grow(18); v6.Spacer(); }) .Grow(8); h5.Spacer(); var counter2 = counter3; h5.Vstack(v6 => { v6.Spacer(); var counter1 = counter2; v6.Button("Delete", clickAction: (e, a) => { int index = counter1; var existingServers = ClientSettings.GetSettings(); existingServers.ServerSettings.Servers.RemoveAt(index); ClientSettings.SaveSettings(existingServers); UIManager.StartLayer(nameof(EditServerListUI), ParentScene); }) .Center() .Grow(18); v6.Spacer(); }) .Grow(6); h5.Spacer(); }) .Background(bgColor) .Height(0.23f); counter++; if (bg) { bg = false; bgColor = new Color(130, 131, 129); } else { bg = true; bgColor = new Color(169, 170, 168); } }); }); }) .Grow(15); v1.Hstack(h2 => { //Add Server h2.Vstack(v3 => { v3.Button("Add Server", clickAction: (e, a) => { UIManager.StartLayer(nameof(AddServerUI), ParentScene); }) .Height(0.8f) .Center(); }).Grow(8); h2.Spacer(); //Cancel h2.Vstack(v3 => { v3.Button("Cancel", clickAction: (e, a) => { UIManager.StartLayer(nameof(ServerMenuUI), ParentScene); }) .Height(0.8f) .Center(); }).Grow(8); }).Grow(3); //Back v1.Button("Back", clickAction: (e, a) => { UIManager.StartLayer(nameof(MainMenuUI), ParentScene); }).Grow(2); }) .Width(0.8f) .Height(0.8f) .Grow(2) .Center(); }
public override void Body() { RootUI.Hstack(h1 => { h1.Spacer(); h1.Vstack(v1 => { v1.Spacer(); //Game title v1.Hstack(h2 => { h2.Text("Boss Fight Battlegrounds") .Color(Color.White) .FontSize(1.5f); }) .Grow(2); //Play v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Button("Play", clickAction: (e, a) => { ConnectionSettings.Ip = Ip.Split(":")[0]; ConnectionSettings.Port = Convert.ToInt32(Ip.Split(":")[1]); SceneManager.StartScene(nameof(GameScene)); }); h3.TextBoxFor(this, x => x.Ip) .Background(Color.White) .Grow(3) .Color(Color.Black); }) .Width(0.8f) .Height(0.8f) .Center(); }); //Server Menu v1.Hstack(h2 => { h2.Button("Server Menu", clickAction: (e, a) => { UIManager.StartLayer(nameof(ServerMenuUI), ParentScene); }) .Width(0.8f) .Height(0.8f) .Center(); }); //Settings v1.Hstack(h2 => { h2.Button("Settings", clickAction: (e, a) => { UIManager.StartLayer(nameof(SettingsMenuUI), ParentScene); }) .Width(0.8f) .Height(0.8f) .Center(); }); //Help v1.Hstack(h2 => { h2.Button("Help", clickAction: (e, a) => { UIManager.StartLayer(nameof(HelpUI), ParentScene); }) .Width(0.8f) .Height(0.8f) .Center(); }); v1.Hstack(h2 => { h2.Button("Store", clickAction: (e, a) => { UIManager.StartLayer(nameof(StoreUI), ParentScene); }) .Width(0.8f) .Height(0.8f) .Center(); }); v1.Spacer(); }) .Grow(3) .Center(); h1.Spacer(); }); }
public void Init() { font = (Font)Resources.Load("Fonts/Zpix") as Font; GM = GameObject.FindWithTag("GameManager").GetComponent <GameManager>(); UICanvas = GM.transform.gameObject.GetComponent <Canvas>(); //属性 12个 AttrsValue = new List <Text>(); for (int _i = 0; _i < 12; _i++) { AttrsValue.Add(GameObject.FindWithTag("V" + _i).GetComponent <Text>()); } EquipUIImages = new List <Sprite> { Resources.Load <Sprite>("UI/Empty"), Resources.LoadAll <Sprite>("Textures/Item01-08")[0], Resources.LoadAll <Sprite>("Textures/Item01-08")[5], Resources.LoadAll <Sprite>("Textures/Item01-08")[1], Resources.LoadAll <Sprite>("Textures/Item01-08")[6], Resources.LoadAll <Sprite>("Textures/Item01-08")[2], Resources.LoadAll <Sprite>("Textures/Item01-08")[7], Resources.LoadAll <Sprite>("Textures/Item01-08")[3], Resources.LoadAll <Sprite>("Textures/Item01-08")[8], Resources.LoadAll <Sprite>("Textures/Item01-08")[4], Resources.LoadAll <Sprite>("Textures/Item01-08")[9], Resources.Load <Sprite>("Textures/object_040"), Resources.Load <Sprite>("Textures/object_039") }; ItemUIImages = new List <Sprite> { Resources.Load <Sprite>("Textures/object_017"), Resources.Load <Sprite>("Textures/object_043"), Resources.LoadAll <Sprite>("Textures/Item01-05")[9], Resources.LoadAll <Sprite>("Textures/Item01-03")[9], Resources.LoadAll <Sprite>("Textures/Item01-01")[4], Resources.LoadAll <Sprite>("Textures/Item01-06")[5], Resources.LoadAll <Sprite>("Textures/Item01-06")[6], Resources.LoadAll <Sprite>("Textures/Item01-05")[3], Resources.LoadAll <Sprite>("Textures/Item01-06")[8], Resources.LoadAll <Sprite>("Textures/Item01-06")[10], Resources.LoadAll <Sprite>("Textures/Item01-06")[2], Resources.Load <Sprite>("Textures/object_037"), Resources.Load <Sprite>("Textures/object_038"), Resources.LoadAll <Sprite>("Textures/Item01-06")[0], Resources.LoadAll <Sprite>("Textures/Item03-16")[0], Resources.Load <Sprite>("Textures/object_048") }; WeaponUI = GameObject.FindWithTag("EP0").transform; ArmorUI = GameObject.FindWithTag("EP1").transform; //道具16个 ItemBtns = new List <Transform>(); Transform _itemBtnsRoot = GameObject.FindWithTag("ItemBtns").transform; for (int _i = 0; _i < 16; _i++) { _itemBtnsRoot.GetChild(_i).GetComponent <Button>().onClick.AddListener(GM.DoPropEvent); ItemBtns.Add(_itemBtnsRoot.GetChild(_i)); } ShopBtn = GameObject.FindWithTag("ShopBtn").transform; ConfigBtn = GameObject.FindWithTag("ConfigBtn").transform; ShopBtn.GetComponent <Button>().onClick.AddListener(OpenMainUI); ConfigBtn.GetComponent <Button>().onClick.AddListener(OpenMainUI); RootUI = GameObject.FindWithTag("RootUI").transform; BasicUIBox = RootUI.GetChild(0); ItemUIBox = RootUI.GetChild(1); ShopUIBox = RootUI.GetChild(2); ConfigUIBox = RootUI.GetChild(3); BasicUIBox.GetComponent <Button>().onClick.AddListener(GM.CloseUIBox); ItemUIBox.GetComponent <Button>().onClick.AddListener(GM.CloseUIBox); ShopUIBox.GetComponent <Button>().onClick.AddListener(GM.CloseUIBox); ConfigUIBox.GetComponent <Button>().onClick.AddListener(GM.CloseUIBox); //有个安全框 SafeFrame MessagePart = BasicUIBox.GetChild(0).GetChild(0); SelectsPart = BasicUIBox.GetChild(0).GetChild(1); FloorText = GameObject.FindWithTag("F").GetComponent <Text>(); InitSupplies(); }
public override void Body() { RootUI.Hstack(h1 => { h1.Spacer(); h1.Vstack(v1 => { v1.Spacer(); v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Text("Store") .Color(Color.White) .FontSize(2f); }) .Height(0.7f) .Width(0.7f) .Right(0) .Center(); }) .Grow(4); v1.Hstack(h2 => { h2.Button("1 Red Gem - $0.99", clickAction: (e, a) => { UIManager.StartLayer(nameof(CreditCardUI), ParentScene); }) .Height(1.0f) .Width(0.6f) .Center() .Top(5); }).Grow(1); v1.Hstack(h2 => { h2.Button("5 Red Gems - $3.99", clickAction: (e, a) => { UIManager.StartLayer(nameof(CreditCardUI), ParentScene); }) .Height(1.0f) .Width(0.6f) .Center() .Top(5); }).Grow(1); v1.Hstack(h2 => { h2.Button("20 Red Gems - $16.99", clickAction: (e, a) => { UIManager.StartLayer(nameof(CreditCardUI), ParentScene); }) .Height(1.0f) .Width(0.6f) .Center() .Top(5); }).Grow(1); v1.Hstack(h2 => { }).Grow(2); v1.Hstack(h2 => { }).Grow(2); v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Button("Back", clickAction: (e, a) => { UIManager.StartLayer(nameof(MainMenuUI), ParentScene); }) .Height(0.8f) .Width(0.2f) .Right(0); }); }); v1.Spacer(); }) .Grow(3); h1.Spacer(); }) .AspectRatio(1.78f) .Center(); }
public override void Body() { RootUI.Vstack(v1 => { v1.Text("Add Server").FontSize(1.6f).Color(Color.White); v1.Spacer(2); v1.Vstack(v2 => { v2.Text("Server name:").JustifyText(JustifyText.Start).Color(Color.White); v2.TextBoxFor(NewServer, x => x.Name) .Background(Color.White) .Color(Color.Black); v2.Text("IP Address:").JustifyText(JustifyText.Start).Color(Color.White); v2.TextBoxFor(NewServer, x => x.Ip) .Background(Color.White) .Color(Color.Black); }).Grow(13); v1.Spacer(6); //Buttons v1.Hstack(h2 => { //Save Server h2.Vstack(v3 => { v3.Button("Save Server", clickAction: (e, a) => { if (string.IsNullOrEmpty(NewServer.Name) || string.IsNullOrEmpty(NewServer.Ip)) { return; } ClientSettings existingServers = ClientSettings.GetSettings(); existingServers.ServerSettings.Servers.Add(NewServer); ClientSettings.SaveSettings(existingServers); UIManager.StartLayer(nameof(ServerMenuUI), ParentScene); }) .Height(0.8f) .Center(); }).Grow(8); h2.Spacer(); //Cancel h2.Vstack(v3 => { v3.Button("Cancel", clickAction: (e, a) => { UIManager.StartLayer(nameof(ServerMenuUI), ParentScene); }) .Height(0.8f) .Center(); }).Grow(8); }).Grow(3); }) .Width(0.8f) .Height(0.8f) .Grow(2) .Center(); }
public override void Body() { RootUI.Vstack(v1 => { v1.Text("Sound Settings") .FontSize(1.5f) .Color(Color.White) .Grow(2); v1.Vstack(v2 => { v2.Text("Master Volume:") .Color(Color.White) .JustifyText(JustifyText.Start); v2.Hstack(h3 => { h3.SliderFor(Model, x => x.MasterVolume, 0, 100).Grow(10); h3.Hstack(h4 => { h4.CheckBoxFor(Model, x => x.MasterMute) .Center(); }); }); }).Grow(3); v1.Spacer(); v1.Vstack(v2 => { v2.Text("Music Volume:") .Color(Color.White) .JustifyText(JustifyText.Start); v2.Hstack(h3 => { h3.SliderFor(Model, x => x.MusicVolume, 0, 100).Grow(10); h3.Hstack(h4 => { h4.CheckBoxFor(Model, x => x.MusicMute) .Center(); }); }); }).Grow(3); v1.Spacer(); v1.Vstack(v2 => { v2.Text("Sound Effects Volume:") .Color(Color.White) .JustifyText(JustifyText.Start); v2.Hstack(h3 => { h3.SliderFor(Model, x => x.SoundEffectVolume, 0, 100).Grow(10); h3.Hstack(h4 => { h4.CheckBoxFor(Model, x => x.SoundEffectMute) .Center(); }); }); }).Grow(3); v1.Spacer(); v1.Hstack(h2 => { h2.Button("Back to Settings", clickAction: (e, a) => { UIManager.StartLayer(nameof(SettingsMenuUI), ParentScene); }) .Height(0.9f); h2.Button("Save Settings", clickAction: (e, a) => { //Save sound settings ClientSettings settings = ClientSettings.GetSettings(); settings.SoundSettings = Model; ClientSettings.SaveSettings(settings); }) .Height(0.9f); }).Grow(2); }) .Width(0.7f) .Height(0.8f) .Center(); }
public override void Body() { Color bgColor = new Color(130, 131, 129); bool bg = false; RootUI.Vstack(v1 => { v1.Text("Server Menu").FontSize(1.6f).Color(Color.White); v1.Spacer(); v1.Hstack(h2 => { h2.ScrollableContainer(s3 => { s3.ListFor(Model, x => x.Servers, (stack4, item) => { stack4.Hstack(h5 => { h5.Spacer(); h5.Vstack(v6 => { v6.Text(item.Name).JustifyText(JustifyText.Start); v6.Text(item.Ip).JustifyText(JustifyText.Start).FontSize(0.75f); }) .Grow(40); h5.Vstack(v6 => { v6.Spacer(); v6.Button("Join", clickAction: (e, a) => { ConnectionSettings.Ip = item.Ip.Split(":")[0]; ConnectionSettings.Port = Convert.ToInt32(item.Ip.Split(":")[1]); SceneManager.StartScene(nameof(GameScene)); }) .Center() .Grow(18); v6.Spacer(); }).Grow(5); h5.Spacer(); }) .Background(bgColor) .Height(0.23f); if (bg) { bg = false; bgColor = new Color(130, 131, 129); } else { bg = true; bgColor = new Color(169, 170, 168); } }); }); }) .Grow(15); v1.Hstack(h2 => { //Add Server h2.Vstack(v3 => { v3.Button("Add Server", clickAction: (e, a) => { UIManager.StartLayer(nameof(AddServerUI), ParentScene); }) .Height(0.8f) .Center(); }).Grow(8); h2.Spacer(); //Edit Servers h2.Vstack(v3 => { v3.Button("Edit Servers", clickAction: (e, a) => { UIManager.StartLayer(nameof(EditServerListUI), ParentScene); }) .Height(0.8f) .Center(); }).Grow(8); }).Grow(3); //Back v1.Button("Back", clickAction: (e, a) => { UIManager.StartLayer(nameof(MainMenuUI), ParentScene); }).Grow(2); }) .Width(0.8f) .Height(0.8f) .Grow(2) .Center(); }
public override void Body() { RootUI.Hstack(h1 => { h1.Spacer(); h1.Vstack(v1 => { v1.Spacer(); v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Text("Settings") .Color(Color.White) .FontSize(2f); }) .Height(0.7f) .Width(0.7f) .Center(); }) .Grow(3); v1.Hstack(h2 => { h2.Button("Controls", clickAction: (e, a) => { UIManager.StartLayer(nameof(ControlUI), ParentScene); }) .Height(0.8f) .Width(0.8f) .Center(); }); v1.Hstack(h2 => { h2.Button("Sound Options", clickAction: (e, a) => { UIManager.StartLayer(nameof(SoundSettingsUI), ParentScene); }) .Height(0.8f) .Width(0.8f) .Center(); }); v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Button("Back", clickAction: (e, a) => { UIManager.StartLayer(nameof(MainMenuUI), ParentScene); }) .Height(0.8f) .Width(0.8f) .Center(); }); }); v1.Spacer(); }) .Grow(3); h1.Spacer(); }) .AspectRatio(1.78f) .Center(); }
public override void Body() { RootUI.Hstack(h1 => { h1.Spacer(); h1.Vstack(v1 => { v1.Spacer(); v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Text("Transaction - Please Enter Credit Card Info"); }) .Height(1.5f) .Width(1.5f) .Right(0) .Center(); }) .Grow(4); v1.Hstack(h2 => { h2.Hstack(h4 => { h4.Text("Full Name"); }) .Height(1.0f) .Width(0.5f); h2.TextBoxFor(nameModel, x => x.name) .Width(0.5f) .Height(0.8f) .Background(Color.White) .Color(Color.Black); }).Grow(1); v1.Hstack(h2 => { h2.Hstack(h4 => { h4.Text("Credit Card Number"); }) .Height(1.0f) .Width(0.5f); h2.TextBoxFor(cardModel, x => x.number) .Width(0.5f) .Height(0.8f) .Background(Color.White) .Color(Color.Black); }).Grow(1); v1.Hstack(h2 => { h2.Hstack(h4 => { h4.Text("Security Code"); }) .Height(1.0f) .Width(0.5f); h2.TextBoxFor(codeModel, x => x.code) .Width(0.5f) .Height(0.8f) .Background(Color.White) .Color(Color.Black); }).Grow(1); v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Button("Purchase", clickAction: (e, a) => { UIManager.StartLayer(nameof(CompletedTransactionUI), ParentScene); }) .Height(0.8f) .Width(0.3f) .Right(0); }); }); v1.Spacer(); }) .Grow(3); h1.Spacer(); }) .AspectRatio(1.78f) .Center(); }
public override void Body() { RootUI.Vstack(v1 => { v1.Text("Control Settings") .FontSize(1.5f) .Color(Color.White) .Grow(2); v1.Vstack(v2 => { v2.Text("Vertical Scroll Sensitivity:") .Color(Color.White) .JustifyText(JustifyText.Start); v2.SliderFor(Model, x => x.VerticalScrollSensitivity, 0, 100); }).Grow(3); v1.Spacer(); v1.Vstack(v2 => { v2.Text("Horizontal Scroll Sensitivity:") .Color(Color.White) .JustifyText(JustifyText.Start); v2.SliderFor(Model, x => x.HorizontalScrollSensitivity, 0, 100); }).Grow(3); v1.Spacer(); v1.Text("Keyboard Controls:").JustifyText(JustifyText.Start).Color(Color.White); v1.ScrollableContainer(s2 => { s2.ListFor(Model, x => x.KeyboardControls.ToList(), (stack, item) => { stack.Hstack(h3 => { h3.Text(item.Key); h3.ControlFor(item, x => x.Value, (e, s) => { }); }).Height(0.3f); }); }) .Background(Color.Silver) .Border(3, new Color(211, 212, 210)) .Grow(6); v1.Spacer(); v1.Hstack(h2 => { h2.Button("Back to Settings", clickAction: (e, a) => { UIManager.StartLayer(nameof(SettingsMenuUI), ParentScene); }) .Height(0.9f); h2.Button("Save Settings", clickAction: (e, a) => { //Save sound settings ClientSettings settings = ClientSettings.GetSettings(); settings.ControlSettings = Model; ClientSettings.SaveSettings(settings); }) .Height(0.9f); }).Grow(2); }) .Width(0.7f) .Height(0.9f) .Center(); }
public override void Body() { RootUI.Background(Color.Transparent); RootUI.Hstack(h1 => { h1.Spacer(); h1.Vstack(v1 => { v1.Spacer(); v1.Hstack(h2 => { h2.Hstack(h3 => { h3.Text("Select Your Monster"); }) .Height(0.7f) .Width(0.7f) .Center(); }) .Grow(3); v1.Hstack(h2 => { h2.Button("Spider", clickAction: (e, a) => { DataMessage msg = new DataMessage(); msg.Message = "Spider"; ParentScene.Client.Emit("UISelect", msg); UIManager.StartLayer(nameof(HudUI), ParentScene); }) .Height(0.8f) .Width(0.8f) .Center(); }); v1.Hstack(h2 => { h2.Button("Skeleton", clickAction: (e, a) => { DataMessage msg = new DataMessage(); msg.Message = "Skeleton"; ParentScene.Client.Emit("UISelect", msg); UIManager.StartLayer(nameof(HudUI), ParentScene); }) .Height(0.8f) .Width(0.8f) .Center(); }); v1.Hstack(h2 => { h2.Button("Zombie", clickAction: (e, a) => { DataMessage msg = new DataMessage(); msg.Message = "Zombie"; ParentScene.Client.Emit("UISelect", msg); UIManager.StartLayer(nameof(HudUI), ParentScene); }) .Height(0.8f) .Width(0.8f) .Center(); }); v1.Spacer(3); }) .Grow(3); h1.Spacer(); }) .Background(new Color(0, 0, 0, 100)); }