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); } }
private void OnOffTargetEffect(bool bOn) { if (bOn && this.mTargetEffectRoot == null) { this.mTargetEffectRoot = TBSUTIL.Attach("FX_ARROW_MARK", base.gameObject); NrTSingleton <NkEffectManager> .Instance.AddEffect("FX_ARROW_MARK", this.mTargetEffectRoot); } if (null != this.mTargetEffectRoot) { Vector3 vector = new Vector3(0f, 1f, 0f); if (this.BattleChar != null && null != this.BattleChar.GetNameDummy()) { vector += this.BattleChar.GetNameDummy().position; } this.mTargetEffectRoot.transform.position = vector; this.mTargetEffectRoot.SetActive(bOn); } }
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]); } } }
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); }