1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using Common.Utility.CombatTimer;
- using Fort23.Core;
- using Fort23.UTool;
- using GameLogic.Combat.CombatTool;
- 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;
- if (isHarm)
- {
- text.color=heroEntity.IsEnemy?Color.white:Color.red;
- }
- else
- {
- text.color=Color.green;
- }
- text.text = att.ToString();
- if (Animator != null)
- {
- if (harmType.HasFlag(HarmType.BaoJi))
- {
- Animator.Play("ShowTextWidgetBaoji");
- }
- else
- {
- Animator.Play("ShowTextWidgetShow");
- }
- }
- CombatTimerManager.Instance.AddTimer(1, delegate
- {
- GObjectPool.Instance.Recycle(this);
- });
- }
- }
- }
|