private int currentButtonID = -1;       //last touched button, for touch mode only
        public void OnTowerButton(GameObject butObj, int pointerID = -1)
        {
            int ID = GetButtonID(butObj);

            if (UIMainControl.InTouchMode() && !BuildManager.UseDragNDrop())
            {
                if (currentButtonID >= 0)
                {
                    buttonList[currentButtonID].imgHighlight.enabled = false;
                }
                if (currentButtonID != ID)
                {
                    currentButtonID = ID;
                    buttonList[ID].imgHighlight.enabled = true;
                    OnHoverButton(butObj);
                    return;
                }
                ClearTouchModeButton();
            }

            string exception = BuildManager.BuildTower(ID, buildInfo, pointerID);

            if (exception != "")
            {
                UIMessage.DisplayMessage(exception);
                return;
            }

            buildInfo = null;

            if (!BuildManager.UseDragNDrop())
            {
                Hide();
            }
        }
Exemple #2
0
        public void OnUpgradeButton(int index)
        {
            if (UIMainControl.InTouchMode())
            {
                if (currentState != 2)
                {
                    currentState = 2;
                    SetCurrentStateToTwo(index);
                    return;
                }
                else
                {
                    if (currentUpgradeIndex == index)
                    {
                        ClearState();
                        OnExitUpgradeButton();
                    }
                    else
                    {
                        SetCurrentStateToTwo(index);
                        return;
                    }
                }
            }

            string exception = currentTower.Upgrade(index);

            if (exception != "")
            {
                UIMessage.DisplayMessage(exception);
            }
        }
        private int currentButtonID = -1;       //last touched button, for touch mode only
        public void OnAbilityButton(GameObject butObj, int pointerID = -1)
        {
            int ID = GetButtonID(butObj);

            if (UIMainControl.InTouchMode())
            {
                if (currentButtonID >= 0)
                {
                    buttonList[currentButtonID].imgHighlight.enabled = false;
                }
                if (currentButtonID != ID)
                {
                    //OnAbilitySelectingTarget(true);	//to turn on cancel button
                    butCancelCanvasG.alpha        = 1;
                    butCancelCanvasG.interactable = true;

                    currentButtonID = ID;
                    buttonList[ID].imgHighlight.enabled = true;
                    OnHoverButton(butObj);
                    return;
                }
                ClearTouchModeButton();
            }

            string exception = AbilityManager.SelectAbility(ID, pointerID);

            if (exception != "")
            {
                UIMessage.DisplayMessage(exception);
            }
        }
        public void OnUpgradeButton(int index)
        {
            string exception = currentTower.Upgrade(index);

            if (exception != "")
            {
                UIMessage.DisplayMessage(exception);
            }
        }
Exemple #5
0
        public override void Awake()
        {
            base.Awake();

            canvasGroup.interactable   = false;
            canvasGroup.blocksRaycasts = false;
            canvasGroup.alpha          = 1;

            instance = this;
            thisObj.SetActive(true);
        }
        public void OnPurchaseButton()
        {
            //Perk perk=PerkManager.GetPerk(perkItemList[selectID].perkID);

            string text = PerkManager.PurchasePerk(perkItemList[selectID].perkID);

            if (text != "")
            {
                UIMessage.DisplayMessage(text);
                return;
            }

            UpdatePerkItemList();

            UpdateDisplay();
        }
Exemple #7
0
 void Awake()
 {
     instance = this;
     gameObject.GetComponent <RectTransform>().localPosition = new Vector3(0, 0, 0);
 }