示例#1
0
    void onItemOver()
    {
        GameTouchCenterUI.instance.showUI();

        GameBattleCursor.instance.show();

        GameBattleUnit a = GameBattleSelection.instance.SelectionUnit;

        a.action();

        GameBattleSelection.instance.clearSelection();

        clearInput();
    }
示例#2
0
    void updateItemSelection()
    {
        if (!GameBattleUnitItemSelection.instance.IsShow)
        {
            return;
        }

        if (confirm)
        {
            confirm = false;

            int x = GameBattleCursor.instance.PosX;
            int y = GameBattleCursor.instance.PosY;

            GameBattleAttackMapDirection dir;

            if (!GameBattleUnitItemSelection.instance.checkCell(x, y, out dir))
            {
                return;
            }

            GameBattleUnit unit = GameBattleSelection.instance.SelectionUnit;

            int      itemSlot = GameBattleItemUI.instance.Selection;
            GameItem item     = GameBattleItemUI.instance.getSelectionItem();

            switch (GameBattleItemUI.instance.Mode)
            {
            case GameBattleUnitActionItemMode.Use:
            {
                GameBattleSelection.instance.getUnits(unit, item, dir);

                if (GameBattleSelection.instance.SelectionUnits.Count == 0)
                {
                    return;
                }

                GameBattleUnitSkillSelection.instance.unShow();

                GameTouchCenterUI.instance.unShowUI();

                GameBattleAttackResult.instance.itemAttack(item, unit,
                                                           GameBattleSelection.instance.SelectionUnits, dir, GameBattleAttackResultSide.Right, onItemOver);

                GameBattleUnitItemSelection.instance.unShow();

                GameBattleCursor.instance.unShow();
            }
            break;

            case GameBattleUnitActionItemMode.Give:
            {
                GameBattleUnit unit2 = GameBattleUnitManager.instance.getUnit(x, y);

                if (unit2 == null)
                {
                    return;
                }

                if (!unit2.IsUser)
                {
                    return;
                }

                if (!unit2.canAddItem())
                {
                    // item full

                    return;
                }

                unit.giveItem(itemSlot, unit2);

                GameBattleUnitItemSelection.instance.unShow();

//                        GameBattleCursor.instance.show();

                unit.action();

                GameBattleSelection.instance.clearSelection();
            }
            break;
            }

            return;
        }

        if (cancel)
        {
            cancel = false;

            GameBattleUnitActionUI.instance.show();
            GameBattleUnitActionUI.instance.enable(true);
            GameBattleUnitActionUI.instance.showFade();

            GameBattleUnit unit = GameBattleSelection.instance.SelectionUnit;

            GameBattleUnitItemSelection.instance.unShow();

            GameBattleCursor.instance.moveTo(unit.PosX, unit.PosY, true);
            GameBattleCursor.instance.unShow();

            return;
        }
    }
示例#3
0
    void updateActionUI()
    {
        if (!GameBattleUnitActionUI.instance.IsShow)
        {
            return;
        }

        if (confirm)
        {
            confirm = false;

            GameBattleUnit unit = GameBattleSelection.instance.SelectionUnit;

            if (unit != null)
            {
                switch (GameBattleUnitActionUI.instance.Selection)
                {
                case 0:
                {
                    GameBattleCursor.instance.show();

                    GameBattleUnitActionUI.instance.unShowFade();

                    unit.burst();

                    GameBattleSelection.instance.clearSelection();
                }
                break;

                case 1:
                {
                    GameBattleCursor.instance.unShow();

                    GameBattleUnitActionUI.instance.unShowFade();

                    GameBattleSkillUI.instance.show();
                    GameBattleSkillUI.instance.setData(unit);
                    GameBattleSkillUI.instance.showFade();
                }
                break;

                case 2:
                {
                    if (unit.checkEffect(GameSkillResutlEffect.Palsy))
                    {
                        return;
                    }

                    GameBattleCursor.instance.show();

                    GameBattleUnitActionUI.instance.unShowFade();

                    GameBattleUnitAttackSelection.instance.show(unit.PosX,
                                                                unit.PosY,
                                                                unit.Weapon,
                                                                unit.UnitCampType,
                                                                true);

                    GameBattleCursor.instance.moveTo(GameBattleUnitAttackSelection.instance.AttackCell.x,
                                                     GameBattleUnitAttackSelection.instance.AttackCell.y,
                                                     GameBattleCursor.SpeedX, GameBattleCursor.SpeedY,
                                                     true,
                                                     onCursorMoveOver);
                }
                break;

                case 3:
                {
                    GameBattleUnitActionItemUI.instance.show(GameBattleCursor.instance.PosX,
                                                             GameBattleCursor.instance.PosY);
                    GameBattleUnitActionItemUI.instance.showFade();

                    GameBattleUnitActionUI.instance.enable(false);
                }
                break;

                case 4:
                {
                    GameBattleCursor.instance.show();

                    GameBattleUnitActionUI.instance.unShowFade();

                    unit.action();

                    GameBattleSelection.instance.clearSelection();
                }
                break;
                }
            }
        }

        if (cancel)
        {
            cancel = false;

            GameBattleUnit unit = GameBattleSelection.instance.SelectionUnit;

            GameBattleUnitAttackSelection.instance.unShow();
            GameBattleUnitActionUI.instance.unShowFade();

            GameBattleCursor.instance.show();

            if (unit != null)
            {
                GameBattleCursor.instance.moveTo(unit.PosX, unit.PosY, true);
            }

            GameBattleSelection.instance.clearSelection();
        }

        moveBattleUnitActionUI();
    }