From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/XLevelUpStatusView.cs | 209 +++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XLevelUpStatusView.cs (limited to 'Client/Assets/Scripts/XMainClient/XLevelUpStatusView.cs') diff --git a/Client/Assets/Scripts/XMainClient/XLevelUpStatusView.cs b/Client/Assets/Scripts/XMainClient/XLevelUpStatusView.cs new file mode 100644 index 00000000..4a5614af --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XLevelUpStatusView.cs @@ -0,0 +1,209 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XLevelUpStatusView : DlgBase + { + public override string fileName + { + get + { + return "GameSystem/LevelUpStatusDlg"; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + private XLevelUpStatusDocument _doc; + + private uint timetoken = 0u; + + private bool canClose = false; + + private XAttributeDefine[] AttrInfos = new XAttributeDefine[] + { + XAttributeDefine.XAttr_Strength_Total, + XAttributeDefine.XAttr_Agility_Total, + XAttributeDefine.XAttr_Intelligence_Total, + XAttributeDefine.XAttr_Vitality_Total + }; + + protected override void Init() + { + base.Init(); + base.uiBehaviour.m_iPlayTween.SetTargetGameObject(base.uiBehaviour.m_iPlayTween.gameObject); + base.uiBehaviour.m_iPlayTween.RegisterOnFinishEventHandler(new OnTweenFinishEventHandler(this.OnPlayTweenFinish)); + this._doc = XDocuments.GetSpecificDocument(XLevelUpStatusDocument.uuID); + base.uiBehaviour.m_AttrFrame.SetActive(false); + base.uiBehaviour.m_FishFrame.SetActive(false); + } + + public override void RegisterEvent() + { + base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClick)); + } + + protected override void OnHide() + { + base.OnHide(); + base.uiBehaviour.m_AttrFrame.SetActive(false); + base.uiBehaviour.m_FishFrame.SetActive(false); + bool flag = this.timetoken > 0u; + if (flag) + { + XSingleton.singleton.KillTimer(this.timetoken); + } + } + + public void OnPlayTweenFinish(IXUITweenTool iPlayTween) + { + bool flag = base.IsVisible(); + if (flag) + { + this.SetVisible(false, true); + } + } + + public bool OnCloseClick(IXUIButton button) + { + bool flag = this.canClose; + if (flag) + { + this.SetVisible(false, true); + } + return true; + } + + private void PlayWingEff() + { + uint curLevel = this._doc.CurLevel; + uint preLevel = this._doc.PreLevel; + bool flag = curLevel > preLevel; + if (flag) + { + base.uiBehaviour.m_iPlayTween.gameObject.SetActive(false); + base.uiBehaviour.m_objWing.SetActive(true); + base.uiBehaviour.m_lblLevel.SetText(curLevel.ToString()); + this.timetoken = XSingleton.singleton.SetTimer(1.4f, new XTimerMgr.ElapsedEventHandler(this.Handler), null); + } + else + { + this.Handler(null); + } + } + + public void ShowLevelUpStatus() + { + base.uiBehaviour.m_Close.gameObject.GetComponent().enabled = true; + this.canClose = false; + this.Handler(null); + base.uiBehaviour.m_tweenLevel.ResetTween(true); + base.uiBehaviour.m_tweenLevel.PlayTween(true, -1f); + } + + private void Handler(object arg) + { + this.timetoken = XSingleton.singleton.SetTimer(2f, new XTimerMgr.ElapsedEventHandler(this.EnableCollider), null); + base.uiBehaviour.m_objWing.SetActive(false); + base.uiBehaviour.m_iPlayTween.gameObject.SetActive(true); + this.ShowLevelUp(); + } + + private void EnableCollider(object o) + { + this.canClose = true; + this._doc.PreLevel = 0u; + this._doc.CurLevel = 0u; + } + + public void ShowLevelUp() + { + base.uiBehaviour.m_AttrFrame.SetActive(true); + base.uiBehaviour.m_AttrPool.ReturnAll(false); + GameObject gameObject = base.uiBehaviour.m_AttrPool.FetchGameObject(false); + IXUILabel ixuilabel = gameObject.transform.Find("AttrName").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(XStringDefineProxy.GetString("XAttr_Level")); + IXUILabel ixuilabel2 = gameObject.transform.Find("PreValue").GetComponent("XUILabel") as IXUILabel; + ixuilabel2.SetText(this._doc.PreLevel.ToString()); + IXUILabel ixuilabel3 = gameObject.transform.Find("CurValue").GetComponent("XUILabel") as IXUILabel; + ixuilabel3.SetText(this._doc.CurLevel.ToString()); + gameObject.SetActive(false); + this.m_uiBehaviour.m_lblSkillPoint.SetText("x" + this.SkillPoint(this._doc.CurLevel).ToString()); + this.m_uiBehaviour.m_lblCurrLevel.SetText(this._doc.CurLevel.ToString()); + for (int i = 0; i < this._doc.AttrID.Count; i++) + { + gameObject = base.uiBehaviour.m_AttrPool.FetchGameObject(false); + gameObject.transform.localPosition = new Vector3(base.uiBehaviour.m_AttrPool.TplPos.x, base.uiBehaviour.m_AttrPool.TplPos.y - (float)(base.uiBehaviour.m_AttrPool.TplHeight * i), base.uiBehaviour.m_AttrPool.TplPos.z); + ixuilabel = (gameObject.transform.Find("AttrName").GetComponent("XUILabel") as IXUILabel); + ixuilabel.SetText(XStringDefineProxy.GetString(((XAttributeDefine)this._doc.AttrID[i]).ToString())); + ixuilabel2 = (gameObject.transform.Find("PreValue").GetComponent("XUILabel") as IXUILabel); + ixuilabel2.SetText(this._doc.AttrOldValue[i].ToString()); + ixuilabel3 = (gameObject.transform.Find("CurValue").GetComponent("XUILabel") as IXUILabel); + ixuilabel3.SetText(this._doc.AttrNewValue[i].ToString()); + } + bool flag = this._doc.NewSkillID.Count != 0; + if (flag) + { + base.uiBehaviour.m_NewSkillFrame.gameObject.SetActive(true); + base.uiBehaviour.m_sprSkillBg.spriteHeight = 550; + base.uiBehaviour.m_SkillPool.ReturnAll(false); + for (int j = 0; j < this._doc.NewSkillID.Count; j++) + { + gameObject = base.uiBehaviour.m_SkillPool.FetchGameObject(false); + SkillList.RowData skillConfig = XSingleton.singleton.GetSkillConfig(this._doc.NewSkillID[j], 0u); + IXUISprite ixuisprite = gameObject.GetComponent("XUISprite") as IXUISprite; + IXUISprite ixuisprite2 = gameObject.transform.Find("Bg").GetComponent("XUISprite") as IXUISprite; + bool flag2 = skillConfig.SkillType == 3; + if (flag2) + { + ixuisprite2.SetSprite("JN_bd0"); + } + else + { + bool flag3 = skillConfig.SkillType == 2; + if (flag3) + { + ixuisprite2.SetSprite("JN_dk_0"); + } + else + { + ixuisprite2.SetSprite("JN_dk"); + } + } + ixuisprite.SetSprite(skillConfig.Icon, skillConfig.Atlas, false); + gameObject.transform.localPosition = new Vector3(base.uiBehaviour.m_SkillPool.TplPos.x - (float)(this._doc.NewSkillID.Count - 1 - j * 2) / 2f * (float)ixuisprite2.spriteWidth, base.uiBehaviour.m_SkillPool.TplPos.y); + } + } + else + { + base.uiBehaviour.m_NewSkillFrame.gameObject.SetActive(false); + base.uiBehaviour.m_sprSkillBg.spriteHeight = 400; + } + base.uiBehaviour.m_iPlayTween.PlayTween(true, -1f); + } + + public int SkillPoint(uint level) + { + PlayerLevelTable levelTable = XSingleton.singleton.LevelTable; + for (int i = 0; i < levelTable.Table.Length; i++) + { + bool flag = (long)levelTable.Table[i].Level == (long)((ulong)level); + if (flag) + { + return levelTable.Table[i].AddSkillPoint; + } + } + return 1; + } + } +} -- cgit v1.1-26-g67d0