public int[] GetIndex(E_ATTACK_GRID_TYPE type, int Start, int xMax, int yMax)
    {
        Vector2    index = NrGridData.Convert(Start, xMax);
        NrGridData grid  = this.GetGrid((int)type);

        if (grid != null)
        {
            return(grid.GetIndex(index, xMax, yMax));
        }
        return(null);
    }
    public void Add(BATTLE_GRID_DATA kData)
    {
        NrGridData nrGridData = this.GetGrid(kData.GRID_ID);

        if (nrGridData == null)
        {
            nrGridData = new NrGridData();
            this.m_dicBattleGrid.Add(kData.GRID_ID, nrGridData);
        }
        nrGridData.InsertData(new Vector2((float)kData.POS_X, (float)kData.POS_Y));
    }
 public int[] GetIndex(Vector2 index, int xMax, int yMax)
 {
     if (this.m_ReturnData == null)
     {
         this.m_ReturnData = new int[this.m_Data.Count];
     }
     for (int i = 0; i < this.m_Data.Count; i++)
     {
         this.m_ReturnData[i] = NrGridData.Convert(index + this.m_Data[i], xMax, yMax);
     }
     return(this.m_ReturnData);
 }
Exemplo n.º 4
0
    public void ActiveBattleSkillGrid(eBATTLE_ALLY Ally, short nStartPosIndex, int TargetIndex, int skillUnique)
    {
        NkBattleChar currentSelectChar = Battle.BATTLE.GetCurrentSelectChar();

        if (currentSelectChar != null)
        {
            if (this.preTargetIndex == TargetIndex)
            {
                return;
            }
            this.preTargetIndex = TargetIndex;
            BATTLESKILL_BASE battleSkillBase = NrTSingleton <BattleSkill_Manager> .Instance.GetBattleSkillBase(skillUnique);

            if (battleSkillBase == null)
            {
                return;
            }
            E_ATTACK_GRID_TYPE nSkillGridType = (E_ATTACK_GRID_TYPE)battleSkillBase.m_nSkillGridType;
            Vector2            size           = this.GetSize(Ally, nStartPosIndex);
            int   xMax  = (int)size.x;
            int   yMax  = (int)size.y;
            int[] index = BASE_BATTLE_GridData_Manager.GetInstance().GetIndex(nSkillGridType, TargetIndex, xMax, yMax);
            if (index != null)
            {
                List <NmBattleGrid> battleGridList = this.GetBattleGridList(Ally, nStartPosIndex);
                foreach (NmBattleGrid current in battleGridList)
                {
                    if (current.BUID != -1)
                    {
                        current.SetMode(E_RENDER_MODE.NORMAL);
                    }
                    else
                    {
                        current.SetMode(E_RENDER_MODE.DISABLE);
                    }
                }
                int[] array = index;
                for (int i = 0; i < array.Length; i++)
                {
                    int index2 = array[i];
                    if (NrGridData.IndexAccessAble(index2, xMax, yMax))
                    {
                        battleGridList[index2].SetMode(E_RENDER_MODE.ATTACK);
                    }
                }
            }
        }
    }
Exemplo n.º 5
0
    public void ActiveAttack(eBATTLE_ALLY Ally, short nStartPosIndex, int TargetIndex, NkBattleChar pkTarget)
    {
        NkBattleChar currentSelectChar = Battle.BATTLE.GetCurrentSelectChar();

        if (currentSelectChar != null)
        {
            if (this.preTargetIndex == TargetIndex)
            {
                return;
            }
            this.preTargetIndex = TargetIndex;
            short num = 0;
            if (pkTarget != null && currentSelectChar.CanAttack(pkTarget, (short)TargetIndex, Vector3.zero, ref num) == -1)
            {
                return;
            }
            NkSoldierInfo      soldierInfo = currentSelectChar.GetSoldierInfo();
            E_ATTACK_GRID_TYPE aTTACKGRID  = (E_ATTACK_GRID_TYPE)soldierInfo.GetAttackInfo().ATTACKGRID;
            Vector2            size        = this.GetSize(Ally, nStartPosIndex);
            int   xMax  = (int)size.x;
            int   yMax  = (int)size.y;
            int[] index = BASE_BATTLE_GridData_Manager.GetInstance().GetIndex(aTTACKGRID, TargetIndex, xMax, yMax);
            if (index != null)
            {
                List <NmBattleGrid> battleGridList = this.GetBattleGridList(Ally, nStartPosIndex);
                foreach (NmBattleGrid current in battleGridList)
                {
                    if (current.BUID != -1)
                    {
                        current.SetMode(E_RENDER_MODE.NORMAL);
                    }
                    else
                    {
                        current.SetMode(E_RENDER_MODE.DISABLE);
                    }
                }
                int[] array = index;
                for (int i = 0; i < array.Length; i++)
                {
                    int index2 = array[i];
                    if (NrGridData.IndexAccessAble(index2, xMax, yMax))
                    {
                        battleGridList[index2].SetMode(E_RENDER_MODE.ATTACK);
                    }
                }
            }
        }
    }
Exemplo n.º 6
0
    public void ActiveAttackGridCanTarget()
    {
        NkBattleChar currentSelectChar = Battle.BATTLE.GetCurrentSelectChar();

        if (currentSelectChar == null)
        {
            return;
        }
        eBATTLE_ALLY eBATTLE_ALLY = (currentSelectChar.Ally != eBATTLE_ALLY.eBATTLE_ALLY_0) ? eBATTLE_ALLY.eBATTLE_ALLY_0 : eBATTLE_ALLY.eBATTLE_ALLY_1;

        NkBattleChar[] charArray = NrTSingleton <NkBattleCharManager> .Instance.GetCharArray();

        short num = 0;

        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 && charArray[iD].Ally == eBATTLE_ALLY)
                {
                    Vector2             size                  = this.GetSize(eBATTLE_ALLY, nkBattleChar.GetStartPosIndex());
                    int                 xMax                  = (int)size.x;
                    int                 yMax                  = (int)size.y;
                    int                 gridPos               = (int)nkBattleChar.GetGridPos();
                    List <NmBattleGrid> battleGridList        = this.GetBattleGridList(eBATTLE_ALLY, nkBattleChar.GetStartPosIndex());
                    int[]               gridIndexFromCharSize = nkBattleChar.GetGridIndexFromCharSize((short)gridPos);
                    if (gridIndexFromCharSize != null && gridIndexFromCharSize.Length > 0)
                    {
                        int[] array2 = gridIndexFromCharSize;
                        for (int j = 0; j < array2.Length; j++)
                        {
                            int num2 = array2[j];
                            int num3 = currentSelectChar.CanAttack(charArray[iD], (short)num2, Vector3.zero, ref num);
                            if ((num3 == 1 || num3 == -2) && NrGridData.IndexAccessAble(num2, xMax, yMax))
                            {
                                battleGridList[num2].SetMode(E_RENDER_MODE.ATTACK);
                            }
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 7
0
    public void ActiveChangePos(eBATTLE_ALLY Ally, short nStartPosIndex, short nBUID, short nGridPos)
    {
        if (nBUID <= -1)
        {
            return;
        }
        NkBattleChar charByBUID = NrTSingleton <NkBattleCharManager> .Instance.GetCharByBUID(nBUID);

        if (charByBUID == null)
        {
            return;
        }
        int[] gridIndexFromCharSize = charByBUID.GetGridIndexFromCharSize(nGridPos);
        if (gridIndexFromCharSize == null)
        {
            return;
        }
        Vector2             size           = this.GetSize(Ally, nStartPosIndex);
        int                 xMax           = (int)size.x;
        int                 yMax           = (int)size.y;
        List <NmBattleGrid> battleGridList = this.GetBattleGridList(Ally, nStartPosIndex);

        foreach (NmBattleGrid current in battleGridList)
        {
            if (current.GRID_MODE != E_RENDER_MODE.ACTIVE_SELECT)
            {
                current.SetMode(E_RENDER_MODE.NORMAL);
            }
        }
        int[] array = gridIndexFromCharSize;
        for (int i = 0; i < array.Length; i++)
        {
            int index = array[i];
            if (NrGridData.IndexAccessAble(index, xMax, yMax))
            {
                battleGridList[index].SetMode(E_RENDER_MODE.CHANGEPOS_SELECT);
            }
        }
    }
Exemplo n.º 8
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);
                                }
                            }
                        }
                    }
                }
            }
        }
    }