public ShoppingItemUI(IItem item, int i, Action whenBought) { _playerAccount = CurrentGameState.State.PlayerAccount; Branch = new ClickUIBranch(item.Name, (int)ClickUIPriorities.Pad); var x = (i % 4) * (Sizes.Item.Width + Sizes.Margin); var y = (i / 4) * (Sizes.Item.Height + Sizes.Margin * 2 + Sizes.Button.Height); _transform = new Transform2(new Vector2((int)x, (int)y)); _productDetails = new ImageWithDescription("Images/Items/" + item.Name.ToLower().Replace(" ", "-").Replace(".", ""), item.Description, new Transform2(Sizes.Item)); _label = new Label { BackgroundColor = Color.Transparent, TextColor = Color.White, Font = "Fonts/14", Transform = new Transform2(new Vector2(0, Sizes.Item.Height + 5), new Size2(Sizes.Item.Width, 30)), RawText = item.Name + " - $" + item.Cost.Amount() }; _amount = item.Cost.Amount(); _button = ImageTextButtonFactory.Create("Buy", new Vector2(0, Sizes.Item.Height + Sizes.SmallMargin + 30), () => { if (_playerAccount.Amount() >= _amount) { whenBought(); } }); _disabledButton = new ImageLabel("Buy", "Images/UI/button-disable", new Transform2(new Vector2(0, Sizes.Item.Height + Sizes.SmallMargin + 30), Sizes.Button)); Branch.Add(_button); Branch.Add(_productDetails); }
public ReturnsCallReadyUI() { Branch = new ClickUIBranch("Ready Button", (int)ClickUIPriorities.Pad); _button = ImageTextButtonFactory.Create("Ready", Vector2.Zero, StartCall); Branch.Add(_button); World.Subscribe(EventSubscription.Create <CallResolved>(x => AtEndCall(), this)); }
public ExcusesUI() { Branch = new ClickUIBranch("Excuses", (int)ClickUIPriorities.Pad); _excuseButton = ImageTextButtonFactory.Create("Soothe", new Vector2(0, 0), MakeExcuse); World.Subscribe(EventSubscription.Create <CallStarted>(OnCallStart, this)); World.Subscribe(EventSubscription.Create <CallResolved>(x => OnCallResolved(), this)); }
public ViewPurchaseListUI() { Branch = new ClickUIBranch("View List Button", (int)ClickUIPriorities.Pad); _button = ImageTextButtonFactory.Create("Purchases", Vector2.Zero, () => World.Publish(new PurchasesListed())); Branch.Add(_button); World.Subscribe(EventSubscription.Create <PurchaseInspected>(x => OnPurchaseInspected(), this)); World.Subscribe(EventSubscription.Create <PurchasesListed>(x => OnPurchasesListed(), this)); }
public NewSelectSleepDurationUI(Action cancel) { _grid = new GridLayout(new Size2(1600, 900), 1, 1); var innerGrid = new GridLayout(new Size2(250, 525), new List <Definition> { new ConcreteDefinition(25), new ConcreteDefinition(200), new ConcreteDefinition(25), }, new List <Definition> { new ConcreteDefinition(25), new ConcreteDefinition(50), new ConcreteDefinition(25), new ConcreteDefinition(70), new ConcreteDefinition(10), new ConcreteDefinition(50), new ConcreteDefinition(10), new ConcreteDefinition(70), new ConcreteDefinition(25), new ConcreteDefinition(70), new ConcreteDefinition(25), new ConcreteDefinition(70), new ConcreteDefinition(25) }); var summary = new Label { BackgroundColor = Color.Transparent, TextColor = Color.White, Font = "Fonts/16", Transform = new Transform2(innerGrid.GetBlockSize(1, 2, 4, 1)), Text = "How long do you want to sleep for?" }; var upHour = ImageTextButtonFactory.CreateUpArrow(Vector2.Zero, AddHour); var smartUpHour = new SmartControl(upHour, (int)ClickUIPriorities.Room); var downHour = ImageTextButtonFactory.CreateDownArrow(Vector2.Zero, ReduceHour); var smartDownHour = new SmartControl(downHour, (int)ClickUIPriorities.Room); _timeLabel = new ImageLabel(_hours + " Hours", "Images/UI/label-small", new Transform2(Sizes.SmallLabel)); var sleepButton = ImageTextButtonFactory.Create("Sleep", Vector2.Zero, () => World.Publish(new WentToBed(_hours))); var smartSleepButton = new SmartControl(sleepButton, (int)ClickUIPriorities.Room); var cancelButton = ImageTextButtonFactory.Create("Cancel", Vector2.Zero, cancel); var smartCancelButton = new SmartControl(cancelButton, (int)ClickUIPriorities.Room); _grid.AddSpatial(innerGrid, new Transform2(innerGrid.Size), 1, 1); innerGrid.AddSpatial(new ImageBox(new Transform2(innerGrid.Size), "Images/UI/messenger"), new Transform2(innerGrid.Size), 1, 1, 3, 13); innerGrid.AddSpatial(summary, summary.Transform, 2, 2); innerGrid.AddSpatial(smartUpHour, new Transform2(new Size2(70, 70)), 2, 4); innerGrid.AddSpatial(_timeLabel, new Transform2(Sizes.SmallLabel), 2, 6); innerGrid.AddSpatial(smartDownHour, new Transform2(new Size2(70, 70)), 2, 8); innerGrid.AddSpatial(smartSleepButton, sleepButton.Transform, 2, 10); innerGrid.AddSpatial(smartCancelButton, cancelButton.Transform, 2, 12); Branch = new ClickUIBranch("Sleep Duration", (int)ClickUIPriorities.Room); Branch.Add(smartUpHour.Branch); Branch.Add(smartDownHour.Branch); Branch.Add(smartSleepButton.Branch); Branch.Add(smartCancelButton.Branch); }
public DevView() { Branch = new ClickUIBranch("Dev", (int)ClickUIPriorities.Dev); var button4 = ImageTextButtonFactory.Create("Return Specialist 1", new Vector2(Sizes.Margin * 4 + Sizes.Button.Width * 3, Sizes.Margin), () => Promote(Job.ReturnSpecialistLevel1)); _buttons.Add(button4); Input.On(Control.Select, Toggle); }
private void StartCall(Call call) { for (var i = 0; i < call.Options.Count; i++) { var button = ImageTextButtonFactory.Create(call.Options[i].Description, new Vector2(i % 2 * (Sizes.Button.Width + Sizes.Margin), (int)(i / 2) * (Sizes.Button.Height + Sizes.Margin)), call.Options[i].Go); _buttons.Add(button); Branch.Add(button); } }
public void OnCallStart(Call call) { for (int i = 0; i < call.Options.Count; i++) { var button = ImageTextButtonFactory.Create(call.Options[i].Description, Vector2.Zero, call.Options[i].Go); var smartButton = new SmartControl(button, (int)ClickUIPriorities.Pad); _choices.Add(smartButton); _grid.AddSpatial(smartButton, button.Transform, i + 1, 1); Branch.Add(smartButton.Branch); } }
public RentApp() { _gameState = CurrentGameState.State; _playerAccount = _gameState.PlayerAccount; _landlord = _gameState.Landlord; Branch = new ClickUIBranch("Rent App", (int)ClickUIPriorities.Pad); _amountDue = new ImageLabel("", "Images/UI/label", new Transform2(new Vector2(-(Sizes.Label.Width / 2), 0), Sizes.Label)); _paymentDueBy = new ImageLabel("", "Images/UI/label", new Transform2(new Vector2(-(Sizes.Label.Width / 2), Sizes.Label.Height + Sizes.Margin), Sizes.Label)); _payButton = ImageTextButtonFactory.Create("PAY", new Vector2(-(Sizes.Button.Width / 2), (Sizes.Label.Height + Sizes.Margin) * 2), () => World.Publish(new RentPaid())); _disabledPayButton = new ImageLabel("PAY", "Images/UI/button-disable", new Transform2(new Vector2(-(Sizes.Button.Width / 2), (Sizes.Label.Height + Sizes.Margin) * 2), Sizes.Button)); }
public NotificationUI(PlayerNotification notification, List <NotificationUI> items) { Branch = new ClickUIBranch("Notification", (int)ClickUIPriorities.Pad); _label = new Label { BackgroundColor = Color.Transparent, TextColor = Color.White, Transform = new Transform2(new Vector2(Sizes.Margin, 0), new Size2(Sizes.Notification.Width - Sizes.Button.Width - Sizes.Margin * 2, 90)), Text = $"{notification.Time} - {notification.Sender} - {notification.Message}", }; _button = ImageTextButtonFactory.Create("Dismiss", new Vector2(Sizes.Notification.Width - Sizes.Margin - Sizes.Button.Width, Sizes.SmallMargin), () => items.Remove(this)); Branch.Add(_button); }
public ThoughtUI() { Input.On(Control.A, Dismiss); Branch = new ClickUIBranch("Thought", (int)ClickUIPriorities.Thoughts); _label = new Label { TextColor = Color.White, BackgroundColor = Color.Transparent, }; _button = ImageTextButtonFactory.Create("Dismiss", new Vector2(Sizes.LargeLabel.Width - Sizes.SmallMargin - Sizes.Button.Width, Sizes.LargeLabel.Height - Sizes.SmallMargin - Sizes.Button.Height), Dismiss); World.Subscribe(EventSubscription.Create <HadAThought>(Think, this)); }
public MenuBar(ClickUIBranch parentBranch) { _branch = new ClickUIBranch("Menu Bar", (int)ClickUIPriorities.Pad); parentBranch.Add(_branch); _callApp = ImageTextButtonFactory.Create("Calls", new Vector2(Sizes.Margin, Sizes.Margin), () => ChangeApp(App.Call)); _foodApp = ImageTextButtonFactory.Create("Shopping", new Vector2(Sizes.Margin * 2 + Sizes.Button.Width, Sizes.Margin), () => ChangeApp(App.Shopping)); _notificationApp = ImageTextButtonFactory.Create("Notification", new Vector2(Sizes.Margin * 3 + Sizes.Button.Width * 2, Sizes.Margin), () => ChangeApp(App.Notification)); _rentApp = ImageTextButtonFactory.Create("Rent", new Vector2(Sizes.Margin * 4 + Sizes.Button.Width * 3, Sizes.Margin), () => ChangeApp(App.Rent)); _policiesApp = ImageTextButtonFactory.Create("Policies", new Vector2(Sizes.Margin * 5 + Sizes.Button.Width * 4, Sizes.Margin), () => ChangeApp(App.Policies)); _branch.Add(_callApp); _branch.Add(_foodApp); _branch.Add(_notificationApp); _branch.Add(_rentApp); _branch.Add(_policiesApp); }
public ShoppingApp() { Branch = new ClickUIBranch("Item App", (int)ClickUIPriorities.Pad); _companiesBranch = new ClickUIBranch("Companies", (int)ClickUIPriorities.Pad); Branch.Add(_companiesBranch); for (var i = 0; i < _companies.Count; i++) { var company = _companies[i]; var companyUI = new ShoppingCompanyUI(company); var option = new ShoppingCompanyOptionUI(company, i, () => NavigateToCompany(companyUI)); _companyOptionUIs.Add(option); _companiesBranch.Add(option.Branch); } _return = ImageTextButtonFactory.Create("Return", new Vector2(1000, 625), NavigateToCompanySelection); }
public ShoppingCompanyOptionUI(IShoppingCompany company, int i, Action whenBought) { Branch = new ClickUIBranch(company.Name, (int)ClickUIPriorities.Pad); var x = (i % 4) * (Sizes.Item.Width + Sizes.Margin); var y = (i / 4) * (Sizes.Item.Height + Sizes.Margin * 2 + Sizes.Button.Height); _transform = new Transform2(new Vector2((int)x, (int)y)); _productDetails = new ImageWithDescription("Images/Companies/" + company.Name.ToLower().Replace(" ", "-").Replace(".", "").Replace("'", ""), company.Description, new Transform2(Sizes.Item)); _label = new Label { BackgroundColor = Color.Transparent, TextColor = Color.White, Font = "Fonts/14", Transform = new Transform2(new Vector2(0, Sizes.Item.Height + 5), new Size2(Sizes.Item.Width, 30)), RawText = company.Name }; _button = ImageTextButtonFactory.Create("Shop", new Vector2(0, Sizes.Item.Height + Sizes.SmallMargin + 30), whenBought); Branch.Add(_button); Branch.Add(_productDetails); }