From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/XBillBoardDocument.cs | 123 +++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XBillBoardDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/XBillBoardDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/XBillBoardDocument.cs b/Client/Assets/Scripts/XMainClient/XBillBoardDocument.cs new file mode 100644 index 00000000..86c44dec --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XBillBoardDocument.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XBillBoardDocument : XDocComponent + { + public override uint ID + { + get + { + return XBillBoardDocument.uuID; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("BillboardDocument"); + + public static GameObject GetBillboard(Vector3 position, Quaternion quaternion) + { + return XSingleton.singleton.CreateFromPrefab(XBillboardComponent.HPBAR_TEMPLATE, position, quaternion, true, false); + } + + public static void ReturnBillboard(GameObject go) + { + bool flag = go != null; + if (flag) + { + XSingleton.singleton.UnSafeDestroy(go, true, false); + } + } + + public static void PreLoad(int count) + { + XSingleton.singleton.CreateInAdvance(XBillboardComponent.HPBAR_TEMPLATE, count, ECreateHideType.NotHide); + } + + protected override void EventSubscribe() + { + base.EventSubscribe(); + base.RegisterEvent(XEventDefine.XEvent_FightGroupChanged, new XComponent.XEventHandler(this.FightGroupChangeMyself)); + } + + private bool FightGroupChangeMyself(XEventArgs e) + { + XFightGroupChangedArgs xfightGroupChangedArgs = e as XFightGroupChangedArgs; + bool flag = xfightGroupChangedArgs == null || xfightGroupChangedArgs.targetEntity == null || !xfightGroupChangedArgs.targetEntity.IsPlayer; + bool result; + if (flag) + { + result = true; + } + else + { + List all = XSingleton.singleton.GetAll(); + for (int i = 0; i < all.Count; i++) + { + bool flag2 = all[i].Attributes == null; + if (!flag2) + { + bool flag3 = all[i].BillBoard != null; + if (flag3) + { + all[i].BillBoard.Refresh(); + } + } + } + result = true; + } + return result; + } + + public override void OnEnterScene() + { + base.OnEnterScene(); + bool flag = XSingleton.singleton.HpbarRoot != null; + if (flag) + { + XSingleton.singleton.HpbarRoot.gameObject.SetActive(true); + } + bool flag2 = XSingleton.singleton.NpcHpbarRoot != null; + if (flag2) + { + XSingleton.singleton.NpcHpbarRoot.gameObject.SetActive(true); + } + } + + public override void OnEnterSceneFinally() + { + bool flag = XSingleton.singleton.CurrentStage.Stage != EXStage.Hall; + if (flag) + { + bool flag2 = !XSingleton.singleton.IsPVPScene() && !XSingleton.singleton.IsPVEScene(); + if (flag2) + { + XSingleton.singleton.AddErrorLog("Please set the scene PVE or PVP", null, null, null, null, null); + } + } + } + + public static void SetAllBillBoardState(BillBoardHideType type, bool state) + { + List all = XSingleton.singleton.GetAll(); + for (int i = 0; i < all.Count; i++) + { + bool flag = all[i].BillBoard == null; + if (!flag) + { + XBillboardShowCtrlEventArgs @event = XEventPool.GetEvent(); + @event.show = state; + @event.type = type; + @event.Firer = all[i]; + XSingleton.singleton.FireEvent(@event); + } + } + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + } + } +} -- cgit v1.1-26-g67d0