| | |
| | | using System.Globalization; |
| | | using Core.Health; |
| | | using Core.Health; |
| | | using Core.Input; |
| | | using Core.Utilities; |
| | | using DG.Tweening; |
| | | using JetBrains.Annotations; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using TMPro; |
| | | using TowerDefense.Level; |
| | |
| | | using UnityEngine.EventSystems; |
| | | using UnityEngine.UI; |
| | | using TowerDefense.Nodes; |
| | | using TowerDefense.Affectors; |
| | | using KTGMGemClient; |
| | | |
| | | namespace TowerDefense.UI.HUD |
| | |
| | | public TextMoveDoTween bloodCrit; |
| | | |
| | | /// <summary> |
| | | /// 减速飘字 |
| | | /// </summary> |
| | | public Image SlowDownWord; |
| | | |
| | | /// <summary> |
| | | /// 暴击飘字 |
| | | /// </summary> |
| | | public Image CritWord; |
| | | |
| | | /// <summary> |
| | | /// 冰冻飘字 |
| | | /// </summary> |
| | | public Image FrostWord; |
| | | |
| | | public Image RestrainWord; |
| | | |
| | | /// <summary> |
| | | /// 购买塔防按钮上的Text. |
| | | /// </summary> |
| | | protected TextMeshProUGUI towerPriceText; |
| | | |
| | | //protected TextMeshProUGUI towerPriceText1; |
| | | |
| | | protected bool tdBuyDisable = false; |
| | | |
| | |
| | | return m_CurrentTower != null; |
| | | } |
| | | } |
| | | |
| | | |
| | | // TowerList用于简单记录相关的数据 |
| | | protected List<Tower> m_listTower = new List<Tower>(); |
| | |
| | | if (tower.towerName != towerOld.towerName) |
| | | continue; |
| | | |
| | | newT = Instantiate(tower, transform); |
| | | newT = tower; |
| | | break; |
| | | } |
| | | |
| | |
| | | // 判断格子上的塔防: |
| | | UIPointer pointer = WrapPointer(pinfo); |
| | | Tower sTower = PickTowerInGrid(pointer); |
| | | |
| | | // 泡泡禁锢状态不允许合并 |
| | | if (sTower && sTower.IsStartBondage) return false; |
| | | |
| | | if (sTower && sTower != towerToMove) |
| | | { |
| | | int testLvl = dragTowerLevel; |
| | |
| | | // 判断格子上的塔防: |
| | | UIPointer pointer = WrapPointer(pinfo); |
| | | Tower sTower = PickTowerInGrid(pointer); |
| | | |
| | | // 泡泡禁锢状态不允许置换 |
| | | if (sTower && sTower.IsStartBondage) return false; |
| | | |
| | | if (sTower && sTower != towerToMove) |
| | | { |
| | |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 提升所有塔的等级,如果现在塔的等级 < level,设置等级为 level,如果 > level 不做改变 |
| | | /// </summary> |
| | | /// <param name="level">从0开始</param> |
| | | public void UpgradeAllTowerMinLevel(int level) |
| | | { |
| | | if (level < 0 || level > ElfUpgradeData.MaxTowerLevel - 1) return; |
| | | |
| | | for (int i = 0; i < m_listTower.Count; ++i) |
| | | { |
| | | if (m_listTower[i].currentLevel < level) |
| | | { |
| | | m_listTower[i].currentLevel = level; |
| | | m_listTower[i].CurrentTowerLevel.SetShowLevel(level + 1); |
| | | m_listTower[i].CurrentTowerLevel.SetScale(level + 1); |
| | | PlayUpgradeEffect(m_listTower[i]); |
| | | } |
| | | } |
| | | UpdateMinLevelArr(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | EndlessBossSkillManager.instance.ClearSkillList(); |
| | | EndlessBossHPManager.instance.SwitchHP(true); |
| | | EndlessBossHPManager.instance.SetCurrentHP(0); |
| | | EndlessLevelManager.instance.WaveManager.HideTunel(); |
| | | |
| | | // 停止所有兵线的出兵 |
| | | for (int i = 0; i < TotalWaveLines; ++i) |
| | |
| | | } |
| | | } |
| | | |
| | | void CloseCanPlace() |
| | | public void CloseCanPlace() |
| | | { |
| | | dragTowerPlacement.CloseCanPlace(); |
| | | if (bInAttackModeTower != null) |
| | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 推拽结束,如果判断HasTower==true 就强行释放 |
| | | /// </summary> |
| | | public void EndDragCancelPlaceTower() |
| | | { |
| | | Debug.Log("强行释放了m_CurrentTower"); |
| | | CancelPlaceTower(null); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 拖动一个Tower之后,松开鼠标或者EndDrag. |
| | | /// 1: 目标点可合成,则直接合成。 |
| | | /// 2: 目标点不管是空白,还是不能放置Tower,都要让当前的Tower返回到原来的TowerPlace |
| | |
| | | } |
| | | else |
| | | { |
| | | GuideCtrl.Ins.EndDrag11_1(); |
| | | GuideCtrl.Ins.EndDrag5_1(); |
| | | CancelPlaceTower(pointerInfo); |
| | | Debug.Log("没有放置在火塔上"); |
| | | } |
| | |
| | | towerToMove.Sell(); |
| | | towerToMove = null; |
| | | } |
| | | if (m_CurrentTower != null && m_CurrentTower.controller != null) |
| | | Destroy(m_CurrentTower.controller.gameObject); |
| | | } |
| | | else if (EndlessLevelManager.instanceExists && IsSubstitute(pointerInfo)) |
| | | { |
| | | CheckCanChangePos(pointerInfo); |
| | | if (EndlessUIStart.instance.GameStartTime >= JsonDataCenter.DOUBLE_GEM_TIME) |
| | | UpgradeAllTowerMinLevel(1); |
| | | } |
| | | // 当前是Skill塔位的状态. |
| | | else if (bSkill) |
| | |
| | | //强制交换塔的时候检查自身充能条 |
| | | newTower1.CheckCtrl(); |
| | | newTower2.CheckCtrl(); |
| | | //Debug.Log($"newTower1:{newTower1.towerName} newTower2:{newTower2.towerName}"); |
| | | |
| | | TowerPlacementGridEndless.instance.PlayPutPs(newTower2.gridPosition.x, newTower2.gridPosition.y); |
| | | return true; |
| | | } |
| | | } |
| | |
| | | public void PlayUpgradeEffect(Tower newTower) |
| | | { |
| | | newTower.CurrentTowerLevel.PlayUpGradeEffect(); |
| | | AudioSourceManager.Ins.Play(AudioEnum.Upgrade); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | if (tm) |
| | | { |
| | | tm.GetComponent<Transform>().SetParent(GameObject.Find("MainUI/TextPanel").GetComponent<Transform>(), true); |
| | | string bloodStr = ""; |
| | | if (doubleHit) |
| | | bloodStr += "Dble!"; |
| | | if (crit) |
| | | bloodStr += "Crt!"; |
| | | bloodStr += "-"; |
| | | string bloodStr = "-"; |
| | | bloodStr += ((Int64)val).ToString(); |
| | | |
| | | tm.moveBloodText(spos.x, spos.y, bloodStr, crit); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 减速飘字 |
| | | /// </summary> |
| | | public void FloatSlowDownWord(Vector3 worldPos) |
| | | { |
| | | Vector3 screenPos = m_Camera.WorldToScreenPoint(worldPos); |
| | | GameObject obj = Instantiate(SlowDownWord.gameObject); |
| | | obj.GetComponent<Transform>().SetParent(GameObject.Find("MainUI/TextPanel").GetComponent<Transform>(), false); |
| | | obj.GetComponent<TextMoveDoTween>().FloatSlowDownWord(screenPos.x, screenPos.y); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 暴击飘字 |
| | | /// </summary> |
| | | public void FloatCritWord(Vector3 worldPos) |
| | | { |
| | | Vector3 screenPos = m_Camera.WorldToScreenPoint(worldPos); |
| | | GameObject obj = Instantiate(CritWord.gameObject); |
| | | obj.GetComponent<Transform>().SetParent(GameObject.Find("MainUI/TextPanel").GetComponent<Transform>(), false); |
| | | obj.GetComponent<TextMoveDoTween>().FloatCritWord(screenPos.x, screenPos.y); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 冰冻飘字 |
| | | /// </summary> |
| | | /// <param name="worldPos"></param> |
| | | public void FloatFrostWord(Vector3 worldPos) |
| | | { |
| | | Vector3 screenPos = m_Camera.WorldToScreenPoint(worldPos); |
| | | GameObject obj = Instantiate(FrostWord.gameObject); |
| | | obj.GetComponent<Transform>().SetParent(GameObject.Find("MainUI/TextPanel").GetComponent<Transform>(), false); |
| | | obj.GetComponent<TextMoveDoTween>().FloatFrostWord(screenPos.x, screenPos.y); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 克制飘字 |
| | | /// </summary> |
| | | /// <param name="worldPos"></param> |
| | | public void FloatRestrainWord(Vector3 worldPos) |
| | | { |
| | | Vector3 screenPos = m_Camera.WorldToScreenPoint(worldPos); |
| | | GameObject obj = Instantiate(RestrainWord.gameObject); |
| | | obj.GetComponent<Transform>().SetParent(GameObject.Find("MainUI/TextPanel").GetComponent<Transform>(), false); |
| | | obj.GetComponent<TextMoveDoTween>().FloatRestrainWord(screenPos.x, screenPos.y); |
| | | } |
| | | |
| | | private void Start() |
| | |
| | | var controller = output.collider.GetComponent<Tower>(); |
| | | if (controller != null) |
| | | { |
| | | // 泡泡禁锢状态不允许拖动 |
| | | if (controller.IsStartBondage) return; |
| | | |
| | | SelectTower(controller); |
| | | } |
| | | |
| | |
| | | CalSelTowerScreenOffset(info, controller); |
| | | } |
| | | |
| | | public void OnPressed(PointerInfo info) |
| | | { |
| | | UIPointer uiPointer = WrapPointer(info); |
| | | RaycastHit output; |
| | | bool hasHit = Physics.Raycast(uiPointer.ray, out output, float.MaxValue, towerSelectionLayer); |
| | | |
| | | if (uiPointer.overUI) return; |
| | | |
| | | if (hasHit) |
| | | { |
| | | Tower controller = output.collider.GetComponent<Tower>(); |
| | | if (controller != null) |
| | | controller.OnPressed(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 鼠标选中一个Tower的时候,计算当前鼠标位置与当前Tower位置在屏幕上坐标位置的偏移量。 |