From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/XLevelUpStatusDocument.cs | 338 +++++++++++++++++++++ 1 file changed, 338 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XLevelUpStatusDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/XLevelUpStatusDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/XLevelUpStatusDocument.cs b/Client/Assets/Scripts/XMainClient/XLevelUpStatusDocument.cs new file mode 100644 index 00000000..4ad40c81 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XLevelUpStatusDocument.cs @@ -0,0 +1,338 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XLevelUpStatusDocument : XDocComponent + { + public override uint ID + { + get + { + return XLevelUpStatusDocument.uuID; + } + } + + public bool bBlock + { + get + { + return this._bBlock; + } + set + { + this._bBlock = value; + bool flag = !this._bBlock; + if (flag) + { + this.CheckLevelUp(); + } + } + } + + public List NewSkillID + { + get + { + return this._newSkillID; + } + } + + public uint CurLevel + { + get + { + return this._CurLevel; + } + set + { + this._CurLevel = value; + } + } + + public uint PreLevel + { + get + { + return this._PreLevel; + } + set + { + this._PreLevel = value; + } + } + + public List AttrID + { + get + { + return this._AttrID; + } + set + { + this._AttrID = value; + } + } + + public List AttrOldValue + { + get + { + return this._AttrOldValue; + } + set + { + this._AttrOldValue = value; + } + } + + public List AttrNewValue + { + get + { + return this._AttrNewValue; + } + set + { + this._AttrNewValue = value; + } + } + + public ulong Exp { get; set; } + + public ulong MaxExp { get; set; } + + public new static readonly uint uuID = XSingleton.singleton.XHash("LevelUpStatusDocument"); + + private uint _PreLevel; + + private uint _CurLevel; + + private List _AttrID = new List(); + + private List _AttrOldValue = new List(); + + private List _AttrNewValue = new List(); + + public List _newSkillID = new List(); + + private bool Show = false; + + private bool _bBlock; + + public override void OnAttachToHost(XObject host) + { + base.OnAttachToHost(host); + this.CurLevel = 0u; + this.PreLevel = 0u; + } + + public override void OnEnterScene() + { + base.OnEnterScene(); + } + + public override void OnEnterSceneFinally() + { + this._bBlock = false; + XSingleton.singleton.SetTimer(0.5f, new XTimerMgr.ElapsedEventHandler(this.ShowLevelUp), null); + } + + public void CheckLevelUp() + { + bool bBlock = this._bBlock; + if (!bBlock) + { + bool flag = (this.CurLevel == this.PreLevel && this.CurLevel == 0u) || XSingleton.singleton.Player == null; + if (!flag) + { + XRole player = XSingleton.singleton.Player; + bool flag2 = (this.CurLevel != this.PreLevel || player.Attributes.Exp != this.Exp) && DlgBase.singleton.IsVisible(); + if (flag2) + { + DlgBase.singleton.SetGetExpAnimation(this.CalGetExp(player.Attributes.Exp), XSingleton.singleton.Player.EngineObject.Position); + } + player.Attributes.Level = this.CurLevel; + player.Attributes.Exp = this.Exp; + player.Attributes.MaxExp = this.MaxExp; + bool flag3 = DlgBase.singleton.IsVisible(); + if (flag3) + { + DlgBase.singleton.SetExp(XSingleton.singleton.Player.Attributes as XPlayerAttributes); + DlgBase.singleton.SetLevel(this.CurLevel); + DlgBase.singleton.Show(true); + bool flag4 = DlgBase.singleton._yuyinHandler != null; + if (flag4) + { + DlgBase.singleton._yuyinHandler.Refresh((XSingleton.singleton.SceneType == SceneType.SCENE_HALL) ? YuyinIconType.Hall : YuyinIconType.Guild); + } + } + bool flag5 = DlgBase.singleton.IsVisible(); + if (flag5) + { + DlgBase.singleton.SetExp(); + } + bool flag6 = this.CurLevel > this.PreLevel; + if (flag6) + { + XSingleton.singleton.CreateAndPlay(XSingleton.singleton.GetValue("LevelupFx"), player.MoveObj, Vector3.zero, Vector3.one, 1f, true, 5f, true); + this.SetLevelUpStatus(); + XPlayerLevelChangedEventArgs @event = XEventPool.GetEvent(); + @event.level = this.CurLevel; + @event.PreLevel = this.PreLevel; + @event.Firer = XSingleton.singleton.Doc; + XSingleton.singleton.FireEvent(@event); + XSingleton.singleton.OnLevelChanged(this._CurLevel); + DlgBase.singleton.OnPlayerLevelUp(); + bool flag7 = DlgBase.singleton.IsVisible(); + if (flag7) + { + DlgBase.singleton.OnLevelChange(); + } + } + } + } + } + + public void SetLevelUpStatus() + { + bool flag = (ulong)this.CurLevel >= (ulong)((long)XSingleton.singleton.GetInt("ShowLevelUpLimit")); + if (flag) + { + this.Show = true; + this.ShowLevelUp(null); + } + } + + public void LevelRewardShowLevelUp() + { + bool show = this.Show; + if (show) + { + bool flag = !DlgBase.singleton.IsVisible(); + if (flag) + { + DlgBase.singleton.SetVisible(true, true); + } + this.RefreshNewSkillID(); + DlgBase.singleton.ShowLevelUpStatus(); + this.Show = false; + } + } + + public void ShowLevelUp(object o = null) + { + bool flag = XSingleton.singleton.CurrentStage.Stage == EXStage.Hall && this.Show; + if (flag) + { + bool flag2 = !DlgBase.singleton.IsVisible(); + if (flag2) + { + DlgBase.singleton.SetVisible(true, true); + } + this.RefreshNewSkillID(); + DlgBase.singleton.ShowLevelUpStatus(); + this.Show = false; + } + } + + public void RefreshNewSkillID() + { + this._newSkillID.Clear(); + int num = XFastEnumIntEqualityComparer.ToInt(XSingleton.singleton.Player.PlayerAttributes.Profession); + int num2 = num % 10; + int num3 = (num > 10) ? (num % 100) : 0; + int num4 = (num > 100) ? (num % 1000) : 0; + int num5 = (num > 1000) ? (num % 10000) : 0; + bool flag = num2 > 0; + if (flag) + { + List profSkillID = XSingleton.singleton.GetProfSkillID(num2); + for (int i = 0; i < profSkillID.Count; i++) + { + SkillList.RowData skillConfig = XSingleton.singleton.GetSkillConfig(profSkillID[i], 0u); + bool flag2 = (uint)skillConfig.UpReqRoleLevel[0] == this.CurLevel; + if (flag2) + { + this._newSkillID.Add(profSkillID[i]); + } + } + } + bool flag3 = num3 > 0; + if (flag3) + { + List profSkillID2 = XSingleton.singleton.GetProfSkillID(num3); + for (int j = 0; j < profSkillID2.Count; j++) + { + SkillList.RowData skillConfig2 = XSingleton.singleton.GetSkillConfig(profSkillID2[j], 0u); + bool flag4 = (uint)skillConfig2.UpReqRoleLevel[0] == this.CurLevel; + if (flag4) + { + this._newSkillID.Add(profSkillID2[j]); + } + } + } + bool flag5 = num4 > 0; + if (flag5) + { + List profSkillID3 = XSingleton.singleton.GetProfSkillID(num4); + for (int k = 0; k < profSkillID3.Count; k++) + { + SkillList.RowData skillConfig3 = XSingleton.singleton.GetSkillConfig(profSkillID3[k], 0u); + bool flag6 = (uint)skillConfig3.UpReqRoleLevel[0] == this.CurLevel; + if (flag6) + { + this._newSkillID.Add(profSkillID3[k]); + } + } + } + bool flag7 = num5 > 0; + if (flag7) + { + List profSkillID4 = XSingleton.singleton.GetProfSkillID(num5); + for (int l = 0; l < profSkillID4.Count; l++) + { + SkillList.RowData skillConfig4 = XSingleton.singleton.GetSkillConfig(profSkillID4[l], 0u); + bool flag8 = (uint)skillConfig4.UpReqRoleLevel[0] == this.CurLevel; + if (flag8) + { + this._newSkillID.Add(profSkillID4[l]); + } + } + } + XSingleton.singleton.RecalculateRedPointState(XSysDefine.XSys_Skill, true); + } + + private ulong CalGetExp(ulong preExp) + { + bool flag = this.PreLevel == this.CurLevel; + ulong result; + if (flag) + { + result = this.Exp - preExp; + } + else + { + ulong num = 0UL; + PlayerLevelTable.RowData byLevel = XSingleton.singleton.LevelTable.GetByLevel((int)(this.PreLevel + 1u)); + num += (ulong)(byLevel.Exp - (long)preExp); + for (uint num2 = this.PreLevel + 1u; num2 < this.CurLevel; num2 += 1u) + { + byLevel = XSingleton.singleton.LevelTable.GetByLevel((int)(num2 + 1u)); + num += (ulong)byLevel.Exp; + } + result = num + this.Exp; + } + return result; + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + } + } +} -- cgit v1.1-26-g67d0