Esempio n. 1
0
        public void OnExitAbilityButton(GameObject butObj)
        {
            int idx = UI.GetItemIndex(butObj, abilityButtons);

            if (AbilityManager.GetPendingTargetAbilityIndex() == idx || UIControl.GetPendingAbilityIdx() == idx)
            {
                return;
            }
            UITooltip.Hide();
        }
Esempio n. 2
0
        public void OnAbilityButton(GameObject butObj, int pointerID = -1)
        {
            int idx = UI.GetItemIndex(butObj, abilityButtons);

            if (UIControl.InTargetSelectionMode())
            {
                if (AbilityManager.GetPendingTargetAbilityIndex() == idx || UIControl.GetPendingAbilityIdx() == idx)
                {
                    abilityButtons[idx].imgHighlight.gameObject.SetActive(false);
                    UIControl.ClearSelectedAbility();
                    buttonClearSelect.SetActive(false);
                    return;
                }
            }

            Ability._Status status = AbilityManager.IsReady(idx);

            if (status != Ability._Status.Ready)
            {
                if (status == Ability._Status.OnCooldown)
                {
                    GameControl.InvalidAction("Ability is on cooldown");
                }
                if (status == Ability._Status.InsufficientRsc)
                {
                    GameControl.InvalidAction("Insufficient resource");
                }
                if (status == Ability._Status.UseLimitReached)
                {
                    GameControl.InvalidAction("Use limit exceeded");
                }
                return;
            }

            if (UIControl.InTouchMode())
            {
                if (!AbilityManager.RequireTargetSelection(idx) && touchModeButtonIdx != idx)
                {
                    if (touchModeButtonIdx >= 0)
                    {
                        ClearTouchModeSelect();
                    }

                    touchModeButtonIdx = idx;
                    abilityButtons[touchModeButtonIdx].imgHighlight.gameObject.SetActive(true);
                    OnHoverAbilityButton(butObj);
                    buttonClearSelect.SetActive(true);
                    return;
                }

                ClearTouchModeSelect();
            }


            if (AbilityManager.RequireTargetSelection(idx))
            {
                UIControl.SelectAbility(idx);
                abilityButtons[idx].imgHighlight.gameObject.SetActive(true);
                buttonClearSelect.SetActive(true);
            }
            else
            {
                AbilityManager.ActivateAbility(idx);
                abilityButtons[idx].lbMain.text = AbilityManager.GetAbility(idx).GetUseLimitText();
            }
        }