From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/XQualifyingRecordsHandler.cs | 190 +++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XQualifyingRecordsHandler.cs (limited to 'Client/Assets/Scripts/XMainClient/XQualifyingRecordsHandler.cs') diff --git a/Client/Assets/Scripts/XMainClient/XQualifyingRecordsHandler.cs b/Client/Assets/Scripts/XMainClient/XQualifyingRecordsHandler.cs new file mode 100644 index 00000000..61a8fc2d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XQualifyingRecordsHandler.cs @@ -0,0 +1,190 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UILib; +using UnityEngine; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XQualifyingRecordsHandler : DlgHandlerBase + { + public uint MatchTotalCount + { + get + { + return this.WinCount + this.DrawCount + this.LoseCount; + } + } + + public uint MatchTotalPercent + { + get + { + bool flag = this.MatchTotalCount == 0u; + uint result; + if (flag) + { + result = 0u; + } + else + { + bool flag2 = this.WinCount == 0u; + if (flag2) + { + result = 0u; + } + else + { + result = Math.Max(1u, 100u * this.WinCount / this.MatchTotalCount); + } + } + return result; + } + } + + protected override string FileName + { + get + { + return "GameSystem/QualifyRecords"; + } + } + + public uint WinCount; + + public uint DrawCount; + + public uint LoseCount; + + public uint ContinueWin; + + public uint ContinueLose; + + public List ProfessionWin = new List(); + + public List GameRecords = new List(); + + public XUIPool m_RecordPool = new XUIPool(XSingleton.singleton.m_uiTool); + + public IXUIButton m_Close; + + public IXUIScrollView m_ScrollView; + + public IXUILabel MatchTotalWin; + + public IXUILabel MatchTotalLose; + + public IXUILabel RateOfTotalWin; + + public IXUILabel MaxConsecutiveWin; + + public IXUILabel MaxConsecutiveLose; + + public List RateOfWinProf = new List(); + + protected override void Init() + { + this.m_Close = (base.transform.Find("Bg/Close").GetComponent("XUIButton") as IXUIButton); + this.m_RecordPool.SetupPool(base.transform.Find("Bg/Bg/ScrollView").gameObject, base.transform.Find("Bg/Bg/ScrollView/RecordTpl").gameObject, 20u, false); + this.m_ScrollView = (base.transform.Find("Bg/Bg/ScrollView").GetComponent("XUIScrollView") as IXUIScrollView); + this.MatchTotalWin = (base.transform.Find("Bg/Bg/Message/Win/Label").GetComponent("XUILabel") as IXUILabel); + this.MatchTotalLose = (base.transform.Find("Bg/Bg/Message/Lose/Label").GetComponent("XUILabel") as IXUILabel); + this.RateOfTotalWin = (base.transform.Find("Bg/Bg/Message/Rate/Label").GetComponent("XUILabel") as IXUILabel); + this.MaxConsecutiveWin = (base.transform.Find("Bg/Bg/Message/ConsWin/Label").GetComponent("XUILabel") as IXUILabel); + this.MaxConsecutiveLose = (base.transform.Find("Bg/Bg/Message/ConsLose/Label").GetComponent("XUILabel") as IXUILabel); + Transform transform = base.transform.Find("Bg/Bg/Message/WinRate"); + for (int i = 0; i < transform.childCount; i++) + { + IXUILabel item = transform.Find(string.Format("Rate{0}", i)).GetComponent("XUILabel") as IXUILabel; + this.RateOfWinProf.Add(item); + } + } + + public override void RegisterEvent() + { + this.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked)); + } + + protected override void OnShow() + { + base.OnShow(); + } + + protected override void OnHide() + { + base.OnHide(); + } + + public override void OnUnload() + { + base.OnUnload(); + } + + public void Refresh() + { + bool flag = !base.PanelObject.activeSelf; + if (flag) + { + base.SetVisible(true); + } + this.MatchTotalWin.SetText(this.WinCount.ToString()); + this.MatchTotalLose.SetText(this.LoseCount.ToString()); + this.RateOfTotalWin.SetText(this.MatchTotalPercent.ToString() + "%"); + this.MaxConsecutiveWin.SetText(this.ContinueWin.ToString()); + this.MaxConsecutiveLose.SetText(this.ContinueLose.ToString()); + for (int i = 0; i < this.RateOfWinProf.Count; i++) + { + bool flag2 = i >= XGame.RoleCount || i >= this.ProfessionWin.Count; + if (flag2) + { + this.RateOfWinProf[i].gameObject.SetActive(false); + } + else + { + this.RateOfWinProf[i].gameObject.SetActive(true); + this.RateOfWinProf[i].SetText(this.ProfessionWin[i].ToString() + "%"); + } + } + this.m_RecordPool.FakeReturnAll(); + for (int j = 0; j < this.GameRecords.Count; j++) + { + GameObject gameObject = this.m_RecordPool.FetchGameObject(false); + IXUILabel ixuilabel = gameObject.transform.Find("OpponentName").GetComponent("XUILabel") as IXUILabel; + IXUISprite ixuisprite = gameObject.transform.Find("Avatar").GetComponent("XUISprite") as IXUISprite; + IXUISprite ixuisprite2 = gameObject.transform.Find("Status").GetComponent("XUISprite") as IXUISprite; + IXUILabelSymbol ixuilabelSymbol = gameObject.transform.Find("Reward").GetComponent("XUILabelSymbol") as IXUILabelSymbol; + ixuilabel.SetText(this.GameRecords[j].name); + ixuisprite.SetSprite(XSingleton.singleton.GetProfIcon((int)this.GameRecords[j].profession)); + switch (this.GameRecords[j].result) + { + case PkResultType.PkResult_Win: + ixuisprite2.SetSprite("jjc-pws-win"); + break; + case PkResultType.PkResult_Lose: + ixuisprite2.SetSprite("jjc-pws-lose"); + break; + case PkResultType.PkResult_Draw: + ixuisprite2.SetSprite("jjc-pws-draw"); + break; + } + ixuilabelSymbol.InputText = XStringDefineProxy.GetString("MATCH_RECORDS_REWARD", new object[] + { + (this.GameRecords[j].point < 0) ? "" : "+", + this.GameRecords[j].point, + XLabelSymbolHelper.FormatSmallIcon(21), + this.GameRecords[j].honorpoint + }); + gameObject.transform.localPosition = this.m_RecordPool.TplPos - new Vector3(0f, (float)(j * this.m_RecordPool.TplHeight)); + } + this.m_RecordPool.ActualReturnAll(false); + this.m_ScrollView.ResetPosition(); + } + + private bool OnCloseClicked(IXUIButton button) + { + base.SetVisible(false); + return true; + } + } +} -- cgit v1.1-26-g67d0