123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- using System.Diagnostics;
- using Common.Utility.CombatTimer;
- using Fort23.Core;
- using Fort23.UTool;
- using GameLogic.Combat.CombatTool;
- using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
- using UnityEngine;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "ShowTextWidget")]
- public partial class ShowTextWidget : UIComponent
- {
- private void Init()
- {
- }
- public override void AddEvent()
- {
- }
- public override void DelEvent()
- {
- }
- public override void AddButtonEvent()
- {
- }
- public void ShowUI(CombatHeroEntity heroEntity, long att, HarmType harmType, bool isHarm)
- {
- Vector3 worldPos = heroEntity.combatHeroGameObject.hpTransform.position;
- Vector3 p = UIManager.Instance.CurrCustomCameraStack.camera.WorldToScreenPoint(worldPos);
- Vector3 p2 = UIManager.Instance.UICamera.ScreenToWorldPoint(p);
- transform.position = p2;
- string playName = "show";
- if (harmType.HasFlag(HarmType.Shields))
- {
- text.color = Color.cyan;
- }
- else if (harmType.HasFlag(HarmType.Buff))
- {
- playName = "buffshow";
- text.color = Color.white;
- }
- else if (harmType.HasFlag(HarmType.Recover))
- {
- text.color = Color.green;
- }
- else if (harmType.HasFlag(HarmType.Default))
- {
- text.color = Color.red;
- }
- // if (isHarm)
- // {
- // text.color=heroEntity.IsEnemy?Color.white:Color.red;
- // }
- // else
- // {
- // text.color=Color.green;
- // }
- text.text = att.ToString();
- anim.Play(playName, false);
- // if (Animator != null)
- // {
- // if (harmType.HasFlag(HarmType.BaoJi))
- // {
- // Animator.Play("ShowTextWidgetBaoji");
- // }
- // else
- // {
- // Animator.Play("ShowTextWidgetShow");
- // }
- // }
- CombatTimerManager.Instance.AddTimer(1, delegate { GObjectPool.Instance.Recycle(this); });
- }
- public void ShowUI(Vector3 p2, long att, HarmType harmType, bool isHarm)
- {
- // Vector3 worldPos = heroEntity.combatHeroGameObject.hpTransform.position;
- // Vector3 p = UIManager.Instance.CurrCustomCameraStack.camera.WorldToScreenPoint(worldPos);
- // Vector3 p2 = UIManager.Instance.UICamera.ScreenToWorldPoint(p);
- transform.position = p2;
- string playName = "show";
- if (harmType.HasFlag(HarmType.Shields))
- {
- text.color = Color.cyan;
- }
- else if (harmType.HasFlag(HarmType.Buff))
- {
- playName = "buffshow";
- text.color = Color.white;
- }
- else if (harmType.HasFlag(HarmType.Recover))
- {
- text.color = Color.green;
- }
- else if (harmType.HasFlag(HarmType.Default))
- {
- text.color = Color.red;
- }
- // if (isHarm)
- // {
- // text.color=heroEntity.IsEnemy?Color.white:Color.red;
- // }
- // else
- // {
- // text.color=Color.green;
- // }
- text.text = att.ToString();
- anim.Play(playName, false);
- // if (Animator != null)
- // {
- // if (harmType.HasFlag(HarmType.BaoJi))
- // {
- // Animator.Play("ShowTextWidgetBaoji");
- // }
- // else
- // {
- // Animator.Play("ShowTextWidgetShow");
- // }
- // }
- CombatTimerManager.Instance.AddTimer(1, delegate { GObjectPool.Instance.Recycle(this); });
- }
- }
- }
|