using Common.Utility.CombatEvent; using Fort23.Core; using GameLogic.Combat.CombatTool; using UnityEngine; using Utility; namespace Fort23.Mono { [UIBinding(prefab = "CombatShowTextPanel")] public partial class CombatShowTextPanel : UIPanel { // public static Font huiFuFont; // public static Font shangHai; public static void OpenCombatShowTextPanel(CTaskAwaitBuffer cTaskAwaitBuffer) { cTaskAwaitBuffer.AddTask(UIManager.Instance.LoadAndOpenPanel(null, UILayer.Middle)); // cTaskAwaitBuffer.AddTask(AssetBundleLoadManager.Instance.LoadAssetAsyncTask("hd_0.fontsettings", // delegate(AssetHandle handle) { huiFuFont = handle.AssetObject(); })); // // cTaskAwaitBuffer.AddTask(AssetBundleLoadManager.Instance.LoadAssetAsyncTask("Zhanli_0.fontsettings", // delegate(AssetHandle handle) { shangHai = handle.AssetObject(); })); } private void Init() { } protected override void AddEvent() { CombatEventManager.Instance.AddEventListener(CombatEventType.HarmUpdate, HarmUpdate); CombatEventManager.Instance.AddEventListener(CombatEventType.RecoverUpdate, RecoverUpdate); } protected override void DelEvent() { CombatEventManager.Instance.RemoveEventListener(CombatEventType.HarmUpdate, HarmUpdate); CombatEventManager.Instance.AddEventListener(CombatEventType.RecoverUpdate, RecoverUpdate); } public override void AddButtonEvent() { } private async void RecoverUpdate(IEventData iEventData) { HarmUpdateEventData harmUpdateEventData = iEventData as HarmUpdateEventData; HarmReturnInfo harmReturnInfo = harmUpdateEventData.HarmReturnInfo; CombatHeroEntity heroEntity = harmReturnInfo.target.combatHeroEntity; long att = harmReturnInfo.att; HarmType harmType = harmReturnInfo.harmType; ShowTextWidget widget = await UIManager.Instance.CreateGComponentForObject(ShowTextWidget, null, transform, isInstance: true); widget.ShowUI(heroEntity, att, harmType, false); } private async void HarmUpdate(IEventData iEventData) { HarmUpdateEventData harmUpdateEventData = iEventData as HarmUpdateEventData; HarmReturnInfo harmReturnInfo = harmUpdateEventData.HarmReturnInfo; CombatHeroEntity heroEntity = harmReturnInfo.target.combatHeroEntity; long att = harmReturnInfo.att; HarmType harmType = harmReturnInfo.harmType; ShowTextWidget widget = await UIManager.Instance.CreateGComponentForObject(ShowTextWidget, null, transform, isInstance: true); widget.ShowUI(heroEntity, att, harmType, true); } } }