| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Runtime.InteropServices; |
| | | using Core.Utilities; |
| | | using KTGMGemClient; |
| | | using Microsoft.VisualBasic; |
| | |
| | | /// 相应的界面指针传到塔防的数据结构内。 |
| | | /// </summary> |
| | | public GameObject towerBulletUIPrefab; |
| | | /// <summary> |
| | | /// 充能条对应的界面 |
| | | /// </summary> |
| | | public GameObject towerEnergyUIPrefab; |
| | | |
| | | /// <summary> |
| | | /// 等待购买开启对应按钮. |
| | |
| | | /// </summary> |
| | | Vector2[] m_arrTowerBulletUIPos; |
| | | BulletUICtl[] arrTowerBulletUi; |
| | | EnergyUICtl[] arrTowerEnergyUi; |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | if (arrTowerBulletUi[x] != null) |
| | | arrTowerBulletUi[x].gameObject.SetActive(false); |
| | | |
| | | if (arrTowerEnergyUi[x] != null) |
| | | arrTowerEnergyUi[x].gameObject.SetActive(false); |
| | | |
| | | m_Tiles[x, y].SetTileType(PlacementGridType.EGridDestroyed); |
| | | |
| | |
| | | // 处理攻击塔位对应的血条 |
| | | m_arrTowerBulletUIPos = new Vector2[dimensions.x]; |
| | | arrTowerBulletUi = new BulletUICtl[dimensions.x]; |
| | | arrTowerEnergyUi = new EnergyUICtl[dimensions.x]; |
| | | |
| | | for (int x = 0; x < dimensions.x; x++) |
| | | { |
| | | m_arrTowerBulletUIPos[x].x = m_arrGridCentUIPos[x, dy].x + m_fGridUISize/2.0f - 10; |
| | | m_arrTowerBulletUIPos[x].y = m_arrGridCentUIPos[x, dy].y; |
| | | |
| | | GameObject img = Instantiate(towerBulletUIPrefab); |
| | | |
| | | GameObject go = GameObject.Find("BattleMainUI"); |
| | | if (!go) continue; |
| | | Transform tp = go.GetComponent<Transform>(); |
| | | |
| | | GameObject img; |
| | | |
| | | img = Instantiate(towerBulletUIPrefab); |
| | | img.GetComponent<Transform>().SetParent(tp, true); |
| | | Vector3 tpos = img.transform.position; |
| | | tpos.x = m_arrTowerBulletUIPos[x].x; |
| | |
| | | BulletUICtl buc = img.GetComponent<BulletUICtl>(); |
| | | arrTowerBulletUi[x] = buc; |
| | | buc.gameObject.SetActive(false); |
| | | |
| | | // 把充能条也创建出来了. |
| | | img = Instantiate(towerEnergyUIPrefab); |
| | | img.GetComponent<Transform>().SetParent(tp, true); |
| | | tpos = img.transform.position; |
| | | tpos.x = m_arrTowerBulletUIPos[x].x; |
| | | tpos.y = m_arrTowerBulletUIPos[x].y; |
| | | img.transform.position = tpos; |
| | | |
| | | img.transform.SetAsFirstSibling(); |
| | | EnergyUICtl euc = img.GetComponent<EnergyUICtl>(); |
| | | arrTowerEnergyUi[x] = euc; |
| | | euc.gameObject.SetActive(false); |
| | | |
| | | } |
| | | |
| | | return; |