23 lines
632 B
C#
23 lines
632 B
C#
|
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}");
|
|||
|
var unit = entity.As<Unit>();
|
|||
|
int title = MathHelper.RoundToInt(value);
|
|||
|
await Game.EventSystem.Publish(new ET.EventType.ChangeTtile
|
|||
|
{
|
|||
|
Id = unit.Id,
|
|||
|
title = title
|
|||
|
});
|
|||
|
unit.RefreshPosition();
|
|||
|
await ETTask.CompletedTask;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|