From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/XBillboardComponent.cs | 1636 ++++++++++++++++++++ 1 file changed, 1636 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XBillboardComponent.cs (limited to 'Client/Assets/Scripts/XMainClient/XBillboardComponent.cs') diff --git a/Client/Assets/Scripts/XMainClient/XBillboardComponent.cs b/Client/Assets/Scripts/XMainClient/XBillboardComponent.cs new file mode 100644 index 00000000..4339971c --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XBillboardComponent.cs @@ -0,0 +1,1636 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal sealed class XBillboardComponent : XComponent + { + public override uint ID + { + get + { + return XBillboardComponent.uuID; + } + } + + public float viewDistance + { + get + { + return this._viewDistance; + } + } + + public bool alwaysShow + { + get + { + return this._alwaysShow; + } + } + + private bool isTerritoryFight + { + get + { + return XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT || XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("Character_Billboard"); + + public static string HPBAR_TEMPLATE = "UI/Billboard/Billboard"; + + private static readonly string BOSS_ICON_ATLAS = "common/Billboard"; + + private static readonly string BOSS_ICON_SPRITE = "BOSSicon"; + + private static readonly string ELITE_ICON_ATLAS = "common/Billboard"; + + private static readonly string ELITE_ICON_SPRITE = "BOSSicon"; + + private static readonly string GUILD_ICON_ATLAS = "common/Billboard"; + + private static readonly string DESIGNATION_ATLAS = "common/Title"; + + private static readonly string MILITARY_ATLAS = "common/Billboard"; + + private static readonly string NPCFAVOR_ICON_SPRITE = "Blessing"; + + private static readonly string POINT_ATLAS = "common/Billboard"; + + private Transform _billboard = null; + + private float _heroHeight = 10f; + + private float f = 1f; + + private IUIDummy _uiDummy = null; + + private static float k = 0.001f; + + private static float[] fscale; + + private float _heroRidingHeight = 0.5f; + + private IXUIProgress _bloodBar = null; + + private IXUIProgress _indureBar; + + public IXUIBillBoardCompRef _compRef; + + public IXUISpecLabelSymbol _desiSpcSymbol; + + public IXUISpecLabelSymbol _guildSpcSymbol; + + public IXUISpecLabelSymbol _nameSpcSymbol; + + private bool InitByMaster = false; + + private string _nameColor = ""; + + private float _viewDistance = 0f; + + private bool _alwaysShow = false; + + private int _alwaysHide = 0; + + private BillboardUsage _secondbar_usage = BillboardUsage.Indure; + + private bool _bHitFlag = false; + + private uint _timer = 0u; + + private uint _hideTimer = 0u; + + private bool _onFreezeBuff = false; + + private UIBuffInfo _freezeBuffInfo; + + public static readonly Color billboard_red = new Color32(byte.MaxValue, 61, 35, byte.MaxValue); + + public static readonly Color billboard_yellow = new Color32(byte.MaxValue, byte.MaxValue, 0, byte.MaxValue); + + public static readonly Color billboard_gold = new Color32(byte.MaxValue, 153, 0, byte.MaxValue); + + public static readonly Color billboard_sgreen = new Color32(123, byte.MaxValue, 128, byte.MaxValue); + + public static readonly Color billboard_green = new Color32(92, byte.MaxValue, 0, byte.MaxValue); + + public static readonly Color billboard_blue = new Color32(0, 189, byte.MaxValue, byte.MaxValue); + + public static readonly Color billboard_white = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); + + public static readonly Color billboard_ally_hp = new Color32(byte.MaxValue, 236, 0, byte.MaxValue); + + public static readonly Color billboard_favor = new Color32(byte.MaxValue, 145, 69, byte.MaxValue); + + public static readonly Color nullColor = new Color32(0, 0, 0, 0); + + public static readonly string billboardString_red = "[ff3d23]"; + + public static readonly string billboardString_syellow = "[ffeb04]"; + + public static readonly string billboardString_blue = "[00bdff]"; + + public static readonly string billboardString_gold = "[ff9900]"; + + public static readonly string billboardString_white = "[ffffff]"; + + public bool _bHpbarVisible = false; + + public bool _bIndurebarVisible = false; + + private XTimerMgr.ElapsedEventHandler _resetOnHitCb = null; + + private bool _inited = false; + + private bool _active = false; + + private List TextDepthMgr = new List(); + + private List SpriteDepthMgr = new List(); + + private List BoardDepthMgr = new List(); + + private int pointType = int.Parse(XSingleton.singleton.GetValue("BigMeleePointType")); + + public XBillboardComponent() + { + this._resetOnHitCb = new XTimerMgr.ElapsedEventHandler(this.ResetOnHit); + } + + public override void OnAttachToHost(XObject host) + { + base.OnAttachToHost(host); + GameObject billboard = XBillBoardDocument.GetBillboard(this._entity.EngineObject.Position, this._entity.EngineObject.Rotation); + bool flag = billboard != null; + if (flag) + { + billboard.name = this._entity.ID.ToString() + "_billb"; + this._billboard = billboard.transform; + } + this._uiDummy = (this._billboard.GetComponent("UIDummy") as IUIDummy); + bool isNpc = this._entity.IsNpc; + if (isNpc) + { + IUIRect parent = XSingleton.singleton.NpcHpbarRoot.UIComponent as IUIRect; + XSingleton.singleton.AddChild(parent, billboard, XSingleton.singleton.NpcHpbarRoot); + } + else + { + IUIRect parent2 = XSingleton.singleton.HpbarRoot.UIComponent as IUIRect; + XSingleton.singleton.AddChild(parent2, billboard, XSingleton.singleton.HpbarRoot); + } + bool flag2 = XBillboardComponent.fscale == null; + if (flag2) + { + XSingleton.singleton.GetFloatList("BillboardScaleConfig", ref XBillboardComponent.fscale); + } + } + + protected override void EventSubscribe() + { + base.RegisterEvent(XEventDefine.XEvent_HUDAdd, new XComponent.XEventHandler(this.OnHit)); + base.RegisterEvent(XEventDefine.XEvent_GuildInfoChange, new XComponent.XEventHandler(this.OnGuildInfoChange)); + base.RegisterEvent(XEventDefine.XEvent_DesignationInfoChange, new XComponent.XEventHandler(this.OnDesignationInfoChange)); + base.RegisterEvent(XEventDefine.XEvent_TitleChange, new XComponent.XEventHandler(this.OnTitleNameChange)); + base.RegisterEvent(XEventDefine.XEvent_BillboardHide, new XComponent.XEventHandler(this.OnHideSelf)); + base.RegisterEvent(XEventDefine.XEvent_BillboardShowCtrl, new XComponent.XEventHandler(this.OnShowCtrl)); + base.RegisterEvent(XEventDefine.XEvent_FightGroupChanged, new XComponent.XEventHandler(this.OnFightGroupChange)); + base.RegisterEvent(XEventDefine.XEvent_BigMeleePointChange, new XComponent.XEventHandler(this.OnBigMeleePointChange)); + base.RegisterEvent(XEventDefine.XEvent_BigMeleeEnemyChange, new XComponent.XEventHandler(this.OnBigMeleeEnemyChange)); + } + + private bool OnHit(XEventArgs e) + { + this._bHitFlag = true; + bool flag = this._timer > 0u; + if (flag) + { + XSingleton.singleton.KillTimer(this._timer); + } + this._timer = XSingleton.singleton.SetTimer(2f, this._resetOnHitCb, null); + return true; + } + + private void ResetOnHit(object o) + { + this._bHitFlag = false; + } + + private bool OnFightGroupChange(XEventArgs e) + { + this.Refresh(); + return true; + } + + public void Refresh() + { + this.Attached(); + } + + public override void Attached() + { + base.Attached(); + this._inited = true; + this._compRef = (this._billboard.GetComponent("XUIBillBoardCompRef") as IXUIBillBoardCompRef); + this._bloodBar = this._compRef.BloodBar; + this._indureBar = this._compRef.IndureBar; + this._desiSpcSymbol = this._compRef.DesiSpecLabelSymbol; + this._guildSpcSymbol = this._compRef.GuildSpecLabelSymbol; + this._nameSpcSymbol = this._compRef.NameSpecLabelSymbol; + this._active = this._billboard.gameObject.activeInHierarchy; + bool flag = !this._active; + if (!flag) + { + this._desiSpcSymbol.SetVisible(false); + this.UpdateDesignationPos(); + XEntityStatistics.RowData byID = XSingleton.singleton.EntityStatistics.GetByID(this._entity.TypeID); + this._alwaysShow = (!this._entity.IsRole && byID != null && byID.AlwaysHpBar); + bool flag2 = XSingleton.singleton.IsPVEScene(); + if (flag2) + { + bool bSpectator = XSingleton.singleton.bSpectator; + if (bSpectator) + { + bool flag3 = XSingleton.singleton.Player == null || XSingleton.singleton.Player.WatchTo == null; + if (flag3) + { + this._inited = false; + return; + } + } + bool flag4 = XSingleton.singleton.bSpectator ? XSingleton.singleton.IsOpponent(XSingleton.singleton.Player.WatchTo, this._entity) : XSingleton.singleton.IsOpponent(XSingleton.singleton.Player, this._entity); + this._viewDistance = XSingleton.singleton.GetVisibleDistance(0u); + bool isPlayer = this._entity.IsPlayer; + if (isPlayer) + { + this.SetupInfo(false, false, this._alwaysShow, false, "", XBillboardComponent.nullColor, XBillboardComponent.nullColor, XBillboardComponent.nullColor); + this.f = XBillboardComponent.fscale[0]; + } + else + { + bool flag5 = flag4; + if (flag5) + { + bool isBoss = this._entity.IsBoss; + if (isBoss) + { + this._viewDistance = 30f; + this.SetupInfo(true, false, this._alwaysShow, false, XBillboardComponent.billboardString_red, XBillboardComponent.nullColor, XBillboardComponent.nullColor, XBillboardComponent.nullColor); + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr(XBillboardComponent.BOSS_ICON_ATLAS, XBillboardComponent.BOSS_ICON_SPRITE, false), + this.GetStr("", this._nameColor + this._entity.Attributes.Name, false), + this.GetStr(XBillboardComponent.BOSS_ICON_ATLAS, XBillboardComponent.BOSS_ICON_SPRITE, false) + }); + this.f = XBillboardComponent.fscale[1]; + } + else + { + bool isElite = this._entity.IsElite; + if (isElite) + { + this.SetupInfo(true, false, true, true, XBillboardComponent.billboardString_gold, XBillboardComponent.nullColor, XBillboardComponent.billboard_red, XBillboardComponent.billboard_yellow); + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr(XBillboardComponent.ELITE_ICON_ATLAS, XBillboardComponent.ELITE_ICON_SPRITE, false), + this.GetStr("", this._nameColor + this._entity.Attributes.Name, false), + this.GetStr(XBillboardComponent.ELITE_ICON_ATLAS, XBillboardComponent.ELITE_ICON_SPRITE, false) + }); + this._alwaysShow = true; + this._bHpbarVisible = true; + this._bIndurebarVisible = true; + this._secondbar_usage = BillboardUsage.Indure; + this.f = XBillboardComponent.fscale[2]; + } + else + { + bool isOpposer = this._entity.IsOpposer; + if (isOpposer) + { + bool flag6 = this._entity.Prefab == "Empty_monster_trap"; + if (flag6) + { + this.SetupInfo(false, false, false, false, "", XBillboardComponent.nullColor, XBillboardComponent.billboard_red, XBillboardComponent.nullColor); + this._bHpbarVisible = false; + } + else + { + this.SetupInfo(false, false, true, false, "", XBillboardComponent.nullColor, XBillboardComponent.billboard_red, XBillboardComponent.nullColor); + this._bHpbarVisible = true; + } + this.f = XBillboardComponent.fscale[3]; + } + else + { + bool isRole = this._entity.IsRole; + if (isRole) + { + this.SetupInfo(true, true, true, false, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_red, XBillboardComponent.nullColor); + this._alwaysShow = true; + this._bHpbarVisible = true; + this._bIndurebarVisible = false; + this.SetupGuildInfo(); + this.f = XBillboardComponent.fscale[4]; + } + } + } + } + } + else + { + this._viewDistance = 10f; + bool flag7 = !this._entity.IsPuppet && !this._entity.IsSubstance; + if (flag7) + { + XEntityStatistics.RowData byID2 = XSingleton.singleton.EntityStatistics.GetByID(this._entity.TypeID); + bool flag8 = !this._entity.IsRole && byID2 != null; + if (flag8) + { + this.SetupInfo(!byID2.HideName, false, this._alwaysShow, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_ally_hp, XBillboardComponent.nullColor); + } + else + { + this.SetupInfo(true, false, this._alwaysShow, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_ally_hp, XBillboardComponent.nullColor); + } + this._bHpbarVisible = this._alwaysShow; + this.SetupGuildInfo(); + bool isRole2 = this._entity.IsRole; + if (isRole2) + { + this.f = XBillboardComponent.fscale[4]; + } + else + { + this.f = XBillboardComponent.fscale[6]; + } + } + } + } + } + else + { + bool flag9 = XSingleton.singleton.IsPVPScene(); + if (flag9) + { + this._viewDistance = 10f; + this._bHpbarVisible = true; + this._bIndurebarVisible = true; + bool isPlayer2 = this._entity.IsPlayer; + if (isPlayer2) + { + this.f = XBillboardComponent.fscale[0]; + } + else + { + this.f = XBillboardComponent.fscale[4]; + } + bool flag10 = (this._entity.IsRole || (this._entity.Attributes != null && this._entity.Attributes.HostID != 0UL)) && XSingleton.singleton.bSpectator; + if (flag10) + { + bool isPlayer3 = this._entity.IsPlayer; + if (isPlayer3) + { + this._bHpbarVisible = false; + this._bIndurebarVisible = false; + this.SetupInfo(false, false, false, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue); + } + else + { + bool isRole3 = this._entity.IsRole; + if (isRole3) + { + XSpectateSceneDocument specificDocument = XDocuments.GetSpecificDocument(XSpectateSceneDocument.uuID); + bool flag12; + bool flag11 = !specificDocument.TryGetEntityIsBlueTeam(this._entity, out flag12); + if (flag11) + { + this._bHpbarVisible = false; + this._bIndurebarVisible = false; + this.SetupInfo(false, false, false, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue); + } + else + { + bool flag13 = flag12; + if (flag13) + { + this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue); + } + else + { + this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_green, XBillboardComponent.billboard_red, XBillboardComponent.billboard_blue); + } + this._alwaysShow = true; + this._secondbar_usage = BillboardUsage.MP; + this.SetupGuildInfo(); + } + XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes; + this.DealWithTitleNameChange(0u, xroleAttributes.MilitaryRank); + } + else + { + bool flag14 = this._entity.Attributes != null && this._entity.Attributes.HostID > 0UL; + if (flag14) + { + XSpectateSceneDocument specificDocument2 = XDocuments.GetSpecificDocument(XSpectateSceneDocument.uuID); + bool flag16; + bool flag15 = !specificDocument2.TryGetSummonedIsBlueTeam(this._entity, out flag16); + if (flag15) + { + this._bHpbarVisible = false; + this._bIndurebarVisible = false; + this.SetupInfo(false, false, false, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue); + } + else + { + string nameColor = flag16 ? XBillboardComponent.billboardString_blue : XBillboardComponent.billboardString_red; + Color bloodColor = flag16 ? XBillboardComponent.billboard_green : XBillboardComponent.billboard_red; + this._bIndurebarVisible = false; + XEntityStatistics.RowData byID3 = XSingleton.singleton.EntityStatistics.GetByID(this._entity.TypeID); + this.SetupInfo(byID3 == null || !byID3.HideName, false, true, false, nameColor, XBillboardComponent.billboard_green, bloodColor, XBillboardComponent.billboard_blue); + this._bHpbarVisible = this._alwaysShow; + this._secondbar_usage = BillboardUsage.MP; + } + } + } + } + } + else + { + bool flag17 = !this._entity.IsPlayer && XSingleton.singleton.IsOpponent(XSingleton.singleton.Player, this._entity); + if (flag17) + { + bool flag18 = !this._entity.IsRole; + if (flag18) + { + this._bIndurebarVisible = false; + XEntityStatistics.RowData byID4 = XSingleton.singleton.EntityStatistics.GetByID(this._entity.TypeID); + bool flag19 = byID4 != null; + if (flag19) + { + this.SetupInfo(!byID4.HideName, false, true, false, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_red, XBillboardComponent.nullColor); + } + else + { + this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_blue); + } + this.SetupGuildInfo(); + this._bHpbarVisible = this._alwaysShow; + } + else + { + this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_red, XBillboardComponent.billboard_blue); + this.SetupGuildInfo(); + XRoleAttributes xroleAttributes2 = this._entity.Attributes as XRoleAttributes; + this.DealWithTitleNameChange(0u, xroleAttributes2.MilitaryRank); + } + this._secondbar_usage = BillboardUsage.MP; + } + else + { + bool flag20 = !this._entity.IsPlayer && !this._entity.IsRole; + if (flag20) + { + this._bIndurebarVisible = false; + XEntityStatistics.RowData byID5 = XSingleton.singleton.EntityStatistics.GetByID(this._entity.TypeID); + bool flag21 = byID5 != null; + if (flag21) + { + this.SetupInfo(!byID5.HideName, false, true, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.nullColor); + } + else + { + this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue); + } + this.SetupGuildInfo(); + this._bHpbarVisible = this._alwaysShow; + } + else + { + bool flag22 = XSingleton.singleton.SceneType == SceneType.SCENE_BIGMELEE_FIGHT; + if (flag22) + { + this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_white, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue); + } + else + { + this.SetupInfo(true, true, true, true, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_blue, XBillboardComponent.billboard_green, XBillboardComponent.billboard_blue); + } + this.SetupGuildInfo(); + bool isPlayer4 = this._entity.IsPlayer; + if (isPlayer4) + { + this.DealWithTitleNameChange(XSingleton.singleton.XPlayerData.TitleID, XSingleton.singleton.XPlayerData.MilitaryRank); + } + else + { + XRoleAttributes xroleAttributes3 = this._entity.Attributes as XRoleAttributes; + this.DealWithTitleNameChange(0u, xroleAttributes3.MilitaryRank); + } + } + this._secondbar_usage = BillboardUsage.MP; + } + } + } + else + { + bool isPlayer5 = this._entity.IsPlayer; + if (isPlayer5) + { + this.SetupInfo(true, true, false, false, XBillboardComponent.billboardString_blue, XBillboardComponent.billboard_sgreen, XBillboardComponent.nullColor, XBillboardComponent.nullColor); + this.SetupGuildInfo(); + XDesignationDocument specificDocument3 = XDocuments.GetSpecificDocument(XDesignationDocument.uuID); + this.DealWithDesignation(specificDocument3.CoverDesignationID, specificDocument3.SpecialDesignation); + this.DealWithTitleNameChange(XSingleton.singleton.XPlayerData.TitleID, XSingleton.singleton.XPlayerData.MilitaryRank); + this.f = XBillboardComponent.fscale[0]; + } + else + { + bool flag23 = XSingleton.singleton.IsAlly(this._entity); + if (flag23) + { + this._viewDistance = Mathf.Sqrt(XQualitySetting._FadeDistance); + bool isRole4 = this._entity.IsRole; + if (isRole4) + { + this.SetupInfo(true, true, false, false, XBillboardComponent.billboardString_white, XBillboardComponent.billboard_sgreen, XBillboardComponent.nullColor, XBillboardComponent.nullColor); + this.SetupGuildInfo(); + XRoleAttributes xroleAttributes4 = this._entity.Attributes as XRoleAttributes; + this.DealWithDesignation(xroleAttributes4.DesignationID, xroleAttributes4.SpecialDesignation); + this.DealWithTitleNameChange(this._entity.Attributes.TitleID, xroleAttributes4.MilitaryRank); + this.f = XBillboardComponent.fscale[4]; + } + else + { + this.SetupInfo(true, false, this._alwaysShow, false, XBillboardComponent.billboardString_white, XBillboardComponent.billboard_white, XBillboardComponent.nullColor, XBillboardComponent.nullColor); + this.f = XBillboardComponent.fscale[6]; + } + } + else + { + bool isNpc = this._entity.IsNpc; + if (isNpc) + { + XNpcInfo.RowData byNPCID = XSingleton.singleton.NpcInfo.GetByNPCID(this._entity.TypeID); + bool flag24 = byNPCID.NPCType == 2u; + if (flag24) + { + this._nameSpcSymbol.SetVisible(false); + } + else + { + XNPCFavorDocument specificDocument4 = XDocuments.GetSpecificDocument(XNPCFavorDocument.uuID); + bool flag25 = specificDocument4.IsShowNPCFavoritePlayer(this._entity.TypeID); + if (flag25) + { + this.SetupInfo(true, true, this._alwaysShow, false, XBillboardComponent.billboardString_syellow, XBillboardComponent.billboard_favor, XBillboardComponent.nullColor, XBillboardComponent.nullColor); + this.SetupNpcFavorInfo(); + } + else + { + this.SetupInfo(true, false, this._alwaysShow, false, XBillboardComponent.billboardString_syellow, XBillboardComponent.nullColor, XBillboardComponent.nullColor, XBillboardComponent.nullColor); + } + this._viewDistance = 10f; + this.f = XBillboardComponent.fscale[5]; + } + } + } + } + } + } + this.DrawStr(this._nameSpcSymbol); + bool isPlayer6 = this._entity.IsPlayer; + if (isPlayer6) + { + this.SetBillBoardDepth(true, 0f); + } + else + { + this.KeepAllDepth(); + } + this._billboard.transform.localScale = new Vector3(XBillboardComponent.k * this.f, XBillboardComponent.k * this.f, XBillboardComponent.k * this.f); + this._uiDummy.alpha = 0f; + } + } + + private void SetupNpcFavorInfo() + { + bool flag = XSingleton.singleton.IsPVEScene() || XSingleton.singleton.IsPVPScene() || !this._entity.IsNpc; + if (flag) + { + this._guildSpcSymbol.SetVisible(false); + } + else + { + XNPCFavorDocument specificDocument = XDocuments.GetSpecificDocument(XNPCFavorDocument.uuID); + string favoritePlayerName = specificDocument.GetFavoritePlayerName(this._entity.TypeID); + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr(XBillboardComponent.GUILD_ICON_ATLAS, XBillboardComponent.NPCFAVOR_ICON_SPRITE, false), + this.GetStr("", string.Format("{0}", favoritePlayerName), false) + }); + this.DrawStr(this._guildSpcSymbol); + XSingleton.singleton.ComSpriteStr.Clear(); + XSingleton.singleton.ComSpriteStr.Add(this.GetStr("", this._nameColor + this._entity.Attributes.Name, false)); + } + } + + private void SetBillBoardSameByMaster() + { + bool flag = XEntity.ValideEntity(this._entity.MobbedBy); + if (flag) + { + XBillboardComponent billBoard = this._entity.MobbedBy.BillBoard; + this._bHpbarVisible = billBoard._bHpbarVisible; + this._bIndurebarVisible = billBoard._bIndurebarVisible; + this._indureBar.SetForegroundColor(XBillboardComponent.billboard_blue); + this._desiSpcSymbol.Copy(billBoard._desiSpcSymbol); + this._guildSpcSymbol.Copy(billBoard._guildSpcSymbol); + this._nameSpcSymbol.Copy(billBoard._nameSpcSymbol); + } + } + + private bool OnGuildInfoChange(XEventArgs e) + { + this.SetupGuildInfo(); + this.UpdateDesignationPos(); + this.KeepAllDepth(); + return true; + } + + private void UpdateDesignationPos() + { + bool isPlayer = this._entity.IsPlayer; + if (isPlayer) + { + XGuildDocument specificDocument = XDocuments.GetSpecificDocument(XGuildDocument.uuID); + bool flag = !specificDocument.bInGuild; + if (flag) + { + this._desiSpcSymbol.gameObject.transform.localPosition = new Vector3(0f, 65f, 0f); + } + else + { + this._desiSpcSymbol.gameObject.transform.localPosition = new Vector3(0f, 96f, 0f); + } + } + else + { + bool isRole = this._entity.IsRole; + if (isRole) + { + XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes; + bool flag2 = xroleAttributes != null; + if (flag2) + { + bool flag3 = string.IsNullOrEmpty(xroleAttributes.GuildName) && XSingleton.singleton.SceneType != SceneType.SCENE_BIGMELEE_FIGHT; + if (flag3) + { + this._desiSpcSymbol.gameObject.transform.localPosition = new Vector3(0f, 65f, 0f); + } + else + { + this._desiSpcSymbol.gameObject.transform.localPosition = new Vector3(0f, 96f, 0f); + } + } + } + } + } + + public void OnFightDesignationInfoChange(uint id) + { + bool isTerritoryFight = this.isTerritoryFight; + if (isTerritoryFight) + { + bool isRole = this._entity.IsRole; + if (isRole) + { + XGuildTerritoryDocument specificDocument = XDocuments.GetSpecificDocument(XGuildTerritoryDocument.uuID); + FightDesignation.RowData designation = specificDocument.GetDesignation(id); + this._desiSpcSymbol.SetVisible(id != 0u && designation != null); + bool flag = id != 0u && designation != null; + if (flag) + { + bool flag2 = string.IsNullOrEmpty(designation.Effect); + if (flag2) + { + this._desiSpcSymbol.Board.SetVisible(true); + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr("", designation.Color + designation.Designation, false) + }); + this.DrawStr(this._desiSpcSymbol); + } + else + { + this._desiSpcSymbol.Board.SetVisible(false); + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr(XBillboardComponent.DESIGNATION_ATLAS, designation.Effect, false) + }); + this.DrawStr(this._desiSpcSymbol); + } + } + } + } + } + + private void DealWithDesignation(uint id, string specDesi) + { + bool isTerritoryFight = this.isTerritoryFight; + if (!isTerritoryFight) + { + XDesignationDocument specificDocument = XDocuments.GetSpecificDocument(XDesignationDocument.uuID); + DesignationTable.RowData byID = specificDocument._DesignationTable.GetByID((int)id); + bool flag = byID == null; + if (flag) + { + id = 0u; + } + this._desiSpcSymbol.SetVisible(id > 0u); + bool flag2 = id > 0u; + if (flag2) + { + bool flag3 = byID.Effect == ""; + if (flag3) + { + this._desiSpcSymbol.Board.SetVisible(true); + bool special = byID.Special; + if (special) + { + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr("", byID.Color + specDesi, false) + }); + } + else + { + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr("", byID.Color + byID.Designation, false) + }); + } + this.DrawStr(this._desiSpcSymbol); + } + else + { + this._desiSpcSymbol.Board.SetVisible(false); + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr(byID.Atlas, byID.Effect, false) + }); + this.DrawStr(this._desiSpcSymbol); + } + } + } + } + + public bool OnDesignationInfoChange(XEventArgs e = null) + { + bool flag = XSingleton.singleton.IsPVEScene() || XSingleton.singleton.IsPVPScene(); + bool result; + if (flag) + { + result = true; + } + else + { + bool isPlayer = this._entity.IsPlayer; + if (isPlayer) + { + XDesignationDocument specificDocument = XDocuments.GetSpecificDocument(XDesignationDocument.uuID); + this.DealWithDesignation(specificDocument.CoverDesignationID, specificDocument.SpecialDesignation); + } + else + { + bool isRole = this._entity.IsRole; + if (isRole) + { + XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes; + this.DealWithDesignation(xroleAttributes.DesignationID, xroleAttributes.SpecialDesignation); + } + } + this.KeepAllDepth(); + result = true; + } + return result; + } + + private void DealWithTitleNameChange(uint titleId, uint level) + { + XSingleton.singleton.ComSpriteStr.Clear(); + bool flag = XSingleton.singleton.CurrentStage.Stage == EXStage.Hall || XSingleton.singleton.SceneType == SceneType.SCENE_PVP || XSingleton.singleton.SceneType == SceneType.SCENE_HEROBATTLE || XSingleton.singleton.SceneType == SceneType.SCENE_GPR || XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT || XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT; + if (flag) + { + MilitaryRankByExploit.RowData byMilitaryRank = XMilitaryRankDocument._militaryReader.GetByMilitaryRank(level); + bool flag2 = byMilitaryRank != null; + if (flag2) + { + XSingleton.singleton.ComSpriteStr.Add(this.GetStr(XBillboardComponent.MILITARY_ATLAS, byMilitaryRank.Icon, false)); + } + } + bool flag3 = !XSingleton.singleton.IsPVPScene(); + if (flag3) + { + bool flag4 = titleId > 0u; + if (flag4) + { + TitleTable.RowData title = XTitleDocument.GetTitle(titleId); + bool flag5 = title != null; + if (flag5) + { + XSingleton.singleton.ComSpriteStr.Add(this.GetStr(title.RankAtlas, title.RankIcon, true)); + } + } + } + XSingleton.singleton.ComSpriteStr.Add(this.GetStr("", this._nameColor + this._entity.Attributes.Name, false)); + } + + public bool OnTitleNameChange(XEventArgs e = null) + { + bool flag = XSingleton.singleton.IsPVEScene(); + bool result; + if (flag) + { + result = true; + } + else + { + bool isPlayer = this._entity.IsPlayer; + if (isPlayer) + { + this.DealWithTitleNameChange(XSingleton.singleton.XPlayerData.TitleID, XSingleton.singleton.XPlayerData.MilitaryRank); + } + else + { + bool isRole = this._entity.IsRole; + if (isRole) + { + XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes; + this.DealWithTitleNameChange(this._entity.Attributes.TitleID, xroleAttributes.MilitaryRank); + } + } + this.DrawStr(this._nameSpcSymbol); + this.KeepAllDepth(); + result = true; + } + return result; + } + + public void OnGuildCollectNpcNameChange(string name) + { + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr("", this._nameColor + name, false) + }); + this.DrawStr(this._nameSpcSymbol); + } + + private void SetupInfo(bool nameState, bool guildState, bool bloodBarState, bool indureBarState, string nameColor, Color guildColor, Color bloodColor, Color indureColor) + { + if (bloodBarState) + { + this._bloodBar.gameObject.SetActive(true); + this._bloodBar.SetForegroundColor(bloodColor); + } + else + { + this._bloodBar.gameObject.SetActive(false); + } + if (nameState) + { + this._nameSpcSymbol.SetVisible(true); + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr("", nameColor + this._entity.Attributes.Name, false) + }); + this._nameColor = nameColor; + } + else + { + this._nameSpcSymbol.SetVisible(false); + } + if (guildState) + { + this._guildSpcSymbol.SetVisible(true); + this._guildSpcSymbol.SetColor(guildColor); + } + else + { + this._guildSpcSymbol.SetVisible(false); + } + if (indureBarState) + { + this._indureBar.gameObject.SetActive(true); + this._indureBar.SetForegroundColor(indureColor); + } + else + { + this._indureBar.gameObject.SetActive(false); + } + } + + private void SetupGuildInfo() + { + bool flag = XSingleton.singleton.IsPVEScene() || XSingleton.singleton.SceneType == SceneType.SCENE_BATTLEFIELD_FIGHT || XSingleton.singleton.SceneType == SceneType.SCENE_BIGMELEE_FIGHT; + if (flag) + { + this._guildSpcSymbol.SetVisible(false); + } + else + { + bool isPlayer = this._entity.IsPlayer; + if (isPlayer) + { + XGuildDocument specificDocument = XDocuments.GetSpecificDocument(XGuildDocument.uuID); + bool bInGuild = specificDocument.bInGuild; + if (bInGuild) + { + this._guildSpcSymbol.SetVisible(true); + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr(XBillboardComponent.GUILD_ICON_ATLAS, XGuildDocument.GetPortraitName(specificDocument.BasicData.portraitIndex), false), + this.GetStr("", string.Format("<{0}>", specificDocument.BasicData.guildName), false) + }); + this.DrawStr(this._guildSpcSymbol); + } + else + { + this._guildSpcSymbol.SetVisible(false); + } + } + else + { + bool isRole = this._entity.IsRole; + if (isRole) + { + XRoleAttributes xroleAttributes = this._entity.Attributes as XRoleAttributes; + bool flag2 = xroleAttributes != null; + if (flag2) + { + bool flag3 = string.IsNullOrEmpty(xroleAttributes.GuildName); + if (flag3) + { + this._guildSpcSymbol.SetVisible(false); + } + else + { + this._guildSpcSymbol.SetVisible(true); + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr(XBillboardComponent.GUILD_ICON_ATLAS, XGuildDocument.GetPortraitName((int)xroleAttributes.GuildPortrait), false), + this.GetStr("", string.Format("<{0}>", xroleAttributes.GuildName), false) + }); + this.DrawStr(this._guildSpcSymbol); + } + } + } + else + { + bool isBoss = this._entity.IsBoss; + if (isBoss) + { + this._guildSpcSymbol.SetVisible(false); + } + } + } + } + } + + public override void OnDetachFromHost() + { + bool flag = this._timer > 0u; + if (flag) + { + XSingleton.singleton.KillTimer(this._timer); + } + bool flag2 = this._hideTimer > 0u; + if (flag2) + { + XSingleton.singleton.KillTimer(this._hideTimer); + } + this._alwaysHide = 0; + this._alwaysShow = false; + this.DestroyGameObjects(); + this._entity.BillBoard = null; + base.OnDetachFromHost(); + } + + private void DestroyGameObjects() + { + bool flag = this._billboard != null; + if (flag) + { + this.ClearRef(this._desiSpcSymbol); + this.ClearRef(this._guildSpcSymbol); + this.ClearRef(this._nameSpcSymbol); + XBillBoardDocument.ReturnBillboard(this._billboard.gameObject); + this._billboard = null; + } + } + + private void ClearRef(IXUISpecLabelSymbol symbol) + { + bool flag = symbol != null; + if (flag) + { + for (int i = 0; i < symbol.SpriteList.Length; i++) + { + symbol.SpriteList[i].spriteName = ""; + symbol.SetSpriteVisibleFalse(i); + } + } + } + + private bool OnHideSelf(XEventArgs e) + { + this._alwaysHide |= 1 << XFastEnumIntEqualityComparer.ToInt(BillBoardHideType.LevelScript); + XBillboardHideEventArgs xbillboardHideEventArgs = e as XBillboardHideEventArgs; + bool flag = this._hideTimer > 0u; + if (flag) + { + XSingleton.singleton.KillTimer(this._hideTimer); + } + this._hideTimer = XSingleton.singleton.SetTimer(xbillboardHideEventArgs.hidetime, new XTimerMgr.ElapsedEventHandler(this.ReShow), null); + return true; + } + + private void ReShow(object o) + { + this._alwaysHide &= ~(1 << XFastEnumIntEqualityComparer.ToInt(BillBoardHideType.LevelScript)); + } + + private bool OnShowCtrl(XEventArgs e) + { + XBillboardShowCtrlEventArgs xbillboardShowCtrlEventArgs = e as XBillboardShowCtrlEventArgs; + bool flag = xbillboardShowCtrlEventArgs.type == BillBoardHideType.Invalid; + bool result; + if (flag) + { + XSingleton.singleton.AddErrorLog("undefine billboard hide type. check code or contect pyc.", null, null, null, null, null); + result = false; + } + else + { + bool show = xbillboardShowCtrlEventArgs.show; + if (show) + { + this._alwaysHide &= ~(1 << XFastEnumIntEqualityComparer.ToInt(xbillboardShowCtrlEventArgs.type)); + } + else + { + this._alwaysHide |= 1 << XFastEnumIntEqualityComparer.ToInt(xbillboardShowCtrlEventArgs.type); + } + result = true; + } + return result; + } + + public override void PostUpdate(float fDeltaT) + { + XEntity xentity = this._host as XEntity; + bool flag = xentity == null; + if (!flag) + { + bool flag2 = !this._entity.IsDummy && !this._active && this._billboard != null; + if (flag2) + { + bool activeInHierarchy = this._billboard.gameObject.activeInHierarchy; + if (!activeInHierarchy) + { + return; + } + this.Attached(); + } + bool flag3 = !this.InitByMaster && this._entity.MobbedBy != null; + if (flag3) + { + this.InitByMaster = true; + XOthersAttributes xothersAttributes = this._entity.Attributes as XOthersAttributes; + bool sameBillBoardByMaster = xothersAttributes.SameBillBoardByMaster; + if (sameBillBoardByMaster) + { + this.SetBillBoardSameByMaster(); + } + } + bool flag4 = !this.InitByMaster && this._entity.Attributes != null && this._entity.Attributes.HostID > 0UL; + if (flag4) + { + this.InitByMaster = true; + this.Refresh(); + } + bool isDummy = this._entity.IsDummy; + if (isDummy) + { + this.UpdateDummyBillboard(); + } + else + { + bool flag5 = !XEntity.ValideEntity(xentity); + if (flag5) + { + this._uiDummy.alpha = 0f; + } + else + { + bool flag6 = this._alwaysHide != 0; + if (flag6) + { + this._uiDummy.alpha = 0f; + } + else + { + XPlayer player = XSingleton.singleton.Player; + bool flag7 = player == null || player.EngineObject == null; + if (flag7) + { + this.DestroyGameObjects(); + } + else + { + float num = Vector3.Distance(xentity.EngineObject.Position, player.EngineObject.Position); + bool flag8 = num > this._viewDistance && !this._bHitFlag; + if (flag8) + { + bool flag9 = this._billboard != null; + if (flag9) + { + bool flag10 = !this._alwaysShow; + if (flag10) + { + this._uiDummy.alpha = 0f; + return; + } + } + } + bool flag11 = this._billboard != null; + if (flag11) + { + this.UpdateHpBar(); + } + } + } + } + } + } + } + + private void UpdateHpBar() + { + bool flag = !this._inited && XSingleton.singleton.Player != null && XSingleton.singleton.Player.WatchTo != null; + if (flag) + { + this.Attached(); + } + bool flag2 = this._uiDummy.alpha == 0f; + if (flag2) + { + this._uiDummy.alpha = 1f; + } + float num = 0.2f; + bool flag3 = !this._bloodBar.gameObject.activeSelf; + if (flag3) + { + num -= 0.05f; + } + bool flag4 = !this._indureBar.gameObject.activeSelf; + if (flag4) + { + num -= 0.05f; + } + this._heroHeight = ((this._entity.Transformer == null || !XEntity.ValideEntity(this._entity.Transformer)) ? this._entity.Height : this._entity.Transformer.Height); + bool flag5 = this._entity.Attributes != null && this._entity.Attributes.Outlook != null && this._entity.Attributes.Outlook.state != null && this._entity.Attributes.Outlook.state.bMounted; + float num2; + if (flag5) + { + num2 = this._heroRidingHeight; + } + else + { + num2 = this._heroHeight; + } + Vector3 position; + position= new Vector3(this._entity.EngineObject.Position.x, this._entity.EngineObject.Position.y + num2 + num, this._entity.EngineObject.Position.z); + bool flag6 = this._entity.Prefab == "Empty_monster"; + if (flag6) + { + bool flag7 = this._entity.Skill.IsCasting() && this._entity.Skill.CurrentSkill.Target != null; + if (flag7) + { + position= new Vector3(this._entity.Skill.CurrentSkill.Target.MoveObj.Position.x, this._entity.Skill.CurrentSkill.Target.MoveObj.Position.y + this._heroHeight + num, this._entity.Skill.CurrentSkill.Target.EngineObject.Position.z); + } + } + this._billboard.position = position; + this._billboard.rotation = XSingleton.singleton.GameCamera.Rotaton; + bool flag8 = XSingleton.singleton.Player != null; + if (flag8) + { + float num3 = XBillboardComponent.k; + float num4 = 6.27f; + float num5 = Vector3.Distance(XSingleton.singleton.GameCamera.UnityCamera.transform.position, this._billboard.position); + bool flag9 = !this._entity.IsPlayer; + if (flag9) + { + bool flag10 = Time.frameCount % 15 == 0; + if (flag10) + { + this.SetBillBoardDepth(false, num5); + } + } + num3 = num3 * this.f * num5 / num4; + this._billboard.localScale = new Vector3(num3, num3, num3); + } + this._bloodBar.gameObject.SetActive(this._bHpbarVisible && !this._entity.Present.IsShowUp); + this._indureBar.gameObject.SetActive(this._bIndurebarVisible && !this._entity.Present.IsShowUp); + bool flag11 = this._entity.Attributes != null; + if (flag11) + { + bool onFreezeBuff = this._onFreezeBuff; + if (onFreezeBuff) + { + bool flag12 = this._freezeBuffInfo == null; + if (!flag12) + { + this._bloodBar.gameObject.SetActive(true); + this._indureBar.gameObject.SetActive(false); + this._bloodBar.value = (float)(this._freezeBuffInfo.HP / this._freezeBuffInfo.maxHP); + Vector3 localScale = this._billboard.localScale; + this._billboard.localScale = localScale * 1.4f; + return; + } + this._onFreezeBuff = false; + } + double attr = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxHP_Total); + double num6 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentHP_Basic); + bool flag13 = num6 < 0.0; + if (flag13) + { + num6 = 0.0; + } + this._bloodBar.value = (float)(num6 / attr); + bool activeInHierarchy = this._indureBar.gameObject.activeInHierarchy; + if (activeInHierarchy) + { + bool flag14 = this._secondbar_usage == BillboardUsage.Indure; + if (flag14) + { + double attr2 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxSuperArmor_Total); + double attr3 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentSuperArmor_Total); + bool flag15 = attr2 > 0.0; + if (flag15) + { + this._indureBar.gameObject.SetActive(true); + bool flag16 = attr3 < attr2; + if (flag16) + { + this._indureBar.value = (float)(attr3 / attr2); + } + else + { + this._indureBar.value = 1f; + } + } + else + { + this._indureBar.gameObject.SetActive(false); + } + } + else + { + bool flag17 = this._secondbar_usage == BillboardUsage.MP; + if (flag17) + { + double attr4 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxMP_Total); + double attr5 = this._entity.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentMP_Basic); + bool flag18 = attr5 < attr4; + if (flag18) + { + this._indureBar.value = (float)(attr5 / attr4); + } + else + { + this._indureBar.value = 1f; + } + } + } + } + } + } + + public void SetFreezeBuffState(UIBuffInfo buff) + { + bool flag = buff == null; + if (flag) + { + this._onFreezeBuff = false; + this._freezeBuffInfo = null; + bool flag2 = XEntity.ValideEntity(this._entity); + if (flag2) + { + this.Attached(); + } + } + else + { + this._onFreezeBuff = true; + this._freezeBuffInfo = buff; + this._nameSpcSymbol.SetVisible(true); + BuffTable.RowData buffData = XSingleton.singleton.GetBuffData((int)buff.buffID, (int)buff.buffLevel); + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr("", XBillboardComponent.billboardString_red + buffData.BuffName, false) + }); + this.DrawStr(this._nameSpcSymbol); + this._bloodBar.SetForegroundColor(XBillboardComponent.billboard_red); + } + } + + public void HideBillboard() + { + this._uiDummy.alpha = 0f; + } + + public void AttachDummyBillboard(string name, int level, int prof) + { + bool flag = XSingleton.singleton.CurrentStage.Stage == EXStage.SelectChar; + if (flag) + { + this._heroHeight = XSingleton.singleton.GetSelectCharDummyHeight((uint)prof); + } + else + { + this._heroHeight = 1f; + } + float num = 0.003f; + this._billboard.localScale = new Vector3(num, num, num); + this._uiDummy.alpha = 1f; + this._compRef = (this._billboard.GetComponent("XUIBillBoardCompRef") as IXUIBillBoardCompRef); + this._bloodBar = this._compRef.BloodBar; + this._indureBar = this._compRef.IndureBar; + this._guildSpcSymbol = this._compRef.GuildSpecLabelSymbol; + this._desiSpcSymbol = this._compRef.DesiSpecLabelSymbol; + this._nameSpcSymbol = this._compRef.NameSpecLabelSymbol; + this._bloodBar.SetVisible(false); + this._indureBar.SetVisible(false); + this._guildSpcSymbol.SetVisible(false); + this._desiSpcSymbol.SetVisible(false); + this._nameSpcSymbol.SetVisible(true); + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr("", string.Concat(new object[] + { + "Lv.", + level, + " ", + name + }), false) + }); + this.DrawStr(this._nameSpcSymbol); + } + + public float GetExitTitleHeight() + { + float num = 0f; + bool flag = this._billboard != null; + if (flag) + { + for (int i = 0; i < this._billboard.childCount; i++) + { + Transform child = this._billboard.GetChild(i); + bool activeSelf = child.gameObject.activeSelf; + if (activeSelf) + { + num = Mathf.Max(num, child.localPosition.y); + } + } + } + return num; + } + + public bool AttachChild(Transform child, bool updatePos = false, float childHeight = 60f) + { + bool flag = this._billboard != null; + bool result; + if (flag) + { + child.parent = this._billboard; + child.transform.localRotation = Quaternion.identity; + child.transform.localScale = Vector3.one; + if (updatePos) + { + float exitTitleHeight = this.GetExitTitleHeight(); + child.transform.localPosition = new Vector3(0f, exitTitleHeight + childHeight, 0f); + } + else + { + child.transform.localPosition = Vector3.zero; + } + result = true; + } + else + { + result = false; + } + return result; + } + + public bool UnAttachChild(Transform child) + { + bool flag = this._billboard != null; + if (flag) + { + for (int i = 0; i < this._billboard.childCount; i++) + { + Transform child2 = this._billboard.GetChild(i); + bool flag2 = child2 == child; + if (flag2) + { + child.parent = null; + return true; + } + } + } + return false; + } + + private void UpdateDummyBillboard() + { + Vector3 vector; + vector= new Vector3(this._entity.EngineObject.Position.x, this._entity.EngineObject.Position.y + this._heroHeight, this._entity.EngineObject.Position.z); + Vector3 vector2 = XSingleton.singleton.Horizontal(XSingleton.singleton.GameCamera.CameraTrans.position - this._entity.EngineObject.Position); + this._billboard.position = vector + vector2 * 0.5f; + this._billboard.rotation = XSingleton.singleton.GameCamera.Rotaton; + } + + public void SetSelectCharStageScale() + { + this._billboard.localScale = this._billboard.localScale / 3f * 2f; + } + + private void KeepAllDepth() + { + this.TextDepthMgr.Clear(); + this.SpriteDepthMgr.Clear(); + this.BoardDepthMgr.Clear(); + this.KeepDepth(this._desiSpcSymbol); + this.KeepDepth(this._guildSpcSymbol); + this.KeepDepth(this._nameSpcSymbol); + bool isPlayer = this._entity.IsPlayer; + if (isPlayer) + { + this.SetBillBoardDepth(true, 0f); + } + } + + private void KeepDepth(IXUISpecLabelSymbol symbol) + { + bool flag = symbol.IsVisible(); + if (flag) + { + bool flag2 = symbol.Label.IsVisible(); + if (flag2) + { + this.TextDepthMgr.Add(symbol.Label); + } + bool flag3 = symbol.Board.IsVisible(); + if (flag3) + { + this.BoardDepthMgr.Add(symbol.Board); + } + for (int i = 0; i < symbol.SpriteList.Length; i++) + { + bool flag4 = symbol.SpriteList[i].IsVisible(); + if (flag4) + { + this.SpriteDepthMgr.Add(symbol.SpriteList[i]); + } + } + } + } + + private void SetBillBoardDepth(bool isMy, float dis = 0f) + { + bool flag = !this._billboard.gameObject.activeInHierarchy; + if (!flag) + { + int num = isMy ? 10 : (-(int)(dis * 100f)); + for (int i = 0; i < this.TextDepthMgr.Count; i++) + { + this.TextDepthMgr[i].spriteDepth = num; + } + for (int j = 0; j < this.SpriteDepthMgr.Count; j++) + { + bool flag2 = this.SpriteDepthMgr[j].spriteName != null; + if (flag2) + { + this.SpriteDepthMgr[j].spriteDepth = num; + } + } + for (int k = 0; k < this.BoardDepthMgr.Count; k++) + { + bool flag3 = this.BoardDepthMgr[k].spriteName != null; + if (flag3) + { + this.BoardDepthMgr[k].spriteDepth = num - 1; + } + } + } + } + + private void DrawStr(IXUISpecLabelSymbol symbol) + { + symbol.SetInputText(XSingleton.singleton.ComSpriteStr); + } + + private string GetStr(string atlas, string sprite, bool isAnimation = false) + { + string result; + if (isAnimation) + { + result = string.Format("{0}|{1}|1", atlas, sprite); + } + else + { + result = string.Format("{0}|{1}|0", atlas, sprite); + } + return result; + } + + private bool OnBigMeleePointChange(XEventArgs e) + { + XBigMeleeBattleDocument.RoleData roleData = XBigMeleeBattleDocument.Doc.userIdToRole[this._entity.ID]; + this.SetBigMeleePointInfo(roleData.point, DlgBase.singleton.CurEnemy == this._entity.ID); + return true; + } + + private bool OnBigMeleeEnemyChange(XEventArgs e) + { + XBigMeleeEnemyChange xbigMeleeEnemyChange = e as XBigMeleeEnemyChange; + XBigMeleeBattleDocument.RoleData roleData = XBigMeleeBattleDocument.Doc.userIdToRole[this._entity.ID]; + this.SetBigMeleePointInfo(roleData.point, xbigMeleeEnemyChange.isEnemy); + return true; + } + + private void SetBigMeleePointInfo(uint point, bool isEnemy) + { + bool flag = this.pointType == 1; + if (flag) + { + int num = 1; + int num2 = 1; + int i; + for (i = (int)point; i >= 10; i /= 10) + { + num++; + num2 *= 10; + } + i = (int)point; + int num3 = 0; + string[] array; + if (isEnemy) + { + array = new string[num + 2]; + array[num3++] = this.GetStr(XBillboardComponent.POINT_ATLAS, "icon_cr", false); + } + else + { + array = new string[num + 1]; + } + array[num3++] = this.GetStr(XBillboardComponent.POINT_ATLAS, "NmFight_jf", false); + for (int j = num3; j < num3 + num; j++) + { + array[j] = this.GetStr(XBillboardComponent.POINT_ATLAS, string.Format("NmFight_{0}", i / num2), false); + i %= num2; + num2 /= 10; + } + XSingleton.singleton.BillBoardCommonSetSpriteStr(array); + } + else if (isEnemy) + { + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr(XBillboardComponent.POINT_ATLAS, "icon_cr", false), + this.GetStr("", string.Format("{0}:{1}", XStringDefineProxy.GetString("POINT"), point), false) + }); + } + else + { + XSingleton.singleton.BillBoardCommonSetSpriteStr(new string[] + { + this.GetStr("", string.Format("{0}:{1}", XStringDefineProxy.GetString("POINT"), point), false) + }); + } + this._guildSpcSymbol.SetVisible(true); + this.DrawStr(this._guildSpcSymbol); + XSingleton.singleton.ComSpriteStr.Clear(); + } + } +} -- cgit v1.1-26-g67d0