using System; using KKSG; using UnityEngine; using XMainClient.UI; using XMainClient.UI.UICommon; using XUtliPoolLib; namespace XMainClient { internal class XSelectcharStage : XCharStage { private uint _token2 = 0u; private uint _token3 = 0u; private float _turn_interval = 3f; private float _turn_update = 0f; private bool _character_show = false; public XSelectcharStage() : base(EXStage.SelectChar) { this._turn_interval = XSingleton.singleton.ProShowTurnInterval; this._turn_update = 0f; } public override void OnEnterStage(EXStage eOld) { base.OnEnterStage(eOld); CombineMeshTask.s_CombineMatType = ECombineMatType.EIndependent; XSingleton.singleton.DelayLoad = false; bool flag = this._eStage != eOld; if (flag) { this._auto_enter = false; } this._character_show = false; this._prelusive = true; bool flag2 = eOld == EXStage.Login; if (flag2) { XSingleton.singleton.Start("CutScene/first2second_slash_show", false, true); this._token2 = XSingleton.singleton.SetTimer(XSingleton.singleton.Length, new XTimerMgr.ElapsedEventHandler(this.PresentDone), null); } else { this.ReLogined(); XSingleton.singleton.Uninit(); } XSingleton.singleton.XLoginStep = XLoginStep.EnterGame; } public override void OnLeaveStage(EXStage eNew) { base.OnLeaveStage(eNew); this._character_show = false; XSingleton.singleton.KillTimer(this._token2); XSingleton.singleton.KillTimer(this._token3); CombineMeshTask.s_CombineMatType = ECombineMatType.ECombined; XSingleton.singleton.DelayLoad = true; } public void ReLogined() { this._auto_enter = false; this._cur_tag = 0; DlgBase.singleton.SwitchProfession(-1); XSingleton.singleton.Start("CutScene/second_slash_show", false, true); XSingleton.singleton.ShowSelectCharGerenalUI(); this._prelusive = false; } public static void ShowBillboard(XDummy dummy) { int num = -1; int.TryParse(dummy.EngineObject.Tag, out num); bool flag = num < 0 || num - 1 >= XSingleton.singleton.XPlayerCharacters.PlayerBriefInfo.Count; if (flag) { XSingleton.singleton.AddErrorLog("Character tag ", dummy.EngineObject.Tag, " exceeded server PlayerBriefInfo count.", null, null, null); } else { RoleBriefInfo roleBriefInfo = XSingleton.singleton.XPlayerCharacters.PlayerBriefInfo[num - 1]; bool flag2 = roleBriefInfo == null; if (!flag2) { XSingleton.singleton.HpbarRoot.gameObject.SetActive(true); XSingleton.singleton.NpcHpbarRoot.gameObject.SetActive(true); bool flag3 = dummy.BillBoard == null; if (flag3) { dummy.BillBoard = (XSingleton.singleton.CreateComponent(dummy, XBillboardComponent.uuID) as XBillboardComponent); dummy.BillBoard.AttachDummyBillboard(roleBriefInfo.name, roleBriefInfo.level, (int)((int)roleBriefInfo.type % 10)); } else { dummy.BillBoard.AttachDummyBillboard(roleBriefInfo.name, roleBriefInfo.level, (int)((int)roleBriefInfo.type % 10)); } dummy.BillBoard.SetSelectCharStageScale(); } } } public override void Update(float fDeltaT) { base.Update(fDeltaT); this._turn_update = (this._character_show ? (this._turn_update + fDeltaT) : 0f); bool flag = !this._prelusive; if (flag) { bool flag2 = this._turn_update > this._turn_interval; if (flag2) { base.ShowCharacterTurn(this._cur_tag); } else { bool oneTouch = XSingleton.singleton.OneTouch; if (oneTouch) { Ray ray = XSingleton.singleton.GameCamera.UnityCamera.ScreenPointToRay(XSingleton.singleton.TouchPosition); int num = 1 << LayerMask.NameToLayer("Dummy"); RaycastHit raycastHit; bool flag3 = Physics.SphereCast(ray, 0.1f, out raycastHit, float.PositiveInfinity, num); if (flag3) { int num2 = int.Parse(raycastHit.collider.tag); bool flag4 = this._cur_tag == num2; if (flag4) { base.ShowCharacterTurn(this._cur_tag); } else { base.ShowCharacter(num2); } } } } } bool prelusive = this._prelusive; if (prelusive) { this._character_show = false; } } public override void Play() { XAutoFade.FadeOut2In(0.5f, 0.5f); XSingleton.singleton.SetTimer(0.5f, new XTimerMgr.ElapsedEventHandler(this.EnterFinally), null); } public void EnterGameWorld(int index) { XSingleton.singleton.SetBlockUIVisable(true); XSingleton.singleton.EnterWorld(index); } protected void EnterFinally(object o) { XSingleton.singleton.SceneEnterTo(false); } protected void PresentDone(object o) { XSingleton.singleton.Start("CutScene/second_slash_show", false, true); bool auto_enter = this._auto_enter; if (auto_enter) { base.ShowCharacter(XSingleton.singleton.XPlayerCharacters.SelectedSlot); } else { this._token3 = XSingleton.singleton.SetTimer(0.433f, new XTimerMgr.ElapsedEventHandler(this.FirstShow), XSingleton.singleton.XPlayerCharacters.SelectedSlot); XSingleton.singleton.ShowSelectCharGerenalUI(); this._prelusive = false; } } protected void FirstShow(object o) { int tag = (int)o; base.ShowCharacter(tag); } protected override void PrelusiveDone() { bool flag = this._cur_tag == 0; if (!flag) { DlgBase.singleton.SelectCharIndex = this._cur_tag; bool auto_enter = this._auto_enter; if (auto_enter) { this.EnterGameWorld(this._cur_tag); } else { this._prelusive = false; bool flag2 = this._cur_tag - 1 >= XSingleton.singleton.XPlayerCharacters.PlayerBriefInfo.Count; if (flag2) { XSingleton.singleton.AddErrorLog("Character tag ", this._cur_tag.ToString(), " exceeded server PlayerBriefInfo count.", null, null, null); } else { bool flag3 = XSingleton.singleton.XPlayerCharacters.PlayerBriefInfo[this._cur_tag - 1] == null; if (flag3) { XSingleton.singleton.ShowSelectCharCreatedUI(); } else { int level = XSingleton.singleton.XPlayerCharacters.PlayerBriefInfo[this._cur_tag - 1].level; XSingleton.singleton.ShowSelectCharSelectedUI(XSingleton.singleton.XPlayerCharacters.PlayerBriefInfo[this._cur_tag - 1].name, level); } XSingleton.singleton.Start("CutScene/character_show" + XCharStage.role_type[this._cur_tag], false, true); this._character_show = true; } } } } } }