| | |
| | | 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> |
| | | /// 购买塔防按钮上的Text. |
| | | /// </summary> |
| | | protected TextMeshProUGUI towerPriceText; |
| | | |
| | | //protected TextMeshProUGUI towerPriceText1; |
| | | |
| | | protected bool tdBuyDisable = false; |
| | | |
| | |
| | | // 判断格子上的塔防: |
| | | UIPointer pointer = WrapPointer(pinfo); |
| | | Tower sTower = PickTowerInGrid(pointer); |
| | | |
| | | // 泡泡禁锢状态不允许合并 |
| | | if (sTower.IsBondage) return false; |
| | | |
| | | if (sTower && sTower != towerToMove) |
| | | { |
| | | int testLvl = dragTowerLevel; |
| | |
| | | // 判断格子上的塔防: |
| | | UIPointer pointer = WrapPointer(pinfo); |
| | | Tower sTower = PickTowerInGrid(pointer); |
| | | |
| | | // 泡泡禁锢状态不允许置换 |
| | | if (sTower.IsBondage) return false; |
| | | |
| | | if (sTower && sTower != towerToMove) |
| | | { |
| | |
| | | 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); |
| | | } |
| | | |
| | | private void Start() |
| | |
| | | var controller = output.collider.GetComponent<Tower>(); |
| | | if (controller != null) |
| | | { |
| | | // 泡泡禁锢状态不允许拖动 |
| | | if (controller.IsBondage) 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位置在屏幕上坐标位置的偏移量。 |