2021-04-08 20:09:59 +08:00
|
|
|
|
using ET;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
[NumericWatcher(NumericType.Title)]
|
|
|
|
|
public class NumericWatcher_Title : INumericWatcher
|
|
|
|
|
{
|
|
|
|
|
public async ETTask Run(Entity entity, float old, float value)
|
|
|
|
|
{
|
|
|
|
|
Log.Info($"@{entity.Id}改变 Title:{old} -> {value}");
|
2021-04-11 19:50:39 +08:00
|
|
|
|
Unit unit = entity.As<Unit>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
int title = MathHelper.RoundToInt(value);
|
|
|
|
|
await Game.EventSystem.Publish(new ET.EventType.ChangeTtile
|
|
|
|
|
{
|
2021-04-20 00:25:04 +08:00
|
|
|
|
zoneScene = entity.ZoneScene(),
|
2021-04-08 20:09:59 +08:00
|
|
|
|
Id = unit.Id,
|
|
|
|
|
title = title
|
|
|
|
|
});
|
|
|
|
|
unit.RefreshPosition();
|
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|