示例#1
0
    public void ActiveBattleSkillGridCanTarget(NkBattleChar pkSendChar, BATTLESKILL_BASE BSkillBase, BATTLESKILL_DETAIL BSkillDetail)
    {
        if (pkSendChar == null || BSkillBase == null || BSkillDetail == null)
        {
            return;
        }
        eBATTLE_ALLY eBATTLE_ALLY = eBATTLE_ALLY.eBATTLE_ALLY_1;
        bool         flag         = false;

        switch (BSkillBase.m_nSkillTargetType)
        {
        case 1:
        case 2:
            eBATTLE_ALLY = ((pkSendChar.Ally != eBATTLE_ALLY.eBATTLE_ALLY_0) ? eBATTLE_ALLY.eBATTLE_ALLY_1 : eBATTLE_ALLY.eBATTLE_ALLY_0);
            break;

        case 3:
            eBATTLE_ALLY = ((pkSendChar.Ally != eBATTLE_ALLY.eBATTLE_ALLY_0) ? eBATTLE_ALLY.eBATTLE_ALLY_0 : eBATTLE_ALLY.eBATTLE_ALLY_1);
            break;

        case 4:
            flag = true;
            break;
        }
        NkBattleChar[] charArray = NrTSingleton <NkBattleCharManager> .Instance.GetCharArray();

        NkBattleChar[] array = charArray;
        for (int i = 0; i < array.Length; i++)
        {
            NkBattleChar nkBattleChar = array[i];
            if (nkBattleChar != null)
            {
                int iD = nkBattleChar.GetID();
                if (iD >= 0 && charArray[iD] != null)
                {
                    bool flag2 = flag || charArray[iD].Ally == eBATTLE_ALLY;
                    if (flag2)
                    {
                        List <NmBattleGrid> battleGridList = this.GetBattleGridList(charArray[iD].Ally, nkBattleChar.GetStartPosIndex());
                        int     gridPos = (int)nkBattleChar.GetGridPos();
                        Vector2 size    = this.GetSize(charArray[iD].Ally, nkBattleChar.GetStartPosIndex());
                        int     xMax    = (int)size.x;
                        int     yMax    = (int)size.y;
                        int[]   gridIndexFromCharSize = nkBattleChar.GetGridIndexFromCharSize((short)gridPos);
                        int[]   array2 = gridIndexFromCharSize;
                        for (int j = 0; j < array2.Length; j++)
                        {
                            int num = array2[j];
                            if (pkSendChar.CanBattleSkillForTargetGrid(charArray[iD], (short)num, BSkillBase, BSkillDetail))
                            {
                                if (NrTSingleton <BattleSkill_Manager> .Instance.IsTargetWeaponTypeCheck(BSkillBase, charArray[iD]) && NrGridData.IndexAccessAble(num, xMax, yMax))
                                {
                                    battleGridList[num].SetMode(E_RENDER_MODE.ATTACK);
                                }
                            }
                            else if (battleGridList[num].GRID_MODE != E_RENDER_MODE.ACTIVE_SELECT)
                            {
                                battleGridList[num].SetMode(E_RENDER_MODE.DISABLE);
                            }
                        }
                    }
                    else
                    {
                        List <NmBattleGrid> battleGridList2 = this.GetBattleGridList(charArray[iD].Ally, nkBattleChar.GetStartPosIndex());
                        if (battleGridList2 != null)
                        {
                            int gridPos2 = (int)nkBattleChar.GetGridPos();
                            if (battleGridList2[gridPos2].GRID_MODE != E_RENDER_MODE.ACTIVE_SELECT)
                            {
                                int[] gridIndexFromCharSize2       = nkBattleChar.GetGridIndexFromCharSize((short)gridPos2);
                                List <NmBattleGrid> battleGridList = this.GetBattleGridList(charArray[iD].Ally, nkBattleChar.GetStartPosIndex());
                                int[] array3 = gridIndexFromCharSize2;
                                for (int k = 0; k < array3.Length; k++)
                                {
                                    int index = array3[k];
                                    battleGridList[index].SetMode(E_RENDER_MODE.DISABLE);
                                }
                            }
                        }
                    }
                }
            }
        }
    }