public NewPurchaseHistoriesUI(Size2 size)
        {
            Branch = new ClickUIBranch("Purchases", (int)ClickUIPriorities.Pad);
            _grid  = new GridLayout(size,
                                    new List <Definition> {
                new ConcreteDefinition(120), new ShareDefintion(), new ConcreteDefinition(120)
            }, 1);

            var backButton      = ImageTextButtonFactory.CreateRotated("<<", Vector2.Zero, NavigateBack, () => _index != 0 && _isInCall);
            var smartBackButton = new SmartControl(backButton, (int)ClickUIPriorities.Pad);

            Branch.Add(smartBackButton.Branch);
            _grid.AddSpatial(smartBackButton, backButton.Transform, 1, 1);

            var forwardButton      = ImageTextButtonFactory.CreateRotated(">>", Vector2.Zero, NavigateForward, () => (_purchaseSupplier?.Current != null || _index + _ordersPerPage < _purchaseUIs.Count) && _isInCall);
            var smartForwardButton = new SmartControl(forwardButton, (int)ClickUIPriorities.Pad);

            Branch.Add(smartForwardButton.Branch);
            _grid.AddSpatial(smartForwardButton, forwardButton.Transform, 3, 1);

            _branches.Add(smartForwardButton.Branch);
            _branches.Add(smartBackButton.Branch);

            World.Subscribe(EventSubscription.Create <PurchaseInspected>(x => Inspect(), this));
            World.Subscribe(EventSubscription.Create <PurchasesListed>(x => ListPurchases(), this));
            World.Subscribe(EventSubscription.Create <CallResolved>(x => EndCall(), this));
            World.Subscribe(EventSubscription.Create <CallStarted>(x => StartCall(x.Call), this));
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public InGameMenu(ClickUI clickUi)
        {
            _clickUI = clickUi;
            var ctx = new Buttons.MenuContext {
                X = _menuX, Y = _menuY, Width = _menuWidth, FirstButtonYOffset = 50
            };

            var menu = new UiImage
            {
                Transform = new Transform2(new Rectangle(_menuX, _menuY, _menuWidth, _menuHeight)),
                Image     = "UI/menu-wide-panel.png"
            };

            var mainMenuButton  = Buttons.Text(ctx, 4, "Return to Main Menu", () => Scene.NavigateTo("MainMenu"), () => true);
            var characterStatus = Buttons.Text(ctx, 3, "Character Status", () => Event.Publish(new DisplayCharacterStatusRequested(GameWorld.CurrentCharacter)), () => true);

            _visuals.Add(new ColoredRectangle
            {
                Color     = UiColors.InGameMenu_FullScreenRectangle,
                Transform = new Transform2(new Size2(1920, 1080))
            });
            _visuals.Add(menu);
            _visuals.Add(mainMenuButton);
            _visuals.Add(characterStatus);
            _interceptLayer.Add(new ScreenClickable(HideDisplay));
            _branch.Add(mainMenuButton);
            _branch.Add(characterStatus);
            Input.On(Control.Menu, ToggleMenu);
            Event.Subscribe(EventSubscription.Create <MenuRequested>(x => PresentOptions(), this));
            Event.Subscribe(EventSubscription.Create <SubviewRequested>(x => HideDisplay(), this));
            Event.Subscribe(EventSubscription.Create <SubviewDismissed>(x => PresentOptions(), 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);
        }
Esempio n. 5
0
 private ChoiceUI(string title, Action backAction, bool backButtonActive, params OptionUI[] options)
 {
     _title = new Label
     {
         Text      = title,
         Font      = GuiFonts.Header,
         TextColor = UiColors.InGame_Text,
         Transform = new Transform2(new Vector2(0.22.VW(), 0.1.VH()), new Size2(0.75.VW(), 80))
     };
     _options    = options.ToList();
     _backButton = new TextButton(new Rectangle(700, 800, 200, 35), backAction, "Back", UiColors.Buttons_Default, UiColors.Buttons_Hover, UiColors.Buttons_Press, () => backButtonActive);
     Branch      = new ClickUIBranch("Choice", 2);
     Branch.Add(_backButton);
     _options.ForEach(x => Branch.Add(x));
 }
Esempio n. 6
0
 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);
 }
Esempio n. 7
0
        public ReturnCallApp()
        {
            Branch             = new ClickUIBranch("Call App", (int)ClickUIPriorities.Pad);
            _callBranch        = new ClickUIBranch("In Call Branch", (int)ClickUIPriorities.Pad);
            _betweenCallBranch = new ClickUIBranch("Between Call Branch", (int)ClickUIPriorities.Pad);

            _callGrid = new GridLayout(new Size2(1600, 720),
                                       new List <Definition>
            {
                new ConcreteDefinition(25),
                new ConcreteDefinition(250),
                new ConcreteDefinition(525),
                new ShareDefintion()
            },
                                       new List <Definition>
            {
                new ShareDefintion(),
                new ConcreteDefinition(70)
            });

            var callerGrid          = new CallerGrid(_callGrid.GetBlockSize(2, 1));
            var messengerGrid       = new MessengerGrid(_callGrid.GetBlockSize(3, 1));
            var purchaseHistoryGrid = new PurchaseHistoryGrid(_callGrid.GetBlockSize(4, 1));

            _betweenCallGrid = new BetweenCallGrid(_callGrid.GetBlockSize(1, 1, 4, 2));
            var excuses = new ExcusesUI();
            var callChoicesTransform = new Transform2(_callGrid.GetBlockSize(4, 2));
            var callChoices          = new ChoicesUI(callChoicesTransform);

            _callGrid.AddSpatial(callerGrid, new Transform2(_callGrid.GetBlockSize(2, 1)), 2, 1);
            _callGrid.AddSpatial(messengerGrid, new Transform2(_callGrid.GetBlockSize(3, 1)), 3, 1);
            _callGrid.AddSpatial(purchaseHistoryGrid, new Transform2(_callGrid.GetBlockSize(4, 1)), 4, 1);
            _callGrid.AddSpatial(callChoices, callChoicesTransform, 4, 2);
            _callGrid.AddSpatial(excuses, excuses.Transform, 3, 2);

            _callBranch.Add(callChoices.Branch);
            _callBranch.Add(purchaseHistoryGrid.Branch);
            _callBranch.Add(excuses.Branch);
            _betweenCallBranch.Add(_betweenCallGrid.Branch);
            _automatons.Add(messengerGrid);
            _automatons.Add(callerGrid);
            _automatons.Add(_betweenCallGrid);

            _toDraw = _betweenCallGrid;
            Branch.Add(_betweenCallBranch);
            World.Subscribe(EventSubscription.Create <CallStarted>(x => OnCallStart(), this));
            World.Subscribe(EventSubscription.Create <CallResolved>(x => OnCallEnd(), this));
        }
        public ActionOptionsMenu(ClickUI clickUI)
        {
            _clickUI = clickUI;
            var ctx = new Buttons.MenuContext {
                X = _menuX, Y = _menuY, Width = _menuWidth, FirstButtonYOffset = 30
            };

            var menu = new UiImage
            {
                Transform = new Transform2(new Rectangle(_menuX, _menuY, _menuWidth, _menuHeight)),
                Image     = "UI/menu-tall-panel.png"
            };

            _buttons = new List <TextButton>
            {
                Buttons.Text(ctx, 0, "Hide", () => Select(ActionType.Hide), () => _options.ContainsKey(ActionType.Hide)),
                Buttons.Text(ctx, 1, "Shoot", () => Select(ActionType.Shoot), () => _options.ContainsKey(ActionType.Shoot)),
                Buttons.Text(ctx, 2, "Overwatch", () => Select(ActionType.Overwatch), () => _options.ContainsKey(ActionType.Overwatch)),
                Buttons.Text(ctx, 3, "Pass", () => Select(ActionType.Pass), () => _options.ContainsKey(ActionType.Pass))
            };

            _visuals.Add(menu);
            _buttons.ForEach(x =>
            {
                _visuals.Add(x);
                _branch.Add(x);
            });

            Event.Subscribe <ActionOptionsAvailable>(UpdateOptions, this);
            Event.Subscribe <ActionSelected>(e => HideDisplay(), this);
            Event.Subscribe <ActionCancelled>(x => PresentOptions(), this);
            Event.Subscribe <ActionConfirmed>(x => _options.Clear(), this);
            Event.Subscribe <GameOver>(e => HideDisplay(), this);
        }
Esempio n. 9
0
        public void Init()
        {
            _tooltipLabel = new Label
            {
                Transform           = new Transform2(new Vector2(1270, 124), new Size2(500, 60)),
                BackgroundColor     = Color.Transparent,
                HorizontalAlignment = HorizontalAlignment.Right,
                TextColor           = UiStyle.TextLightPurple
            };

            _confirmationVisuals = new List <IVisual>();
            _confirmationBranch  = new ClickUIBranch("Confirm", 3);
            AddConfirmationButton(UiButtons.MenuRed("Quit", new Vector2(960 - 360 - 100, 500), Confirm));
            AddConfirmationButton(UiButtons.MenuRed("Cancel", new Vector2(960 + 0 + 100, 500), Cancel));
            _confirmationBranch.Add(new ScreenClickable(() => { }));

            _clickables = new List <VisualClickableUIElement>();
            AddIconButton(() => Scene.NavigateTo(GameResources.DilemmasSceneName), "Icons/Dilemmas", "Dilemmas");
            AddIconButton(() => Scene.NavigateTo(GameResources.DialogueMemoriesScene), "Icons/Conversations", "Conversations");
            AddIconButton(() => Scene.NavigateTo(GameResources.OptionsSceneName), "Icons/Options", "Options");
            AddIconButton(() => Scene.NavigateTo(GameResources.SaveLoadSceneName), "Icons/Save", "Save / Load");
            AddIconButton(OpenConfirmationMenu, "Icons/ExitToMenu", "Main Menu");
            HudBranch = new ClickUIBranch("HUD", 2);
            _clickables.ForEach(x => HudBranch.Add(x));
            _newIcon = new ImageBox
            {
                Transform = new Transform2(new Size2(43, 43)),
                Image     = "UI/NewRedIconBorderless"
            };

            Event.SubscribeForever(EventSubscription.Create <ActiveElementChanged>(UpdateTooltip, this));
        }
Esempio n. 10
0
 public NewPurchaseUI(Size2 size)
 {
     Branch = new ClickUIBranch("Purchase UI", (int)ClickUIPriorities.Pad);
     _grid  = new GridLayout(size - new Size2(Sizes.Margin * 2, Sizes.Margin * 2),
                             new List <Definition>
     {
         new ConcreteDefinition(50),
         new ShareDefintion(),
         new ShareDefintion(),
         new ShareDefintion(),
         new ConcreteDefinition(50)
     },
                             new List <Definition>
     {
         new ShareDefintion(2),
         new ShareDefintion(),
         new ShareDefintion(),
         new ShareDefintion(),
         new ShareDefintion(),
         new ShareDefintion(),
         new ShareDefintion(),
         new ShareDefintion(),
         new ShareDefintion(),
         new ConcreteDefinition(90)
     });
     _viewList = new ViewPurchaseListUI();
     Branch.Add(_viewList.Branch);
     World.Subscribe(EventSubscription.Create <PurchaseInspected>(x => OnPurchaseInspected(x.Purchase), this));
     World.Subscribe(EventSubscription.Create <PurchasesListed>(x => OnPurchasesListed(), this));
 }
Esempio n. 11
0
        public NewPurchaseSummaryUI(Purchase purchase, Size2 size)
        {
            Branch = new ClickUIBranch("Purchase Summary", (int)ClickUIPriorities.Pad);
            var goToDetails = new ImageButton("Images/UI/purchase-summary-press", "Images/UI/purchase-summary", "Images/UI/purchase-summary-hover",
                                              new Transform2(new Size2(size.Width, 50)), () => World.Publish(new PurchaseInspected(purchase)));
            var name = new Label
            {
                BackgroundColor     = Color.Transparent,
                TextColor           = Color.White,
                Font                = "Fonts/14",
                Transform           = new Transform2(new Vector2(10, 0), new Size2(size.Width - 20, 50)),
                HorizontalAlignment = HorizontalAlignment.Left,
                RawText             = purchase.ProductName
            };
            var date = new Label
            {
                BackgroundColor     = Color.Transparent,
                TextColor           = Color.White,
                Font                = "Fonts/12",
                Transform           = new Transform2(new Vector2(10, 0), new Size2(size.Width - 20, 50)),
                HorizontalAlignment = HorizontalAlignment.Right,
                RawText             = purchase.Date
            };

            Branch.Add(goToDetails);
            _visuals.Add(goToDetails);
            _visuals.Add(name);
            _visuals.Add(date);
        }
Esempio n. 12
0
 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));
 }
Esempio n. 13
0
        public GameOverMenu(ClickUI clickUi)
        {
            _clickUI = clickUi;
            var ctx = new Buttons.MenuContext {
                X = _menuX, Y = _menuY, Width = _menuWidth, FirstButtonYOffset = 50
            };

            var mainMenuButton = Buttons.Text(ctx, 7, "Return to Main Menu",
                                              () =>
            {
                AudioPlayer.Instance.StopAll();
                Scene.NavigateTo("MainMenu");
            }, () => true);

            _visuals.Add(_black);
            _fade = new ScreenFade
            {
                ToAlpha   = 255,
                FromAlpha = 0,
                Duration  = TimeSpan.FromSeconds(2)
            };
            _visuals.Add(_fade);
            _visuals.Add(new UiImage
            {
                Image     = "UI/game-over.png",
                Transform = new Transform2(new Vector2(0.5.VW() - 329, 0.3.VH()), new Size2(639, 150))
            });

            _visuals.Add(mainMenuButton);
            _interceptLayer.Add(new ScreenClickable(() => { }));
            _branch.Add(mainMenuButton);
            Event.Subscribe(EventSubscription.Create <GameOver>(e => Enable(), this));
        }
Esempio n. 14
0
 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));
 }
Esempio n. 15
0
        public PurchaseHistoryGrid(Size2 size)
        {
            Branch = new ClickUIBranch("Purchase History", (int)ClickUIPriorities.Pad);
            _grid  = new GridLayout(size, 1, new List <Definition> {
                new ShareDefintion()
            });

            var purchases = new NewPurchaseHistoriesUI(_grid.GetBlockSize(1, 1, 2, 1));
            var purchase  = new NewPurchaseUI(_grid.GetBlockSize(1, 1, 2, 1));

            _grid.AddSpatial(purchases, new Transform2(_grid.GetBlockSize(1, 1)), 1, 1);
            _grid.AddSpatial(purchase, purchase.Transform, 1, 1);

            Branch.Add(purchases.Branch);
            Branch.Add(purchase.Branch);
            World.Subscribe(EventSubscription.Create <CallResolved>(x => OnCallResolved(), this));
        }
Esempio n. 16
0
 public void Init()
 {
     _gameState   = CurrentGameState.StartNewGame();
     _padLocation = 900;
     _clock       = _gameState.Clock;
     _clickUi.Add(_branch);
     _overlay = new Overlay();
     _branch.Add(_overlay.Branch);
     _pad           = new Pad(_branch);
     _gameState.Pad = _pad;
     _room          = new RoomUI();
     _thoughts      = new ThoughtUI();
     _branch.Add(_thoughts.Branch);
     _dev = new DevView();
     _branch.Add(_dev.Branch);
     _branch.Add(_room.Branch);
     InitAutomatons();
     InitSubscriptions();
 }
Esempio n. 17
0
 public TogglePad()
 {
     _open    = ImageTextButtonFactory.CreateTrapazoid("Open", Vector2.Zero, () => World.Publish(new PadOpened()));
     _close   = ImageTextButtonFactory.CreateTrapazoid("Close", Vector2.Zero, () => World.Publish(new PadClosed()));
     Branch   = new ClickUIBranch("Toggle Pad", (int)ClickUIPriorities.Overlay);
     _current = _open;
     Branch.Add(_open);
     World.Subscribe(EventSubscription.Create <PadOpened>(x => PadOpened(), this));
     World.Subscribe(EventSubscription.Create <PadClosed>(x => PadClosed(), this));
 }
Esempio n. 18
0
        public ActionConfirmMenu(ClickUI clickUI)
        {
            _clickUI = clickUI;
            var ctx = new Buttons.MenuContext {
                X = _menuX, Y = _menuY, Width = _menuWidth, FirstButtonYOffset = 30
            };

            _visuals.Add(new UiImage
            {
                Transform = new Transform2(new Rectangle(_menuX, _menuY, _menuWidth, _menuHeight)),
                Image     = "UI/menu-tall-panel.png"
            });

            _confirmButton = new ImageButton("UI/confirm.png", "UI/confirm-hover.png", "UI/confirm-press.png",
                                             new Transform2(new Vector2(UI.OfScreenWidth(0.5f) + 30, _menuY + 64), new Size2(52, 52)), () =>
                                             {;
                                              Hide();
                                              Event.Publish(new ActionConfirmed()); }, () => _isReady);
            var cancelButton = new ImageButton("UI/cancel.png", "UI/cancel-hover.png", "UI/cancel-press.png",
                                               new Transform2(new Vector2(UI.OfScreenWidth(0.5f) - 52 - 30, _menuY + 64), new Size2(52, 52)),
                                               () =>
            {
                Hide();
                Event.Publish(new ActionCancelled());
            });

            _actionLabel = new Label
            {
                Transform       = new Transform2(new Rectangle(_menuX, _menuY + 20, _menuWidth, 52)),
                BackgroundColor = Color.Transparent,
                TextColor       = UiColors.InGame_Text,
                Font            = GuiFonts.Body,
            };

            _visuals.Add(_actionLabel);
            _visuals.Add(_confirmButton);
            _branch.Add(_confirmButton);
            _visuals.Add(cancelButton);
            _branch.Add(cancelButton);
            Event.Subscribe <ActionSelected>(Show, this);
            Event.Subscribe <ActionReadied>(Show, this);
        }
Esempio n. 19
0
 public Overlay()
 {
     // @todo #1 update toggle button colors
     Branch     = new ClickUIBranch("Overlay", (int)ClickUIPriorities.Overlay);
     _clockUi   = new ClockUI();
     _togglePad = new TogglePad();
     _moneyUI   = new MoneyUI();
     _energyUI  = new EnergyUI();
     _hungerUI  = new HungerUI();
     Branch.Add(_togglePad.Branch);
 }
Esempio n. 20
0
 public Pad(ClickUIBranch parentBranch)
 {
     _branch = new ClickUIBranch("Pad", (int)ClickUIPriorities.Pad);
     parentBranch.Add(_branch);
     _menuBar    = new MenuBar(_branch);
     _currentApp = new NoneApp();
     World.Subscribe(EventSubscription.Create <AppChanged>(x => OpenApp(x.App), this));
     // @todo #1 Fix the state transfer architecture
     OpenApp(App.Notification);
     OpenApp(App.Call);
 }
Esempio n. 21
0
        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);
        }
Esempio n. 22
0
 private void InitUiElements()
 {
     _subview    = new NoSubView();
     _objectives = new ObjectivesView();
     _objectives.Init();
     _investigateRoomBranch = new ClickUIBranch("Location Investigation", 1);
     _locationNameLabel     = UiLabels.HeaderLabel(_location.Name, Color.White);
     _clickUi        = new ClickUI();
     _tutorialBranch = new ClickUIBranch("Tutorial", 25);
     _tutorialBranch.Add(_objectives.TutorialButton);
     _clickUi.Add(_tutorialBranch);
 }
Esempio n. 23
0
 public ShoppingCompanyUI(IShoppingCompany company)
 {
     Branch   = new ClickUIBranch("McKing Jr's", (int)ClickUIPriorities.Pad);
     _company = company;
     for (var i = 0; i < _company.Items.Count; i++)
     {
         var item   = _company.Items[i];
         var option = new ShoppingItemUI(item, i, () => _company.Buy(item));
         _itemsUI.Add(option);
         Branch.Add(option.Branch);
     }
 }
Esempio n. 24
0
 private void RememberDialogsWithPerson(Character person)
 {
     _selectedPerson = person;
     _dialogOptions  = new List <IVisual>();
     _dialogMemoriesBranch.ClearElements();
     foreach (var dialog in person.GetOldDialogs())
     {
         var button = dialog.CreateButton((l) => RememberDialog(dialog.Dialog, l), 0, 0);
         button.Offset = new Vector2(0, -300 + _dialogOptions.Count * 100);
         _dialogMemoriesBranch.Add(button);
         _dialogOptions.Add(button);
     }
 }
Esempio n. 25
0
 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);
 }
Esempio n. 26
0
 public void OpenApp(App app)
 {
     if (_currentApp.Type == app)
     {
         return;
     }
     if (!_apps.ContainsKey(app))
     {
         _apps[app] = MakeApp(app);
     }
     _branch.Remove(_currentApp.Branch);
     _currentApp = _apps[app];
     _branch.Add(_currentApp.Branch);
 }
Esempio n. 27
0
        public RoomUI()
        {
            _gameState = CurrentGameState.State;
            Branch     = new ClickUIBranch("Room", (int)ClickUIPriorities.Room);
            _map       = ApartmentMapFactory.Create();
            Branch.Add(_map.Branch);
            _sleep = new NewSelectSleepDurationUI(() => { _preparingForBed = false; Branch.Remove(_sleep.Branch); });
            _gameState.PlayerCharacter = new PlayerCharacter(_gameState.CharacterSex, _map,
                                                             new Transform2(new Vector2(TileSize.Size.Width * 2, TileSize.Size.Height * 3)));

            World.Subscribe(EventSubscription.Create <PreparingForBed>(PrepareForBed, this));
            World.Subscribe(EventSubscription.Create <WentToBed>((e) => WentToBed(), this));
            World.Subscribe(EventSubscription.Create <Awaken>(Awaken, this));
            World.Subscribe(EventSubscription.Create <CollapsedWithExhaustion>((e) => WentToBed(), this));
        }
Esempio n. 28
0
        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);
        }
Esempio n. 29
0
        public BetweenCallGrid(Size2 size)
        {
            Branch = new ClickUIBranch("BetweenCalls", (int)ClickUIPriorities.Pad);
            _grid  = new GridLayout(size, 1, 3);

            var rating    = new ReturnsRatingsUI();
            var ready     = new ReturnsCallReadyUI();
            var summaries = new CallSummaryUI();

            _spinner = new Spinner();

            _grid.AddSpatial(rating, rating.Transform, 1, 1);
            _grid.AddSpatial(ready, ready.Transform, 1, 2);
            _grid.AddSpatial(summaries, summaries.Transform, 1, 3);
            _grid.AddSpatial(_spinner, _spinner.Transform, 1, 2);

            Branch.Add(ready.Branch);
        }
        public SwitchWeaponsMenu(ClickUI clickUI)
        {
            _clickUI = clickUI;
            var ctx = new Buttons.MenuContext {
                X = _menuX, Y = _menuY, Width = _menuWidth, FirstButtonYOffset = 40
            };
            var menu = new UiImage
            {
                Transform = new Transform2(new Rectangle(_menuX, _menuY, _menuWidth, _menuHeight)),
                Image     = "UI/menu-tall-panel.png"
            };

            _switchWeaponsButton = Buttons.Text(ctx, 0, "Switch Weapons", () => GameWorld.CurrentCharacter.Gear.SwitchWeapons(), () => _show);
            _branch.Add(_switchWeaponsButton);
            _visuals.Add(menu);
            _visuals.Add(_switchWeaponsButton);
            Event.Subscribe <TurnBegun>(_ => Show(), this);
            Event.Subscribe <MovementConfirmed>(_ => Hide(), this);
        }