76 lines
3.2 KiB
C#
76 lines
3.2 KiB
C#
using DG.Tweening;
|
|
using ET.EventType;
|
|
using ET;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using FairyGUI;
|
|
|
|
namespace ET
|
|
{
|
|
public class InitHeadInfoEvent : AEvent_Sync<InitHeadInfo>
|
|
{
|
|
public override void Run(InitHeadInfo args)
|
|
{
|
|
var zoneScene = args.zoneScene;
|
|
if (!(FUIComponent.Instance.Get(FUIPackage.Common_MainUI) is FUI_MainUI ui))
|
|
{
|
|
return;
|
|
}
|
|
float tweenTime = 0.3f;
|
|
{
|
|
NumericComponent num = zoneScene.GetComponent<UnitComponent>().MyUnit.GetComponent<NumericComponent>();
|
|
GProgressBar hpBar = ui.m_mineHeadInfo.m_pBarHp;
|
|
hpBar.max = num.Get(NumericType.MaxHp);
|
|
DOTween.To(() => (float)hpBar.value, x => hpBar.value = x, num.Get(NumericType.Hp), tweenTime).SetEase(Ease.InOutQuad);
|
|
GProgressBar mpBar = ui.m_mineHeadInfo.m_pbarMp;
|
|
mpBar.max = num.Get(NumericType.MaxMp);
|
|
DOTween.To(() => (float)mpBar.value, x => mpBar.value = x, num.Get(NumericType.Mp), tweenTime).SetEase(Ease.InOutQuad);
|
|
|
|
int level = (int)num.Get(NumericType.Level);
|
|
|
|
long maxExp = CharacterUIHelper.GetMaxExpByLevel((zoneScene.GetComponent<GlobalVariable>().JobId + 1) / 2, level);
|
|
ui.m_mineHeadInfo.m_txtLevel.text = string.Empty + level;
|
|
GProgressBar expBar = ui.m_mineHeadInfo.m_pBarExp;
|
|
expBar.max = maxExp;
|
|
DOTween.To(() => (float)expBar.value, x => expBar.value = x, num.Get(NumericType.Exp), tweenTime).SetEase(Ease.InOutQuad);
|
|
|
|
}
|
|
|
|
|
|
//!队友的UI
|
|
foreach (var kv in UpdateTeamHeadInfoEvent.TeamMemberHeadInfoDic)
|
|
{
|
|
Unit unit = zoneScene.GetComponent<UnitComponent>().Get(kv.Key);
|
|
if (unit == null)
|
|
{
|
|
Log.Error($"unit == null where id ={kv.Key}");
|
|
return;
|
|
}
|
|
NumericComponent num = unit.GetComponent<NumericComponent>();
|
|
if (unit == null)
|
|
{
|
|
Log.Error($"num == null where id ={kv.Key}");
|
|
return;
|
|
}
|
|
GProgressBar hpBar = kv.Value.m_pBarHp;
|
|
hpBar.max = num.Get(NumericType.MaxHp);
|
|
DOTween.To(() => (float)hpBar.value, x => hpBar.value = x, num.Get(NumericType.Hp), tweenTime).SetEase(Ease.InOutQuad);
|
|
GProgressBar mpBar = kv.Value.m_pbarMp;
|
|
mpBar.max = num.Get(NumericType.MaxMp);
|
|
DOTween.To(() => (float)mpBar.value, x => mpBar.value = x, num.Get(NumericType.Mp), tweenTime).SetEase(Ease.InOutQuad);
|
|
|
|
int level = (int)num.Get(NumericType.Level);
|
|
|
|
long maxExp = CharacterUIHelper.GetMaxExpByLevel((zoneScene.GetComponent<GlobalVariable>().JobId + 1) / 2, level);
|
|
kv.Value.m_txtLevel.text = string.Empty + level;
|
|
GProgressBar expBar = kv.Value.m_pBarExp;
|
|
expBar.max = maxExp;
|
|
DOTween.To(() => (float)expBar.value, x => expBar.value = x, num.Get(NumericType.Exp), tweenTime).SetEase(Ease.InOutQuad);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|