예제 #1
0
 public HQUIManager(Button recruitNewUnitButton, Button sellUnitButton, EconomyController ecoContr, UpgradeUIManager upgradeManager)
 {
     _upgradeManager       = upgradeManager;
     _ecoController        = ecoContr;
     _recruitNewUnitButton = recruitNewUnitButton;
     _sellUnitButton       = sellUnitButton;
 }
예제 #2
0
        public UIController(GameController gc, EQCanvasController eqCanvas, Canvas choiceMenu, Text choiceText, Button choiceLeft,
                            Button choiceMid, Button choiceRight, Button recruitNewUnitButton, Button sellUnitButton,
                            Button buyRandomItemButton, Text nameText, Text describText, Button hideUnitButton, GameObject rangeIndicator)
        {
            _gc         = gc;
            _choiceMenu = choiceMenu;
            _choiceText = choiceText;

            _choiceLeft     = choiceLeft;
            _choiceLeftText = choiceLeft.GetComponentInChildren <Text>();

            _choiceMid     = choiceMid;
            _choiceMidText = choiceMid.GetComponentInChildren <Text>();

            _choiceRight     = choiceRight;
            _choiceRightText = choiceRight.GetComponentInChildren <Text>();

            _rangeIndicator = rangeIndicator;

            UpgradeManager     = new UpgradeUIManager(choiceMenu, choiceLeft, choiceMid, choiceRight, nameText, describText, hideUnitButton, rangeIndicator);
            HQUIManager        = new HQUIManager(recruitNewUnitButton, sellUnitButton, gc.EconomyController, UpgradeManager);
            EQCanvasController = eqCanvas;

            buyRandomItemButton.onClick.AddListener(() =>
            {
                if (!gc.EconomyController.TryBuy(EQCanvasController.RandomItemCost))
                {
                    return;
                }

                eqCanvas.AddNewItem(ConsumableItemsList.AllConsumableItems[GameController.RandomGenerator.Next(0, ConsumableItemsList.AllConsumableItems.Length)], gc);
            });

            hideUnitButton.onClick.AddListener(() =>
            {
                UpgradeManager.CurrentUnit.SetHideUnit(!UpgradeManager.CurrentUnit.Hidden);
            });
        }