zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/HotfixView/Event/UI/UpdateHeadInfo_ChangeMaxHpE...

39 lines
1.3 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using DG.Tweening;
using ET.EventType;
using ET;
using System;
using System.Collections.Generic;
2021-04-11 19:50:39 +08:00
using FairyGUI;
2021-04-08 20:09:59 +08:00
namespace ET
{
public class UpdateHeadInfo_ChangeMaxHpEvent : AEvent_Sync<UpdateHeadInfo_ChangeMaxHp>
{
public override void Run(UpdateHeadInfo_ChangeMaxHp args)
{
long id = args.unit.Id;
float tweenTime = args.duration;
var zoneScene = args.zoneScene;
2021-04-08 20:09:59 +08:00
//!玩家的UI
if (id == zoneScene.GetComponent<GlobalVariable>().MyId)
2021-04-08 20:09:59 +08:00
{
if (!(FUIComponent.Instance.Get(FUIPackage.Common_MainUI) is FUI_MainUI ui))
{
return;
}
2021-04-11 19:50:39 +08:00
GProgressBar hpBar = ui.m_mineHeadInfo.m_pBarHp;
2021-04-08 20:09:59 +08:00
DOTween.To(() => (float)hpBar.max, x => hpBar.max = x, args.value, tweenTime).SetEase(Ease.InOutQuad);
}
else
{
//!队友的UI
2021-04-11 19:50:39 +08:00
if (UpdateTeamHeadInfoEvent.TeamMemberHeadInfoDic.TryGetValue(id, out FUI_HeadInfoItem ui))
2021-04-08 20:09:59 +08:00
{
2021-04-11 19:50:39 +08:00
GProgressBar hpBar = ui.m_pBarHp;
2021-04-08 20:09:59 +08:00
DOTween.To(() => (float)hpBar.max, x => hpBar.max = x, args.value, tweenTime).SetEase(Ease.InOutQuad);
}
}
}
}
}