Ejemplo n.º 1
0
    public void Init()
    {
        if (TsPlatform.IsIPhone && (Battle.BATTLE.BattleRoomtype == eBATTLE_ROOMTYPE.eBATTLE_ROOMTYPE_PLUNDER || Battle.BATTLE.BattleRoomtype == eBATTLE_ROOMTYPE.eBATTLE_ROOMTYPE_MINE || Battle.BATTLE.BattleRoomtype == eBATTLE_ROOMTYPE.eBATTLE_ROOMTYPE_INFINITY || Battle.BATTLE.BattleRoomtype == eBATTLE_ROOMTYPE.eBATTLE_ROOMTYPE_EXPEDITION))
        {
            return;
        }
        GameObject parent = GameObject.Find(TsSceneSwitcher.ESceneType.BattleScene.ToString());

        if (this.mRoot == null)
        {
            this.mRoot = TBSUTIL.Attach("GridManager", parent);
        }
        eBATTLE_ALLY eBATTLE_ALLY = eBATTLE_ALLY.eBATTLE_ALLY_0;
        Dictionary <int, BATTLE_POS_GRID> battleGrid = Battle.BATTLE.GetBattleGrid(eBATTLE_ALLY);

        foreach (KeyValuePair <int, BATTLE_POS_GRID> current in battleGrid)
        {
            this.Insert(eBATTLE_ALLY, (short)current.Key, current.Value);
        }
        eBATTLE_ALLY = eBATTLE_ALLY.eBATTLE_ALLY_1;
        battleGrid   = Battle.BATTLE.GetBattleGrid(eBATTLE_ALLY);
        foreach (KeyValuePair <int, BATTLE_POS_GRID> current2 in battleGrid)
        {
            this.Insert(eBATTLE_ALLY, (short)current2.Key, current2.Value);
        }
    }
 public void SetCurrentTurnAlly(eBATTLE_ALLY eAlly)
 {
     if (eAlly == eBATTLE_ALLY.eBATTLE_ALLY_0)
     {
         if (this.m_goAlly0Effect != null)
         {
             this.m_goAlly0Effect.SetActive(true);
             this.m_goAlly0Effect.transform.localPosition = Vector3.zero;
         }
         if (this.m_goAlly1Effect != null)
         {
             this.m_goAlly1Effect.SetActive(false);
             this.m_goAlly1Effect.transform.localPosition = Vector3.zero;
         }
     }
     else
     {
         if (this.m_goAlly1Effect != null)
         {
             this.m_goAlly1Effect.SetActive(true);
             this.m_goAlly1Effect.transform.localPosition = Vector3.zero;
         }
         if (this.m_goAlly0Effect != null)
         {
             this.m_goAlly0Effect.SetActive(false);
             this.m_goAlly0Effect.transform.localPosition = Vector3.zero;
         }
     }
 }
Ejemplo n.º 3
0
    public void ActiveBattleCharGrid(eBATTLE_ALLY Ally, short nStartPosIndex)
    {
        List <NmBattleGrid> battleGridList = this.GetBattleGridList(Ally, nStartPosIndex);

        foreach (NmBattleGrid current in battleGridList)
        {
            if (current.BUID != -1)
            {
                NkBattleChar charByBUID = NrTSingleton <NkBattleCharManager> .Instance.GetCharByBUID(current.BUID);

                if (charByBUID != null && charByBUID.GetTurnState() != eBATTLE_TURN_STATE.eBATTLE_TURN_STATE_ENABLE)
                {
                    current.SetMode(E_RENDER_MODE.NORMAL);
                }
                else
                {
                    current.SetMode(E_RENDER_MODE.DISABLE);
                }
            }
            else
            {
                current.SetMode(E_RENDER_MODE.DISABLE);
            }
        }
    }
 public void SetAngerPoint(eBATTLE_ALLY nAlly, int nPoint)
 {
     if (nPoint >= this.m_obAnger[(int)nAlly].m_nMaxAngerPoint)
     {
         nPoint = this.m_obAnger[(int)nAlly].m_nMaxAngerPoint;
     }
     this.m_obAnger[(int)nAlly].m_nAngerPoint = nPoint;
     this.SetAngerText(nAlly);
 }
Ejemplo n.º 5
0
    private List <NmBattleGrid> GetBattleGridList(eBATTLE_ALLY Ally, short nStartPosIndex)
    {
        KeyValuePair <eBATTLE_ALLY, int> key = new KeyValuePair <eBATTLE_ALLY, int>(Ally, (int)nStartPosIndex);

        if (this.m_BattlePosGrid.ContainsKey(key))
        {
            return(this.m_BattlePosGrid[key]);
        }
        return(null);
    }
Ejemplo n.º 6
0
    private NmBattleGrid GetBattleGrid(eBATTLE_ALLY Ally, short nStartPosIndex, int index)
    {
        List <NmBattleGrid> battleGridList = this.GetBattleGridList(Ally, nStartPosIndex);

        if (battleGridList != null)
        {
            return(battleGridList[index]);
        }
        return(null);
    }
Ejemplo n.º 7
0
    private Vector2 GetSize(eBATTLE_ALLY Ally, short nStartPosIndex)
    {
        KeyValuePair <eBATTLE_ALLY, int> key = new KeyValuePair <eBATTLE_ALLY, int>(Ally, (int)nStartPosIndex);

        if (this.m_BattlePosGridSize.ContainsKey(key))
        {
            return(this.m_BattlePosGridSize[key]);
        }
        return(Vector2.zero);
    }
 public void SetDeadCount(eBATTLE_ALLY eAlly)
 {
     if (eAlly == eBATTLE_ALLY.eBATTLE_ALLY_0)
     {
         this.nDeadCount1++;
     }
     else
     {
         this.nDeadCount0++;
     }
 }
 public void AddAngerPoint(eBATTLE_ALLY nAlly, int nPoint)
 {
     this.m_obAnger[(int)nAlly].m_nAngerPoint += nPoint;
     if (this.m_obAnger[(int)nAlly].m_nAngerPoint >= this.m_obAnger[(int)nAlly].m_nMaxAngerPoint)
     {
         this.m_obAnger[(int)nAlly].m_nAngerPoint = this.m_obAnger[(int)nAlly].m_nMaxAngerPoint;
     }
     if (this.m_obAnger[(int)nAlly].m_nAngerPoint < 0)
     {
         this.m_obAnger[(int)nAlly].m_nAngerPoint = 0;
     }
     this.SetAngerText(nAlly);
 }
Ejemplo n.º 10
0
 private void Make(eBATTLE_ALLY eAlly, short nStartPosIndex, int index)
 {
     this.mAlly               = eAlly;
     this.mnStartPosIndex     = nStartPosIndex;
     this.mIdx                = index;
     this.mGridCell           = base.gameObject.AddComponent <SoldierBatchGridCell>();
     this.mCollider           = base.gameObject.AddComponent <BoxCollider>();
     this.mCollider.isTrigger = true;
     this.mCollider.size      = new Vector3(6f, 1f, 6f);
     base.gameObject.layer    = TsLayer.PC_DECORATION;
     base.gameObject.SetActive(true);
     this.SetMODE(E_RENDER_MODE.NORMAL);
 }
Ejemplo n.º 11
0
    public void ChangeCharLayer(eBATTLE_ALLY eBattleAlly, short nExceptBUID, bool bShow, bool bNameCheck)
    {
        NkBattleChar[] arChar = this.m_arChar;
        for (int i = 0; i < arChar.Length; i++)
        {
            NkBattleChar nkBattleChar = arChar[i];
            if (nkBattleChar != null && nkBattleChar.m_k3DChar != null)
            {
                if (nkBattleChar.Ally == eBattleAlly && nkBattleChar.GetBUID() != nExceptBUID)
                {
                    if (!bShow)
                    {
                        nkBattleChar.Get3DChar().SetLayer(TsLayer.BLOCK);
                    }
                    else
                    {
                        switch (nkBattleChar.GetCharKindType())
                        {
                        case eCharKindType.CKT_USER:
                            nkBattleChar.Get3DChar().SetLayer(TsLayer.PC);
                            break;

                        case eCharKindType.CKT_SOLDIER:
                            nkBattleChar.Get3DChar().SetLayer(TsLayer.NPC, TsTag.NPC_MOB.ToString());
                            break;

                        case eCharKindType.CKT_MONSTER:
                            nkBattleChar.Get3DChar().SetLayer(TsLayer.NPC, TsTag.NPC_MOB.ToString());
                            break;

                        case eCharKindType.CKT_NPC:
                            nkBattleChar.Get3DChar().SetLayer(TsLayer.NPC, TsTag.NPC_QUEST.ToString());
                            break;

                        case eCharKindType.CKT_OBJECT:
                            nkBattleChar.Get3DChar().SetLayer(TsLayer.NPC, TsTag.NPC_EXTRA.ToString());
                            break;

                        default:
                            nkBattleChar.Get3DChar().SetLayer(TsLayer.NPC, TsTag.NPC_EXTRA.ToString());
                            break;
                        }
                    }
                }
                if (nkBattleChar.Ally != eBattleAlly)
                {
                    nkBattleChar.SetShowHeadUp(bShow, !bShow, true);
                }
            }
        }
    }
Ejemplo n.º 12
0
 private void Make(eBATTLE_ALLY eAlly, short nStartPosIndex, short BUID, int index)
 {
     this.mAlly           = eAlly;
     this.mnStartPosIndex = nStartPosIndex;
     this.mBUID           = BUID;
     this.mIdx            = index;
     this.SetBUID(this.mBUID);
     this.mGridCell           = base.gameObject.AddComponent <NmGridCell>();
     this.mCollider           = base.gameObject.AddComponent <BoxCollider>();
     this.mCollider.isTrigger = true;
     this.mCollider.size      = new Vector3(8f, 1f, 8f);
     base.gameObject.layer    = TsLayer.PC_DECORATION;
     this.SetMode(E_RENDER_MODE.NORMAL);
 }
 public void SetDeadFlag(eBATTLE_ALLY nAlly, short nBUID)
 {
     ColosseumObserverControlDlg.OBSERVER_SOLDIERINFO obSoldierInfo = this.GetObSoldierInfo(nAlly, nBUID);
     if (obSoldierInfo == null)
     {
         return;
     }
     obSoldierInfo.m_dtDeadMark.Visible = true;
     if (obSoldierInfo.m_goTurnEffect != null)
     {
         obSoldierInfo.m_goTurnEffect.SetActive(false);
     }
     this.SetKillEffect();
 }
Ejemplo n.º 14
0
    public void RemoveBUID(eBATTLE_ALLY Ally, short nStartPosIndex, short BUID)
    {
        List <NmBattleGrid> battleGridList = this.GetBattleGridList(Ally, nStartPosIndex);

        if (battleGridList != null)
        {
            foreach (NmBattleGrid current in battleGridList)
            {
                if (current.BUID == BUID)
                {
                    current.SetBUID(-1);
                }
            }
        }
    }
Ejemplo n.º 15
0
 public void InitbyAlly(eBATTLE_ALLY Ally)
 {
     foreach (List <NmBattleGrid> current in this.m_BattlePosGrid.Values)
     {
         foreach (NmBattleGrid current2 in current)
         {
             if (current2.ALLY == Ally)
             {
                 current2.SetSelectBattleSkill(false);
                 current2.CheckState();
             }
         }
     }
     this.preTargetIndex = -1;
 }
Ejemplo n.º 16
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);
                    }
                }
            }
        }
    }
Ejemplo n.º 17
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);
                    }
                }
            }
        }
    }
Ejemplo n.º 18
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);
                            }
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 19
0
    public static SoldierBatchGrid Create(eBATTLE_ALLY eAlly, short nStartPosIndex, Vector3 Pos, int index)
    {
        string     name       = string.Format("GRID_{0}", index);
        GameObject gameObject = new GameObject(name);

        if (gameObject == null)
        {
            gameObject = new GameObject("NO_CELL");
        }
        Pos.y = NrTSingleton <NrTerrain> .Instance.SampleHeight(Pos);

        gameObject.transform.position = Pos;
        SoldierBatchGrid soldierBatchGrid = gameObject.AddComponent <SoldierBatchGrid>();

        soldierBatchGrid.Make(eAlly, nStartPosIndex, index);
        return(soldierBatchGrid);
    }
Ejemplo n.º 20
0
 public void DeleteAllCharByAlly(eBATTLE_ALLY eAlly)
 {
     NkBattleChar[] arChar = this.m_arChar;
     for (int i = 0; i < arChar.Length; i++)
     {
         NkBattleChar nkBattleChar = arChar[i];
         if (nkBattleChar != null)
         {
             int iD = nkBattleChar.GetID();
             if (iD >= 0 && this.m_arChar[iD] != null && this.m_arChar[iD].Ally == eAlly)
             {
                 this.m_arChar[iD].DeleteChar();
                 this.m_arChar[iD] = null;
             }
         }
     }
 }
Ejemplo n.º 21
0
 public void SetGridChangePosMode(bool bOn, eBATTLE_ALLY Ally, short nStartPosIndex)
 {
     if (bOn)
     {
         List <NmBattleGrid> battleGridList = this.GetBattleGridList(Ally, nStartPosIndex);
         if (battleGridList == null)
         {
             return;
         }
         for (int i = 0; i < battleGridList.Count; i++)
         {
             NmBattleGrid nmBattleGrid = battleGridList[i];
             if (!(nmBattleGrid == null))
             {
                 if (nmBattleGrid.mMode == E_RENDER_MODE.DISABLE)
                 {
                     nmBattleGrid.SetMode(E_RENDER_MODE.CHANGEPOS);
                 }
             }
         }
     }
     else
     {
         List <NmBattleGrid> battleGridList2 = this.GetBattleGridList(Ally, nStartPosIndex);
         if (battleGridList2 == null)
         {
             return;
         }
         for (int j = 0; j < battleGridList2.Count; j++)
         {
             NmBattleGrid nmBattleGrid2 = battleGridList2[j];
             if (!(nmBattleGrid2 == null))
             {
                 if (nmBattleGrid2.mMode == E_RENDER_MODE.CHANGEPOS)
                 {
                     nmBattleGrid2.SetMode(E_RENDER_MODE.DISABLE);
                 }
             }
         }
         if (Battle.BATTLE.m_iBattleSkillIndex == -1)
         {
             this.ActiveAttackGridCanTarget();
         }
     }
 }
 public ColosseumObserverControlDlg.OBSERVER_SOLDIERINFO GetObSoldierInfo(eBATTLE_ALLY eAlly, short nBuid)
 {
     for (int i = 0; i < 6; i++)
     {
         if (this.m_obSoldier[(int)eAlly][i].m_nBUID == nBuid)
         {
             return(this.m_obSoldier[(int)eAlly][i]);
         }
     }
     for (int i = 0; i < 6; i++)
     {
         if (this.m_obSoldier[(int)eAlly][i].m_nBUID == -1)
         {
             return(this.m_obSoldier[(int)eAlly][i]);
         }
     }
     return(null);
 }
Ejemplo n.º 23
0
 public void ShowHideAlly(eBATTLE_ALLY eBattleAlly, short nExceptBUID, bool bShow, bool bNameCheck)
 {
     NkBattleChar[] arChar = this.m_arChar;
     for (int i = 0; i < arChar.Length; i++)
     {
         NkBattleChar nkBattleChar = arChar[i];
         if (nkBattleChar != null && nkBattleChar.m_k3DChar != null)
         {
             if (nkBattleChar.Ally == eBattleAlly && nkBattleChar.GetBUID() != nExceptBUID)
             {
                 nkBattleChar.SetShowHide3DModel(bShow, bShow, bNameCheck);
             }
             if (nkBattleChar.Ally != eBattleAlly)
             {
                 nkBattleChar.SetShowHeadUp(bShow, !bShow, true);
             }
         }
     }
 }
 public override void Update()
 {
     base.Update();
     if (Battle.BATTLE == null)
     {
         return;
     }
     if (Battle.BATTLE.CurrentTurnAlly != this.m_eCurrentTurnAlly)
     {
         this.m_eCurrentTurnAlly = Battle.BATTLE.CurrentTurnAlly;
         this.SetCurrentTurnAlly(this.m_eCurrentTurnAlly);
     }
     if (this.m_fEndTime != 0f && this.m_fEndTime < Time.realtimeSinceStartup)
     {
         UnityEngine.Object.Destroy(this.m_goStartCount);
         this.m_goStartCount = null;
         this.m_fEndTime     = 0f;
     }
 }
 public void SetEnableTurn(eBATTLE_ALLY nAlly, short nBUID, bool bEnable)
 {
     ColosseumObserverControlDlg.OBSERVER_SOLDIERINFO obSoldierInfo = this.GetObSoldierInfo(nAlly, nBUID);
     if (obSoldierInfo == null)
     {
         return;
     }
     if (obSoldierInfo.m_goTurnEffect == null)
     {
         return;
     }
     if (bEnable)
     {
         obSoldierInfo.m_goTurnEffect.SetActive(true);
     }
     else
     {
         obSoldierInfo.m_goTurnEffect.SetActive(false);
     }
 }
    public void SetAngerText(eBATTLE_ALLY nAlly)
    {
        this.m_obAnger[(int)nAlly].m_lbAngerPoint.SetText(this.m_obAnger[(int)nAlly].m_nAngerPoint.ToString());
        float num;

        if (this.m_obAnger[(int)nAlly].m_nAngerPoint == this.m_obAnger[(int)nAlly].m_nMaxAngerPoint)
        {
            num = this.m_obAnger[(int)nAlly].m_fMaxAngerSize;
        }
        else
        {
            num = this.m_obAnger[(int)nAlly].m_fMaxAngerSize * ((float)this.m_obAnger[(int)nAlly].m_nAngerPoint / (float)this.m_obAnger[(int)nAlly].m_nMaxAngerPoint);
        }
        if (this.m_obAnger[(int)nAlly].m_fBeforeAngerSize != num)
        {
            this.m_obAnger[(int)nAlly].m_dtAngerGage.SetSize(this.m_obAnger[(int)nAlly].m_dtAngerGage.GetSize().x, num);
            this.m_obAnger[(int)nAlly].m_dtAngerGage.SetLocation(this.m_obAnger[(int)nAlly].m_dtAngerGage.GetLocationX(), this.m_obAnger[(int)nAlly].m_fLoactionY + (this.m_obAnger[(int)nAlly].m_fMaxAngerSize - this.m_obAnger[(int)nAlly].m_dtAngerGage.GetSize().y));
            this.m_obAnger[(int)nAlly].m_fBeforeAngerSize = num;
        }
    }
Ejemplo n.º 27
0
    private void UpdateGrid(eBATTLE_ALLY Ally, short nStartPosIndex, BATTLE_POS_GRID kPosGrid)
    {
        List <NmBattleGrid> list = this.GetBattleGridList(Ally, nStartPosIndex);

        if (list == null)
        {
            return;
        }
        if (list.Count != kPosGrid.m_veBUID.Length)
        {
            KeyValuePair <eBATTLE_ALLY, int> key = new KeyValuePair <eBATTLE_ALLY, int>(Ally, (int)nStartPosIndex);
            Transform child = NkUtil.GetChild(this.mRoot.transform, string.Format("GRID{0}_{1}", (int)Ally, nStartPosIndex));
            if (child != null)
            {
                UnityEngine.Object.Destroy(child.gameObject);
            }
            this.m_BattlePosGrid.Remove(key);
            this.m_BattlePosGridSize.Remove(key);
            list = new List <NmBattleGrid>();
            GameObject gameObject = TBSUTIL.Attach(string.Format("GRID{0}_{1}", (int)Ally, nStartPosIndex), this.mRoot);
            for (int i = 0; i < kPosGrid.mListPos.Length; i++)
            {
                Vector3      pos          = kPosGrid.mListPos[i];
                short        bUID         = kPosGrid.m_veBUID[i];
                NmBattleGrid nmBattleGrid = NmBattleGrid.Create(Ally, nStartPosIndex, bUID, pos, i);
                nmBattleGrid.gameObject.transform.parent = gameObject.transform;
                list.Insert(list.Count, nmBattleGrid);
            }
            this.m_BattlePosGridSize.Add(key, new Vector2((float)kPosGrid.m_nWidthCount, (float)kPosGrid.m_nHeightCount));
            this.m_BattlePosGrid.Add(key, list);
            return;
        }
        for (int i = 0; i < list.Count; i++)
        {
            NmBattleGrid nmBattleGrid2 = list[i];
            if (!(nmBattleGrid2 == null))
            {
                nmBattleGrid2.SetBUID(kPosGrid.m_veBUID[i]);
            }
        }
    }
Ejemplo n.º 28
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);
            }
        }
    }
Ejemplo n.º 29
0
    private void Insert(eBATTLE_ALLY Ally, short nStartPosIndex, BATTLE_POS_GRID kPosGrid)
    {
        KeyValuePair <eBATTLE_ALLY, int> key = new KeyValuePair <eBATTLE_ALLY, int>(Ally, (int)nStartPosIndex);

        if (this.m_BattlePosGrid.ContainsKey(key))
        {
            this.UpdateGrid(Ally, nStartPosIndex, kPosGrid);
            return;
        }
        List <NmBattleGrid> list       = new List <NmBattleGrid>();
        GameObject          gameObject = TBSUTIL.Attach(string.Format("GRID{0}_{1}", (int)Ally, nStartPosIndex), this.mRoot);

        for (int i = 0; i < kPosGrid.mListPos.Length; i++)
        {
            Vector3      pos          = kPosGrid.mListPos[i];
            short        bUID         = kPosGrid.m_veBUID[i];
            NmBattleGrid nmBattleGrid = NmBattleGrid.Create(Ally, nStartPosIndex, bUID, pos, i);
            nmBattleGrid.gameObject.transform.parent = gameObject.transform;
            list.Insert(list.Count, nmBattleGrid);
        }
        this.m_BattlePosGridSize.Add(key, new Vector2((float)kPosGrid.m_nWidthCount, (float)kPosGrid.m_nHeightCount));
        this.m_BattlePosGrid.Add(key, list);
    }
Ejemplo n.º 30
0
    public void ChangeTurn(eBATTLE_ALLY eCurrentTurnAlly)
    {
        for (int i = 0; i < 4; i++)
        {
            if (eCurrentTurnAlly == eBATTLE_ALLY.eBATTLE_ALLY_0)
            {
                float num = BATTLE_CONSTANT_Manager.GetInstance().GetValue(eBATTLE_CONSTANT.eBATTLE_CONSTANT_BATTLE_TURN_CONTROL_DELAY);
                this.m_fTime[i]       = Time.realtimeSinceStartup + (float)i * num;
                this.m_nRemainTime[i] = -1;
                NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

                if (this.m_stCharinfo[i].nCharUnique == nrCharUser.GetCharUnique())
                {
                    Battle.BATTLE.EnableOrderTime          = this.m_fTime[i];
                    Battle.BATTLE.BabelAdvantageCharUnique = 0;
                    this.m_nAdvantageIndex = -1;
                    this.m_nMyIndex        = i;
                    base.SetShowLayer(1, true);
                    string empty = string.Empty;
                    NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[]
                    {
                        NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("924"),
                        "charname",
                        TKString.NEWString(this.m_stCharinfo[0].szCharName)
                    });

                    this.m_lbTurnInfo.SetText(empty);
                }
            }
            else
            {
                this.m_lbTurnTime.SetText("-");
                Battle.BATTLE.BabelAdvantageCharUnique = 0;
                base.SetShowLayer(1, false);
            }
        }
    }