示例#1
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);
            });
        }
示例#2
0
 public void Instantiate()
 {
     HQUIManager.Instantiate(SetButtonsBehaviour, _gc.EnemiesController,
                             _gc.SoldiersController);
 }