From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/Team/XTeam.cs | 255 +++ .../Assets/Scripts/XMainClient/Team/XTeam.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamBloodUIData.cs | 22 + .../XMainClient/Team/XTeamBloodUIData.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamBonusHandler.cs | 106 + .../XMainClient/Team/XTeamBonusHandler.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamBriefData.cs | 337 ++++ .../XMainClient/Team/XTeamBriefData.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamCategory.cs | 248 +++ .../Scripts/XMainClient/Team/XTeamCategory.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamCategoryMgr.cs | 146 ++ .../XMainClient/Team/XTeamCategoryMgr.cs.meta | 12 + .../XMainClient/Team/XTeamCreateTeamWindow.cs | 62 + .../XMainClient/Team/XTeamCreateTeamWindow.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamDocument.cs | 2016 ++++++++++++++++++++ .../Scripts/XMainClient/Team/XTeamDocument.cs.meta | 12 + .../Team/XTeamDungeonSelectorHandler.cs | 306 +++ .../Team/XTeamDungeonSelectorHandler.cs.meta | 12 + .../XMainClient/Team/XTeamFriendDegreeHandler.cs | 366 ++++ .../Team/XTeamFriendDegreeHandler.cs.meta | 12 + .../XMainClient/Team/XTeamInputPasswordView.cs | 80 + .../Team/XTeamInputPasswordView.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamInviteData.cs | 56 + .../XMainClient/Team/XTeamInviteData.cs.meta | 12 + .../XMainClient/Team/XTeamInviteDocument.cs | 333 ++++ .../XMainClient/Team/XTeamInviteDocument.cs.meta | 12 + .../XMainClient/Team/XTeamInviteListData.cs | 189 ++ .../XMainClient/Team/XTeamInviteListData.cs.meta | 12 + .../XMainClient/Team/XTeamLeagueBattleDocument.cs | 372 ++++ .../Team/XTeamLeagueBattleDocument.cs.meta | 12 + .../XMainClient/Team/XTeamLeagueCreateBehaviour.cs | 25 + .../Team/XTeamLeagueCreateBehaviour.cs.meta | 12 + .../XMainClient/Team/XTeamLeagueCreateView.cs | 56 + .../XMainClient/Team/XTeamLeagueCreateView.cs.meta | 12 + .../XMainClient/Team/XTeamLeagueDetailBehaviour.cs | 28 + .../Team/XTeamLeagueDetailBehaviour.cs.meta | 12 + .../XMainClient/Team/XTeamLeagueDetailView.cs | 85 + .../XMainClient/Team/XTeamLeagueDetailView.cs.meta | 12 + .../Team/XTeamLeagueFinalResultBehavior.cs | 35 + .../Team/XTeamLeagueFinalResultBehavior.cs.meta | 12 + .../Team/XTeamLeagueLoadingBehaviour.cs | 45 + .../Team/XTeamLeagueLoadingBehaviour.cs.meta | 12 + .../XMainClient/Team/XTeamLeagueLoadingView.cs | 141 ++ .../Team/XTeamLeagueLoadingView.cs.meta | 12 + .../XMainClient/Team/XTeamLeagueRankBehavior.cs | 23 + .../Team/XTeamLeagueRankBehavior.cs.meta | 12 + .../XMainClient/Team/XTeamLeagueRankView.cs | 127 ++ .../XMainClient/Team/XTeamLeagueRankView.cs.meta | 12 + .../XMainClient/Team/XTeamLeagueRecordBehavior.cs | 34 + .../Team/XTeamLeagueRecordBehavior.cs.meta | 12 + .../XMainClient/Team/XTeamLeagueRecordView.cs | 140 ++ .../XMainClient/Team/XTeamLeagueRecordView.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamListHandler.cs | 536 ++++++ .../XMainClient/Team/XTeamListHandler.cs.meta | 12 + .../Assets/Scripts/XMainClient/Team/XTeamMember.cs | 228 +++ .../Scripts/XMainClient/Team/XTeamMember.cs.meta | 12 + .../XMainClient/Team/XTeamMemberBriefData.cs | 95 + .../XMainClient/Team/XTeamMemberBriefData.cs.meta | 12 + .../Team/XTeamMemberCountChangedEventArgs.cs | 24 + .../Team/XTeamMemberCountChangedEventArgs.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamMemberMonitor.cs | 441 +++++ .../XMainClient/Team/XTeamMemberMonitor.cs.meta | 12 + .../XMainClient/Team/XTeamMonitorHandler.cs | 448 +++++ .../XMainClient/Team/XTeamMonitorHandler.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamMonitorState.cs | 11 + .../XMainClient/Team/XTeamMonitorState.cs.meta | 12 + .../XMainClient/Team/XTeamMonitorStateMgr.cs | 74 + .../XMainClient/Team/XTeamMonitorStateMgr.cs.meta | 12 + .../XMainClient/Team/XTeamPartnerBonusHandler.cs | 289 +++ .../Team/XTeamPartnerBonusHandler.cs.meta | 12 + .../XMainClient/Team/XTeamPasswordHandler.cs | 133 ++ .../XMainClient/Team/XTeamPasswordHandler.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamPosition.cs | 10 + .../Scripts/XMainClient/Team/XTeamPosition.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamRelation.cs | 170 ++ .../Scripts/XMainClient/Team/XTeamRelation.cs.meta | 12 + .../Assets/Scripts/XMainClient/Team/XTeamRift.cs | 75 + .../Scripts/XMainClient/Team/XTeamRift.cs.meta | 12 + .../XMainClient/Team/XTeamSettingHandler.cs | 331 ++++ .../XMainClient/Team/XTeamSettingHandler.cs.meta | 12 + .../XMainClient/Team/XTeamSmallChatHandler.cs | 202 ++ .../XMainClient/Team/XTeamSmallChatHandler.cs.meta | 12 + .../Assets/Scripts/XMainClient/Team/XTeamState.cs | 12 + .../Scripts/XMainClient/Team/XTeamState.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamTowerRankInfo.cs | 54 + .../XMainClient/Team/XTeamTowerRankInfo.cs.meta | 12 + .../Scripts/XMainClient/Team/XTeamTowerRankList.cs | 17 + .../XMainClient/Team/XTeamTowerRankList.cs.meta | 12 + 88 files changed, 9311 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeam.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeam.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamBloodUIData.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamBloodUIData.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamBonusHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamBonusHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamBriefData.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamBriefData.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamCategory.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamCategory.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamCategoryMgr.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamCategoryMgr.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamCreateTeamWindow.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamCreateTeamWindow.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamDocument.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamDocument.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamDungeonSelectorHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamDungeonSelectorHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamFriendDegreeHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamFriendDegreeHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamInputPasswordView.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamInputPasswordView.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamInviteData.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamInviteData.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamInviteDocument.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamInviteDocument.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamInviteListData.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamInviteListData.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueBattleDocument.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueBattleDocument.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateBehaviour.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateBehaviour.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateView.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateView.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailBehaviour.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailBehaviour.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailView.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailView.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueFinalResultBehavior.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueFinalResultBehavior.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingBehaviour.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingBehaviour.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingView.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingView.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankBehavior.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankBehavior.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankView.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankView.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordBehavior.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordBehavior.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordView.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordView.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamListHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamListHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMember.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMember.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMemberBriefData.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMemberBriefData.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMemberCountChangedEventArgs.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMemberCountChangedEventArgs.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMemberMonitor.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMemberMonitor.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMonitorHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMonitorHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMonitorState.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMonitorState.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamPartnerBonusHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamPartnerBonusHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamPasswordHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamPasswordHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamPosition.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamPosition.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamRelation.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamRelation.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamRift.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamRift.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamSettingHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamSettingHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamSmallChatHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamSmallChatHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamState.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamState.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankInfo.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankInfo.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankList.cs create mode 100644 Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankList.cs.meta (limited to 'Client/Assets/Scripts/XMainClient/Team') diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeam.cs b/Client/Assets/Scripts/XMainClient/Team/XTeam.cs new file mode 100644 index 00000000..a8c033b5 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeam.cs @@ -0,0 +1,255 @@ +using System; +using System.Collections.Generic; +using KKSG; +using XMainClient.UI; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeam + { + public bool bAllReady + { + get + { + return this._bAllReady; + } + } + + public bool bLeaderChanged + { + get + { + return this.m_bLeaderChanged; + } + } + + public XTeamBriefData teamBrief = new XTeamBriefData(); + + public List members = new List(); + + public XTeamMember myData = null; + + private int joinIndex = 0; + + private bool _bAllReady = false; + + public XTeamMember leaderData = null; + + private bool m_bLeaderChanged; + + public void AddMember(TeamMember data) + { + for (int i = 0; i < this.members.Count; i++) + { + XTeamMember xteamMember = this.members[i]; + bool flag = xteamMember.uid == data.memberID; + if (flag) + { + XSingleton.singleton.AddErrorLog("Duplicated member: ", xteamMember.uid.ToString(), null, null, null, null); + return; + } + } + string leaderName = this.teamBrief.leaderName; + int num = this.joinIndex; + this.joinIndex = num + 1; + XTeamMember xteamMember2 = XTeamMember.CreateTeamMember(data, leaderName, num); + this.members.Add(xteamMember2); + bool flag2 = this.myData == null; + if (flag2) + { + XPlayerAttributes xplayerData = XSingleton.singleton.XPlayerData; + bool flag3 = xplayerData != null && xplayerData.EntityID == data.memberID; + if (flag3) + { + this.myData = xteamMember2; + } + } + bool bIsLeader = xteamMember2.bIsLeader; + if (bIsLeader) + { + this.leaderData = xteamMember2; + this.m_bLeaderChanged = true; + } + XSingleton.singleton.AddGreenLog("Add Teammember ", xteamMember2.name, ", uid = ", data.memberID.ToString(), " count = ", this.members.Count.ToString()); + } + + public string RemoveMember(ulong uid) + { + string text = ""; + for (int i = 0; i < this.members.Count; i++) + { + bool flag = this.members[i].uid == uid; + if (flag) + { + text = this.members[i].name; + this.members.RemoveAt(i); + XSingleton.singleton.AddGreenLog("Remove Teammember ", text, ", uid = ", uid.ToString(), ", count = ", this.members.Count.ToString()); + break; + } + } + bool flag2 = string.IsNullOrEmpty(text); + if (flag2) + { + XSingleton.singleton.AddGreenLog("Cant find teammember ", uid.ToString(), " when remove", null, null, null); + } + bool flag3 = this.leaderData != null && this.leaderData.uid == uid; + if (flag3) + { + this.leaderData = null; + } + return text; + } + + public void UpdateMember(TeamMember data) + { + for (int i = 0; i < this.members.Count; i++) + { + XTeamMember xteamMember = this.members[i]; + bool flag = xteamMember.uid == data.memberID; + if (flag) + { + ExpTeamMemberState state = xteamMember.state; + xteamMember.SetData(data, this.teamBrief.leaderName, xteamMember.joinIndex); + ExpTeamMemberState state2 = xteamMember.state; + bool flag2 = xteamMember == this.leaderData && !xteamMember.bIsLeader; + if (flag2) + { + this.leaderData = null; + } + bool flag3 = state == ExpTeamMemberState.EXPTEAM_IDLE && state2 == ExpTeamMemberState.EXPTEAM_DISAGREE; + if (flag3) + { + bool flag4 = this.teamBrief.rowData.Type == 15; + if (flag4) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("RefusePartner", new object[] + { + xteamMember.name + }), "fece00"); + } + else + { + bool flag5 = this.teamBrief.rowData.Type == 17; + if (flag5) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("RefuseCreateTeamLeague", new object[] + { + xteamMember.name + }), "fece00"); + } + else + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("TEAM_REFUSE_BATTLE", new object[] + { + xteamMember.name + }), "fece00"); + } + } + } + break; + } + } + } + + private void UpdateTeamState() + { + this._bAllReady = true; + foreach (XTeamMember xteamMember in this.members) + { + bool flag = xteamMember.position != XTeamPosition.TP_LEADER && xteamMember.state == ExpTeamMemberState.EXPTEAM_IDLE; + if (flag) + { + this._bAllReady = false; + break; + } + } + } + + public void PreUpdate() + { + this.m_bLeaderChanged = false; + } + + public void OnUpdate() + { + bool flag = this.myData == null; + if (flag) + { + XPlayer player = XSingleton.singleton.Player; + bool flag2 = player != null; + if (flag2) + { + for (int i = 0; i < this.members.Count; i++) + { + bool flag3 = this.members[i].uid == player.ID; + if (flag3) + { + this.myData = this.members[i]; + break; + } + } + } + } + } + + public void PostUpdate() + { + bool flag = this.leaderData == null || this.leaderData.name != this.teamBrief.leaderName; + if (flag) + { + bool flag2 = this.leaderData != null; + if (flag2) + { + this.leaderData.position = XTeamPosition.TP_MEMBER; + } + for (int i = 0; i < this.members.Count; i++) + { + bool flag3 = this.members[i].name == this.teamBrief.leaderName; + if (flag3) + { + this.leaderData = this.members[i]; + this.leaderData.position = XTeamPosition.TP_LEADER; + this.m_bLeaderChanged = true; + break; + } + } + } + } + + public void Reset() + { + this.members.Clear(); + this.myData = null; + this.leaderData = null; + } + + public XTeamMember FindMember(ulong uid) + { + for (int i = 0; i < this.members.Count; i++) + { + bool flag = this.members[i].uid == uid; + if (flag) + { + return this.members[i]; + } + } + return null; + } + + public void OnEntityMatchingInfo(AllyMatchRoleID data) + { + ulong roleID = data.roleID; + ulong allyID = data.allyID; + for (int i = 0; i < this.members.Count; i++) + { + bool flag = this.members[i].uid == roleID; + if (flag) + { + this.members[i].entityID = allyID; + break; + } + } + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeam.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeam.cs.meta new file mode 100644 index 00000000..73f21a43 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeam.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ff8fbf732bcceb1498adf2caa4317a6b +timeCreated: 1611404947 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamBloodUIData.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamBloodUIData.cs new file mode 100644 index 00000000..133ff362 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamBloodUIData.cs @@ -0,0 +1,22 @@ +using System; +using KKSG; + +namespace XMainClient +{ + internal class XTeamBloodUIData + { + public ulong uid; + + public ulong entityID; + + public RoleType profession; + + public string name; + + public bool bIsLeader; + + public uint level; + + public bool isLeft = true; + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamBloodUIData.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamBloodUIData.cs.meta new file mode 100644 index 00000000..b20b4585 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamBloodUIData.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9afa11666acb67e4a8f2686437fc6386 +timeCreated: 1611404203 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamBonusHandler.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamBonusHandler.cs new file mode 100644 index 00000000..40755590 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamBonusHandler.cs @@ -0,0 +1,106 @@ +using System; +using UILib; +using UnityEngine; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamBonusHandler : DlgHandlerBase + { + private XUIPool m_AttrPool = new XUIPool(XSingleton.singleton.m_uiTool); + + private XTeamDocument _TeamDoc; + + private IXUIButton m_Root; + + private GameObject m_TitleActive; + + private GameObject m_TitleDisactive; + + private GameObject m_AttrActive; + + private GameObject m_AttrDisactive; + + protected override void Init() + { + base.Init(); + this.m_Root = (base.PanelObject.GetComponent("XUIButton") as IXUIButton); + this.m_TitleActive = base.PanelObject.transform.Find("TitleActive").gameObject; + this.m_TitleDisactive = base.PanelObject.transform.Find("TitleDisactive").gameObject; + Transform transform = base.PanelObject.transform.Find("AttrActive"); + Transform transform2 = base.PanelObject.transform.Find("AttrDisactive"); + this.m_AttrActive = transform.gameObject; + this.m_AttrDisactive = transform2.gameObject; + this._TeamDoc = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + string[] array = XSingleton.singleton.GetValue("TeamGuildBuff").Split(XGlobalConfig.SequenceSeparator); + int num = int.Parse(array[0]); + int num2 = int.Parse(array[1]); + BuffTable.RowData buffData = XSingleton.singleton.GetBuffData(num, num2); + bool flag = buffData == null; + if (flag) + { + XSingleton.singleton.AddErrorLog(string.Format("TeamGuildBuff: Buff data not found: [{0} {1}]", num, num2), null, null, null, null, null); + } + else + { + IXUILabel ixuilabel = transform.Find("Name").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel2 = transform.Find("Value").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel3 = transform2.Find("Name").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel4 = transform2.Find("Value").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(buffData.BuffName); + ixuilabel2.SetText(string.Empty); + ixuilabel3.SetText(buffData.BuffName); + ixuilabel4.SetText(string.Empty); + } + } + + public void Refresh() + { + bool flag = !this._TeamDoc.bInTeam; + if (flag) + { + this._Enable(false); + } + else + { + XTeamMember myData = this._TeamDoc.MyTeam.myData; + bool flag2 = myData == null || myData.guildID == 0UL; + if (flag2) + { + this._Enable(false); + } + else + { + bool flag3 = false; + for (int i = 0; i < this._TeamDoc.MyTeam.members.Count; i++) + { + XTeamMember xteamMember = this._TeamDoc.MyTeam.members[i]; + bool flag4 = xteamMember != myData && xteamMember.guildID == myData.guildID; + if (flag4) + { + flag3 = true; + break; + } + } + bool flag5 = !flag3; + if (flag5) + { + this._Enable(false); + } + else + { + this._Enable(true); + } + } + } + } + + private void _Enable(bool bEnable) + { + this.m_TitleActive.SetActive(bEnable); + this.m_TitleDisactive.SetActive(!bEnable); + this.m_AttrActive.SetActive(bEnable); + this.m_AttrDisactive.SetActive(!bEnable); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamBonusHandler.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamBonusHandler.cs.meta new file mode 100644 index 00000000..5ba2b00f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamBonusHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1f56697ff1558354786eeef5f1b4eb7f +timeCreated: 1611403401 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamBriefData.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamBriefData.cs new file mode 100644 index 00000000..8e392980 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamBriefData.cs @@ -0,0 +1,337 @@ +using System; +using System.Collections.Generic; +using KKSG; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamBriefData : XDataBase, IComparable + { + public ExpeditionTable.RowData rowData; + + public int currentMemberCount; + + public int totalMemberCount; + + public XTeamCategory category; + + public uint dungeonID = 0u; + + public int teamID; + + public string leaderName; + + public int leaderLevel = 44; + + public uint leaderPPT = 555u; + + public RoleType leaderProfession = RoleType.Role_Warrior; + + public XTeamState state = XTeamState.TS_NOT_FULL; + + public TeamState actualState = TeamState.TEAM_WAITING; + + public KMatchType matchType = KMatchType.KMT_NONE; + + public bool hasPwd; + + public string password; + + public string dungeonName; + + public string teamName; + + public uint dungeonLevel; + + public List members = new List(); + + public XTeamRelation relation = new XTeamRelation(); + + public uint teamPPT = 0u; + + public bool isTarja = false; + + public XGoldGroupData goldGroup = default(XGoldGroupData); + + public XTeamRift rift = null; + + public bool regression = false; + + public static int[] DefaultSortDirection = new int[] + { + 1, + 1, + -1, + 1, + 1, + 1 + }; + + public static TeamBriefSortType sortType = TeamBriefSortType.TBST_TEAM_ID; + + public static int dir = 1; + + public static string GetStrTeamPPT(double teamPPT, double myPPT) + { + bool flag = teamPPT == 0.0; + string result; + if (flag) + { + result = XStringDefineProxy.GetString("NONE"); + } + else + { + bool flag2 = myPPT == 0.0; + if (flag2) + { + myPPT = XSingleton.singleton.XPlayerData.GetAttr(XAttributeDefine.XAttr_POWER_POINT_Basic); + } + bool flag3 = myPPT < teamPPT; + if (flag3) + { + result = XSingleton.singleton.StringCombine("[ff0000]", teamPPT.ToString(), "[-]"); + } + else + { + result = teamPPT.ToString(); + } + } + return result; + } + + public XTeamBriefData() + { + this.goldGroup.teamBrief = this; + } + + public string GetStrTeamPPT(double myPPT = 0.0) + { + return XTeamBriefData.GetStrTeamPPT(this.teamPPT, myPPT); + } + + private void _UpdateRelation() + { + this.relation.Reset(); + for (int i = 0; i < this.members.Count; i++) + { + XTeamMemberBriefData xteamMemberBriefData = this.members[i]; + bool flag = xteamMemberBriefData.uid == XSingleton.singleton.XPlayerData.RoleID; + if (flag) + { + xteamMemberBriefData.relation.Reset(); + } + else + { + xteamMemberBriefData.relation.UpdateRelation(xteamMemberBriefData.uid, xteamMemberBriefData.guildid, xteamMemberBriefData.dragonguildid); + this.relation.Append(xteamMemberBriefData.relation.ActualRelation, true); + } + } + } + + public void SetMembers(List memberDatas) + { + this.isTarja = false; + this.regression = false; + for (int i = 0; i < memberDatas.Count; i++) + { + XTeamMemberBriefData data = XDataPool.GetData(); + data.SetData(memberDatas[i], this.leaderName); + this.members.Add(data); + this.regression = (this.regression || data.regression); + this.isTarja = (this.isTarja || (data.isTarja && XTeamDocument.InTarja(this.dungeonID, (uint)XFastEnumIntEqualityComparer.ToInt(data.profession)))); + } + this.members.Sort(); + this._UpdateRelation(); + } + + public void SetData(TeamBrief brief, XExpeditionDocument expDoc) + { + bool flag = this.dungeonID != brief.expID; + if (flag) + { + this.dungeonID = brief.expID; + this.category = expDoc.TeamCategoryMgr.GetCategoryByExpID((int)this.dungeonID); + this.rowData = expDoc.GetExpeditionDataByID((int)this.dungeonID); + bool flag2 = this.rowData != null; + if (flag2) + { + this.dungeonLevel = this.rowData.DisplayLevel; + this.dungeonName = XExpeditionDocument.GetFullName(this.rowData); + this.totalMemberCount = this.rowData.PlayerNumber; + } + else + { + XSingleton.singleton.AddErrorLog("cant find exp id: " + this.dungeonID.ToString(), null, null, null, null, null); + } + } + this.leaderName = brief.leaderName; + this.teamID = brief.teamID; + this.leaderLevel = (int)brief.leaderLevel; + this.leaderPPT = brief.leaderPowerPoint; + this.leaderProfession = brief.leaderProfession; + this.currentMemberCount = brief.teamMemberCount; + this.password = brief.password; + this.hasPwd = brief.haspassword; + this.actualState = (TeamState)brief.teamState; + this.matchType = brief.matchtype; + this.teamName = XStringDefineProxy.GetString("TEAM_NAME", new object[] + { + this.leaderName + }); + this.regression = brief.kingback; + TeamState teamState = this.actualState; + if (teamState != TeamState.TEAM_IN_BATTLE) + { + if (teamState != TeamState.TEAM_VOTE) + { + bool flag3 = this.currentMemberCount < this.totalMemberCount; + if (flag3) + { + this.state = XTeamState.TS_NOT_FULL; + } + else + { + this.state = XTeamState.TS_FULL; + } + } + else + { + this.state = XTeamState.TS_VOTING; + } + } + else + { + this.state = XTeamState.TS_FIGHTING; + } + bool flag4 = brief.extrainfo != null; + if (flag4) + { + this.teamPPT = brief.extrainfo.pptlimit; + this.goldGroup.SetData(brief.extrainfo, this.rowData); + bool flag5 = brief.extrainfo.rift != null; + if (flag5) + { + bool flag6 = this.rift == null; + if (flag6) + { + this.rift = XDataPool.GetData(); + } + this.rift.SetData(brief.extrainfo.rift, this.rowData); + } + else + { + bool flag7 = this.rift != null; + if (flag7) + { + this.rift.Recycle(); + this.rift = null; + } + } + } + else + { + this.teamPPT = 0u; + this.goldGroup.bActive = false; + } + } + + public static int CompareToAccordingToRelation(XTeamBriefData left, XTeamBriefData right) + { + int num = XFastEnumIntEqualityComparer.ToInt(left.state).CompareTo(XFastEnumIntEqualityComparer.ToInt(right.state)); + bool flag = num == 0; + if (flag) + { + num = left.relation.CompareTo(right.relation); + } + bool flag2 = num == 0; + int result; + if (flag2) + { + result = left.CompareTo(right); + } + else + { + result = num; + } + return result; + } + + public int CompareTo(XTeamBriefData other) + { + int num = 0; + switch (XTeamBriefData.sortType) + { + case TeamBriefSortType.TBST_TEAM_NAME: + num = this.teamName.CompareTo(other.teamName); + break; + case TeamBriefSortType.TBST_DUNGEON_LEVEL: + num = -this.dungeonLevel.CompareTo(other.dungeonLevel); + break; + case TeamBriefSortType.TBST_MEMBER_COUNT: + num = this.currentMemberCount.CompareTo(other.currentMemberCount); + break; + case TeamBriefSortType.TBST_CATEGORY: + num = this.category.category.CompareTo(other.category.category); + break; + case TeamBriefSortType.TBST_DUNGEON_ID: + num = this.dungeonID.CompareTo(other.dungeonID); + break; + } + bool flag = num == 0; + if (flag) + { + num = XFastEnumIntEqualityComparer.ToInt(this.state).CompareTo(XFastEnumIntEqualityComparer.ToInt(other.state)); + } + bool flag2 = num == 0; + if (flag2) + { + num = this.relation.CompareTo(other.relation) * XTeamBriefData.dir; + } + bool flag3 = num == 0; + if (flag3) + { + double attr = XSingleton.singleton.XPlayerData.GetAttr(XAttributeDefine.XAttr_POWER_POINT_Basic); + bool flag4 = attr >= this.teamPPT; + bool value = attr >= other.teamPPT; + num = -flag4.CompareTo(value); + } + bool flag5 = num == 0; + if (flag5) + { + num = this.hasPwd.CompareTo(other.hasPwd); + } + bool flag6 = num == 0; + if (flag6) + { + bool flag7 = this.rift != null && other.rift != null; + if (flag7) + { + num = -this.rift.floor.CompareTo(other.rift.floor); + } + } + bool flag8 = num == 0; + if (flag8) + { + num = this.teamID.CompareTo(other.teamID); + } + return num * XTeamBriefData.dir; + } + + public override void Recycle() + { + base.Recycle(); + for (int i = 0; i < this.members.Count; i++) + { + this.members[i].Recycle(); + } + this.members.Clear(); + bool flag = this.rift != null; + if (flag) + { + this.rift.Recycle(); + this.rift = null; + } + XDataPool.Recycle(this); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamBriefData.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamBriefData.cs.meta new file mode 100644 index 00000000..a2f108ea --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamBriefData.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 119d32daa52ad7048903b82ff457d97f +timeCreated: 1611403239 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamCategory.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamCategory.cs new file mode 100644 index 00000000..c6152384 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamCategory.cs @@ -0,0 +1,248 @@ +using System; +using System.Collections.Generic; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamCategory : IComparable + { + public string Name + { + get + { + return XTeamCategory.GetCategoryName(this.category); + } + } + + private XExpeditionDocument expDoc = null; + + private XGuildDocument guildDoc = null; + + private XLevelDocument levelDoc = null; + + private XDragonNestDocument dnDoc = null; + + private XLevelSealDocument levelSealDoc = null; + + private XOperatingActivityDocument operatingDoc = null; + + public int category; + + public List expList = new List(); + + private XTeamCategoryMgr m_Mgr; + + public static string GetCategoryName(int categoryID) + { + return XStringDefineProxy.GetString("TeamCategory" + categoryID.ToString()); + } + + public static int SortExp(ExpeditionTable.RowData left, ExpeditionTable.RowData right) + { + return left.SortID.CompareTo(right.SortID); + } + + public XTeamCategory(XTeamCategoryMgr mgr) + { + this.m_Mgr = mgr; + } + + public int CompareTo(XTeamCategory other) + { + return this.category.CompareTo(other.category); + } + + public bool HasOpened() + { + return this.GetOpenedExpCount() > 0; + } + + public bool IsExpOpened(ExpeditionTable.RowData rowData) + { + bool flag = rowData == null || XSingleton.singleton.XPlayerData == null; + bool result; + if (flag) + { + result = false; + } + else + { + uint level = XSingleton.singleton.XPlayerData.Level; + bool flag2 = (ulong)level < (ulong)((long)rowData.RequiredLevel); + if (flag2) + { + result = false; + } + else + { + bool flag3 = this.expDoc == null; + if (flag3) + { + this.expDoc = XDocuments.GetSpecificDocument(XExpeditionDocument.uuID); + } + bool flag4 = this.guildDoc == null; + if (flag4) + { + this.guildDoc = XDocuments.GetSpecificDocument(XGuildDocument.uuID); + } + bool flag5 = this.levelDoc == null; + if (flag5) + { + this.levelDoc = XDocuments.GetSpecificDocument(XLevelDocument.uuID); + } + bool flag6 = this.dnDoc == null; + if (flag6) + { + this.dnDoc = XDocuments.GetSpecificDocument(XDragonNestDocument.uuID); + } + bool flag7 = this.levelSealDoc == null; + if (flag7) + { + this.levelSealDoc = XDocuments.GetSpecificDocument(XLevelSealDocument.uuID); + } + bool flag8 = this.operatingDoc == null; + if (flag8) + { + this.operatingDoc = XDocuments.GetSpecificDocument(XOperatingActivityDocument.uuID); + } + bool flag9 = rowData.LevelSealType > 0u && rowData.LevelSealType != this.levelSealDoc.SealType; + if (flag9) + { + result = false; + } + else + { + TeamLevelType type = (TeamLevelType)rowData.Type; + TeamLevelType teamLevelType = type; + if (teamLevelType <= TeamLevelType.TeamLevelFestival) + { + switch (teamLevelType) + { + case TeamLevelType.TeamLevelNest: + { + bool flag10 = XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_Activity_Nest) && this.levelDoc.CanLevelOpen(this.expDoc.GetSceneIDByExpID(rowData.DNExpeditionID)) == SceneRefuseReason.Admit; + bool flag11 = !flag10; + if (flag11) + { + return false; + } + break; + } + case TeamLevelType.TeamLevelAbyss: + { + bool flag12 = this.levelDoc.CanLevelOpen(this.expDoc.GetSceneIDByExpID(rowData.DNExpeditionID)) == SceneRefuseReason.Admit; + bool flag13 = !flag12; + if (flag13) + { + return false; + } + break; + } + case (TeamLevelType)5: + break; + case TeamLevelType.TeamLevelDragonNest: + { + bool flag14 = !this.dnDoc.CheckCanFightByExpID((uint)rowData.DNExpeditionID); + if (flag14) + { + return false; + } + break; + } + case TeamLevelType.TeamLevelTeamTower: + { + bool flag15 = !this.expDoc.IsTeamTowerOpen(rowData.DNExpeditionID); + if (flag15) + { + return false; + } + break; + } + default: + switch (teamLevelType) + { + case TeamLevelType.TeamLevelGuildCamp: + { + bool flag16 = !this.guildDoc.bInGuild || (ulong)this.guildDoc.Level < (ulong)((long)rowData.GuildLevel); + if (flag16) + { + return false; + } + XGuildSmallMonsterDocument specificDocument = XDocuments.GetSpecificDocument(XGuildSmallMonsterDocument.uuID); + return specificDocument.IsOpen(rowData); + } + case TeamLevelType.TeamLevelWeekNest: + { + XWeekNestDocument doc = XWeekNestDocument.Doc; + bool flag17 = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_WeekNest); + if (flag17) + { + return false; + } + XActivityDocument specificDocument2 = XDocuments.GetSpecificDocument(XActivityDocument.uuID); + bool flag18 = specificDocument2.ServerOpenDay < XSingleton.singleton.GetSysOpenServerDay(XFastEnumIntEqualityComparer.ToInt(XSysDefine.XSys_WeekNest)); + if (flag18) + { + return false; + } + return rowData.DNExpeditionID == doc.CurDNid; + } + case TeamLevelType.TeamLevelTeamLeague: + { + XFreeTeamVersusLeagueDocument specificDocument3 = XDocuments.GetSpecificDocument(XFreeTeamVersusLeagueDocument.uuID); + return specificDocument3.IsOpen; + } + case TeamLevelType.TeamLevelFestival: + return this.operatingDoc.CheckFestivalIsOpen(this.expDoc.GetSceneIDByExpID(rowData.DNExpeditionID)); + } + break; + } + } + else if (teamLevelType != TeamLevelType.TeamLevelWeekendParty) + { + if (teamLevelType == TeamLevelType.TeamLevelWedding) + { + return false; + } + if (teamLevelType == TeamLevelType.TeamLevelWeddingLicense) + { + return XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_Wedding); + } + } + else + { + bool flag19 = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_MulActivity_WeekendParty); + if (flag19) + { + return false; + } + XWeekendPartyDocument specificDocument4 = XDocuments.GetSpecificDocument(XWeekendPartyDocument.uuID); + return specificDocument4.CheckIsOpen(this.expDoc.GetSceneIDByExpID(rowData.DNExpeditionID)); + } + result = true; + } + } + } + return result; + } + + public int GetOpenedExpCount() + { + int num = 0; + bool flag = this.expDoc == null; + if (flag) + { + this.expDoc = XDocuments.GetSpecificDocument(XExpeditionDocument.uuID); + } + for (int i = 0; i < this.expList.Count; i++) + { + bool flag2 = this.IsExpOpened(this.expList[i]); + if (flag2) + { + num++; + } + } + return num; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamCategory.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamCategory.cs.meta new file mode 100644 index 00000000..3f4bf7c7 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamCategory.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4715f319c70a6454da0c137b17096340 +timeCreated: 1611403652 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamCategoryMgr.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamCategoryMgr.cs new file mode 100644 index 00000000..971e49b9 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamCategoryMgr.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using KKSG; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamCategoryMgr + { + public int LastestNoRankAbyssSceneID { get; set; } + + public List m_Categories = new List(); + + private Dictionary m_DicCate = new Dictionary(); + + private Dictionary m_DicExpCate = new Dictionary(); + + public void Init() + { + XExpeditionDocument specificDocument = XDocuments.GetSpecificDocument(XExpeditionDocument.uuID); + this.m_DicExpCate.Clear(); + this.m_DicCate.Clear(); + this.m_Categories.Clear(); + XTeamCategory xteamCategory = null; + for (int i = 0; i < XExpeditionDocument.ExpTable.Table.Length; i++) + { + ExpeditionTable.RowData rowData = XExpeditionDocument.ExpTable.Table[i]; + bool flag = rowData.Category == 0; + if (!flag) + { + bool flag2 = xteamCategory == null || xteamCategory.category != rowData.Category; + if (flag2) + { + xteamCategory = null; + for (int j = 0; j < this.m_Categories.Count; j++) + { + bool flag3 = this.m_Categories[j].category == rowData.Category; + if (flag3) + { + xteamCategory = this.m_Categories[j]; + break; + } + } + bool flag4 = xteamCategory == null; + if (flag4) + { + xteamCategory = new XTeamCategory(this); + xteamCategory.category = rowData.Category; + this.m_Categories.Add(xteamCategory); + this.m_DicCate[xteamCategory.category] = xteamCategory; + } + } + xteamCategory.expList.Add(rowData); + this.m_DicExpCate[rowData.DNExpeditionID] = xteamCategory; + } + } + this.m_Categories.Sort(); + for (int k = 0; k < this.m_Categories.Count; k++) + { + this.m_Categories[k].expList.Sort(new Comparison(XTeamCategory.SortExp)); + } + } + + public void RefreshAbyssStates() + { + this.LastestNoRankAbyssSceneID = 1073741824; + List list = ListPool.Get(); + XSingleton.singleton.GetSceneList(SceneType.SCENE_ABYSSS, list); + for (int i = 0; i < list.Count; i++) + { + int num = list[i]; + bool flag = num < this.LastestNoRankAbyssSceneID && XSingleton.singleton.GetRank(num) <= 0; + if (flag) + { + this.LastestNoRankAbyssSceneID = num; + } + } + ListPool.Release(list); + } + + public XTeamCategory GetCategoryByExpID(int expID) + { + XTeamCategory xteamCategory; + bool flag = this.m_DicExpCate.TryGetValue(expID, out xteamCategory); + XTeamCategory result; + if (flag) + { + result = xteamCategory; + } + else + { + result = null; + } + return result; + } + + public XTeamCategory FindCategory(int category) + { + XTeamCategory xteamCategory; + bool flag = this.m_DicCate.TryGetValue(category, out xteamCategory); + XTeamCategory result; + if (flag) + { + result = xteamCategory; + } + else + { + result = null; + } + return result; + } + + public bool IsExpOpened(ExpeditionTable.RowData rowData) + { + bool flag = rowData == null; + bool result; + if (flag) + { + result = false; + } + else + { + XTeamCategory xteamCategory = this.FindCategory(rowData.Category); + bool flag2 = xteamCategory == null; + result = (!flag2 && xteamCategory.IsExpOpened(rowData)); + } + return result; + } + + public bool IsExpOpening(ExpeditionTable.RowData rowData) + { + bool flag = rowData == null; + bool result; + if (flag) + { + result = false; + } + else + { + XTeamCategory xteamCategory = this.FindCategory(rowData.Category); + result = (xteamCategory != null && xteamCategory.HasOpened()); + } + return result; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamCategoryMgr.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamCategoryMgr.cs.meta new file mode 100644 index 00000000..7db0b6a1 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamCategoryMgr.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bf78b027775f77e4e874cb0cab0c07c4 +timeCreated: 1611404483 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamCreateTeamWindow.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamCreateTeamWindow.cs new file mode 100644 index 00000000..20958dae --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamCreateTeamWindow.cs @@ -0,0 +1,62 @@ +using System; +using KKSG; +using UILib; +using UnityEngine; + +namespace XMainClient +{ + internal class XTeamCreateTeamWindow + { + private GameObject PanelObject; + + private XTeamDocument _doc; + + private IXUIInput m_Input; + + private IXUILabel m_Title; + + public XTeamCreateTeamWindow(GameObject panelGo) + { + this.PanelObject = panelGo; + this.m_Input = (this.PanelObject.transform.Find("CreateMenu/PwdInput").GetComponent("XUIInput") as IXUIInput); + this.m_Title = (this.PanelObject.transform.Find("CreateMenu/Dungeon").GetComponent("XUILabel") as IXUILabel); + this._doc = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + this.RegisterEvent(); + } + + public void RegisterEvent() + { + IXUIButton ixuibutton = this.PanelObject.transform.Find("CreateMenu/OK").GetComponent("XUIButton") as IXUIButton; + ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnOKBtnClicked)); + IXUIButton ixuibutton2 = this.PanelObject.transform.Find("CreateMenu/Cancel").GetComponent("XUIButton") as IXUIButton; + ixuibutton2.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnCancelBtnClicked)); + } + + public void Show() + { + this.PanelObject.SetActive(true); + this.m_Input.SetText(""); + this.m_Title.SetText(this._doc.currentDungeonName); + } + + public void Hide() + { + this.PanelObject.SetActive(false); + } + + private bool _OnOKBtnClicked(IXUIButton btn) + { + string text = this.m_Input.GetText(); + this._doc.password = text; + this._doc.ReqTeamOp(TeamOperate.TEAM_CREATE, 0UL, null, TeamMemberType.TMT_NORMAL, null); + this.Hide(); + return true; + } + + private bool _OnCancelBtnClicked(IXUIButton btn) + { + this.Hide(); + return true; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamCreateTeamWindow.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamCreateTeamWindow.cs.meta new file mode 100644 index 00000000..fff060e9 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamCreateTeamWindow.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a7f7aa16786e2bf4f953a14096a61a50 +timeCreated: 1611404293 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamDocument.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamDocument.cs new file mode 100644 index 00000000..fd662356 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamDocument.cs @@ -0,0 +1,2016 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamDocument : XDocComponent + { + public override uint ID + { + get + { + return XTeamDocument.uuID; + } + } + + public List TeamList + { + get + { + return this._TeamList; + } + } + + public XExpeditionDocument ExpDoc + { + get + { + bool flag = this.m_ExpDoc == null; + if (flag) + { + this.m_ExpDoc = XDocuments.GetSpecificDocument(XExpeditionDocument.uuID); + } + return this.m_ExpDoc; + } + } + + public bool bVoting + { + get + { + return this._bVoting; + } + } + + public bool bAutoMatching + { + get + { + return this.m_bAutoMatching; + } + set + { + this.m_bAutoMatching = value; + } + } + + public KMatchType SoloMatchType + { + get + { + return this.m_SoloMatchType; + } + } + + public bool bSoloMatching + { + get + { + return this.m_SoloMatchType > KMatchType.KMT_NONE; + } + } + + public bool bMatching + { + get + { + bool bInTeam = this.bInTeam; + bool result; + if (bInTeam) + { + result = (this._MyTeam.teamBrief.matchType > KMatchType.KMT_NONE); + } + else + { + result = this.bSoloMatching; + } + return result; + } + } + + public XTeam MyTeam + { + get + { + return this._MyTeam; + } + set + { + this._MyTeam = value; + } + } + + public bool bInTeam + { + get + { + return this._MyTeam != null; + } + } + + public bool bIsLeader + { + get + { + return this._MyTeam != null && this._MyTeam.myData != null && this._MyTeam.myData.bIsLeader; + } + } + + public bool bIsHelper + { + get + { + return this._MyTeam != null && this._MyTeam.myData != null && this._MyTeam.myData.bIsHelper; + } + } + + public bool bIsTecket + { + get + { + return this._MyTeam != null && this._MyTeam.myData != null && this._MyTeam.myData.bIsTicket; + } + } + + public int MatchingTime + { + get + { + return this.m_nMatchingTime; + } + } + + public TeamBriefSortType TeamListSortType + { + get + { + return this.m_TeamListSortType; + } + set + { + bool flag = this.m_TeamListSortType != value; + if (flag) + { + this.m_TeamListSortDirection = XTeamBriefData.DefaultSortDirection[XFastEnumIntEqualityComparer.ToInt(value)]; + } + else + { + this.m_TeamListSortDirection = -this.m_TeamListSortDirection; + } + this.m_TeamListSortType = value; + } + } + + public int TeamListSortDirection + { + get + { + return this.m_TeamListSortDirection; + } + } + + public HashSet TeamListSelectedCategories + { + get + { + return this.m_TeamListSelectedCategories; + } + } + + public bool IsTarja + { + get + { + return this._tarja > 0u; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("TeamDocument"); + + public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader(); + + private static PveProfessionTable m_pveProfessionTables = new PveProfessionTable(); + + private static Dictionary m_pveProfessions = new Dictionary(); + + public XTeamListHandler TeamListView; + + public XMyTeamHandler MyTeamView; + + private List _TeamList = new List(); + + public XTeamListView AllListView; + + public XTeamDungeonSelectorHandler DungeonSelector; + + public ExpeditionTable.RowData currentExpInfo; + + public uint currentDungeonID; + + public string currentCategoryName; + + public string currentDungeonName; + + public TeamLevelType currentDungeonType = TeamLevelType.TeamLevelNone; + + public string teamLeagueName; + + private XExpeditionDocument m_ExpDoc = null; + + public SceneTable.RowData currentSceneData; + + public string password = ""; + + private bool _bVoting; + + private bool m_bAutoMatching = false; + + private KMatchType m_SoloMatchType = KMatchType.KMT_NONE; + + private XTeam _MyTeam; + + private bool bTryAutoJoin = false; + + private static bool bFromHyperLink = false; + + private float m_fMatchingTime = -1f; + + private int m_nMatchingTime = -1; + + private int m_AutoSelectFloatingLevel = -10; + + private int m_TeamListSortDirection = 1; + + private TeamBriefSortType m_TeamListSortType = TeamBriefSortType.TBST_MEMBER_COUNT; + + private HashSet m_TeamListSelectedCategories = new HashSet(); + + private uint _tarja = 0u; + + private bool m_bReqTeamListJustTarget; + + private static ButtonClickEventHandler _EnterHandler = null; + + private static IXUIButton _EnterButton = null; + + private static bool _bCanEnter = false; + + private static EventDelegate _EventDel; + + private struct XPreviousTeamData + { + public TeamState state; + + public int goldGroupIndex; + + public int goldGroupItemID; + + public bool bNewTeam; + + public string leaderName; + + public ExpeditionTable.RowData expData; + + private XTeamDocument doc; + + public XPreviousTeamData(XTeamDocument _doc) + { + this.doc = _doc; + this.state = TeamState.TEAM_WAITING; + this.goldGroupIndex = -1; + this.goldGroupItemID = 0; + this.bNewTeam = false; + this.leaderName = null; + this.expData = null; + } + + public void PreserveTeamData(XTeam team) + { + this.state = team.teamBrief.actualState; + this.goldGroupIndex = team.teamBrief.goldGroup.index; + this.goldGroupItemID = team.teamBrief.goldGroup.itemid; + this.leaderName = team.teamBrief.leaderName; + this.expData = team.teamBrief.rowData; + } + + public void CheckNewTeamData(XTeam team) + { + bool flag = this.state != team.teamBrief.actualState; + if (flag) + { + this.doc.ToggleVoting(team.teamBrief.actualState == TeamState.TEAM_VOTE); + } + bool flag2 = !this.bNewTeam && this.goldGroupIndex != team.teamBrief.goldGroup.index; + if (flag2) + { + int index = team.teamBrief.goldGroup.index; + bool flag3 = this.doc.currentExpInfo != null; + if (flag3) + { + bool flag4 = index < 0; + if (flag4) + { + bool flag5 = this.doc.MyTeam.myData.name == this.leaderName; + if (!flag5) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("TeamGoldGroupTurnedOff"), "fece00"); + } + } + else + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("TeamGoldGroupTurnedOn", new object[] + { + XGoldGroupData.GetName(ref this.doc.currentExpInfo.CostType, index) + }), "fece00"); + } + } + } + } + } + + public void SortTeamListAndShow() + { + CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture; + Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo(XSingleton.singleton.GetValue("Culture")); + bool bReqTeamListJustTarget = this.m_bReqTeamListJustTarget; + if (bReqTeamListJustTarget) + { + XTeamBriefData.dir = 1; + XTeamBriefData.sortType = TeamBriefSortType.TBST_MAX; + this._TeamList.Sort(new Comparison(XTeamBriefData.CompareToAccordingToRelation)); + } + else + { + XTeamBriefData.dir = this.m_TeamListSortDirection; + XTeamBriefData.sortType = this.m_TeamListSortType; + this._TeamList.Sort(); + } + Thread.CurrentThread.CurrentCulture = currentCulture; + bool flag = this.TeamListView != null && this.TeamListView.IsVisible(); + if (flag) + { + this.TeamListView.RefreshPage(); + } + bool flag2 = this.AllListView != null && this.AllListView.IsVisible(); + if (flag2) + { + this.AllListView.RefreshPage(); + } + } + + public static void Execute(OnLoadedCallback callback = null) + { + XTeamDocument.AsyncLoader.AddTask("Table/PveProfession", XTeamDocument.m_pveProfessionTables, false); + XTeamDocument.AsyncLoader.Execute(callback); + } + + public static string GetProfessionKey(uint profession, uint sceneid) + { + return XSingleton.singleton.StringCombine(profession.ToString(), "_", sceneid.ToString()); + } + + public static void OnTableLoaded() + { + XTeamDocument.m_pveProfessions.Clear(); + int i = 0; + int num = XTeamDocument.m_pveProfessionTables.Table.Length; + while (i < num) + { + XTeamDocument.m_pveProfessions.Add(XTeamDocument.GetProfessionKey((uint)XTeamDocument.m_pveProfessionTables.Table[i].ProfessionID, XTeamDocument.m_pveProfessionTables.Table[i].SceneID), XTeamDocument.m_pveProfessionTables.Table[i]); + i++; + } + } + + public void SetTarja(uint tarja) + { + XSingleton.singleton.AddGreenLog("SetTarja:", tarja.ToString(), null, null, null, null); + this._tarja = tarja; + bool flag = this.MyTeamView != null && this.MyTeamView.IsVisible(); + if (flag) + { + this.MyTeamView.RefreshPage(); + } + bool flag2 = this.TeamListView != null && this.TeamListView.IsVisible(); + if (flag2) + { + this.TeamListView.RefreshPage(); + } + bool flag3 = this.AllListView != null && this.AllListView.IsVisible(); + if (flag3) + { + this.AllListView.RefreshPage(); + } + bool flag4 = this.DungeonSelector != null && this.DungeonSelector.IsVisible(); + if (flag4) + { + this.DungeonSelector.RefreshData(); + } + } + + public static PveProfessionTable.RowData GetPveProfession(uint sceneID, uint profession) + { + bool flag = sceneID == 0u || profession == 0u; + PveProfessionTable.RowData result; + if (flag) + { + result = null; + } + else + { + string professionKey = XTeamDocument.GetProfessionKey(profession, sceneID); + bool flag2 = !XTeamDocument.m_pveProfessions.ContainsKey(professionKey); + if (flag2) + { + result = null; + } + else + { + result = XTeamDocument.m_pveProfessions[professionKey]; + } + } + return result; + } + + public bool InTarja(uint profession) + { + return XTeamDocument.InTarja(this.currentDungeonID, profession); + } + + public static bool InTarja(uint dungeonID, uint profession) + { + return XTeamDocument.GetPveProfession(dungeonID, profession) != null; + } + + public bool ShowTarja(uint dungeonID) + { + bool isTarja = this.IsTarja; + bool result; + if (isTarja) + { + PveProfessionTable.RowData pveProfession = XTeamDocument.GetPveProfession(dungeonID, XSingleton.singleton.XPlayerData.TypeID); + bool flag = pveProfession == null; + if (flag) + { + result = false; + } + else + { + XExpeditionDocument specificDocument = XDocuments.GetSpecificDocument(XExpeditionDocument.uuID); + ExpeditionTable.RowData expeditionDataByID = specificDocument.GetExpeditionDataByID((int)dungeonID); + result = (expeditionDataByID != null && XSingleton.singleton.XPlayerData.GetAttr(XAttributeDefine.XAttr_POWER_POINT_Basic) < expeditionDataByID.DisplayPPT); + } + } + else + { + result = this.IsTarja; + } + return result; + } + + public bool ShowTarja() + { + return this.ShowTarja(this.currentDungeonID); + } + + public bool TryGetPveProfessionPPT(bool isTarja, uint profression, ref uint ppt) + { + bool flag = !isTarja; + bool result; + if (flag) + { + result = false; + } + else + { + PveProfessionTable.RowData pveProfession = XTeamDocument.GetPveProfession(this.currentDungeonID, profression); + bool flag2 = pveProfession == null; + if (flag2) + { + result = false; + } + else + { + XExpeditionDocument specificDocument = XDocuments.GetSpecificDocument(XExpeditionDocument.uuID); + ExpeditionTable.RowData expeditionDataByID = specificDocument.GetExpeditionDataByID((int)this.currentDungeonID); + bool flag3 = expeditionDataByID == null; + if (flag3) + { + result = false; + } + else + { + bool flag4 = ppt < expeditionDataByID.DisplayPPT; + if (flag4) + { + ppt = expeditionDataByID.DisplayPPT; + result = true; + } + else + { + result = false; + } + } + } + } + return result; + } + + public override void OnAttachToHost(XObject host) + { + base.OnAttachToHost(host); + this._TeamList.Clear(); + this.currentExpInfo = null; + this.currentDungeonID = 0u; + this.currentDungeonName = string.Empty; + this.currentCategoryName = string.Empty; + this.currentDungeonType = TeamLevelType.TeamLevelNone; + this.m_nMatchingTime = -1; + this.m_AutoSelectFloatingLevel = XSingleton.singleton.GetInt("TeamAutoSelectFloatingLevel"); + this.m_SoloMatchType = KMatchType.KMT_NONE; + this.m_bAutoMatching = false; + this.TeamListSelectedCategories.Clear(); + this.TeamListSelectedCategories.Add(0); + } + + protected override void EventSubscribe() + { + base.EventSubscribe(); + base.RegisterEvent(XEventDefine.XEvent_JoinTeam, new XComponent.XEventHandler(this._OnJoinTeam)); + base.RegisterEvent(XEventDefine.XEvent_LeaveTeam, new XComponent.XEventHandler(this._OnLeaveTeam)); + base.RegisterEvent(XEventDefine.XEvent_FriendInfoChange, new XComponent.XEventHandler(this._OnFriendInfoChanged)); + } + + public void InitTeamListSelection() + { + bool flag = this.TeamListSelectedCategories.Contains(0) && this.TeamListSelectedCategories.Count == 1; + if (flag) + { + List categories = this.ExpDoc.TeamCategoryMgr.m_Categories; + for (int i = 0; i < categories.Count; i++) + { + this.TeamListSelectedCategories.Add(categories[i].category); + } + } + } + + private bool _OnJoinTeam(XEventArgs e) + { + DlgBase.singleton.ClearInviteList(); + return true; + } + + private bool _OnLeaveTeam(XEventArgs e) + { + this.m_nMatchingTime = -1; + this.ToggleVoting(false); + bool flag = DlgBase.singleton.IsVisible(); + if (flag) + { + DlgBase.singleton.ShowTeamView(); + } + this._UpdateOtherUI(); + return true; + } + + private bool _OnFriendInfoChanged(XEventArgs e) + { + this.RefreshMyTeamView(); + return true; + } + + public override void OnEnterSceneFinally() + { + base.OnEnterSceneFinally(); + bool flag = XSingleton.singleton.CurrentStage.Stage == EXStage.Hall; + if (flag) + { + DlgBase.singleton._TaskNaviHandler.SetTeamMatching(this.bSoloMatching); + bool bInTeam = this.bInTeam; + if (bInTeam) + { + DlgBase.singleton._TaskNaviHandler.SetTeamMemberCount(this.MyTeam.members.Count); + } + else + { + DlgBase.singleton._TaskNaviHandler.SetTeamMemberCount(0); + } + } + else + { + bool flag2 = XSingleton.singleton.CurrentStage.Stage == EXStage.World; + if (flag2) + { + bool bInTeam2 = this.bInTeam; + if (bInTeam2) + { + bool flag3 = this.currentDungeonID != 2101u && this.currentDungeonID != 2102u && this.currentDungeonID != 2103u; + if (flag3) + { + XSingleton.singleton.CacheUI(XSysDefine.XSys_Team, EXStage.Hall); + } + } + } + } + } + + public bool TryChangeToExpID(int expID) + { + bool flag = (ulong)this.currentDungeonID == (ulong)((long)expID); + bool result; + if (flag) + { + result = false; + } + else + { + bool bInTeam = this.bInTeam; + if (bInTeam) + { + bool bIsLeader = this.bIsLeader; + if (bIsLeader) + { + this.ReqTeamOp(TeamOperate.TEAM_CHANGE_EPXTEAMID, (ulong)((long)expID), null, TeamMemberType.TMT_NORMAL, null); + result = true; + } + else + { + result = false; + } + } + else + { + bool flag2 = this.currentDungeonID > 0u; + this._SetCurrentDungeon(expID); + bool flag3 = flag2; + if (flag3) + { + this.CancelMatch(); + } + bool flag4 = this.TeamListView != null && this.TeamListView.IsVisible(); + if (flag4) + { + this.TeamListView.OnCurrentDungeonChanged(); + } + result = true; + } + } + return result; + } + + public void TryAutoSelectExp() + { + bool flag = this.SoloMatchType > KMatchType.KMT_NONE; + if (flag) + { + TeamLevelType teamLevelType = XTeamDocument.MatchType2TeamType(this.SoloMatchType); + bool flag2 = teamLevelType > TeamLevelType.TeamLevelNone; + if (flag2) + { + List expeditionList = this.ExpDoc.GetExpeditionList(teamLevelType); + bool flag3 = expeditionList != null && expeditionList.Count > 0; + if (flag3) + { + bool flag4 = this.TryChangeToExpID(expeditionList[0].DNExpeditionID); + if (flag4) + { + return; + } + } + } + } + bool flag5 = this.currentDungeonID > 0u; + if (!flag5) + { + uint level = XSingleton.singleton.XPlayerData.Level; + int num = 0; + int num2 = int.MaxValue; + int num3 = int.MaxValue; + for (int i = 0; i < this.ExpDoc.TeamCategoryMgr.m_Categories.Count; i++) + { + XTeamCategory xteamCategory = this.ExpDoc.TeamCategoryMgr.m_Categories[i]; + for (int j = 0; j < xteamCategory.expList.Count; j++) + { + ExpeditionTable.RowData rowData = xteamCategory.expList[j]; + bool flag6 = rowData == null; + if (!flag6) + { + int num4 = Math.Abs((int)(rowData.DisplayLevel - level)); + bool flag7 = num3 < num4; + if (!flag7) + { + bool flag8 = num4 == num3 && num2 < rowData.AutoSelectPriority; + if (!flag8) + { + bool flag9 = !xteamCategory.IsExpOpened(rowData); + if (!flag9) + { + num3 = num4; + num2 = rowData.AutoSelectPriority; + num = rowData.DNExpeditionID; + } + } + } + } + } + } + bool flag10 = num != 0; + if (flag10) + { + this.TryChangeToExpID(num); + } + } + } + + private void _SetCurrentDungeon(int dungeonID) + { + ExpeditionTable.RowData expeditionDataByID = this.ExpDoc.GetExpeditionDataByID(dungeonID); + bool flag = expeditionDataByID != null; + if (flag) + { + TeamLevelType type = (TeamLevelType)expeditionDataByID.Type; + this._SetCurrentTeamInfo(expeditionDataByID); + this.currentSceneData = null; + uint sceneIDByExpID = this.ExpDoc.GetSceneIDByExpID(dungeonID); + this.currentSceneData = XSingleton.singleton.GetSceneData(sceneIDByExpID); + bool flag2 = type == TeamLevelType.TeamLevelTeamTower; + if (flag2) + { + this.ExpDoc.ExpeditionId = expeditionDataByID.DNExpeditionID; + } + } + } + + private void _SetCurrentTeamInfo(ExpeditionTable.RowData rowData) + { + bool flag = this.currentDungeonID != (uint)rowData.DNExpeditionID; + if (flag) + { + bool flag2 = this.currentDungeonID == 0u; + this.currentExpInfo = rowData; + this.currentDungeonID = (uint)rowData.DNExpeditionID; + this.currentDungeonName = XExpeditionDocument.GetFullName(rowData); + this.currentDungeonType = (TeamLevelType)rowData.Type; + this.currentCategoryName = XTeamCategory.GetCategoryName(rowData.Category); + bool flag3 = !flag2 && this.bInTeam && !this.bIsLeader; + if (flag3) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("TEAM_LEADER_CHANGE_EXP", new object[] + { + this.currentDungeonName + }), "fece00"); + } + } + bool flag4 = this.MyTeamView != null && this.MyTeamView.IsVisible(); + if (flag4) + { + this.MyTeamView.RefreshButtonStates(); + } + bool flag5 = this.DungeonSelector != null && this.DungeonSelector.IsVisible(); + if (flag5) + { + this.DungeonSelector.SetCurrentDungeon(true); + } + } + + public XTeamBriefData GetTeamBriefByIndex(int index) + { + bool flag = index >= this._TeamList.Count; + XTeamBriefData result; + if (flag) + { + result = null; + } + else + { + result = this._TeamList[index]; + } + return result; + } + + public XTeamBriefData GetTeamBriefByID(int teamID) + { + for (int i = 0; i < this._TeamList.Count; i++) + { + bool flag = this._TeamList[i].teamID == teamID; + if (flag) + { + return this._TeamList[i]; + } + } + return null; + } + + public void ReqTeamList(bool bJustTarget) + { + this.m_bReqTeamListJustTarget = bJustTarget; + if (bJustTarget) + { + bool flag = this.currentDungeonID > 0u; + if (flag) + { + RpcC2M_FetchTeamListC2M rpcC2M_FetchTeamListC2M = new RpcC2M_FetchTeamListC2M(); + rpcC2M_FetchTeamListC2M.oArg.expID = this.currentDungeonID; + XSingleton.singleton.Send(rpcC2M_FetchTeamListC2M); + } + } + else + { + bool flag2 = this.m_TeamListSelectedCategories.Count > 0; + if (flag2) + { + RpcC2M_FetchTeamListC2M rpcC2M_FetchTeamListC2M2 = new RpcC2M_FetchTeamListC2M(); + foreach (int num in this.m_TeamListSelectedCategories) + { + bool flag3 = num != 0; + if (flag3) + { + rpcC2M_FetchTeamListC2M2.oArg.categoryID.Add((uint)num); + } + } + XSingleton.singleton.Send(rpcC2M_FetchTeamListC2M2); + } + else + { + this.ClearTeamList(); + this.SortTeamListAndShow(); + } + } + } + + public void ClearTeamList() + { + for (int i = 0; i < this._TeamList.Count; i++) + { + this._TeamList[i].Recycle(); + } + this._TeamList.Clear(); + } + + public void OnGetTeamList(FetchTeamListRes oRes) + { + this.ClearTeamList(); + for (int i = 0; i < oRes.TheTeams.Count; i++) + { + TeamFullDataNtf teamFullDataNtf = oRes.TheTeams[i]; + bool flag = teamFullDataNtf.teamBrief.teamState == 1; + if (!flag) + { + XTeamBriefData data = XDataPool.GetData(); + data.SetData(teamFullDataNtf.teamBrief, this.ExpDoc); + data.SetMembers(teamFullDataNtf.members); + this._TeamList.Add(data); + } + } + this.SortTeamListAndShow(); + bool flag2 = this.bTryAutoJoin; + if (flag2) + { + this._AutoJoin(); + } + } + + public void OnTeamInfoChanged(TeamChanged data) + { + XSingleton.singleton.AddGreenLog("TeamInfoChanged", null, null, null, null, null); + XTeamDocument.XPreviousTeamData xpreviousTeamData = new XTeamDocument.XPreviousTeamData(this); + xpreviousTeamData.bNewTeam = false; + bool flag = this._MyTeam == null; + if (flag) + { + this._MyTeam = new XTeam(); + xpreviousTeamData.bNewTeam = true; + } + xpreviousTeamData.PreserveTeamData(this._MyTeam); + this._MyTeam.PreUpdate(); + this._MyTeam.teamBrief.SetData(data.teamBrief, this.ExpDoc); + bool flag2 = this._MyTeam.teamBrief.rowData == null; + if (flag2) + { + bool flag3 = xpreviousTeamData.bNewTeam || xpreviousTeamData.expData != null; + if (flag3) + { + XSingleton.singleton.ShowModalDialog(XStringDefineProxy.GetString("LeaveTeamSinceNoConfig"), XStringDefineProxy.GetString(XStringDefine.COMMON_OK)); + this.ReqTeamOp(TeamOperate.TEAM_LEAVE, 0UL, null, TeamMemberType.TMT_NORMAL, null); + } + } + else + { + for (int i = 0; i < data.leaveMember.Count; i++) + { + XSingleton.singleton.AddGreenLog("Try Leave Teammember ", data.leaveMember[i].ToString(), null, null, null, null); + string text = this._MyTeam.RemoveMember(data.leaveMember[i]); + bool flag4 = this._MyTeam.teamBrief.matchType != KMatchType.KMT_NONE && this._MyTeam.teamBrief.matchType != KMatchType.KMT_EXP; + if (flag4) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("TEAM_LEAVE_TEAM_MATCH", new object[] + { + text + }), "fece00"); + } + else + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("TEAM_LEAVE_TEAM", new object[] + { + text + }), "fece00"); + } + } + for (int j = 0; j < data.addMember.Count; j++) + { + XSingleton.singleton.AddGreenLog("Try Add Teammember ", data.addMember[j].memberID.ToString(), null, null, null, null); + this._MyTeam.AddMember(data.addMember[j]); + bool flag5 = !xpreviousTeamData.bNewTeam; + if (flag5) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("TEAM_ADD_TEAM", new object[] + { + data.addMember[j].name + }), "fece00"); + } + } + for (int k = 0; k < data.chgstateMember.Count; k++) + { + this._MyTeam.UpdateMember(data.chgstateMember[k]); + } + this._MyTeam.PostUpdate(); + bool flag6 = this.MyTeam.members.Count > 1; + if (flag6) + { + XSingleton.singleton.HasTeam = true; + } + this._MyTeam.members.Sort(); + this._PostTeamInfoChanged(xpreviousTeamData, data.teamBrief); + int num = data.addMember.Count - data.leaveMember.Count; + bool flag7 = num != 0; + if (flag7) + { + XTeamMemberCountChangedEventArgs @event = XEventPool.GetEvent(); + @event.oldCount = (uint)(this._MyTeam.members.Count - num); + @event.newCount = (uint)this._MyTeam.members.Count; + @event.Firer = XSingleton.singleton.Doc; + XSingleton.singleton.FireEvent(@event); + } + } + } + + private void _PostTeamInfoChanged(XTeamDocument.XPreviousTeamData previousData, TeamBrief brief) + { + this.teamLeagueName = brief.extrainfo.league_teamname; + bool flag = previousData.bNewTeam || this.currentDungeonID != this._MyTeam.teamBrief.dungeonID || this._MyTeam.bLeaderChanged; + if (flag) + { + this._SetCurrentDungeon((int)this._MyTeam.teamBrief.dungeonID); + } + bool bNewTeam = previousData.bNewTeam; + if (bNewTeam) + { + bool flag2 = XSingleton.singleton.CurrentStage.Stage == EXStage.Hall && !XSingleton.singleton.switchScene; + if (flag2) + { + bool flag3 = this.AllListView != null && this.AllListView.IsVisible(); + if (flag3) + { + this.AllListView.SetVisibleWithAnimation(false, new DlgBase.OnAnimationOver(DlgBase.singleton.ShowTeamView)); + } + else + { + bool flag4 = DlgBase.singleton.IsVisible(); + if (flag4) + { + DlgBase.singleton.SetVisibleWithAnimation(false, new DlgBase.OnAnimationOver(DlgBase.singleton.ShowTeamView)); + } + else + { + ExpeditionTable.RowData expeditionDataByID = this.ExpDoc.GetExpeditionDataByID((int)this.currentDungeonID); + bool flag5 = expeditionDataByID != null && XSingleton.singleton.SceneType != SceneType.SKYCITY_WAITING; + if (flag5) + { + bool flag6 = expeditionDataByID.fastmatch == 0 || DlgBase.singleton.IsVisible(); + if (flag6) + { + DlgBase.singleton.ShowTeamView(); + } + } + } + } + XSingleton.singleton.Cancel(); + } + this.password = brief.password; + XJoinTeamEventArgs @event = XEventPool.GetEvent(); + @event.dungeonID = this._MyTeam.teamBrief.dungeonID; + @event.Firer = XSingleton.singleton.Doc; + XSingleton.singleton.FireEvent(@event); + } + previousData.CheckNewTeamData(this._MyTeam); + this.RefreshMyTeamView(); + bool bVoting = this.bVoting; + if (bVoting) + { + DlgBase.singleton.RefreshFightVote(); + } + bool bMatching = this.bMatching; + if (bMatching) + { + bool flag7 = this.m_nMatchingTime < 0; + if (flag7) + { + this.m_nMatchingTime = 0; + this.m_fMatchingTime = Time.time; + } + } + else + { + this.m_nMatchingTime = -1; + } + this._UpdateOtherUI(); + } + + public void ReqTeamOp(TeamOperate op, ulong param = 0UL, object o = null, TeamMemberType memberType = TeamMemberType.TMT_NORMAL, string account = null) + { + XTeamDocument.bFromHyperLink = false; + bool flag = this._MyTeam == null; + if (flag) + { + bool flag2 = op == TeamOperate.TEAM_LEAVE || op == TeamOperate.TEAM_TOGGLE_READY; + if (flag2) + { + XSingleton.singleton.AddErrorLog("Not in a team.", null, null, null, null, null); + return; + } + } + else + { + bool flag3 = this._MyTeam != null; + if (flag3) + { + bool flag4 = op == TeamOperate.TEAM_CREATE || op == TeamOperate.TEAM_JOIN; + if (flag4) + { + XSingleton.singleton.AddErrorLog("Already in a team.", null, null, null, null, null); + return; + } + } + } + RpcC2M_TeamRequestC2M rpcC2M_TeamRequestC2M = new RpcC2M_TeamRequestC2M(); + switch (op) + { + case TeamOperate.TEAM_CREATE: + rpcC2M_TeamRequestC2M.oArg.expID = this.currentDungeonID; + rpcC2M_TeamRequestC2M.oArg.param = param; + rpcC2M_TeamRequestC2M.oArg.password = this.password; + goto IL_2CE; + case TeamOperate.TEAM_JOIN: + { + rpcC2M_TeamRequestC2M.oArg.teamID = (int)param; + XTeamBriefData teamBriefByID = this.GetTeamBriefByID((int)param); + bool flag5 = teamBriefByID != null; + if (flag5) + { + rpcC2M_TeamRequestC2M.oArg.expID = teamBriefByID.dungeonID; + } + rpcC2M_TeamRequestC2M.oArg.password = this.password; + goto IL_2CE; + } + case TeamOperate.TEAM_LEAVE: + rpcC2M_TeamRequestC2M.oArg.param = param; + goto IL_2CE; + case TeamOperate.TEAM_QUERYCOUNT: + goto IL_2CE; + case TeamOperate.TEAM_KICK: + case TeamOperate.TEAM_TRAHS_LEADER: + rpcC2M_TeamRequestC2M.oArg.roleid = param; + goto IL_2CE; + case TeamOperate.TEAM_START_BATTLE: + { + bool flag6 = o != null; + if (flag6) + { + TeamExtraInfo teamExtraInfo = new TeamExtraInfo(); + teamExtraInfo.league_teamname = (o as string); + rpcC2M_TeamRequestC2M.oArg.extrainfo = teamExtraInfo; + } + goto IL_2CE; + } + case TeamOperate.TEAM_CHANGE_EPXTEAMID: + rpcC2M_TeamRequestC2M.oArg.expID = (uint)param; + goto IL_2CE; + case TeamOperate.TEAM_INVITE: + rpcC2M_TeamRequestC2M.oArg.roleid = param; + rpcC2M_TeamRequestC2M.oArg.account = account; + goto IL_2CE; + case TeamOperate.TEAM_START_MATCH: + case TeamOperate.TEAM_STOP_MATCH: + case TeamOperate.TEAM_DOWN_MATCH: + rpcC2M_TeamRequestC2M.oArg.expID = this.currentDungeonID; + rpcC2M_TeamRequestC2M.oArg.param = param; + goto IL_2CE; + case TeamOperate.TEAM_PPTLIMIT: + case TeamOperate.TEAM_COSTTYPE: + { + TeamExtraInfo teamExtraInfo2 = o as TeamExtraInfo; + bool flag7 = teamExtraInfo2 == null; + if (flag7) + { + return; + } + rpcC2M_TeamRequestC2M.oArg.extrainfo = teamExtraInfo2; + goto IL_2CE; + } + case TeamOperate.TEAM_CHANGE_PASSWORD: + rpcC2M_TeamRequestC2M.oArg.password = (o as string); + goto IL_2CE; + case TeamOperate.TEAM_MEMBER_TYPE: + rpcC2M_TeamRequestC2M.oArg.membertype = memberType; + goto IL_2CE; + } + bool flag8 = this._MyTeam == null; + if (flag8) + { + return; + } + rpcC2M_TeamRequestC2M.oArg.teamID = this._MyTeam.teamBrief.teamID; + rpcC2M_TeamRequestC2M.oArg.expID = this._MyTeam.teamBrief.dungeonID; + IL_2CE: + rpcC2M_TeamRequestC2M.oArg.request = op; + XSingleton.singleton.Send(rpcC2M_TeamRequestC2M); + } + + private string _GetRoleName(ulong roleID) + { + bool flag = XSingleton.singleton.XPlayerData.RoleID == roleID; + string result; + if (flag) + { + result = XStringDefineProxy.GetString("YOU"); + } + else + { + bool flag2 = this.MyTeam != null; + if (flag2) + { + XTeamMember xteamMember = this.MyTeam.FindMember(roleID); + bool flag3 = xteamMember != null; + if (flag3) + { + result = xteamMember.name; + } + else + { + result = XStringDefineProxy.GetString("THIS_ROLE"); + } + } + else + { + result = string.Empty; + } + } + return result; + } + + public void ProcessTeamOPErrorCode(ErrorCode errcode, ulong roleID) + { + ErrorCode errorCode = errcode; + if (errorCode != ErrorCode.ERR_TEAM_NEED_ATLEAST_2_MEMBER) + { + if (errorCode != ErrorCode.ERR_TEAM_SERVER_OPEN_TIME) + { + bool flag = roleID > 0UL; + if (flag) + { + string text = this._GetRoleName(roleID); + bool flag2 = string.IsNullOrEmpty(text); + if (flag2) + { + XSingleton.singleton.ShowSystemTip(errcode, "fece00"); + } + else + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString(string.Format("TEAM_{0}", errcode.ToString()), new object[] + { + text + }), "fece00"); + } + } + else + { + XSingleton.singleton.ShowSystemTip(errcode, "fece00"); + } + } + } + else + { + string key = string.Format("TEAM_{0}", errcode.ToString()); + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString(key, new object[] + { + this.currentExpInfo.PlayerLeastNumber + }), "fece00"); + } + } + + public void OnGetTeamOp(TeamOPArg oArg, TeamOPRes oRes) + { + bool flag = oRes.result > ErrorCode.ERR_SUCCESS; + if (flag) + { + this.ProcessTeamOPErrorCode(oRes.result, oRes.problem_roleid); + ErrorCode result = oRes.result; + if (result <= ErrorCode.ERR_SCENE_TODYCOUNTLIMIT) + { + if (result == ErrorCode.ERR_SCENE_NOFATIGUE) + { + bool flag2 = oRes.problem_roleid == 0UL || XSingleton.singleton.XPlayerData.RoleID == oRes.problem_roleid; + if (flag2) + { + DlgBase.singleton.ReqQuickCommonPurchase(ItemEnum.FATIGUE); + } + goto IL_155; + } + if (result != ErrorCode.ERR_SCENE_TODYCOUNTLIMIT) + { + goto IL_155; + } + } + else if (result != ErrorCode.ERR_TEAM_NEST_DAYCOUNT) + { + if (result != ErrorCode.ERR_TEAM_SERVER_OPEN_TIME) + { + goto IL_155; + } + string text = this._GetRoleName(oRes.problem_roleid); + bool flag3 = text == null; + if (flag3) + { + text = string.Empty; + } + XSingleton.singleton.ShowSystemTip(XSingleton.singleton.TimeFormatSince1970((int)oRes.opentime, XStringDefineProxy.GetString("TEAM_ERR_TEAM_SERVER_OPEN_TIME", new object[] + { + text + }), true), "fece00"); + goto IL_155; + } + bool flag4 = oRes.problem_roleid == 0UL || XSingleton.singleton.XPlayerData.RoleID == oRes.problem_roleid; + if (flag4) + { + ExpeditionTable.RowData expeditionDataByID = this.ExpDoc.GetExpeditionDataByID((int)oArg.expID); + bool flag5 = expeditionDataByID != null; + if (flag5) + { + TeamLevelType type = (TeamLevelType)expeditionDataByID.Type; + DlgBase.singleton.PassiveShow(type); + } + } + IL_155: + TeamOperate request = oArg.request; + if (request == TeamOperate.TEAM_START_MATCH) + { + this.m_bAutoMatching = false; + } + } + else + { + TeamOperate request2 = oArg.request; + if (request2 <= TeamOperate.TEAM_STOP_MATCH) + { + switch (request2) + { + case TeamOperate.TEAM_CREATE: + { + bool flag6 = oArg.param > 0UL; + if (flag6) + { + this.ReqTeamOp(TeamOperate.TEAM_INVITE, oArg.param, null, TeamMemberType.TMT_NORMAL, null); + } + this.ExpDoc.TryShowPveAttrTips(oArg.expID); + break; + } + case TeamOperate.TEAM_JOIN: + this.TryChangeToExpID((int)oArg.expID); + break; + case TeamOperate.TEAM_LEAVE: + { + bool flag7 = oArg.param > 0UL; + if (flag7) + { + bool bHasPwd = (oArg.param & 4294967296UL) > 0UL; + ulong num = oArg.param & ulong.MaxValue; + XTeamView.TryJoinTeam((int)num, bHasPwd); + } + break; + } + default: + switch (request2) + { + case TeamOperate.TEAM_CHANGE_EPXTEAMID: + this._SetCurrentDungeon((int)oArg.expID); + break; + case TeamOperate.TEAM_INVITE: + { + bool flag8 = oArg.accountSpecified && !string.IsNullOrEmpty(oArg.account); + if (!flag8) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("TEAM_INVITE_SUCCESS"), "fece00"); + } + break; + } + case TeamOperate.TEAM_START_MATCH: + { + bool bAutoMatching = this.m_bAutoMatching; + if (bAutoMatching) + { + DlgBase.singleton.ShowTeamView(); + } + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("BEGIN_MATCH"), "fece00"); + break; + } + case TeamOperate.TEAM_STOP_MATCH: + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("CANCEL_MATCH"), "fece00"); + break; + } + break; + } + } + else if (request2 != TeamOperate.TEAM_CHANGE_PASSWORD) + { + if (request2 == TeamOperate.TEAM_MEMBER_TYPE) + { + bool flag9 = TeamMemberType.TMT_USETICKET == oArg.membertype; + if (flag9) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("ERR_TEAM_TICKET_SUCCESS"), "fece00"); + } + else + { + bool flag10 = TeamMemberType.TMT_HELPER == oArg.membertype; + if (flag10) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("SWITCH_TO_HELPER"), "fece00"); + } + } + } + } + else + { + bool flag11 = string.IsNullOrEmpty(oArg.password); + if (flag11) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("TEAM_REMOVE_PWD"), "fece00"); + } + else + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("TEAM_SET_PWD"), "fece00"); + } + } + bool flag12 = XTeamDocument.bFromHyperLink; + if (flag12) + { + DlgBase.singleton.ShowTeamView(); + } + } + } + + public void OnLeaveTeam(LeaveTeamType errType) + { + bool flag = this._MyTeam == null; + if (flag) + { + bool flag2 = errType != LeaveTeamType.LTT_MS_CRASH; + if (flag2) + { + XSingleton.singleton.AddErrorLog("Not in team now. Shouldnt receive leave team ptc.", null, null, null, null, null); + } + } + else + { + LeaveTeamType leaveTeamType = errType; + if (leaveTeamType != LeaveTeamType.LTT_BY_SELF) + { + if (leaveTeamType - LeaveTeamType.LTT_DEL_ROBOT > 1) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString(errType.ToString()), "fece00"); + } + } + else + { + bool flag3 = XSingleton.singleton.CurrentStage.Stage == EXStage.Hall; + if (flag3) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("TEAM_LEAVE_TEAM", new object[] + { + XStringDefineProxy.GetString("YOU") + }), "fece00"); + } + } + XLeaveTeamEventArgs @event = XEventPool.GetEvent(); + @event.dungeonID = this._MyTeam.teamBrief.dungeonID; + @event.Firer = XSingleton.singleton.Doc; + this._MyTeam = null; + this.password = ""; + XSingleton.singleton.FireEvent(@event); + } + } + + public void RefreshMyTeamView() + { + bool flag = this.MyTeamView != null && this.MyTeamView.IsVisible(); + if (flag) + { + this.MyTeamView.RefreshPage(); + } + } + + public void RefreshRedPoint() + { + this._UpdateOtherUI(); + } + + private void _UpdateOtherUI() + { + bool flag = DlgBase.singleton.IsLoaded() && DlgBase.singleton.IsVisible(); + if (flag) + { + bool flag2 = XSingleton.singleton.SceneType != SceneType.SCENE_PVP && XSingleton.singleton.SceneType != SceneType.SCENE_HEROBATTLE; + if (flag2) + { + DlgBase.singleton.TeamMonitor.TeamInfoChangeOnBattle(this._MyTeam); + } + } + bool flag3 = DlgBase.singleton.IsVisible(); + if (flag3) + { + bool flag4 = !DlgBase.singleton._TaskNaviHandler.IsShowingTaskTab; + if (flag4) + { + DlgBase.singleton._TaskNaviHandler.TeamHandler.TeamInfoChange(this._MyTeam); + } + } + } + + public override void Update(float fDeltaT) + { + base.Update(fDeltaT); + bool flag = this.MyTeam != null; + if (flag) + { + this.MyTeam.OnUpdate(); + } + bool flag2 = this.m_nMatchingTime >= 0; + if (flag2) + { + int num = (int)(Time.time - this.m_fMatchingTime); + bool flag3 = num > this.m_nMatchingTime; + if (flag3) + { + this.m_nMatchingTime = num; + } + } + } + + private void _AutoJoin() + { + this.bTryAutoJoin = false; + foreach (XTeamBriefData xteamBriefData in this._TeamList) + { + bool flag = xteamBriefData.state == XTeamState.TS_NOT_FULL; + if (flag) + { + this.ReqTeamOp(TeamOperate.TEAM_JOIN, (ulong)((long)xteamBriefData.teamID), null, TeamMemberType.TMT_NORMAL, null); + return; + } + } + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("TEAM_AUTOJOIN_FAILED"), "fece00"); + } + + public void ToggleVoting(bool bVote) + { + this._bVoting = bVote; + bool bVoting = this._bVoting; + if (bVoting) + { + DlgBase.singleton.StartFightVote(); + } + else + { + bool flag = !this.bInTeam || this.MyTeam.teamBrief.actualState != TeamState.TEAM_IN_BATTLE; + if (flag) + { + bool flag2 = DlgBase.singleton.IsVisible(); + if (flag2) + { + DlgBase.singleton.SetVisibleWithAnimation(false, null); + } + } + } + } + + public static KMatchType TeamType2MatchType(TeamLevelType type) + { + KMatchType result; + if (type != TeamLevelType.TeamLevelCaptainPVP) + { + switch (type) + { + case TeamLevelType.TeamLevelHeroBattle: + return KMatchType.KMT_HERO; + case TeamLevelType.TeamLevelTeamLeague: + return KMatchType.KMT_LEAGUE; + case TeamLevelType.TeamLevelMultiPK: + return KMatchType.KMT_PKTWO; + case TeamLevelType.TeamLevelWeekendParty: + return KMatchType.KMT_WEEKEND_ACT; + case TeamLevelType.TeamLevelMoba: + return KMatchType.KMT_MOBA; + case TeamLevelType.TeamLevelCustomPKTwo: + return KMatchType.KMT_CUSTOM_PKTWO; + } + result = KMatchType.KMT_EXP; + } + else + { + result = KMatchType.KMT_PVP; + } + return result; + } + + public static TeamLevelType MatchType2TeamType(KMatchType type) + { + switch (type) + { + case KMatchType.KMT_PVP: + return TeamLevelType.TeamLevelCaptainPVP; + case KMatchType.KMT_HERO: + return TeamLevelType.TeamLevelHeroBattle; + case KMatchType.KMT_LEAGUE: + return TeamLevelType.TeamLevelTeamLeague; + case KMatchType.KMT_PKTWO: + return TeamLevelType.TeamLevelMultiPK; + case KMatchType.KMT_MOBA: + return TeamLevelType.TeamLevelMoba; + case KMatchType.KMT_WEEKEND_ACT: + return TeamLevelType.TeamLevelWeekendParty; + case KMatchType.KMT_CUSTOM_PKTWO: + return TeamLevelType.TeamLevelCustomPKTwo; + } + return TeamLevelType.TeamLevelNone; + } + + public bool IsSoloMatching(TeamLevelType type) + { + return this.SoloMatchType == XTeamDocument.TeamType2MatchType(type); + } + + public bool IsMatching(TeamLevelType type) + { + bool bInTeam = this.bInTeam; + bool result; + if (bInTeam) + { + result = (this._MyTeam.teamBrief.matchType == XTeamDocument.TeamType2MatchType(type)); + } + else + { + result = this.IsSoloMatching(type); + } + return result; + } + + public void CancelMatch() + { + bool flag = this.bInTeam || !this.bSoloMatching; + if (!flag) + { + bool flag2 = this.SoloMatchType != KMatchType.KMT_EXP; + if (flag2) + { + TeamLevelType teamLevelType = XTeamDocument.MatchType2TeamType(this.SoloMatchType); + bool flag3 = teamLevelType == this.currentDungeonType; + if (flag3) + { + return; + } + } + KMatchType soloMatchType = this.SoloMatchType; + if (soloMatchType != KMatchType.KMT_EXP) + { + if (soloMatchType - KMatchType.KMT_PVP <= 1) + { + this.ReqMatchStateChange(this.SoloMatchType, KMatchOp.KMATCH_OP_STOP, false); + } + } + else + { + this.ReqTeamOp(TeamOperate.TEAM_STOP_MATCH, 0UL, null, TeamMemberType.TMT_NORMAL, null); + } + } + } + + public void ForceMatching(bool matching) + { + bool flag = !matching; + if (flag) + { + this.ReqTeamOp(TeamOperate.TEAM_STOP_MATCH, 0UL, null, TeamMemberType.TMT_NORMAL, null); + this.m_bAutoMatching = false; + } + else + { + this.ReqTeamOp(TeamOperate.TEAM_START_MATCH, 0UL, null, TeamMemberType.TMT_NORMAL, null); + this.m_bAutoMatching = true; + } + } + + public void SetAndMatch(int expid) + { + this.TryChangeToExpID(expid); + DlgBase.singleton.ShowTeamView(); + } + + public void ToggleMatching() + { + bool flag = this.IsMatching(this.currentDungeonType); + if (flag) + { + this.ReqTeamOp(TeamOperate.TEAM_STOP_MATCH, 0UL, null, TeamMemberType.TMT_NORMAL, null); + } + else + { + bool flag2 = this.currentDungeonType == TeamLevelType.TeamLevelTeamTower && this.ExpDoc.EnlargeMatch; + if (flag2) + { + this.ReqTeamOp(TeamOperate.TEAM_DOWN_MATCH, 0UL, null, TeamMemberType.TMT_NORMAL, null); + } + else + { + this.ReqTeamOp(TeamOperate.TEAM_START_MATCH, 0UL, null, TeamMemberType.TMT_NORMAL, null); + } + } + this.m_bAutoMatching = false; + } + + private bool _ForceStart(IXUIButton btn) + { + this.ReqTeamOp(TeamOperate.TEAM_START_BATTLE_REMOVE_DISAGREE_MEMBER, 0UL, null, TeamMemberType.TMT_NORMAL, null); + XSingleton.singleton.CloseModalDlg(); + return true; + } + + public int GetCurrentDayMaxCount() + { + return this.ExpDoc.GetDayMaxCount(this.currentDungeonType, this.currentSceneData); + } + + public int GetMyDayCount() + { + return this.ExpDoc.GetDayCount(this.currentDungeonType, this.currentSceneData); + } + + public void ReqSceneDayCount() + { + RpcC2G_QuerySceneDayCount rpcC2G_QuerySceneDayCount = new RpcC2G_QuerySceneDayCount(); + rpcC2G_QuerySceneDayCount.oArg.type = 1u; + List categories = this.ExpDoc.TeamCategoryMgr.m_Categories; + for (int i = 0; i < categories.Count; i++) + { + bool flag = !categories[i].HasOpened(); + if (!flag) + { + List expList = categories[i].expList; + for (int j = 0; j < expList.Count; j++) + { + uint sceneIDByExpID = this.ExpDoc.GetSceneIDByExpID(expList[j].DNExpeditionID); + bool flag2 = sceneIDByExpID == 0u; + if (flag2) + { + break; + } + rpcC2G_QuerySceneDayCount.oArg.groupid.Add(sceneIDByExpID); + } + } + } + XSingleton.singleton.Send(rpcC2G_QuerySceneDayCount); + } + + public void OnGetSceneDayCount(QuerySceneDayCountRes oRes) + { + bool flag = !DlgBase.singleton.IsVisible(); + if (!flag) + { + this.TryAutoSelectExp(); + } + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + RpcC2M_TeamRequestC2M rpcC2M_TeamRequestC2M = new RpcC2M_TeamRequestC2M(); + rpcC2M_TeamRequestC2M.oArg.request = TeamOperate.TEAM_GET_FULL_DATA; + XSingleton.singleton.Send(rpcC2M_TeamRequestC2M); + } + + public void OnTeamFullDataNotify(TeamFullDataNtf data) + { + XSingleton.singleton.AddGreenLog("Team reconnect", null, null, null, null, null); + bool flag = !data.hasTeam && this.bInTeam; + if (flag) + { + this.OnLeaveTeam(LeaveTeamType.LTT_BY_SELF); + } + else + { + bool hasTeam = data.hasTeam; + if (hasTeam) + { + XTeamDocument.XPreviousTeamData previousData = new XTeamDocument.XPreviousTeamData(this); + bool flag2 = this.MyTeam == null; + if (flag2) + { + this._MyTeam = new XTeam(); + previousData.bNewTeam = true; + } + previousData.PreserveTeamData(this._MyTeam); + this._MyTeam.Reset(); + this._MyTeam.PreUpdate(); + this._MyTeam.teamBrief.SetData(data.teamBrief, this.ExpDoc); + bool flag3 = this._MyTeam.teamBrief.rowData == null; + if (flag3) + { + XSingleton.singleton.ShowModalDialog(XStringDefineProxy.GetString("LeaveTeamSinceNoConfig"), XStringDefineProxy.GetString(XStringDefine.COMMON_OK)); + this.ReqTeamOp(TeamOperate.TEAM_LEAVE, 0UL, null, TeamMemberType.TMT_NORMAL, null); + } + else + { + for (int i = 0; i < data.members.Count; i++) + { + this._MyTeam.AddMember(data.members[i]); + } + this._MyTeam.PostUpdate(); + bool flag4 = this.MyTeam.members.Count > 1; + if (flag4) + { + XSingleton.singleton.HasTeam = true; + } + this._MyTeam.members.Sort(); + this._PostTeamInfoChanged(previousData, data.teamBrief); + } + } + } + } + + public void ReqMatchStateChange(KMatchType type, KMatchOp op, bool isTeamMatch) + { + XSingleton.singleton.AddGreenLog(string.Concat(new object[] + { + "KKSG.KMatchType:", + type, + " KKSG.KMatchOp:", + op, + "\nisTeamMatch:", + isTeamMatch.ToString() + }), null, null, null, null, null); + RpcC2M_KMatchCommonReq rpcC2M_KMatchCommonReq = new RpcC2M_KMatchCommonReq(); + rpcC2M_KMatchCommonReq.oArg.type = type; + rpcC2M_KMatchCommonReq.oArg.op = op; + rpcC2M_KMatchCommonReq.oArg.isteam = isTeamMatch; + XSingleton.singleton.Send(rpcC2M_KMatchCommonReq); + } + + public void OnRoleMatchStateNotify(RoleStateMatch matchData) + { + bool flag = matchData.matchtype > KMatchType.KMT_NONE; + if (flag) + { + bool flag2 = this.m_SoloMatchType != matchData.matchtype; + if (flag2) + { + this.m_nMatchingTime = 0; + this.m_fMatchingTime = Time.time; + } + } + else + { + this.m_nMatchingTime = -1; + } + this.m_SoloMatchType = matchData.matchtype; + bool flag3 = this.TeamListView != null && this.TeamListView.IsVisible(); + if (flag3) + { + this.TeamListView.RefreshPage(); + } + bool flag4 = DlgBase.singleton.IsLoaded(); + if (flag4) + { + DlgBase.singleton._TaskNaviHandler.SetTeamMatching(this.bSoloMatching); + } + bool flag5 = DlgBase.singleton.IsVisible(); + if (flag5) + { + DlgBase.singleton.RefreshButtonState(); + } + bool flag6 = DlgBase.singleton.IsVisible(); + if (flag6) + { + DlgBase.singleton.Refresh(); + } + bool flag7 = DlgBase.singleton.IsVisible(); + if (flag7) + { + DlgBase.singleton.RefreshMatch(); + } + bool flag8 = DlgBase.singleton.IsVisible(); + if (flag8) + { + DlgBase.singleton.RefreshMatch2v2Btn(); + } + bool flag9 = DlgBase.singleton.IsVisible(); + if (flag9) + { + DlgBase.singleton.RefreshMatchBtn(); + } + } + + public static bool GoSingleBattleBeforeNeed(ButtonClickEventHandler handler, IXUIButton btn) + { + XTeamDocument._EventDel = null; + XTeamDocument specificDocument = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + bool bCanEnter = XTeamDocument._bCanEnter; + bool result; + if (bCanEnter) + { + XTeamDocument._bCanEnter = false; + result = false; + } + else + { + XTeamDocument._EnterButton = btn; + XTeamDocument._EnterHandler = handler; + bool bInTeam = specificDocument.bInTeam; + if (bInTeam) + { + result = XTeamDocument.ShouldLeaveTeamFirst(); + } + else + { + result = XTeamDocument.ShouldTips(); + } + } + return result; + } + + public static bool GoSingleBattleBeforeNeed(EventDelegate del) + { + XTeamDocument._EnterHandler = null; + XTeamDocument specificDocument = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + bool bCanEnter = XTeamDocument._bCanEnter; + bool result; + if (bCanEnter) + { + XTeamDocument._bCanEnter = false; + result = false; + } + else + { + XTeamDocument._EventDel = del; + bool bInTeam = specificDocument.bInTeam; + if (bInTeam) + { + result = XTeamDocument.ShouldLeaveTeamFirst(); + } + else + { + result = XTeamDocument.ShouldTips(); + } + } + return result; + } + + public static bool ShouldTips() + { + bool flag = XSingleton.singleton.SceneType == SceneType.SKYCITY_WAITING || XSingleton.singleton.SceneType == SceneType.SCENE_HORSE || XSingleton.singleton.SceneType == SceneType.SCENE_BIGMELEE_READY || XSingleton.singleton.SceneType == SceneType.SCENE_BATTLEFIELD_READY; + bool result; + if (flag) + { + XSingleton.singleton.ShowModalDialog(XStringDefineProxy.GetString("SKY_ARENA_LEAVE_SINGLE_TIP"), XStringDefineProxy.GetString(XStringDefine.COMMON_OK), XStringDefineProxy.GetString(XStringDefine.COMMON_CANCEL), new ButtonClickEventHandler(XTeamDocument._Enter)); + result = true; + } + else + { + result = false; + } + return result; + } + + public static bool ShouldLeaveTeamFirst() + { + bool flag = XSingleton.singleton.SceneType == SceneType.SKYCITY_WAITING; + string @string; + if (flag) + { + @string = XStringDefineProxy.GetString("SKY_ARENA_LEAVE_TEAM_TIP"); + } + else + { + @string = XStringDefineProxy.GetString("TEAM_SHOULD_LEAVE_TEAM_CONFIRM"); + } + XSingleton.singleton.ShowModalDialog(@string, XStringDefineProxy.GetString(XStringDefine.COMMON_OK), XStringDefineProxy.GetString(XStringDefine.COMMON_CANCEL), new ButtonClickEventHandler(XTeamDocument._LeaveAndEnter)); + return true; + } + + private static bool _Enter(IXUIButton button) + { + XTeamDocument._bCanEnter = true; + bool flag = XTeamDocument._EnterHandler != null; + if (flag) + { + XTeamDocument._EnterHandler(XTeamDocument._EnterButton); + XTeamDocument._EnterHandler = null; + } + bool flag2 = XTeamDocument._EventDel != null; + if (flag2) + { + XTeamDocument._EventDel(); + XTeamDocument._EventDel = null; + } + XSingleton.singleton.CloseModalDlg(); + return true; + } + + private static bool _LeaveAndEnter(IXUIButton button) + { + XTeamDocument specificDocument = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + bool bInTeam = specificDocument.bInTeam; + if (bInTeam) + { + specificDocument.ReqTeamOp(TeamOperate.TEAM_LEAVE, 0UL, null, TeamMemberType.TMT_NORMAL, null); + } + XTeamDocument._bCanEnter = true; + bool flag = XTeamDocument._EnterHandler != null; + if (flag) + { + XTeamDocument._EnterHandler(XTeamDocument._EnterButton); + XTeamDocument._EnterHandler = null; + } + bool flag2 = XTeamDocument._EventDel != null; + if (flag2) + { + XTeamDocument._EventDel(); + XTeamDocument._EventDel = null; + } + XSingleton.singleton.CloseModalDlg(); + return true; + } + + public static void OnTeamHyperLinkClick(string param) + { + bool flag = XSingleton.singleton.CurrentStage.Stage != EXStage.Hall; + if (!flag) + { + XTeamDocument specificDocument = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + bool bInTeam = specificDocument.bInTeam; + if (bInTeam) + { + XSingleton.singleton.ShowSystemTip(ErrorCode.ERR_TEAM_ALREADY_INTEAM, "fece00"); + } + else + { + int teamID = 0; + uint num = 0u; + bool flag2 = !XLabelSymbolHelper.ParseTeamParam(param, ref teamID, ref num); + if (!flag2) + { + XExpeditionDocument specificDocument2 = XDocuments.GetSpecificDocument(XExpeditionDocument.uuID); + ExpeditionTable.RowData expeditionDataByID = specificDocument2.GetExpeditionDataByID((int)num); + bool flag3 = expeditionDataByID == null; + if (flag3) + { + XSingleton.singleton.AddErrorLog("Invalid expedi ID ", num.ToString(), null, null, null, null); + } + else + { + bool flag4 = (long)expeditionDataByID.RequiredLevel > (long)((ulong)XSingleton.singleton.XPlayerData.Level); + if (flag4) + { + XSingleton.singleton.ShowSystemTip(ErrorCode.ERR_TEAM_LEVEL_REQUARE, "fece00"); + } + else + { + XTeamDocument.bFromHyperLink = true; + RpcC2M_TeamRequestC2M rpcC2M_TeamRequestC2M = new RpcC2M_TeamRequestC2M(); + rpcC2M_TeamRequestC2M.oArg.expID = num; + rpcC2M_TeamRequestC2M.oArg.teamID = teamID; + rpcC2M_TeamRequestC2M.oArg.request = TeamOperate.TEAM_JOIN; + XSingleton.singleton.Send(rpcC2M_TeamRequestC2M); + specificDocument._SetCurrentTeamInfo(expeditionDataByID); + } + } + } + } + } + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamDocument.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamDocument.cs.meta new file mode 100644 index 00000000..69d373dd --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamDocument.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a0d00f96aa610c94991525897497aa3e +timeCreated: 1611404250 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamDungeonSelectorHandler.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamDungeonSelectorHandler.cs new file mode 100644 index 00000000..bec3347f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamDungeonSelectorHandler.cs @@ -0,0 +1,306 @@ +using System; +using System.Collections.Generic; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamDungeonSelectorHandler : DlgHandlerBase + { + private static readonly Color BAD_COLOR = new Color(1f, 0.239215687f, 0.137254909f); + + private static readonly Color GOOD_COLOR = new Color(0.392156869f, 0.7176471f, 0.215686277f); + + private XTeamDocument _TeamDoc; + + private XExpeditionDocument _ExpDoc; + + private IXUIScrollView m_DungeonScrollView; + + private IXUIScrollView m_CategoryScrollView; + + private XUIPool m_DungeonPool = new XUIPool(XSingleton.singleton.m_uiTool); + + private XUIPool m_CategoryPool = new XUIPool(XSingleton.singleton.m_uiTool); + + private List m_CategoryList = new List(); + + private IXUISprite m_Close; + + public IXUIButton m_BtnDungeonSelector; + + public IXUILabel m_CurrentDungeon; + + public IXUILabel m_CurrentCategory; + + public GameObject m_SelectorFrame; + + protected override void Init() + { + base.Init(); + this.m_BtnDungeonSelector = (base.PanelObject.transform.Find("CurrentCategory/Btn").GetComponent("XUIButton") as IXUIButton); + this.m_CurrentDungeon = (base.PanelObject.transform.Find("CurrentDungeon").GetComponent("XUILabel") as IXUILabel); + this.m_CurrentCategory = (base.PanelObject.transform.Find("CurrentCategory").GetComponent("XUILabel") as IXUILabel); + this.m_SelectorFrame = base.PanelObject.transform.Find("Selector").gameObject; + this.m_DungeonScrollView = (this.m_SelectorFrame.transform.Find("Main/Dungeons/Panel").GetComponent("XUIScrollView") as IXUIScrollView); + this.m_CategoryScrollView = (this.m_SelectorFrame.transform.Find("Main/Categories/Panel").GetComponent("XUIScrollView") as IXUIScrollView); + this.m_Close = (this.m_SelectorFrame.transform.Find("Close").GetComponent("XUISprite") as IXUISprite); + this._TeamDoc = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + this._ExpDoc = XDocuments.GetSpecificDocument(XExpeditionDocument.uuID); + this._TeamDoc.DungeonSelector = this; + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this.m_Close.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnCloseClicked)); + this.m_BtnDungeonSelector.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnDungeonSelectorClick)); + } + + protected override void _DelayInit() + { + base._DelayInit(); + Transform transform = this.m_DungeonScrollView.gameObject.transform.Find("Tpl"); + this.m_DungeonPool.SetupPool(transform.parent.gameObject, transform.gameObject, 2u, false); + transform = this.m_CategoryScrollView.gameObject.transform.Find("List/CategoryTpl"); + this.m_CategoryPool.SetupPool(transform.parent.gameObject, transform.gameObject, 2u, false); + } + + protected override void OnShow() + { + base.OnShow(); + this.SetCurrentDungeon(true); + } + + public override void RefreshData() + { + base.RefreshData(); + this.SetCurrentDungeon(false); + } + + public override void StackRefresh() + { + base.StackRefresh(); + this.SetCurrentDungeon(false); + } + + public void ToggleSelector(bool bShow) + { + this.m_SelectorFrame.SetActive(bShow); + if (bShow) + { + this._Setup(); + this._DefaultSelect(); + } + } + + public override void OnUnload() + { + this._TeamDoc.DungeonSelector = null; + base.OnUnload(); + } + + private void _OnCloseClicked(IXUISprite iSp) + { + this.ToggleSelector(false); + } + + private bool _OnDungeonSelectorClick(IXUIButton go) + { + this.ToggleSelector(true); + return true; + } + + public void SetCurrentDungeon(bool bCloseSelection) + { + bool flag = this._TeamDoc.currentDungeonID == 0u; + if (flag) + { + this.m_CurrentDungeon.SetText(XStringDefineProxy.GetString("TEAM_NO_TARGET")); + } + else + { + this.m_CurrentDungeon.SetText(string.Format("{0} {1}", this._TeamDoc.currentCategoryName, this._TeamDoc.currentDungeonName)); + } + if (bCloseSelection) + { + this.ToggleSelector(false); + } + this.m_BtnDungeonSelector.SetEnable(!this._TeamDoc.bInTeam || this._TeamDoc.bIsLeader, false); + } + + private void _DefaultSelect() + { + bool flag = this._TeamDoc.currentDungeonID == 0u; + if (!flag) + { + ExpeditionTable.RowData expeditionDataByID = this._ExpDoc.GetExpeditionDataByID((int)this._TeamDoc.currentDungeonID); + bool flag2 = expeditionDataByID == null; + if (!flag2) + { + ulong num = (ulong)((long)expeditionDataByID.Category); + for (int i = 0; i < this.m_CategoryList.Count; i++) + { + bool flag3 = num == this.m_CategoryList[i].ID; + if (flag3) + { + this.m_CategoryList[i].bChecked = true; + break; + } + } + } + } + } + + private void _Setup() + { + this.m_DungeonPool.ReturnAll(false); + this.m_CategoryPool.ReturnAll(false); + this.m_CategoryList.Clear(); + List categories = this._ExpDoc.TeamCategoryMgr.m_Categories; + int num = 0; + for (int i = 0; i < categories.Count; i++) + { + XTeamCategory xteamCategory = categories[i]; + bool flag = !xteamCategory.HasOpened(); + if (!flag) + { + GameObject gameObject = this.m_CategoryPool.FetchGameObject(false); + gameObject.transform.localPosition = new Vector3(this.m_CategoryPool.TplPos.x, this.m_CategoryPool.TplPos.y - (float)(this.m_CategoryPool.TplHeight * num)); + IXUICheckBox ixuicheckBox = gameObject.transform.Find("BtnToggle/Normal").GetComponent("XUICheckBox") as IXUICheckBox; + ixuicheckBox.ID = (ulong)((long)xteamCategory.category); + ixuicheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this._CategoryCheckEventHandler)); + IXUILabel ixuilabel = gameObject.transform.Find("BtnToggle/Text").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel2 = gameObject.transform.Find("BtnToggle/SelectedText").GetComponent("XUILabel") as IXUILabel; + string categoryName = XTeamCategory.GetCategoryName(xteamCategory.category); + ixuilabel.SetText(categoryName); + ixuilabel2.SetText(categoryName); + this.m_CategoryList.Add(ixuicheckBox); + num++; + ixuicheckBox.ForceSetFlag(false); + } + } + this.m_CategoryScrollView.ResetPosition(); + } + + private bool _CategoryCheckEventHandler(IXUICheckBox ckb) + { + bool flag = !ckb.bChecked; + bool result; + if (flag) + { + result = true; + } + else + { + this.m_DungeonPool.FakeReturnAll(); + XTeamCategory xteamCategory = this._ExpDoc.TeamCategoryMgr.FindCategory((int)ckb.ID); + bool flag2 = xteamCategory != null; + if (flag2) + { + XPlayerAttributes playerAttributes = XSingleton.singleton.Player.PlayerAttributes; + uint num = (uint)playerAttributes.GetAttr(XAttributeDefine.XAttr_POWER_POINT_Basic); + uint level = playerAttributes.Level; + int i = 0; + int num2 = 0; + while (i < xteamCategory.expList.Count) + { + ExpeditionTable.RowData rowData = xteamCategory.expList[i]; + bool flag3 = rowData == null; + if (!flag3) + { + bool flag4 = !xteamCategory.IsExpOpened(rowData); + if (!flag4) + { + GameObject gameObject = this.m_DungeonPool.FetchGameObject(false); + gameObject.transform.localPosition = new Vector3(this.m_DungeonPool.TplPos.x, this.m_DungeonPool.TplPos.y - (float)(this.m_DungeonPool.TplHeight * num2++)); + IXUILabel ixuilabel = gameObject.transform.Find("Name").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(XExpeditionDocument.GetFullName(rowData)); + ixuilabel = (gameObject.transform.Find("PPT").GetComponent("XUILabel") as IXUILabel); + ixuilabel.SetText(rowData.DisplayPPT.ToString()); + ixuilabel.SetColor((rowData.DisplayPPT <= num) ? XTeamDungeonSelectorHandler.GOOD_COLOR : XTeamDungeonSelectorHandler.BAD_COLOR); + ixuilabel = (gameObject.transform.Find("Level").GetComponent("XUILabel") as IXUILabel); + ixuilabel.SetText(XStringDefineProxy.GetString("LEVEL", new object[] + { + rowData.DisplayLevel.ToString() + })); + ixuilabel.SetColor((rowData.DisplayLevel <= level) ? XTeamDungeonSelectorHandler.GOOD_COLOR : XTeamDungeonSelectorHandler.BAD_COLOR); + Transform transform = gameObject.transform.Find("Normal"); + IXUICheckBox ixuicheckBox = transform.GetComponent("XUICheckBox") as IXUICheckBox; + ixuicheckBox.ID = (ulong)((long)rowData.DNExpeditionID); + ixuicheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this._DungeonCheckEventHandler)); + IXUIButton ixuibutton = transform.GetComponent("XUIButton") as IXUIButton; + ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this._DungeonClickEventHandler)); + ixuicheckBox.ForceSetFlag((ulong)this._TeamDoc.currentDungeonID == (ulong)((long)rowData.DNExpeditionID)); + IXUISprite ixuisprite = gameObject.transform.Find("SisterTA").GetComponent("XUISprite") as IXUISprite; + ixuisprite.ID = 0UL; + ixuisprite.SetVisible(this._TeamDoc.ShowTarja((uint)rowData.DNExpeditionID)); + ixuisprite.RegisterSpritePressEventHandler(new SpritePressEventHandler(this.OnShowTarjaTipHandle)); + } + } + i++; + } + } + this.m_DungeonPool.ActualReturnAll(false); + this.m_DungeonScrollView.ResetPosition(); + result = true; + } + return result; + } + + private bool OnShowTarjaTipHandle(IXUISprite sprite, bool pressed) + { + IXUILabel ixuilabel = sprite.transform.Find("Info").GetComponent("XUILabel") as IXUILabel; + bool flag = ixuilabel == null; + bool result; + if (flag) + { + result = false; + } + else + { + bool flag2 = sprite.ID == 1UL; + if (flag2) + { + ixuilabel.SetText(XSingleton.singleton.ReplaceReturn(XStringDefineProxy.GetString("TEAM_TARJA_DESC_TEAM"))); + } + else + { + ixuilabel.SetText(XSingleton.singleton.ReplaceReturn(XStringDefineProxy.GetString("TEAM_TARJA_DESC"))); + } + ixuilabel.SetVisible(pressed); + result = false; + } + return result; + } + + private bool _DungeonClickEventHandler(IXUIButton btn) + { + IXUICheckBox ixuicheckBox = btn.gameObject.GetComponent("XUICheckBox") as IXUICheckBox; + bool bChecked = ixuicheckBox.bChecked; + if (bChecked) + { + this.ToggleSelector(false); + } + return true; + } + + private bool _DungeonCheckEventHandler(IXUICheckBox ckb) + { + bool flag = !ckb.bChecked; + bool result; + if (flag) + { + result = true; + } + else + { + this._TeamDoc.TryChangeToExpID((int)ckb.ID); + result = true; + } + return result; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamDungeonSelectorHandler.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamDungeonSelectorHandler.cs.meta new file mode 100644 index 00000000..61eee865 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamDungeonSelectorHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: aaebd8042e38aa24cb8533cc08b87a92 +timeCreated: 1611404305 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamFriendDegreeHandler.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamFriendDegreeHandler.cs new file mode 100644 index 00000000..976b1253 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamFriendDegreeHandler.cs @@ -0,0 +1,366 @@ +using System; +using System.Collections.Generic; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamFriendDegreeHandler : DlgHandlerBase + { + private IXUILabel m_FriendLevel; + + private IXUILabel m_FriendTitle; + + private IXUISprite m_BtnAdd; + + private IXUISprite m_BtnBuff; + + private GameObject m_InfoPanel; + + private IXUISprite m_InfoClose; + + private IXUISprite m_InfoMiddleFrame; + + private IXUILabel m_InfoTopFrameFriendLevel; + + private GameObject m_InfoTopFrameMe; + + private IXUILabel m_InfoBottomFrameFriend; + + private GameObject m_InfoBottomFrameMe; + + private XUIPool m_AttrPool = new XUIPool(XSingleton.singleton.m_uiTool); + + private XFriendsView _FriendsView; + + private XFriendsDocument _FriendsDoc; + + private XTeamDocument _TeamDoc; + + private int m_TeamMemberIndex = 0; + + private ulong m_CurrentUID = 0UL; + + private struct XPercentAttr + { + public uint AttrID; + + public double Scale; + + public static XTeamFriendDegreeHandler.XPercentAttr CreateFromTableData(float data0, float data1) + { + XTeamFriendDegreeHandler.XPercentAttr result; + result.AttrID = (uint)data0; + result.Scale = (double)data1; + return result; + } + } + + protected override void Init() + { + base.Init(); + this.m_FriendLevel = (base.PanelObject.transform.Find("FriendLevel").GetComponent("XUILabel") as IXUILabel); + this.m_FriendTitle = (base.PanelObject.transform.Find("FriendTitle").GetComponent("XUILabel") as IXUILabel); + this.m_BtnAdd = (base.PanelObject.transform.Find("BtnAdd").GetComponent("XUISprite") as IXUISprite); + this.m_BtnBuff = (base.PanelObject.transform.Find("BtnBuff").GetComponent("XUISprite") as IXUISprite); + this.m_InfoPanel = base.PanelObject.transform.Find("InfoPanel").gameObject; + this.m_InfoClose = (this.m_InfoPanel.transform.Find("Close").GetComponent("XUISprite") as IXUISprite); + this.m_InfoMiddleFrame = (this.m_InfoPanel.transform.Find("MiddleFrame").GetComponent("XUISprite") as IXUISprite); + Transform transform = this.m_InfoMiddleFrame.gameObject.transform.Find("Attr"); + this.m_AttrPool.SetupPool(transform.parent.gameObject, transform.gameObject, 2u, false); + transform = this.m_InfoPanel.transform.Find("TopFrame"); + this.m_InfoTopFrameFriendLevel = (transform.Find("FriendLevel").GetComponent("XUILabel") as IXUILabel); + this.m_InfoTopFrameMe = transform.Find("Me").gameObject; + transform = this.m_InfoPanel.transform.Find("BottomFrame"); + this.m_InfoBottomFrameMe = transform.Find("Me").gameObject; + this.m_InfoBottomFrameFriend = (transform.Find("Friend").GetComponent("XUILabel") as IXUILabel); + this._FriendsView = DlgBase.singleton; + this._TeamDoc = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + this._FriendsDoc = XDocuments.GetSpecificDocument(XFriendsDocument.uuID); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this.m_InfoClose.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnCloseClicked)); + this.m_BtnBuff.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnBuffClicked)); + this.m_BtnAdd.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnAddFriendClicked)); + } + + private void _OnCloseClicked(IXUISprite iSp) + { + this.m_InfoPanel.SetActive(false); + } + + private void _OnBuffClicked(IXUISprite iSp) + { + this.m_InfoPanel.SetActive(true); + XPlayer player = XSingleton.singleton.Player; + bool flag = player.ID == this.m_CurrentUID; + bool flag2 = flag; + if (flag2) + { + this._RefreshMyInfoPanel(this.m_CurrentUID); + } + else + { + XFriendData friendDataById = this._FriendsView.GetFriendDataById(this.m_CurrentUID); + bool flag3 = friendDataById == null; + if (flag3) + { + this.m_InfoPanel.SetActive(false); + } + else + { + FriendTable.RowData friendLevelData = this._FriendsDoc.GetFriendLevelData(friendDataById.degreeAll); + this._RefreshFriendInfoPanel(friendDataById, friendLevelData); + } + } + } + + private void _OnAddFriendClicked(IXUISprite iSp) + { + DlgBase.singleton.AddFriendById(this.m_CurrentUID); + } + + public void Refresh(XTeamMember data, bool bActive, int teamMemberIndex) + { + bool flag = data != null && bActive; + if (flag) + { + base.SetVisible(true); + this.m_TeamMemberIndex = teamMemberIndex; + bool flag2 = this.m_CurrentUID != data.uid; + if (flag2) + { + this.m_InfoPanel.SetActive(false); + this.m_CurrentUID = data.uid; + } + XPlayer player = XSingleton.singleton.Player; + bool flag3 = player.ID == data.uid; + bool flag4 = flag3; + if (flag4) + { + this.m_BtnAdd.SetVisible(false); + this.m_BtnBuff.SetVisible(true); + this.m_FriendLevel.SetVisible(false); + this.m_FriendTitle.SetVisible(false); + bool activeSelf = this.m_InfoPanel.activeSelf; + if (activeSelf) + { + this._RefreshMyInfoPanel(data.uid); + } + } + else + { + XFriendData friendDataById = this._FriendsView.GetFriendDataById(data.uid); + bool flag5 = friendDataById != null; + this.m_BtnAdd.SetVisible(!flag5 && !data.bIsRobot); + this.m_BtnBuff.SetVisible(flag5); + this.m_FriendLevel.SetVisible(flag5); + this.m_FriendTitle.SetVisible(flag5); + bool flag6 = !flag5; + if (flag6) + { + this.m_InfoPanel.SetActive(false); + } + else + { + this.m_FriendLevel.SetText(friendDataById.degreeAll.ToString()); + FriendTable.RowData friendLevelData = this._FriendsDoc.GetFriendLevelData(friendDataById.degreeAll); + bool flag7 = friendLevelData != null; + if (flag7) + { + this.m_FriendTitle.SetText(friendLevelData.teamname); + } + else + { + this.m_FriendTitle.SetText(""); + } + bool activeSelf2 = this.m_InfoPanel.activeSelf; + if (activeSelf2) + { + this._RefreshFriendInfoPanel(friendDataById, friendLevelData); + } + } + } + } + else + { + base.SetVisible(false); + } + } + + private void _AppendAttr(List attrs, XTeamFriendDegreeHandler.XPercentAttr newAttr) + { + int i; + for (i = 0; i < attrs.Count; i++) + { + bool flag = attrs[i].AttrID == newAttr.AttrID; + if (flag) + { + newAttr.Scale += attrs[i].Scale; + attrs[i] = newAttr; + break; + } + } + bool flag2 = i == attrs.Count; + if (flag2) + { + attrs.Add(newAttr); + } + } + + private void _SetAttr(XTeamFriendDegreeHandler.XPercentAttr attr, GameObject go) + { + IXUILabel ixuilabel = go.transform.Find("Name").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel2 = go.transform.Find("Value").GetComponent("XUILabel") as IXUILabel; + bool flag = attr.AttrID == 0u; + if (flag) + { + ixuilabel.SetText(XStringDefineProxy.GetString("NONE")); + ixuilabel2.SetText(""); + } + else + { + XAttributeDefine attrID = (XAttributeDefine)attr.AttrID; + ixuilabel.SetText(XStringDefineProxy.GetString(attrID.ToString())); + ixuilabel2.SetText(XAttributeCommon.GetAttrValueStr((int)attr.AttrID, (float)attr.Scale)); + } + } + + private void _RefreshMyInfoPanel(ulong myUID) + { + this.m_InfoBottomFrameMe.SetActive(true); + this.m_InfoBottomFrameFriend.SetVisible(false); + this.m_InfoTopFrameMe.SetActive(true); + this.m_InfoTopFrameFriendLevel.SetVisible(false); + List list = new List(); + bool flag = this._TeamDoc.MyTeam != null; + if (flag) + { + List members = this._TeamDoc.MyTeam.members; + for (int i = 0; i < members.Count; i++) + { + bool flag2 = members[i].uid == myUID; + if (!flag2) + { + XFriendData friendDataById = this._FriendsView.GetFriendDataById(members[i].uid); + bool flag3 = friendDataById == null; + if (!flag3) + { + FriendTable.RowData friendLevelData = this._FriendsDoc.GetFriendLevelData(friendDataById.degreeAll); + bool flag4 = friendLevelData == null; + if (!flag4) + { + BuffTable.RowData buffData = XSingleton.singleton.GetBuffData((int)friendLevelData.buf[0], (int)friendLevelData.buf[1]); + bool flag5 = buffData == null; + if (flag5) + { + XSingleton.singleton.AddErrorLog("buffData == null", null, null, null, null, null); + } + else + { + for (int j = 0; j < buffData.BuffChangeAttribute.Count; j++) + { + XTeamFriendDegreeHandler.XPercentAttr newAttr = XTeamFriendDegreeHandler.XPercentAttr.CreateFromTableData(buffData.BuffChangeAttribute[j, 0], buffData.BuffChangeAttribute[j, 1]); + this._AppendAttr(list, newAttr); + } + } + } + } + } + } + } + this.m_AttrPool.FakeReturnAll(); + bool flag6 = list.Count == 0; + if (flag6) + { + XTeamFriendDegreeHandler.XPercentAttr attr = default(XTeamFriendDegreeHandler.XPercentAttr); + GameObject gameObject = this.m_AttrPool.FetchGameObject(false); + gameObject.transform.localPosition = this.m_AttrPool.TplPos; + this._SetAttr(attr, gameObject); + this.m_InfoMiddleFrame.spriteHeight = this.m_AttrPool.TplHeight; + } + else + { + for (int k = 0; k < list.Count; k++) + { + XTeamFriendDegreeHandler.XPercentAttr attr2 = list[list.Count - k - 1]; + GameObject gameObject2 = this.m_AttrPool.FetchGameObject(false); + gameObject2.transform.localPosition = new Vector3(this.m_AttrPool.TplPos.x, this.m_AttrPool.TplPos.y + (float)(this.m_AttrPool.TplHeight * k), this.m_AttrPool.TplPos.z); + this._SetAttr(attr2, gameObject2); + } + this.m_InfoMiddleFrame.spriteHeight = list.Count * this.m_AttrPool.TplHeight; + } + this.m_AttrPool.ActualReturnAll(false); + } + + private void _RefreshFriendInfoPanel(XFriendData friendData, FriendTable.RowData rowData) + { + this.m_InfoBottomFrameMe.SetActive(false); + this.m_InfoBottomFrameFriend.SetVisible(true); + this.m_InfoTopFrameMe.SetActive(false); + this.m_InfoTopFrameFriendLevel.SetVisible(true); + bool flag = friendData == null; + if (flag) + { + XSingleton.singleton.AddErrorLog("friendData == null", null, null, null, null, null); + } + else + { + uint degreeAll = friendData.degreeAll; + this.m_AttrPool.FakeReturnAll(); + bool flag2 = rowData == null; + if (flag2) + { + XTeamFriendDegreeHandler.XPercentAttr attr = default(XTeamFriendDegreeHandler.XPercentAttr); + GameObject gameObject = this.m_AttrPool.FetchGameObject(false); + gameObject.transform.localPosition = this.m_AttrPool.TplPos; + this._SetAttr(attr, gameObject); + this.m_InfoMiddleFrame.spriteHeight = this.m_AttrPool.TplHeight; + } + else + { + BuffTable.RowData buffData = XSingleton.singleton.GetBuffData((int)rowData.buf[0], (int)rowData.buf[1]); + bool flag3 = buffData == null; + if (flag3) + { + XSingleton.singleton.AddErrorLog("buffData == null", null, null, null, null, null); + return; + } + int i = 0; + int count = buffData.BuffChangeAttribute.Count; + while (i < count) + { + int index = count - i - 1; + XTeamFriendDegreeHandler.XPercentAttr attr2 = XTeamFriendDegreeHandler.XPercentAttr.CreateFromTableData(buffData.BuffChangeAttribute[index, 0], buffData.BuffChangeAttribute[index, 1]); + GameObject gameObject2 = this.m_AttrPool.FetchGameObject(false); + gameObject2.transform.localPosition = new Vector3(this.m_AttrPool.TplPos.x, this.m_AttrPool.TplPos.y + (float)(this.m_AttrPool.TplHeight * i), this.m_AttrPool.TplPos.z); + this._SetAttr(attr2, gameObject2); + i++; + } + this.m_InfoMiddleFrame.spriteHeight = buffData.BuffChangeAttribute.Count * this.m_AttrPool.TplHeight; + } + this.m_AttrPool.ActualReturnAll(false); + this.m_InfoTopFrameFriendLevel.SetText(degreeAll.ToString()); + this.m_InfoBottomFrameFriend.SetText(""); + foreach (FriendTable.RowData rowData2 in this._FriendsDoc.GetFriendLevelDatas()) + { + bool flag4 = rowData2.level > degreeAll && rowData2.dropid > 0u; + if (flag4) + { + this.m_InfoBottomFrameFriend.SetText(XStringDefineProxy.GetString("FRIEND_DEGREE_GIFT_FORENOTICE", new object[] + { + (rowData2.level - degreeAll).ToString(), + rowData2.level.ToString() + })); + break; + } + } + } + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamFriendDegreeHandler.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamFriendDegreeHandler.cs.meta new file mode 100644 index 00000000..8d6bec2c --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamFriendDegreeHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1e705895a91d04f468298386c3d05548 +timeCreated: 1611403364 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamInputPasswordView.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamInputPasswordView.cs new file mode 100644 index 00000000..2312c60d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamInputPasswordView.cs @@ -0,0 +1,80 @@ +using System; +using KKSG; +using UILib; +using XMainClient.UI; +using XMainClient.UI.UICommon; + +namespace XMainClient +{ + internal class XTeamInputPasswordView : DlgBase + { + public override string fileName + { + get + { + return "Team/TeamInputPasswordDlg"; + } + } + + public override int layer + { + get + { + return 1; + } + } + + public override int group + { + get + { + return 1; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + private XTeamDocument _doc; + + public int TeamID; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + } + + public override void RegisterEvent() + { + base.uiBehaviour.m_BtnOK.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnOKBtnClicked)); + base.uiBehaviour.m_BtnClose.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnCloseBtnClicked)); + } + + protected override void OnShow() + { + base.OnShow(); + base.uiBehaviour.m_Input.SetText(string.Empty); + } + + private bool _OnOKBtnClicked(IXUIButton btn) + { + string text = base.uiBehaviour.m_Input.GetText(); + this._doc.password = text; + this._doc.ReqTeamOp(TeamOperate.TEAM_JOIN, (ulong)((long)this.TeamID), null, TeamMemberType.TMT_NORMAL, null); + this.SetVisibleWithAnimation(false, null); + return true; + } + + private bool _OnCloseBtnClicked(IXUIButton btn) + { + this.SetVisibleWithAnimation(false, null); + return true; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamInputPasswordView.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamInputPasswordView.cs.meta new file mode 100644 index 00000000..09270ac9 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamInputPasswordView.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cd901f427b19d5e4c9774e2df8d1b9ee +timeCreated: 1611404556 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamInviteData.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamInviteData.cs new file mode 100644 index 00000000..57bd820f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamInviteData.cs @@ -0,0 +1,56 @@ +using System; +using KKSG; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamInviteData : XDataBase + { + public XTeamBriefData briefData = new XTeamBriefData(); + + public uint inviteID; + + public string invitorName; + + public XTeamRelation invitorRelation = new XTeamRelation(); + + public uint time; + + private ExpeditionTable.RowData expData; + + private void _SetExpID(uint expID) + { + bool flag = this.briefData.dungeonID == expID; + if (!flag) + { + this.briefData.dungeonID = expID; + XExpeditionDocument specificDocument = XDocuments.GetSpecificDocument(XExpeditionDocument.uuID); + this.expData = specificDocument.GetExpeditionDataByID((int)expID); + bool flag2 = this.expData == null; + if (!flag2) + { + this.briefData.dungeonName = XExpeditionDocument.GetFullName(this.expData); + this.briefData.totalMemberCount = this.expData.PlayerNumber; + } + } + } + + public void SetData(TeamInvite data) + { + bool flag = data.teambrief == null; + if (!flag) + { + this.inviteID = data.inviteID; + this.briefData.SetData(data.teambrief, XDocuments.GetSpecificDocument(XExpeditionDocument.uuID)); + this.invitorName = data.invfromrolename; + this.invitorRelation.UpdateRelation(data.invfromroleid, data.invguildid, data.invdragonguildid); + this.time = data.invTime; + } + } + + public override void Recycle() + { + XDataPool.Recycle(this); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamInviteData.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamInviteData.cs.meta new file mode 100644 index 00000000..5baf1256 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamInviteData.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d03675353e661ad4ba62a65d7ed73862 +timeCreated: 1611404585 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamInviteDocument.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamInviteDocument.cs new file mode 100644 index 00000000..623e2d05 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamInviteDocument.cs @@ -0,0 +1,333 @@ +using System; +using System.Collections.Generic; +using KKSG; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamInviteDocument : XDocComponent + { + public override uint ID + { + get + { + return XTeamInviteDocument.uuID; + } + } + + public List[] InviteLists + { + get + { + return this.m_InviteLists; + } + } + + public List InvitedList + { + get + { + return this.m_InvitedList; + } + } + + public int InvitedCount + { + get + { + return this.m_InvitedCount; + } + set + { + this.m_InvitedCount = value; + bool flag = this.m_InvitedCount < 0; + if (flag) + { + this.m_InvitedCount = 0; + } + DlgBase.singleton.RefreshH5ButtonState(XSysDefine.XSys_Team_Invited, true); + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("TeamInviteDocument"); + + private static readonly int INVITE_TYPE_COUNT = 4; + + private List[] m_InviteLists = new List[XTeamInviteDocument.INVITE_TYPE_COUNT]; + + private List m_InvitedList = new List(); + + public int m_InvitedCount; + + public XTeamInviteView InviteHandler = null; + + public XTeamInvitedListView InvitedView = null; + + public override void OnAttachToHost(XObject host) + { + base.OnAttachToHost(host); + for (int i = 0; i < XTeamInviteDocument.INVITE_TYPE_COUNT; i++) + { + this.m_InviteLists[i] = new List(); + } + this.InvitedCount = 0; + } + + public override void OnDetachFromHost() + { + base.OnDetachFromHost(); + for (int i = 0; i < XTeamInviteDocument.INVITE_TYPE_COUNT; i++) + { + for (int j = 0; j < this.m_InviteLists[i].Count; j++) + { + this.m_InviteLists[i][j].Recycle(); + } + this.m_InviteLists[i].Clear(); + } + } + + public override void OnEnterSceneFinally() + { + base.OnEnterSceneFinally(); + bool flag = XSingleton.singleton.CurrentStage.Stage == EXStage.Hall; + if (flag) + { + DlgBase.singleton.RefreshH5ButtonState(XSysDefine.XSys_Team_Invited, true); + } + } + + protected override void EventSubscribe() + { + base.EventSubscribe(); + base.RegisterEvent(XEventDefine.XEvent_JoinTeam, new XComponent.XEventHandler(this._OnJoinTeam)); + } + + private bool _OnJoinTeam(XEventArgs e) + { + this._ClearInvitedList(); + this.InvitedCount = 0; + return true; + } + + public void ReqInviteList() + { + XTeamDocument specificDocument = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + RpcC2G_TeamInviteListReq rpcC2G_TeamInviteListReq = new RpcC2G_TeamInviteListReq(); + rpcC2G_TeamInviteListReq.oArg.expid = (int)specificDocument.currentDungeonID; + XSingleton.singleton.Send(rpcC2G_TeamInviteListReq); + } + + public void OnGetInviteList(TeamInviteRes oRes) + { + XPartnerDocument specificDocument = XDocuments.GetSpecificDocument(XPartnerDocument.uuID); + for (int i = 0; i < XTeamInviteDocument.INVITE_TYPE_COUNT; i++) + { + bool flag = i == 3; + if (!flag) + { + for (int j = 0; j < this.m_InviteLists[i].Count; j++) + { + this.m_InviteLists[i][j].Recycle(); + } + this.m_InviteLists[i].Clear(); + } + } + Dictionary dictionary = new Dictionary(); + for (int k = 0; k < oRes.guild.Count; k++) + { + XTeamInviteListData data = XDataPool.GetData(); + data.SetData(oRes.guild[k], false, true, XDragonGuildDocument.Doc.IsMyDragonGuildMember(oRes.guild[k].roledragonguildid)); + this.m_InviteLists[2].Add(data); + dictionary[data.uid] = data; + } + for (int l = 0; l < oRes.friend.Count; l++) + { + XTeamInviteListData data2; + bool flag2 = !dictionary.TryGetValue(oRes.friend[l].userID, out data2); + if (flag2) + { + data2 = XDataPool.GetData(); + data2.SetData(oRes.friend[l], true, false, XDragonGuildDocument.Doc.IsMyDragonGuildMember(oRes.friend[l].roledragonguildid)); + } + else + { + data2.relation.Append(XTeamRelation.Relation.TR_FRIEND, true); + bool flag3 = XDragonGuildDocument.Doc.IsMyDragonGuildMember(oRes.friend[l].roledragonguildid); + if (flag3) + { + data2.relation.Append(XTeamRelation.Relation.TR_PARTNER, true); + } + } + this.m_InviteLists[1].Add(data2); + } + for (int m = 1; m < XTeamInviteDocument.INVITE_TYPE_COUNT; m++) + { + this.m_InviteLists[m].Sort(); + } + dictionary.Clear(); + int num = 0; + int num2 = 0; + while (num < this.m_InviteLists[2].Count && num2 < 3 && this.m_InviteLists[0].Count < 6) + { + XTeamInviteListData xteamInviteListData = this.m_InviteLists[2][num]; + bool flag4 = xteamInviteListData.state > XTeamInviteListData.InviteState.IS_IDLE; + if (!flag4) + { + this.m_InviteLists[0].Add(xteamInviteListData); + dictionary[xteamInviteListData.uid] = xteamInviteListData; + num2++; + } + num++; + } + int num3 = 0; + int num4 = 0; + while (num3 < this.m_InviteLists[1].Count && num4 < 3 && this.m_InviteLists[0].Count < 6) + { + XTeamInviteListData xteamInviteListData2 = this.m_InviteLists[1][num3]; + bool flag5 = xteamInviteListData2.state > XTeamInviteListData.InviteState.IS_IDLE; + if (!flag5) + { + bool flag6 = dictionary.ContainsKey(xteamInviteListData2.uid); + if (!flag6) + { + this.m_InviteLists[0].Add(xteamInviteListData2); + num4++; + } + } + num3++; + } + int num5 = 0; + while (num5 < oRes.rec.Count && this.m_InviteLists[0].Count < 6) + { + XTeamInviteListData data3 = XDataPool.GetData(); + data3.SetData(oRes.rec[num5], false, false, XDragonGuildDocument.Doc.IsMyDragonGuildMember(oRes.rec[num5].roledragonguildid)); + this.m_InviteLists[0].Add(data3); + num5++; + } + this.m_InviteLists[0].Sort(); + bool flag7 = this.InviteHandler != null && this.InviteHandler.IsVisible(); + if (flag7) + { + this.InviteHandler.LocalServerRefresh(); + } + } + + public bool OnGetInvitePlatList(ReqPlatFriendRankListRes oRes) + { + bool flag = this.InviteHandler != null && this.InviteHandler.IsVisible(); + bool result; + if (flag) + { + XSingleton.singleton.AddLog("[InvitePlatFriend]OnGetInvitePlatListRefreshFriendsCount:" + oRes.platFriends.Count, null, null, null, null, null, XDebugColor.XDebug_None); + for (int i = 0; i < this.m_InviteLists[3].Count; i++) + { + this.m_InviteLists[3][i].Recycle(); + } + this.m_InviteLists[3].Clear(); + for (int j = 0; j < oRes.platFriends.Count; j++) + { + bool flag2 = oRes.platFriends[j].platfriendBaseInfo.openid == XSingleton.singleton.OpenID; + if (!flag2) + { + XTeamInviteListData data = XDataPool.GetData(); + data.SetData(oRes.platFriends[j]); + this.m_InviteLists[3].Add(data); + } + } + this.InviteHandler.Refresh(); + result = true; + } + else + { + result = false; + } + return result; + } + + public void ReqIgnoreAll() + { + RpcC2M_InvHistoryC2MReq rpcC2M_InvHistoryC2MReq = new RpcC2M_InvHistoryC2MReq(); + rpcC2M_InvHistoryC2MReq.oArg.type = InvHReqType.INVH_UNF_IGNORE_ALL; + XSingleton.singleton.Send(rpcC2M_InvHistoryC2MReq); + } + + public void ReqDeny() + { + RpcC2M_InvHistoryC2MReq rpcC2M_InvHistoryC2MReq = new RpcC2M_InvHistoryC2MReq(); + rpcC2M_InvHistoryC2MReq.oArg.type = InvHReqType.INVH_REFUSE_FORNOW; + XSingleton.singleton.Send(rpcC2M_InvHistoryC2MReq); + } + + public void ReqInvitedList() + { + RpcC2M_InvHistoryC2MReq rpcC2M_InvHistoryC2MReq = new RpcC2M_InvHistoryC2MReq(); + rpcC2M_InvHistoryC2MReq.oArg.type = InvHReqType.INVH_REQ_UNF_LIST; + XSingleton.singleton.Send(rpcC2M_InvHistoryC2MReq); + } + + public void OnInvHistoryReq(InvHistoryArg oArg, InvHistoryRes oRes) + { + bool flag = oRes.ret > ErrorCode.ERR_SUCCESS; + if (flag) + { + XSingleton.singleton.ShowSystemTip(oRes.ret, "fece00"); + } + else + { + InvHReqType type = oArg.type; + if (type != InvHReqType.INVH_REQ_UNF_LIST) + { + if (type - InvHReqType.INVH_UNF_IGNORE_ALL <= 1) + { + this.InvitedCount = 0; + } + } + else + { + this._ClearInvitedList(); + for (int i = 0; i < oRes.invUnfH.Count; i++) + { + XTeamInviteData data = XDataPool.GetData(); + data.SetData(oRes.invUnfH[i]); + this.m_InvitedList.Add(data); + } + this.InvitedCount = this.m_InvitedList.Count; + bool flag2 = this.InvitedView != null && this.InvitedView.IsVisible(); + if (flag2) + { + this.InvitedView.RefreshPage(); + } + } + } + } + + private void _ClearInvitedList() + { + for (int i = 0; i < this.m_InvitedList.Count; i++) + { + this.m_InvitedList[i].Recycle(); + } + this.m_InvitedList.Clear(); + } + + public void ReqTeamInviteAck(bool bAgree, uint id) + { + PtcC2M_TeamInviteAckC2M ptcC2M_TeamInviteAckC2M = new PtcC2M_TeamInviteAckC2M(); + ptcC2M_TeamInviteAckC2M.Data.accept = bAgree; + ptcC2M_TeamInviteAckC2M.Data.inviteid = id; + XSingleton.singleton.Send(ptcC2M_TeamInviteAckC2M); + } + + public void OnInviteComing(TeamInvite inviteData) + { + int invitedCount = this.InvitedCount + 1; + this.InvitedCount = invitedCount; + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamInviteDocument.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamInviteDocument.cs.meta new file mode 100644 index 00000000..388b529a --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamInviteDocument.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1425e433215d53f4c8dbae6f36cc7fa5 +timeCreated: 1611403253 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamInviteListData.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamInviteListData.cs new file mode 100644 index 00000000..d75faf15 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamInviteListData.cs @@ -0,0 +1,189 @@ +using System; +using KKSG; + +namespace XMainClient +{ + internal class XTeamInviteListData : XDataBase, IComparable + { + public XTeamRelation relation = new XTeamRelation(); + + public ulong uid; + + public string name; + + public uint ppt; + + public uint level; + + public uint profession = 1u; + + public uint vip; + + public string guildname; + + public uint degree; + + public int sameGuild; + + public bool bSent; + + public XTeamInviteListData.InviteState state; + + public string openid; + + public bool isOnline; + + public string bigpic; + + public string midpic; + + public string smallpic; + + public bool wantHelp; + + public enum InviteState + { + IS_IDLE, + IS_OTHER_TEAM, + IS_MY_TEAM, + IS_FIGHTING, + IS_NO_COUNT, + IS_NO_FATIGUE, + IS_NOT_OPEN + } + + public void SetData(TeamInvRoleInfo data, bool bIsFriend, bool bIsGuild, bool bIsPartner) + { + this.uid = data.userID; + this.name = data.userName; + this.level = data.userLevel; + this.ppt = data.userPowerPoint; + this.vip = data.userVip; + this.guildname = data.guildName; + this.degree = data.degree; + this.sameGuild = ((data.teamguildid == 0UL || data.roleguildid == data.teamguildid) ? 1 : 0); + this.profession = (uint)data.profession; + this.bSent = false; + this.state = this._GetInviteState(data.state); + this.wantHelp = data.wanthelp; + this.relation.Reset(); + if (bIsGuild) + { + this.relation.Append(XTeamRelation.Relation.TR_GUILD, true); + } + if (bIsFriend) + { + this.relation.Append(XTeamRelation.Relation.TR_FRIEND, true); + } + if (bIsPartner) + { + this.relation.Append(XTeamRelation.Relation.TR_PARTNER, true); + } + } + + public void SetData(PlatFriendRankInfo2Client data) + { + this.name = data.platfriendBaseInfo.nickname; + this.level = data.level; + this.ppt = data.maxAbility; + this.profession = (uint)data.profession; + this.bSent = false; + this.state = XTeamInviteListData.InviteState.IS_IDLE; + this.vip = 0u; + this.guildname = null; + this.sameGuild = 1; + this.openid = data.platfriendBaseInfo.openid; + this.isOnline = data.isOnline; + this.bigpic = data.platfriendBaseInfo.bigpic; + this.midpic = data.platfriendBaseInfo.midpic; + this.smallpic = data.platfriendBaseInfo.smallpic; + this.relation.Reset(); + } + + public int CompareTo(XTeamInviteListData other) + { + int num = this.relation.CompareTo(other.relation); + bool flag = num != 0; + int result; + if (flag) + { + result = num; + } + else + { + bool flag2 = this.sameGuild != other.sameGuild; + if (flag2) + { + result = -this.sameGuild.CompareTo(other.sameGuild); + } + else + { + bool flag3 = this.wantHelp != other.wantHelp; + if (flag3) + { + result = -this.wantHelp.CompareTo(other.wantHelp); + } + else + { + bool flag4 = this.state != other.state; + if (flag4) + { + result = this.state.CompareTo(other.state); + } + else + { + bool flag5 = this.degree != other.degree; + if (flag5) + { + result = -this.degree.CompareTo(other.degree); + } + else + { + result = -this.ppt.CompareTo(other.ppt); + } + } + } + } + } + return result; + } + + private XTeamInviteListData.InviteState _GetInviteState(TeamInvRoleState state) + { + XTeamInviteListData.InviteState result; + switch (state) + { + case TeamInvRoleState.TIRS_IN_OTHER_TEAM: + result = XTeamInviteListData.InviteState.IS_OTHER_TEAM; + break; + case TeamInvRoleState.TIRS_IN_MY_TEAM: + result = XTeamInviteListData.InviteState.IS_MY_TEAM; + break; + case TeamInvRoleState.TIRS_IN_BATTLE: + result = XTeamInviteListData.InviteState.IS_FIGHTING; + break; + case TeamInvRoleState.TIRS_NORMAL: + result = XTeamInviteListData.InviteState.IS_IDLE; + break; + case TeamInvRoleState.TIRS_NOT_OPEN: + result = XTeamInviteListData.InviteState.IS_NOT_OPEN; + break; + case TeamInvRoleState.TIRS_COUNT_LESS: + result = XTeamInviteListData.InviteState.IS_NO_COUNT; + break; + case TeamInvRoleState.TIRS_FATIGUE_LESS: + result = XTeamInviteListData.InviteState.IS_NO_FATIGUE; + break; + default: + result = XTeamInviteListData.InviteState.IS_IDLE; + break; + } + return result; + } + + public override void Recycle() + { + XDataPool.Recycle(this); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamInviteListData.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamInviteListData.cs.meta new file mode 100644 index 00000000..10eaa7d3 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamInviteListData.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 814ecb1677e17664d8db2f900bdc7d3e +timeCreated: 1611404036 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueBattleDocument.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueBattleDocument.cs new file mode 100644 index 00000000..e22f5c21 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueBattleDocument.cs @@ -0,0 +1,372 @@ +using System; +using System.Collections.Generic; +using KKSG; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamLeagueBattleDocument : XDocComponent + { + public override uint ID + { + get + { + return XTeamLeagueBattleDocument.uuID; + } + } + + public LeagueBattleTeamData LoadingInfoBlue + { + get + { + return this.m_LoadingInfoBlue; + } + } + + public LeagueBattleTeamData LoadingInfoRed + { + get + { + return this.m_LoadingInfoRed; + } + } + + public LeagueBattleOneTeam BattleBaseInfoBlue + { + get + { + return this.m_BattleBaseInfoBlue; + } + } + + public LeagueBattleOneTeam BattleBaseInfoRed + { + get + { + return this.m_BattleBaseInfoRed; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("TeamLeagueBattleDocument"); + + private LeagueBattleTeamData m_LoadingInfoBlue; + + private LeagueBattleTeamData m_LoadingInfoRed; + + private LeagueBattleOneTeam m_BattleBaseInfoBlue; + + private LeagueBattleOneTeam m_BattleBaseInfoRed; + + public bool IsInTeamLeague = false; + + public bool IsInBattleTeamLeague = false; + + public LeagueBattleRoleState SelfBattleState = LeagueBattleRoleState.LBRoleState_None; + + public int BlueCanBattleNum = 0; + + public int RedCanBattleNum = 0; + + public ulong BluePKingRoleID = 0UL; + + public ulong RedPKingRoleID = 0UL; + + public LeagueBattleFightState BattleState = LeagueBattleFightState.LBFight_None; + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + } + + public override void OnEnterSceneFinally() + { + base.OnEnterSceneFinally(); + DlgBase.singleton.HidePkLoading(); + } + + public ulong GetBattleTeamLeagueID(ulong roleID) + { + bool flag = this.LoadingInfoBlue != null; + if (flag) + { + for (int i = 0; i < this.LoadingInfoBlue.members.Count; i++) + { + bool flag2 = this.LoadingInfoBlue.members[i].roleid == roleID; + if (flag2) + { + return this.LoadingInfoBlue.league_teamid; + } + } + } + bool flag3 = this.LoadingInfoRed != null; + if (flag3) + { + for (int j = 0; j < this.LoadingInfoRed.members.Count; j++) + { + bool flag4 = this.LoadingInfoRed.members[j].roleid == roleID; + if (flag4) + { + return this.LoadingInfoRed.league_teamid; + } + } + } + return 0UL; + } + + public void SetBattlePKInfo(LeagueBattleLoadInfoNtf data) + { + XFreeTeamVersusLeagueDocument specificDocument = XDocuments.GetSpecificDocument(XFreeTeamVersusLeagueDocument.uuID); + bool flag = data.team1 == null || data.team2 == null; + if (flag) + { + XSingleton.singleton.AddErrorLog("[TeamLeague:SetBattlePKInfo] LeagueBattleLoadInfoNtf team == null", null, null, null, null, null); + } + else + { + bool flag2 = data.team1.league_teamid == specificDocument.TeamLeagueID; + if (flag2) + { + this.m_LoadingInfoBlue = data.team1; + this.m_LoadingInfoRed = data.team2; + } + else + { + bool flag3 = data.team2.league_teamid == specificDocument.TeamLeagueID; + if (flag3) + { + this.m_LoadingInfoBlue = data.team2; + this.m_LoadingInfoRed = data.team1; + } + else + { + this.m_LoadingInfoBlue = data.team1; + this.m_LoadingInfoRed = data.team2; + } + } + } + } + + public void UpdateBattleBaseData(LeagueBattleBaseDataNtf data) + { + XSingleton.singleton.AddLog("[TeamLeague]UpdateBattleBaseData", null, null, null, null, null, XDebugColor.XDebug_None); + bool flag = data.team1 == null || data.team2 == null; + if (flag) + { + XSingleton.singleton.AddLog("[TeamLeague]UpdateBattleBaseData team == null", null, null, null, null, null, XDebugColor.XDebug_None); + } + else + { + this.IsInTeamLeague = false; + this.IsInBattleTeamLeague = false; + this.SelfBattleState = LeagueBattleRoleState.LBRoleState_None; + this.BlueCanBattleNum = 0; + this.RedCanBattleNum = 0; + this.BluePKingRoleID = 0UL; + this.RedPKingRoleID = 0UL; + XFreeTeamVersusLeagueDocument specificDocument = XDocuments.GetSpecificDocument(XFreeTeamVersusLeagueDocument.uuID); + List list = new List(); + list.Add(data.team1); + list.Add(data.team2); + bool flag2 = data.team1.league_teamid == specificDocument.TeamLeagueID; + if (flag2) + { + this.m_BattleBaseInfoBlue = data.team1; + this.m_BattleBaseInfoRed = data.team2; + this.IsInTeamLeague = true; + } + else + { + bool flag3 = data.team2.league_teamid == specificDocument.TeamLeagueID; + if (flag3) + { + this.m_BattleBaseInfoBlue = data.team2; + this.m_BattleBaseInfoRed = data.team1; + this.IsInTeamLeague = true; + } + else + { + this.m_BattleBaseInfoBlue = data.team1; + this.m_BattleBaseInfoRed = data.team2; + } + } + for (int i = 0; i < list.Count; i++) + { + LeagueBattleOneTeam leagueBattleOneTeam = list[i]; + for (int j = 0; j < leagueBattleOneTeam.members.Count; j++) + { + bool flag4 = leagueBattleOneTeam.members[j].basedata.roleid == XSingleton.singleton.XPlayerData.RoleID; + if (flag4) + { + this.IsInBattleTeamLeague = true; + this.SelfBattleState = leagueBattleOneTeam.members[j].state; + } + bool flag5 = leagueBattleOneTeam.members[j].state == LeagueBattleRoleState.LBRoleState_Fighting; + if (flag5) + { + bool flag6 = leagueBattleOneTeam == this.m_BattleBaseInfoBlue; + if (flag6) + { + this.BluePKingRoleID = leagueBattleOneTeam.members[j].basedata.roleid; + } + else + { + bool flag7 = leagueBattleOneTeam == this.m_BattleBaseInfoRed; + if (flag7) + { + this.RedPKingRoleID = leagueBattleOneTeam.members[j].basedata.roleid; + } + } + } + bool flag8 = leagueBattleOneTeam.members[j].state != LeagueBattleRoleState.LBRoleState_Failed && leagueBattleOneTeam.members[j].state != LeagueBattleRoleState.LBRoleState_Leave && leagueBattleOneTeam.members[j].state != LeagueBattleRoleState.LBRoleState_None; + if (flag8) + { + bool flag9 = leagueBattleOneTeam == this.m_BattleBaseInfoBlue; + if (flag9) + { + this.BlueCanBattleNum++; + } + else + { + bool flag10 = leagueBattleOneTeam == this.m_BattleBaseInfoRed; + if (flag10) + { + this.RedCanBattleNum++; + } + } + } + } + } + bool flag11 = DlgBase.singleton.IsVisible(); + if (flag11) + { + DlgBase.singleton.RefreshBattleBaseInfo(); + DlgBase.singleton.RefreshBattleState(); + } + } + } + + public void ReqBattle(LeagueBattleReadyOper type) + { + RpcC2G_LeagueBattleReadyReq rpcC2G_LeagueBattleReadyReq = new RpcC2G_LeagueBattleReadyReq(); + rpcC2G_LeagueBattleReadyReq.oArg.type = type; + XSingleton.singleton.Send(rpcC2G_LeagueBattleReadyReq); + } + + public void OnLeagueBattleStateNtf(LeagueBattleStateNtf data) + { + XSingleton.singleton.AddLog("[TeamLeague]OnLeagueBattleStateNtf", data.state.ToString(), " ", data.lefttime.ToString(), null, null, XDebugColor.XDebug_None); + this.BattleState = data.state; + switch (data.state) + { + case LeagueBattleFightState.LBFight_None: + XSingleton.singleton.AddErrorLog("OnLeagueBattleStateNtf state == LBFight_None", null, null, null, null, null); + break; + case LeagueBattleFightState.LBFight_Wait: + DlgBase.singleton.SetVisible(true, true); + DlgBase.singleton.RefreshBattleState(); + DlgBase.singleton.ResetCommonUI(false); + DlgBase.singleton.CloseSmallReward(); + DlgBase.singleton.RefreahCountTime(data.lefttime); + break; + case LeagueBattleFightState.LBFight_Fight: + DlgBase.singleton.SetVisible(true, true); + DlgBase.singleton.RefreshBattleState(); + DlgBase.singleton.ResetCommonUI(true); + DlgBase.singleton.CloseSmallReward(); + DlgBase.singleton.RefreahCountTime(data.lefttime); + break; + case LeagueBattleFightState.LBFight_Result: + DlgBase.singleton.SetVisible(false, true); + break; + } + bool flag = DlgBase.singleton.IsVisible(); + if (flag) + { + DlgBase.singleton.RefreshBattleBaseInfo(); + } + } + + public void OnSmallReward(LeagueBattleOneResultNtf data) + { + bool flag = data == null; + if (flag) + { + XSingleton.singleton.AddErrorLog("SmallReward Is Null", null, null, null, null, null); + } + else + { + bool flag2 = XSingleton.singleton.SceneType == SceneType.SCENE_LEAGUE_BATTLE; + if (flag2) + { + DlgBase.singleton.PlaySmallReward(data); + } + } + } + + public void OnBigReward(LeagueBattleResultNtf data) + { + bool flag = data == null; + if (flag) + { + XSingleton.singleton.AddErrorLog("BigReward Is Null", null, null, null, null, null); + } + else + { + bool flag2 = XSingleton.singleton.SceneType == SceneType.SCENE_LEAGUE_BATTLE; + if (flag2) + { + DlgBase.singleton.PlayBigReward(data); + } + } + } + + public bool FindBlueMember(ulong roleid) + { + bool flag = this.m_LoadingInfoBlue == null; + bool result; + if (flag) + { + XSingleton.singleton.AddErrorLog("m_LoadingInfoBlue is null", null, null, null, null, null); + result = false; + } + else + { + for (int i = 0; i < this.m_LoadingInfoBlue.members.Count; i++) + { + bool flag2 = roleid == this.m_LoadingInfoBlue.members[i].roleid; + if (flag2) + { + return true; + } + } + result = false; + } + return result; + } + + public bool FindRedMember(ulong roleid) + { + bool flag = this.m_LoadingInfoRed == null; + bool result; + if (flag) + { + XSingleton.singleton.AddErrorLog("m_LoadingInfoRed is null", null, null, null, null, null); + result = false; + } + else + { + for (int i = 0; i < this.m_LoadingInfoRed.members.Count; i++) + { + bool flag2 = roleid == this.m_LoadingInfoRed.members[i].roleid; + if (flag2) + { + return true; + } + } + result = false; + } + return result; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueBattleDocument.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueBattleDocument.cs.meta new file mode 100644 index 00000000..1e19578c --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueBattleDocument.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 72289a4b08eab2a45bc3a7b28c318ef6 +timeCreated: 1611403937 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateBehaviour.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateBehaviour.cs new file mode 100644 index 00000000..30f30f17 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateBehaviour.cs @@ -0,0 +1,25 @@ +using System; +using UILib; +using XMainClient.UI.UICommon; + +namespace XMainClient +{ + internal class XTeamLeagueCreateBehaviour : DlgBehaviourBase + { + public IXUIButton m_Close; + + public IXUIButton m_OK; + + public IXUIButton m_Cancel; + + public IXUIInput m_NameInput; + + private void Awake() + { + this.m_Close = (base.transform.Find("CreateMenu/Close").GetComponent("XUIButton") as IXUIButton); + this.m_OK = (base.transform.Find("CreateMenu/OK").GetComponent("XUIButton") as IXUIButton); + this.m_Cancel = (base.transform.Find("CreateMenu/Cancel").GetComponent("XUIButton") as IXUIButton); + this.m_NameInput = (base.transform.Find("CreateMenu/NameInput").GetComponent("XUIInput") as IXUIInput); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateBehaviour.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateBehaviour.cs.meta new file mode 100644 index 00000000..6ecb78cd --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateBehaviour.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 535888211ecec3c44951c423d05b37d7 +timeCreated: 1611403711 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateView.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateView.cs new file mode 100644 index 00000000..3a1bc00b --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateView.cs @@ -0,0 +1,56 @@ +using System; +using KKSG; +using UILib; +using XMainClient.UI.UICommon; + +namespace XMainClient +{ + internal class XTeamLeagueCreateView : DlgBase + { + public override string fileName + { + get + { + return "GameSystem/TeamLeague/TeamLeagueCreateDlg"; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + private XFreeTeamVersusLeagueDocument _doc; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XFreeTeamVersusLeagueDocument.uuID); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked)); + base.uiBehaviour.m_OK.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCreateBtnClicked)); + base.uiBehaviour.m_Cancel.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked)); + } + + private bool OnCreateBtnClicked(IXUIButton button) + { + XTeamDocument specificDocument = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + specificDocument.ReqTeamOp(TeamOperate.TEAM_START_BATTLE, 0UL, base.uiBehaviour.m_NameInput.GetText(), TeamMemberType.TMT_NORMAL, null); + this.SetVisibleWithAnimation(false, null); + return true; + } + + private bool OnCloseClicked(IXUIButton button) + { + this.SetVisibleWithAnimation(false, null); + return true; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateView.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateView.cs.meta new file mode 100644 index 00000000..335c18d4 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueCreateView.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 94e440f474c81bb4bbd23c93f3b4d9f2 +timeCreated: 1611404157 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailBehaviour.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailBehaviour.cs new file mode 100644 index 00000000..18b28bc1 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailBehaviour.cs @@ -0,0 +1,28 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamLeagueDetailBehaviour : DlgBehaviourBase + { + public IXUIButton m_Close; + + public IXUILabel m_TeamName; + + public IXUIList m_MemberList; + + public XUIPool m_MemberPool = new XUIPool(XSingleton.singleton.m_uiTool); + + private void Awake() + { + this.m_Close = (base.transform.Find("p/Close").GetComponent("XUIButton") as IXUIButton); + this.m_TeamName = (base.transform.Find("p/Name").GetComponent("XUILabel") as IXUILabel); + this.m_MemberList = (base.transform.Find("p/Grid").GetComponent("XUIList") as IXUIList); + Transform transform = base.transform.Find("p/Grid/Tpl"); + this.m_MemberPool.SetupPool(this.m_MemberList.gameObject, transform.gameObject, 4u, false); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailBehaviour.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailBehaviour.cs.meta new file mode 100644 index 00000000..7261953b --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailBehaviour.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 882ad74d32d17794cb1b0744feeb518b +timeCreated: 1611404083 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailView.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailView.cs new file mode 100644 index 00000000..ff2d0560 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailView.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamLeagueDetailView : DlgBase + { + public override string fileName + { + get + { + return "GameSystem/TeamLeague/TeamLeagueDetailDlg"; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + private string m_TeamName; + + private List m_listMember = new List(); + + public override void RegisterEvent() + { + base.RegisterEvent(); + base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked)); + } + + public void ShowDetail(string teamName, List members) + { + this.m_TeamName = teamName; + this.m_listMember = members; + bool flag = !base.IsVisible(); + if (flag) + { + this.SetVisibleWithAnimation(true, null); + } + } + + protected override void OnShow() + { + base.OnShow(); + base.uiBehaviour.m_TeamName.SetText(this.m_TeamName); + base.uiBehaviour.m_MemberPool.FakeReturnAll(); + for (int i = 0; i < this.m_listMember.Count; i++) + { + GameObject gameObject = base.uiBehaviour.m_MemberPool.FetchGameObject(false); + gameObject.transform.parent = base.uiBehaviour.m_MemberList.gameObject.transform; + this.SetMemberInfo(gameObject, this.m_listMember[i]); + } + base.uiBehaviour.m_MemberPool.ActualReturnAll(false); + base.uiBehaviour.m_MemberList.Refresh(); + } + + private void SetMemberInfo(GameObject tpl, LeagueTeamMemberDetail member) + { + IXUILabel ixuilabel = tpl.transform.Find("Name").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(member.brief.name); + IXUILabel ixuilabel2 = tpl.transform.Find("Level").GetComponent("XUILabel") as IXUILabel; + ixuilabel2.SetText(string.Format("Lv.{0}", member.brief.level)); + IXUILabel ixuilabel3 = tpl.transform.Find("Score").GetComponent("XUILabel") as IXUILabel; + ixuilabel3.SetText(member.pkpoint.ToString()); + IXUISprite ixuisprite = tpl.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite; + ixuisprite.SetSprite(XSingleton.singleton.GetProfHeadIcon2((int)member.brief.profession)); + IXUISprite ixuisprite2 = tpl.transform.Find("Profession").GetComponent("XUISprite") as IXUISprite; + ixuisprite2.SetSprite(XSingleton.singleton.GetProfIcon((int)member.brief.profession)); + } + + private bool OnCloseClicked(IXUIButton button) + { + this.SetVisibleWithAnimation(false, null); + return true; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailView.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailView.cs.meta new file mode 100644 index 00000000..87d9dd79 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueDetailView.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5b5548102a412a245a9436f6f0d7e055 +timeCreated: 1611403798 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueFinalResultBehavior.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueFinalResultBehavior.cs new file mode 100644 index 00000000..d647792e --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueFinalResultBehavior.cs @@ -0,0 +1,35 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; + +namespace XMainClient +{ + internal class XTeamLeagueFinalResultBehavior : DlgBehaviourBase + { + public Transform Details; + + public IXUIButton EnterMatch; + + public IXUIButton CloseBtn; + + public Transform NoChampion; + + public Transform ChampionMembers; + + public IXUILabel GuildName; + + public IXUILabel FinalTimeLabel; + + private void Awake() + { + this.Details = base.transform.Find("Bg2/Details"); + this.EnterMatch = (base.transform.Find("Bg2/BeginMatch").GetComponent("XUIButton") as IXUIButton); + this.CloseBtn = (base.transform.Find("Close").GetComponent("XUIButton") as IXUIButton); + this.NoChampion = base.transform.Find("Bg2/ChampionFrame/NoChampion"); + this.ChampionMembers = base.transform.Find("Bg2/ChampionFrame/Members"); + this.GuildName = (base.transform.Find("Bg2/ChampionFrame/GuildName").GetComponent("XUILabel") as IXUILabel); + this.FinalTimeLabel = (base.transform.Find("Schedule").GetComponent("XUILabel") as IXUILabel); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueFinalResultBehavior.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueFinalResultBehavior.cs.meta new file mode 100644 index 00000000..a777728f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueFinalResultBehavior.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b6d39612e6d1742499587d9cf0689001 +timeCreated: 1611404400 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingBehaviour.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingBehaviour.cs new file mode 100644 index 00000000..bb13bd84 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingBehaviour.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamLeagueLoadingBehaviour : DlgBehaviourBase + { + public IXUILabel[] m_TeamName = new IXUILabel[2]; + + public IXUILabel[] m_TeamRegion = new IXUILabel[2]; + + public XUIPool[] m_MembersPool = new XUIPool[2]; + + public List m_LeftMemberNode = new List(); + + public List m_RightMemberNode = new List(); + + private void Awake() + { + Transform transform = base.transform.Find("Bg/Left"); + Transform transform2 = base.transform.Find("Bg/Right"); + this.m_TeamName[0] = (transform.Find("Team/Teamneme").GetComponent("XUILabel") as IXUILabel); + this.m_TeamName[1] = (transform2.Find("Team/Teamneme").GetComponent("XUILabel") as IXUILabel); + this.m_TeamRegion[0] = (transform.Find("Team/Region").GetComponent("XUILabel") as IXUILabel); + this.m_TeamRegion[1] = (transform2.Find("Team/Region").GetComponent("XUILabel") as IXUILabel); + Transform transform3 = transform.Find("DetailTpl"); + this.m_MembersPool[0] = new XUIPool(XSingleton.singleton.m_uiTool); + this.m_MembersPool[0].SetupPool(transform3.parent.gameObject, transform3.gameObject, 4u, false); + Transform transform4 = transform2.Find("DetailTpl"); + this.m_MembersPool[1] = new XUIPool(XSingleton.singleton.m_uiTool); + this.m_MembersPool[1].SetupPool(transform4.parent.gameObject, transform4.gameObject, 4u, false); + for (int i = 0; i < 4; i++) + { + Transform item = transform.Find(string.Format("Detail{0}", i)); + this.m_LeftMemberNode.Add(item); + Transform item2 = transform2.Find(string.Format("Detail{0}", i)); + this.m_RightMemberNode.Add(item2); + } + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingBehaviour.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingBehaviour.cs.meta new file mode 100644 index 00000000..5b01152f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingBehaviour.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2cd32bd428a950845b2619d59d92e3fd +timeCreated: 1611403503 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingView.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingView.cs new file mode 100644 index 00000000..ffa07893 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingView.cs @@ -0,0 +1,141 @@ +using System; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamLeagueLoadingView : DlgBase + { + public override string fileName + { + get + { + return "Battle/TeamLeagueLoading"; + } + } + + public override int layer + { + get + { + return 1; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + public bool IsLoadingOver + { + get + { + return this._isLoadingOver; + } + } + + public override bool needOnTop + { + get + { + return true; + } + } + + private XTeamLeagueBattleDocument _doc; + + private bool _isLoadingOver = false; + + protected override void Init() + { + base.Init(); + this._isLoadingOver = false; + this._doc = XDocuments.GetSpecificDocument(XTeamLeagueBattleDocument.uuID); + } + + public void ShowPkLoading() + { + this.SetVisible(true, true); + } + + protected override void OnShow() + { + base.OnShow(); + this.LoadingOver(null); + this.SetBattleInfo(); + } + + private void LoadingOver(object o) + { + this._isLoadingOver = true; + } + + private void SetMemberInfo(GameObject member, LeagueBattleRoleBrief info) + { + bool flag = info == null; + if (!flag) + { + IXUILabel ixuilabel = member.transform.Find("Level").GetComponent("XUILabel") as IXUILabel; + IXUISprite ixuisprite = member.transform.Find("Avatar").GetComponent("XUISprite") as IXUISprite; + IXUISprite ixuisprite2 = member.transform.Find("Profession").GetComponent("XUISprite") as IXUISprite; + IXUILabel ixuilabel2 = member.transform.Find("Name").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel3 = member.transform.Find("PPT").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(info.level.ToString()); + ixuisprite2.SetSprite(XSingleton.singleton.GetProfIcon((int)info.profession)); + ixuisprite.SetSprite(XSingleton.singleton.GetProfHeadIcon((int)info.profession)); + ixuilabel2.SetText(info.name); + ixuilabel3.SetText(info.pkpoint.ToString()); + } + } + + private void SetTeamInfo(int index, LeagueBattleTeamData BattleTeam) + { + bool flag = BattleTeam == null; + if (!flag) + { + base.uiBehaviour.m_TeamName[index].SetText(BattleTeam.name); + base.uiBehaviour.m_TeamRegion[index].SetText(BattleTeam.servername); + base.uiBehaviour.m_MembersPool[index].FakeReturnAll(); + for (int i = 0; i < BattleTeam.members.Count; i++) + { + GameObject gameObject = base.uiBehaviour.m_MembersPool[index].FetchGameObject(false); + this.SetMemberInfo(gameObject, BattleTeam.members[i]); + bool flag2 = i < base.uiBehaviour.m_RightMemberNode.Count; + if (flag2) + { + gameObject.transform.parent = ((index == 0) ? base.uiBehaviour.m_LeftMemberNode[i] : base.uiBehaviour.m_RightMemberNode[i]); + } + gameObject.transform.localPosition = Vector3.zero; + } + base.uiBehaviour.m_MembersPool[index].ActualReturnAll(false); + } + } + + private void SetBattleInfo() + { + this.SetTeamInfo(0, this._doc.LoadingInfoBlue); + this.SetTeamInfo(1, this._doc.LoadingInfoRed); + } + + public void HidePkLoading() + { + bool flag = !base.IsVisible(); + if (!flag) + { + this.SetVisible(false, true); + } + } + + private void OnPkLoadingTweenFinish(IXUITweenTool tween) + { + this.SetVisible(false, true); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingView.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingView.cs.meta new file mode 100644 index 00000000..f63ab591 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueLoadingView.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 90f2d0d56c748c24695dba8ec2016d38 +timeCreated: 1611404141 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankBehavior.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankBehavior.cs new file mode 100644 index 00000000..5bd3ec05 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankBehavior.cs @@ -0,0 +1,23 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; + +namespace XMainClient +{ + internal class XTeamLeagueRankBehavior : DlgBehaviourBase + { + public IXUIButton CloseBtn; + + public IXUIWrapContent WrapContent; + + public Transform NoRankTrans; + + private void Awake() + { + this.CloseBtn = (base.transform.Find("Close").GetComponent("XUIButton") as IXUIButton); + this.WrapContent = (base.transform.Find("Panel/wrapContent").GetComponent("XUIWrapContent") as IXUIWrapContent); + this.NoRankTrans = base.transform.Find("NoRank"); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankBehavior.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankBehavior.cs.meta new file mode 100644 index 00000000..1df2adb5 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankBehavior.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b265341b8df9b6248b01e08819431090 +timeCreated: 1611404385 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankView.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankView.cs new file mode 100644 index 00000000..83e5dee6 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankView.cs @@ -0,0 +1,127 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; + +namespace XMainClient +{ + internal class XTeamLeagueRankView : DlgBase + { + public override string fileName + { + get + { + return "GameSystem/TeamLeague/TeamLeagueRank"; + } + } + + public override int layer + { + get + { + return 1; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + public override bool needOnTop + { + get + { + return true; + } + } + + public bool IsLastWeek = false; + + private XBaseRankList list = null; + + protected override void Init() + { + base.Init(); + this.InitProperties(); + } + + protected override void OnShow() + { + base.OnShow(); + } + + protected override void OnHide() + { + this.IsLastWeek = false; + base.OnHide(); + } + + public void RefreshUI(XBaseRankList list) + { + int num = 0; + this.list = list; + bool flag = list != null; + if (flag) + { + num = this.list.rankList.Count; + base.uiBehaviour.WrapContent.SetContentCount(list.rankList.Count, false); + } + base.uiBehaviour.NoRankTrans.gameObject.SetActive(num == 0); + } + + private void InitProperties() + { + base.uiBehaviour.CloseBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseBtnClicked)); + base.uiBehaviour.WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.UpdateRankItem)); + base.uiBehaviour.WrapContent.RegisterItemInitEventHandler(new WrapItemInitEventHandler(this.InitWrapContentItem)); + } + + private void InitWrapContentItem(Transform itemTransform, int index) + { + IXUISprite ixuisprite = itemTransform.Find("Background").GetComponent("XUISprite") as IXUISprite; + ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickRankItem)); + } + + private void OnClickRankItem(IXUISprite uiSprite) + { + ulong id = uiSprite.ID; + XFreeTeamVersusLeagueDocument.Doc.SendGetLeagueTeamInfo(id); + } + + private void UpdateRankItem(Transform itemTransform, int index) + { + bool flag = this.list != null && index < this.list.rankList.Count; + if (flag) + { + XLeagueTeamRankInfo xleagueTeamRankInfo = this.list.rankList[index] as XLeagueTeamRankInfo; + IXUILabel ixuilabel = itemTransform.Find("Rank").GetComponent("XUILabel") as IXUILabel; + IXUISprite ixuisprite = itemTransform.Find("RankImage").GetComponent("XUISprite") as IXUISprite; + IXUILabel ixuilabel2 = itemTransform.Find("TeamName").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel3 = itemTransform.Find("ServerName").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel4 = itemTransform.Find("Score").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel5 = itemTransform.Find("WinTimes").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel6 = itemTransform.Find("WinRates").GetComponent("XUILabel") as IXUILabel; + IXUISprite ixuisprite2 = itemTransform.Find("Background").GetComponent("XUISprite") as IXUISprite; + ixuisprite.spriteName = ixuisprite.spriteName.Substring(0, ixuisprite.spriteName.Length - 1) + Mathf.Min(xleagueTeamRankInfo.rank + 1u, 3f); + ixuisprite.gameObject.SetActive(xleagueTeamRankInfo.rank < 3u); + ixuilabel.SetText((xleagueTeamRankInfo.rank >= 3u) ? (xleagueTeamRankInfo.rank + 1u).ToString() : ""); + ixuilabel4.SetText(xleagueTeamRankInfo.point.ToString()); + ixuilabel5.SetText(xleagueTeamRankInfo.winNum.ToString()); + ixuilabel6.SetText((int)(xleagueTeamRankInfo.winRate * 100f) + "%"); + ixuilabel2.SetText(xleagueTeamRankInfo.teamName); + ixuilabel3.SetText("(" + xleagueTeamRankInfo.serverName + ")"); + ixuisprite2.ID = xleagueTeamRankInfo.leagueTeamID; + } + } + + private bool OnCloseBtnClicked(IXUIButton button) + { + this.SetVisible(false, true); + return true; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankView.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankView.cs.meta new file mode 100644 index 00000000..14e93eca --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRankView.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2ad09bf7d8012774e9e1e54ff14e8a1a +timeCreated: 1611403496 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordBehavior.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordBehavior.cs new file mode 100644 index 00000000..cce0bfee --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordBehavior.cs @@ -0,0 +1,34 @@ +using System; +using UILib; +using XMainClient.UI.UICommon; + +namespace XMainClient +{ + internal class XTeamLeagueRecordBehavior : DlgBehaviourBase + { + public IXUIButton CloseBtn; + + public IXUIWrapContent WrapContent; + + public IXUILabel WinTimesLabel; + + public IXUILabel LostTimesLabel; + + public IXUILabel WinRateLabel; + + public IXUILabel ConsWinLabel; + + public IXUILabel ConsLoseLabel; + + private void Awake() + { + this.CloseBtn = (base.transform.Find("Bg/Close").GetComponent("XUIButton") as IXUIButton); + this.WrapContent = (base.transform.Find("Bg/Bg/ScrollView/WrapContent").GetComponent("XUIWrapContent") as IXUIWrapContent); + this.WinTimesLabel = (base.transform.Find("Bg/Message/Win/WinTimes").GetComponent("XUILabel") as IXUILabel); + this.LostTimesLabel = (base.transform.Find("Bg/Message/Lose/LoseTimes").GetComponent("XUILabel") as IXUILabel); + this.WinRateLabel = (base.transform.Find("Bg/Message/Rate/Label").GetComponent("XUILabel") as IXUILabel); + this.ConsWinLabel = (base.transform.Find("Bg/Message/ConsWin/Label").GetComponent("XUILabel") as IXUILabel); + this.ConsLoseLabel = (base.transform.Find("Bg/Message/ConsLose/Label").GetComponent("XUILabel") as IXUILabel); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordBehavior.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordBehavior.cs.meta new file mode 100644 index 00000000..aae839f9 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordBehavior.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b923187f194add3429b09f39c2e33599 +timeCreated: 1611404409 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordView.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordView.cs new file mode 100644 index 00000000..e64e436b --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordView.cs @@ -0,0 +1,140 @@ +using System; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; + +namespace XMainClient +{ + internal class XTeamLeagueRecordView : DlgBase + { + public override string fileName + { + get + { + return "GameSystem/TeamLeague/TeamLeagueRecord"; + } + } + + public override int layer + { + get + { + return 1; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + public override bool needOnTop + { + get + { + return true; + } + } + + protected override void Init() + { + base.Init(); + this.InitProperties(); + } + + protected override void OnShow() + { + base.OnShow(); + XFreeTeamVersusLeagueDocument.Doc.SendGetLeagueBattleRecord(); + } + + private void InitProperties() + { + base.uiBehaviour.CloseBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseBtnClicked)); + base.uiBehaviour.WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.UpdateRecordItem)); + } + + private void UpdateRecordItem(Transform itemTransform, int index) + { + LeaguePKRecordInfo pkRecordInfoByIndex = XFreeTeamVersusLeagueDocument.Doc.GetPkRecordInfoByIndex(index); + bool flag = pkRecordInfoByIndex != null; + if (flag) + { + IXUILabel ixuilabel = itemTransform.Find("OpponentName").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(pkRecordInfoByIndex.opponentTeamName); + IXUILabel ixuilabel2 = itemTransform.Find("Reward").GetComponent("XUILabel") as IXUILabel; + string arg = (pkRecordInfoByIndex.scoreChange >= 0) ? "+" : "-"; + ixuilabel2.SetText(arg + Math.Abs(pkRecordInfoByIndex.scoreChange)); + IXUISprite ixuisprite = itemTransform.Find("Status").GetComponent("XUISprite") as IXUISprite; + ixuisprite.spriteName = this.ReplaceString(ixuisprite.spriteName, (pkRecordInfoByIndex.result == PkResultType.PkResult_Draw) ? "draw" : "win"); + ixuisprite.spriteName = this.ReplaceString(ixuisprite.spriteName, (pkRecordInfoByIndex.result == PkResultType.PkResult_Win) ? "win" : "lose"); + } + } + + private string ReplaceString(string origin, string target) + { + bool flag = origin.Contains("win"); + string result; + if (flag) + { + result = origin.Replace("win", target); + } + else + { + bool flag2 = origin.Contains("lose"); + if (flag2) + { + result = origin.Replace("lose", target); + } + else + { + bool flag3 = origin.Contains("draw"); + if (flag3) + { + result = origin.Replace("draw", target); + } + else + { + result = ""; + } + } + } + return result; + } + + private bool OnCloseBtnClicked(IXUIButton button) + { + this.SetVisible(false, true); + return true; + } + + public void RefreshUI() + { + this.RefreshBaseInfo(); + this.RefreshWrapContent(); + } + + private void RefreshWrapContent() + { + int pkRecordCount = XFreeTeamVersusLeagueDocument.Doc.GetPkRecordCount(); + base.uiBehaviour.WrapContent.SetContentCount(pkRecordCount, false); + Transform parent = base.uiBehaviour.WrapContent.gameObject.transform.parent; + IXUIScrollView ixuiscrollView = parent.GetComponent("XUIScrollView") as IXUIScrollView; + ixuiscrollView.ResetPosition(); + } + + private void RefreshBaseInfo() + { + LeagueBattleRecordBaseInfo pkrecordBaseInfo = XFreeTeamVersusLeagueDocument.Doc.PKRecordBaseInfo; + base.uiBehaviour.WinRateLabel.SetText((int)(pkrecordBaseInfo.winRate * 100f) + "%"); + base.uiBehaviour.WinTimesLabel.SetText(pkrecordBaseInfo.totalWinNum.ToString()); + base.uiBehaviour.LostTimesLabel.SetText(pkrecordBaseInfo.totalLoseNum.ToString()); + base.uiBehaviour.ConsWinLabel.SetText(pkrecordBaseInfo.maxContinueWin.ToString()); + base.uiBehaviour.ConsLoseLabel.SetText(pkrecordBaseInfo.maxContinueLose.ToString()); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordView.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordView.cs.meta new file mode 100644 index 00000000..40d4ed7a --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamLeagueRecordView.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 733895182bece454fa60a5fc912cb292 +timeCreated: 1611403940 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamListHandler.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamListHandler.cs new file mode 100644 index 00000000..b343bfa8 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamListHandler.cs @@ -0,0 +1,536 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamListHandler : DlgHandlerBase + { + public IXUIButton m_BtnRefresh; + + public GameObject m_NoTeam; + + public IXUIScrollView m_ScrollView; + + public IXUIWrapContent m_WrapContent; + + public GameObject m_recruitEmpty; + + public IXUIButton m_BtnCreate; + + public IXUIButton m_BtnMatchTeam; + + public IXUIButton m_BtnRecruit; + + public IXUILabel m_MatchTeamLabel; + + public IXUILabel m_MatchingTeamLabel; + + public IXUIButton m_BtnAllList; + + public IXUITweenTool m_MatchingTween; + + private Transform m_BottomButtonsFrame; + + private Transform m_BottomButtonsNormalPos; + + private Transform m_BottomButtonsNoMatchPos; + + private XTeamDocument doc; + + private XCaptainPVPDocument capDoc; + + private XHeroBattleDocument heroDoc; + + private bool _bFirstOpen = false; + + private uint _TimerID = 0u; + + private int m_SelectedTeamID = 0; + + private int mCurTeamBriefIndex; + + private int m_MatchingTime; + + private int m_FastMatchTime; + + private XTeamPasswordHandler m_PasswordHandler; + + private List m_SelectedCategoriesGo = new List(); + + private XTimerMgr.ElapsedEventHandler _autoRefreshCb = null; + + private static readonly int MEMBER_INDEX_MASK = 4; + + public XTeamListHandler() + { + this._autoRefreshCb = new XTimerMgr.ElapsedEventHandler(this._AutoRefresh); + } + + protected override void Init() + { + base.Init(); + Transform transform = base.PanelObject.transform.Find("Bg"); + this.m_BottomButtonsFrame = transform.Find("BottomButtonsFrame"); + this.m_BottomButtonsNormalPos = transform.Find("BottomButtonsNormalPos"); + this.m_BottomButtonsNoMatchPos = transform.Find("BottomButtonsNoMatchPos"); + this.m_BtnRefresh = (transform.Find("BtnRefresh").GetComponent("XUIButton") as IXUIButton); + this.m_BtnRecruit = (transform.Find("BtnRecruit").GetComponent("XUIButton") as IXUIButton); + this.m_BtnCreate = (this.m_BottomButtonsFrame.Find("BtnCreate").GetComponent("XUIButton") as IXUIButton); + this.m_BtnMatchTeam = (this.m_BottomButtonsFrame.Find("BtnMatch").GetComponent("XUIButton") as IXUIButton); + this.m_MatchTeamLabel = (this.m_BtnMatchTeam.gameObject.transform.Find("IdleLabel").GetComponent("XUILabel") as IXUILabel); + this.m_MatchingTeamLabel = (this.m_BtnMatchTeam.gameObject.transform.Find("MatchingLabel").GetComponent("XUILabel") as IXUILabel); + this.m_BtnAllList = (transform.Find("BtnTeamRoom").GetComponent("XUIButton") as IXUIButton); + this.m_MatchingTween = (transform.Find("MatchingFrame").GetComponent("XUIPlayTween") as IXUITweenTool); + this.m_recruitEmpty = transform.Find("RecruitEmpty").gameObject; + transform = base.PanelObject.transform.Find("Bg/AllTeamsFrame"); + this.m_NoTeam = transform.Find("NoTeams").gameObject; + this.m_ScrollView = (transform.Find("Panel").GetComponent("XUIScrollView") as IXUIScrollView); + this.m_WrapContent = (transform.Find("Panel/WrapContent").GetComponent("XUIWrapContent") as IXUIWrapContent); + this.doc = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + this.doc.TeamListView = this; + this.doc.InitTeamListSelection(); + this.capDoc = XDocuments.GetSpecificDocument(XCaptainPVPDocument.uuID); + this.heroDoc = XDocuments.GetSpecificDocument(XHeroBattleDocument.uuID); + DlgHandlerBase.EnsureCreate(ref this.m_PasswordHandler, this.m_BottomButtonsFrame.Find("PasswordFrame").gameObject, this, true); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this.m_BtnRefresh.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnRefreshBtnClick)); + this.m_WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapContentItemUpdated)); + this.m_BtnMatchTeam.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnMatchTeamBtnClick)); + this.m_BtnCreate.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnCreateBtnClick)); + this.m_BtnAllList.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnAllTeamBtnClick)); + this.m_BtnRecruit.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnRecruitClick)); + } + + protected override void OnShow() + { + base.OnShow(); + this.m_MatchingTween.gameObject.SetActive(false); + this._bFirstOpen = true; + this.m_SelectedTeamID = -1; + XSingleton.singleton.KillTimer(this._TimerID); + this._AutoRefresh(null); + this.RefreshPage(); + this._RefreshButtonName(); + } + + protected override void OnHide() + { + base.OnHide(); + XSingleton.singleton.KillTimer(this._TimerID); + this._TimerID = 0u; + } + + public override void OnUnload() + { + this.doc.TeamListView = null; + XSingleton.singleton.KillTimer(this._TimerID); + this._TimerID = 0u; + DlgHandlerBase.EnsureUnload(ref this.m_PasswordHandler); + base.OnUnload(); + } + + public override void OnUpdate() + { + base.OnUpdate(); + this._UpdateMatchingTime(); + } + + public void OnCurrentDungeonChanged() + { + XSingleton.singleton.KillTimer(this._TimerID); + this._AutoRefresh(null); + this._RefreshButtonName(); + } + + public void Matching() + { + this.m_MatchingTween.PlayTween(true, -1f); + } + + private void _AutoRefresh(object param) + { + bool flag = base.IsVisible(); + if (flag) + { + this.doc.ReqTeamList(true); + this._TimerID = XSingleton.singleton.SetTimer(5f, this._autoRefreshCb, null); + } + } + + public void RefreshPage() + { + List teamList = this.doc.TeamList; + this.m_WrapContent.SetContentCount(teamList.Count, false); + bool bFirstOpen = this._bFirstOpen; + if (bFirstOpen) + { + this.m_ScrollView.ResetPosition(); + this._bFirstOpen = false; + } + bool flag = GroupChatDocument.GetStageID(this.doc.currentDungeonID) > 0u; + this.m_BtnRecruit.SetVisible(flag); + bool flag2 = teamList.Count > 0; + this.m_NoTeam.SetActive(!flag2 && !flag); + this.m_recruitEmpty.SetActive(!flag2 && flag); + this._UpdateButtonState(); + } + + private void WrapContentItemUpdated(Transform t, int index) + { + List teamList = this.doc.TeamList; + bool flag = index >= teamList.Count; + if (flag) + { + XSingleton.singleton.AddErrorLog("Item index out of range: ", index.ToString(), null, null, null, null); + } + else + { + XTeamBriefData xteamBriefData = teamList[index]; + IXUILabel ixuilabel = t.Find("TeamName").GetComponent("XUILabel") as IXUILabel; + IXUIButton ixuibutton = t.Find("BtnJoin").GetComponent("XUIButton") as IXUIButton; + GameObject gameObject = t.Find("IsFull").gameObject; + GameObject gameObject2 = t.Find("IsFighting").gameObject; + GameObject gameObject3 = t.Find("Members/Leader").gameObject; + GameObject gameObject4 = t.Find("Lock").gameObject; + IXUILabel ixuilabel2 = t.Find("BattlePoint/Num").GetComponent("XUILabel") as IXUILabel; + IXUISprite ixuisprite = t.Find("SisterTA").GetComponent("XUISprite") as IXUISprite; + ixuisprite.ID = 0UL; + ixuisprite.RegisterSpritePressEventHandler(new SpritePressEventHandler(this._OnPressTarjaInfo)); + IXUILabel ixuilabel3 = ixuisprite.transform.Find("Info").GetComponent("XUILabel") as IXUILabel; + bool flag2 = ixuilabel3 != null; + if (flag2) + { + ixuilabel3.SetVisible(false); + } + IXUISprite ixuisprite2 = t.Find("SisterTATeam").GetComponent("XUISprite") as IXUISprite; + ixuilabel3 = (ixuisprite2.transform.Find("Info").GetComponent("XUILabel") as IXUILabel); + IXUISprite ixuisprite3 = t.Find("Regression").GetComponent("XUISprite") as IXUISprite; + ixuisprite3.SetVisible(xteamBriefData.regression); + bool flag3 = ixuilabel3 != null; + if (flag3) + { + ixuilabel3.SetVisible(false); + } + ixuisprite2.RegisterSpritePressEventHandler(new SpritePressEventHandler(this._OnPressTarjaInfo)); + ixuisprite2.ID = 1UL; + bool flag4 = xteamBriefData.rift == null; + if (flag4) + { + ixuilabel.SetText(xteamBriefData.teamName); + } + else + { + ixuilabel.SetText(xteamBriefData.rift.GetSceneName(xteamBriefData.teamName)); + } + gameObject.SetActive(xteamBriefData.state == XTeamState.TS_FULL); + gameObject2.SetActive(xteamBriefData.state == XTeamState.TS_FIGHTING); + ixuibutton.SetVisible(xteamBriefData.state == XTeamState.TS_NOT_FULL || xteamBriefData.state == XTeamState.TS_VOTING); + ixuibutton.ID = (ulong)((long)index); + ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnJoinBtnClick)); + gameObject3.SetActive(false); + gameObject4.SetActive(xteamBriefData.hasPwd); + ixuilabel2.SetText(xteamBriefData.GetStrTeamPPT(0.0)); + xteamBriefData.goldGroup.SetUI(t.Find("RewardHunt").gameObject, true); + int i; + for (i = 0; i < xteamBriefData.members.Count; i++) + { + Transform transform = t.Find("Members/Member" + i.ToString()); + this._SetTeamMemberUI(transform, xteamBriefData.members[i], xteamBriefData, i, index); + bool flag5 = xteamBriefData.members[i].position == XTeamPosition.TP_LEADER; + if (flag5) + { + gameObject3.SetActive(true); + gameObject3.transform.localPosition = transform.localPosition; + } + } + while (i < xteamBriefData.totalMemberCount) + { + this._SetTeamMemberUI(t.Find("Members/Member" + i.ToString()), null, xteamBriefData, i, index); + i++; + } + while (i < XMyTeamHandler.LARGE_TEAM_CAPACITY) + { + this._SetTeamMemberUI(t.Find("Members/Member" + i.ToString()), null, null, i, index); + i++; + } + ixuisprite2.SetVisible(xteamBriefData.isTarja); + ixuisprite.SetVisible(this.doc.ShowTarja()); + } + } + + private void _SetTeamMemberUI(Transform t, XTeamMemberBriefData memberData, XTeamBriefData teamData, int memberIndex, int teamIndex) + { + bool flag = t == null; + if (!flag) + { + bool flag2 = teamData == null; + if (flag2) + { + t.gameObject.SetActive(false); + } + else + { + t.gameObject.SetActive(true); + IXUISprite ixuisprite = t.Find("Prof").GetComponent("XUISprite") as IXUISprite; + Transform t2 = t.Find("Relation"); + bool flag3 = memberData != null; + if (flag3) + { + ixuisprite.SetVisible(true); + ixuisprite.ID = (ulong)((long)(teamIndex << XTeamListHandler.MEMBER_INDEX_MASK | memberIndex)); + ixuisprite.SetSprite(XSingleton.singleton.GetProfHeadIcon2(XFastEnumIntEqualityComparer.ToInt(memberData.profession))); + ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnMemberClicked)); + XTeamView.SetTeamRelationUI(t2, memberData.relation, true, XTeamRelation.Relation.TR_NONE); + } + else + { + ixuisprite.SetVisible(false); + XTeamView.SetTeamRelationUI(t2, null, true, XTeamRelation.Relation.TR_NONE); + } + } + } + } + + private bool _OnPressTarjaInfo(IXUISprite sprite, bool pressed) + { + IXUILabel ixuilabel = sprite.transform.Find("Info").GetComponent("XUILabel") as IXUILabel; + bool flag = ixuilabel != null; + if (flag) + { + bool flag2 = sprite.ID == 1UL; + if (flag2) + { + ixuilabel.SetText(XSingleton.singleton.ReplaceReturn(XStringDefineProxy.GetString("TEAM_TARJA_DESC_TEAM"))); + } + else + { + ixuilabel.SetText(XSingleton.singleton.ReplaceReturn(XStringDefineProxy.GetString("TEAM_TARJA_DESC"))); + } + ixuilabel.SetVisible(pressed); + } + return false; + } + + private bool _OnRecruitClick(IXUIButton btn) + { + XSingleton.singleton.OpenSystem(XSysDefine.XSys_GroupRecruit, 0UL); + return true; + } + + private void _OnMemberClicked(IXUISprite iSp) + { + int num = (int)(iSp.ID & (ulong)((long)((1 << XTeamListHandler.MEMBER_INDEX_MASK) - 1))); + int num2 = (int)(iSp.ID >> XTeamListHandler.MEMBER_INDEX_MASK); + List teamList = this.doc.TeamList; + bool flag = num2 >= teamList.Count; + if (flag) + { + XSingleton.singleton.AddErrorLog("teamIndex out of range: ", num2.ToString(), null, null, null, null); + } + else + { + XTeamBriefData xteamBriefData = teamList[num2]; + bool flag2 = num >= xteamBriefData.members.Count; + if (flag2) + { + XSingleton.singleton.AddErrorLog("memberIndex out of range: ", num.ToString(), null, null, null, null); + } + else + { + XTeamMemberBriefData xteamMemberBriefData = xteamBriefData.members[num]; + bool flag3 = !xteamMemberBriefData.robot; + if (flag3) + { + XCharacterCommonMenuDocument.ReqCharacterMenuInfo(xteamMemberBriefData.uid, false); + } + } + } + } + + private void _UpdateButtonState() + { + bool flag = this.doc.IsSoloMatching(this.doc.currentDungeonType); + this.m_MatchingTeamLabel.SetVisible(flag); + this.m_MatchTeamLabel.SetVisible(!flag); + bool flag2 = !flag; + if (flag2) + { + this.m_MatchingTween.gameObject.SetActive(false); + } + else + { + bool bAutoMatching = this.doc.bAutoMatching; + if (bAutoMatching) + { + this.Matching(); + this.doc.bAutoMatching = false; + } + } + bool flag3 = !flag; + if (flag3) + { + this.m_MatchingTime = -1; + } + this._UpdateMatchingTime(); + } + + public override void StackRefresh() + { + XSingleton.singleton.KillTimer(this._TimerID); + this._AutoRefresh(null); + this._RefreshButtonName(); + } + + private bool _OnRefreshBtnClick(IXUIButton go) + { + XSingleton.singleton.KillTimer(this._TimerID); + this._AutoRefresh(null); + return true; + } + + private void _OnTeamClick(IXUISprite iSp) + { + int num = (int)iSp.ID; + List teamList = this.doc.TeamList; + bool flag = num >= teamList.Count; + if (flag) + { + XSingleton.singleton.AddErrorLog("Item index out of range: ", num.ToString(), null, null, null, null); + } + else + { + XTeamBriefData xteamBriefData = teamList[num]; + this.m_SelectedTeamID = xteamBriefData.teamID; + this.m_WrapContent.RefreshAllVisibleContents(); + this._UpdateButtonState(); + } + } + + private bool _OnJoinBtnClick(IXUIButton go) + { + this.mCurTeamBriefIndex = (int)go.ID; + this._RealShowJoinTeamView(); + return true; + } + + private bool _OnMatchTeamBtnClick(IXUIButton go) + { + TeamLevelType currentDungeonType = this.doc.currentDungeonType; + if (currentDungeonType != TeamLevelType.TeamLevelCaptainPVP && currentDungeonType != TeamLevelType.TeamLevelHeroBattle && currentDungeonType - TeamLevelType.TeamLevelMultiPK > 3) + { + this.doc.ToggleMatching(); + } + else + { + KMatchType kmatchType = XTeamDocument.TeamType2MatchType(this.doc.currentDungeonType); + KMatchOp op = (this.doc.SoloMatchType != kmatchType) ? KMatchOp.KMATCH_OP_START : KMatchOp.KMATCH_OP_STOP; + this.doc.ReqMatchStateChange(kmatchType, op, false); + } + return true; + } + + private bool _OnAllTeamBtnClick(IXUIButton go) + { + DlgBase.singleton.SetVisibleWithAnimation(true, null); + XSingleton.singleton.KillTimer(this._TimerID); + return true; + } + + private bool _OnCreateBtnClick(IXUIButton go) + { + this._RealShowCreateTeamView(); + return true; + } + + private void _RefreshButtonName() + { + XExpeditionDocument specificDocument = XDocuments.GetSpecificDocument(XExpeditionDocument.uuID); + ExpeditionTable.RowData expeditionDataByID = specificDocument.GetExpeditionDataByID((int)this.doc.currentDungeonID); + bool flag = expeditionDataByID == null || expeditionDataByID.fastmatch == 0; + if (flag) + { + this.m_MatchTeamLabel.SetText(XStringDefineProxy.GetString("TEAM_MATCH_BTN_NORMAL")); + } + else + { + this.m_MatchTeamLabel.SetText(XStringDefineProxy.GetString("TEAM_MATCH_BTN_QUICK")); + } + bool flag2 = expeditionDataByID != null; + if (flag2) + { + bool flag3 = expeditionDataByID.FMARobotTime == 0; + if (flag3) + { + this.m_MatchingTeamLabel.SetText(XStringDefineProxy.GetString("MATCHING")); + } + this.m_FastMatchTime = expeditionDataByID.FMARobotTime; + } + else + { + this.m_FastMatchTime = 0; + } + } + + private void _UpdateMatchingTime() + { + bool flag = this.m_FastMatchTime == 0; + if (!flag) + { + bool flag2 = this.m_MatchingTime != this.doc.MatchingTime && this.doc.MatchingTime >= 0; + if (flag2) + { + this.m_MatchingTime = this.doc.MatchingTime; + this.m_MatchingTeamLabel.SetText(string.Format("{0}...\n{1}", XStringDefineProxy.GetString("MATCHING"), XStringDefineProxy.GetString("LEFT_MATCH_TIME", new object[] + { + this.m_MatchingTime, + this.m_FastMatchTime + }))); + } + } + } + + private void _RealShowCreateTeamView() + { + bool flag = this.doc.MyTeam != null; + if (flag) + { + XSingleton.singleton.ShowSystemTip(ErrorCode.ERR_TEAM_ALREADY_INTEAM, "fece00"); + } + else + { + this.doc.password = this.m_PasswordHandler.GetPassword(); + this.doc.ReqTeamOp(TeamOperate.TEAM_CREATE, 0UL, null, TeamMemberType.TMT_NORMAL, null); + XOptionsDocument specificDocument = XDocuments.GetSpecificDocument(XOptionsDocument.uuID); + specificDocument.SetValue(XOptionsDefine.OD_TEAM_PASSWORD, this.m_PasswordHandler.GetInputPassword()); + } + } + + private void _RealShowJoinTeamView() + { + bool bInTeam = this.doc.bInTeam; + if (bInTeam) + { + XSingleton.singleton.ShowSystemTip(ErrorCode.ERR_TEAM_ALREADY_INTEAM, "fece00"); + } + else + { + XTeamBriefData teamBriefByIndex = this.doc.GetTeamBriefByIndex(this.mCurTeamBriefIndex); + bool flag = teamBriefByIndex == null; + if (!flag) + { + XTeamView.TryJoinTeam(teamBriefByIndex.teamID, teamBriefByIndex.hasPwd); + } + } + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamListHandler.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamListHandler.cs.meta new file mode 100644 index 00000000..ec059316 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamListHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 65cabdf8878cc744a8f1b611bc629039 +timeCreated: 1611403851 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMember.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamMember.cs new file mode 100644 index 00000000..cda9c7f1 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMember.cs @@ -0,0 +1,228 @@ +using System; +using System.Collections.Generic; +using KKSG; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamMember : IComparable + { + public ulong uid + { + get + { + return this.briefData.uid; + } + set + { + this.briefData.uid = value; + } + } + + public string name + { + get + { + return this.briefData.name; + } + set + { + this.briefData.name = value; + } + } + + public RoleType profession + { + get + { + return this.briefData.profession; + } + } + + public int level + { + get + { + return this.briefData.level; + } + } + + public uint ppt + { + get + { + return this.briefData.ppt; + } + } + + public XTeamPosition position + { + get + { + return this.briefData.position; + } + set + { + this.briefData.position = value; + } + } + + public ulong guildID + { + get + { + return this.briefData.guildid; + } + set + { + this.briefData.guildid = value; + } + } + + public uint vip + { + get + { + return this.briefData.vip; + } + set + { + this.briefData.vip = value; + } + } + + public uint paymemberid + { + get + { + return this.briefData.paymemberid; + } + set + { + this.briefData.paymemberid = value; + } + } + + public XTeamRelation Relation + { + get + { + return this.briefData.relation; + } + } + + public ulong dragonGuildID + { + get + { + return this.briefData.dragonguildid; + } + } + + public bool bIsLeader + { + get + { + return this.position == XTeamPosition.TP_LEADER; + } + } + + public bool bIsHelper + { + get + { + return this._is_helper; + } + } + + public bool bIsTicket + { + get + { + return this._is_ticket; + } + } + + public bool IsTarja + { + get + { + return this._tarjatime > 0u; + } + } + + public uint ServerID + { + get + { + return this._server_id; + } + } + + private XTeamMemberBriefData briefData = new XTeamMemberBriefData(); + + public ulong entityID; + + public int joinIndex; + + public ExpTeamMemberState state = ExpTeamMemberState.EXPTEAM_IDLE; + + public List fashion = null; + + public OutLook outlook = null; + + public uint sceneID; + + public int leftCount; + + public bool regression = false; + + public bool bIsRobot = false; + + private bool _is_helper = false; + + private bool _is_ticket = false; + + private uint _tarjatime = 0u; + + private uint _server_id = 0u; + + public void SetData(TeamMember data, string leaderName, int joinindex) + { + this.briefData.SetData(data, leaderName); + this.entityID = this.uid; + this.joinIndex = joinindex; + this.state = (ExpTeamMemberState)data.state; + this.fashion = data.fashion; + this.outlook = data.outlook; + this.sceneID = (data.robot ? 1u : data.sceneID); + this.leftCount = (data.robot ? 1 : data.leftcount); + this.briefData.vip = data.vipLevel; + this.bIsRobot = data.robot; + this._is_helper = (data.membertype == TeamMemberType.TMT_HELPER); + this._is_ticket = (data.membertype == TeamMemberType.TMT_USETICKET); + this.briefData.paymemberid = data.paymemberid; + this._tarjatime = data.tarjatime; + this._server_id = data.serverid; + this.regression = data.kingback; + } + + public int CompareTo(XTeamMember other) + { + int num = XFastEnumIntEqualityComparer.ToInt(this.position).CompareTo(XFastEnumIntEqualityComparer.ToInt(other.position)); + bool flag = num == 0; + if (flag) + { + num = this.joinIndex.CompareTo(other.joinIndex); + } + return num; + } + + public static XTeamMember CreateTeamMember(TeamMember data, string leaderName, int joinindex) + { + XTeamMember xteamMember = new XTeamMember(); + xteamMember.SetData(data, leaderName, joinindex); + return xteamMember; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMember.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamMember.cs.meta new file mode 100644 index 00000000..3960db86 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMember.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1cd0857501a779748be146015c8971a4 +timeCreated: 1611403348 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMemberBriefData.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamMemberBriefData.cs new file mode 100644 index 00000000..83ed9275 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMemberBriefData.cs @@ -0,0 +1,95 @@ +using System; +using KKSG; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamMemberBriefData : XDataBase, IComparable + { + public bool isTarja + { + get + { + return this.tarjatime > 0u; + } + } + + public ulong uid; + + public string name; + + public RoleType profession; + + public XTeamPosition position; + + public int level; + + public uint ppt; + + public ulong guildid; + + public XTeamRelation relation = new XTeamRelation(); + + public uint vip; + + public uint paymemberid; + + public bool robot; + + public ulong dragonguildid; + + public bool regression = false; + + private uint tarjatime; + + public void SetData(TeamMember data, string leaderName) + { + this.uid = data.memberID; + this.name = data.name; + this.profession = data.profession; + this.level = data.level; + this.ppt = data.powerpoint; + this.position = ((this.name == leaderName) ? XTeamPosition.TP_LEADER : XTeamPosition.TP_MEMBER); + this.guildid = data.guildid; + this.robot = data.robot; + this.tarjatime = data.tarjatime; + this.dragonguildid = data.dragonguildid; + this.regression = data.kingback; + } + + public override void Init() + { + base.Init(); + this.position = XTeamPosition.TP_MEMBER; + } + + public override void Recycle() + { + base.Recycle(); + XDataPool.Recycle(this); + } + + public int CompareTo(XTeamMemberBriefData other) + { + bool flag = this.position == XTeamPosition.TP_LEADER; + int result; + if (flag) + { + result = -1; + } + else + { + bool flag2 = this.uid == XSingleton.singleton.XPlayerData.RoleID; + if (flag2) + { + result = -1; + } + else + { + result = -this.level.CompareTo(other.level); + } + } + return result; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMemberBriefData.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamMemberBriefData.cs.meta new file mode 100644 index 00000000..09589410 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMemberBriefData.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4d89d0c9d3c02324aada9cca9660c70c +timeCreated: 1611403696 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMemberCountChangedEventArgs.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamMemberCountChangedEventArgs.cs new file mode 100644 index 00000000..d58ddae8 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMemberCountChangedEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace XMainClient +{ + internal class XTeamMemberCountChangedEventArgs : XEventArgs + { + public uint oldCount; + + public uint newCount; + + public XTeamMemberCountChangedEventArgs() + { + this._eDefine = XEventDefine.XEvent_TeamMemberCountChanged; + } + + public override void Recycle() + { + base.Recycle(); + this.oldCount = 0u; + this.newCount = 0u; + XEventPool.Recycle(this); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMemberCountChangedEventArgs.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamMemberCountChangedEventArgs.cs.meta new file mode 100644 index 00000000..0c78d5e2 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMemberCountChangedEventArgs.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c87889b9975a20c448bce56f5064bc86 +timeCreated: 1611404534 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMemberMonitor.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamMemberMonitor.cs new file mode 100644 index 00000000..52d17dfe --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMemberMonitor.cs @@ -0,0 +1,441 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamMemberMonitor + { + public XTeamBloodUIData Data + { + get + { + return this.m_MemberData; + } + } + + public XEntity Entity + { + get + { + return this.m_Entity; + } + } + + public ulong ID + { + get + { + return this.m_MemberData.uid; + } + } + + public ulong EntityID + { + get + { + return this.m_MemberData.entityID; + } + } + + private GameObject m_Go; + + private bool m_bActive = true; + + private XTeamBloodUIData m_MemberData; + + private XTeamMonitorStateMgr m_StateMgr; + + private XEntity m_Entity; + + private IXUISprite m_uiAvatar; + + private IXUILabel m_uiName; + + private GameObject m_uiLeader; + + private IXUIProgress m_uiHpBar; + + private IXUIProgress m_uiMpBar; + + private GameObject m_uiDead; + + private IXUISprite m_HeroIcon; + + private IXUISprite m_HeroUnSelect; + + private IXUILabel m_uiLevel; + + public IXUISprite m_sprVoice; + + public IXUISprite m_sprSpeak; + + private GameObject m_uiLeave; + + private GameObject m_uiLoading; + + private IXUICheckBox m_uiCheckBox; + + private XBuffMonitorHandler m_BuffMonitor; + + public XTeamMemberMonitor(XTeamMonitorStateMgr stateMgr) + { + this.m_StateMgr = stateMgr; + } + + public void SetGo(GameObject go) + { + this.m_Go = go; + this.m_uiAvatar = (go.transform.Find("AvatarBG/Avatar").GetComponent("XUISprite") as IXUISprite); + this.m_uiName = (go.transform.Find("PlayerName").GetComponent("XUILabel") as IXUILabel); + this.m_uiLeader = go.transform.Find("TeamLeader").gameObject; + this.m_HeroIcon = (go.transform.Find("Frame/HeroIcon").GetComponent("XUISprite") as IXUISprite); + this.m_HeroUnSelect = (go.transform.Find("Frame/UnSelect").GetComponent("XUISprite") as IXUISprite); + bool flag = DlgBase.singleton.IsLoaded(); + if (flag) + { + this.m_sprVoice = (go.transform.Find("VoiceInfo/voice").GetComponent("XUISprite") as IXUISprite); + this.m_sprSpeak = (go.transform.Find("VoiceInfo/speak").GetComponent("XUISprite") as IXUISprite); + } + Transform transform = go.transform.Find("HpBar"); + bool flag2 = transform != null; + if (flag2) + { + this.m_uiHpBar = (transform.GetComponent("XUIProgress") as IXUIProgress); + } + else + { + this.m_uiHpBar = null; + } + transform = go.transform.Find("MpBar"); + bool flag3 = transform != null; + if (flag3) + { + this.m_uiMpBar = (transform.GetComponent("XUIProgress") as IXUIProgress); + } + else + { + this.m_uiMpBar = null; + } + transform = go.transform.Find("BuffFrame"); + bool flag4 = transform != null; + if (flag4) + { + bool flag5 = XSingleton.singleton.SceneType != SceneType.SCENE_HEROBATTLE || !XSingleton.singleton.bSpectator; + if (flag5) + { + transform.gameObject.SetActive(true); + DlgHandlerBase.EnsureCreate(ref this.m_BuffMonitor, transform.gameObject, null, true); + } + else + { + transform.gameObject.SetActive(false); + } + } + transform = go.transform.Find("Dead"); + bool flag6 = transform != null; + if (flag6) + { + this.m_uiDead = transform.gameObject; + } + transform = go.transform.Find("Leave"); + bool flag7 = transform != null; + if (flag7) + { + this.m_uiLeave = transform.gameObject; + } + transform = go.transform.Find("Loading"); + bool flag8 = transform != null; + if (flag8) + { + this.m_uiLoading = transform.gameObject; + } + transform = go.transform.Find("Level"); + bool flag9 = transform != null; + if (flag9) + { + this.m_uiLevel = (transform.GetComponent("XUILabel") as IXUILabel); + } + else + { + this.m_uiLevel = null; + } + bool flag10 = DlgBase.singleton.IsLoaded(); + if (flag10) + { + this.m_uiCheckBox = (go.GetComponent("XUICheckBox") as IXUICheckBox); + } + } + + public void SetActive(bool bActive) + { + this.m_bActive = bActive; + this.m_Go.SetActive(bActive); + } + + public void PlaySound(int state) + { + bool flag = DlgBase.singleton.IsLoaded(); + if (flag) + { + this.m_sprVoice.SetVisible(state == 1); + this.m_sprSpeak.SetVisible(state == 2); + } + } + + public void SetMemberData(XTeamBloodUIData data) + { + this.m_MemberData = data; + this.m_Entity = null; + this.PlaySound(0); + this._SetBasicUI(); + this.Update(); + } + + private bool OnSpectateChangeClick(IXUICheckBox checkBox) + { + bool flag = !checkBox.bChecked; + bool result; + if (flag) + { + result = true; + } + else + { + XEntity entityConsiderDeath = XSingleton.singleton.GetEntityConsiderDeath(checkBox.ID); + bool flag2 = entityConsiderDeath != null && entityConsiderDeath.IsRole; + if (flag2) + { + XSingleton.singleton.Player.WatchIt(entityConsiderDeath as XRole); + } + result = true; + } + return result; + } + + private void _SetBasicUI() + { + bool flag = this.m_MemberData != null; + if (flag) + { + this.m_uiName.SetText(this.m_MemberData.name); + bool flag2 = XSingleton.singleton.SceneType != SceneType.SCENE_HEROBATTLE; + if (flag2) + { + this.m_uiAvatar.SetVisible(true); + this.m_uiLevel.gameObject.SetActive(true); + this.m_HeroIcon.gameObject.transform.parent.gameObject.SetActive(false); + int profID = XFastEnumIntEqualityComparer.ToInt(this.m_MemberData.profession); + this.m_uiAvatar.spriteName = XSingleton.singleton.GetProfIcon(profID); + this.m_uiLeader.SetActive(this.m_MemberData.bIsLeader); + bool flag3 = this.m_uiLevel != null; + if (flag3) + { + this.m_uiLevel.SetText("Lv." + this.m_MemberData.level.ToString()); + } + } + else + { + this.m_uiAvatar.SetVisible(false); + this.m_uiLeader.SetActive(false); + this.m_uiLevel.gameObject.SetActive(false); + this.m_HeroIcon.gameObject.transform.parent.gameObject.SetActive(true); + uint num = 0u; + XHeroBattleDocument specificDocument = XDocuments.GetSpecificDocument(XHeroBattleDocument.uuID); + specificDocument.heroIDIndex.TryGetValue(this.m_MemberData.uid, out num); + bool flag4 = num == 0u; + if (flag4) + { + this.m_HeroIcon.SetAlpha(0f); + this.m_HeroUnSelect.SetAlpha(1f); + } + else + { + this.m_HeroIcon.SetAlpha(1f); + OverWatchTable.RowData byHeroID = specificDocument.OverWatchReader.GetByHeroID(num); + bool flag5 = byHeroID != null; + if (flag5) + { + this.m_HeroIcon.SetSprite(byHeroID.Icon, byHeroID.IconAtlas, false); + } + else + { + XSingleton.singleton.AddErrorLog("Error heroID on TeamMonitor. heroID = ", num.ToString(), null, null, null, null); + } + this.m_HeroUnSelect.SetAlpha(0f); + } + } + } + else + { + this.m_HeroIcon.gameObject.transform.parent.gameObject.SetActive(false); + this.m_uiName.SetText(""); + this.m_uiLeader.SetActive(false); + this.m_uiAvatar.spriteName = "zd_wh"; + bool flag6 = this.m_uiLevel != null; + if (flag6) + { + this.m_uiLevel.SetText(""); + } + } + this.m_uiAvatar.SetEnabled(true); + bool flag7 = this.m_uiDead != null; + if (flag7) + { + this.m_uiDead.SetActive(false); + } + bool flag8 = this.m_uiHpBar != null; + if (flag8) + { + this.m_uiHpBar.value = 0f; + } + bool flag9 = !XSingleton.singleton.bSpectator && this.m_uiMpBar != null; + if (flag9) + { + this.m_uiMpBar.value = 0f; + } + bool flag10 = this.m_BuffMonitor != null; + if (flag10) + { + this.m_BuffMonitor.InitMonitor(XSingleton.singleton.BuffMaxDisplayCountTeam, this.m_MemberData != null && this.m_MemberData.isLeft, false); + } + bool bSpectator = XSingleton.singleton.bSpectator; + if (bSpectator) + { + bool flag11 = XSingleton.singleton.Player != null && XSingleton.singleton.Player.WatchTo != null && this.m_MemberData != null && this.m_MemberData.uid == XSingleton.singleton.Player.WatchTo.ID; + if (flag11) + { + this.m_uiCheckBox.ForceSetFlag(true); + } + else + { + this.m_uiCheckBox.ForceSetFlag(false); + } + this.m_uiCheckBox.ID = this.m_MemberData.uid; + this.m_uiCheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnSpectateChangeClick)); + } + } + + private void _SetState() + { + XTeamMonitorState state = this.m_StateMgr.GetState(this.m_MemberData.uid); + bool flag = this.m_uiLeave != null; + if (flag) + { + this.m_uiLeave.SetActive(this.m_Entity == null && state != XTeamMonitorState.TMS_Loading); + } + bool flag2 = this.m_uiLoading != null; + if (flag2) + { + this.m_uiLoading.SetActive(this.m_Entity == null && state == XTeamMonitorState.TMS_Loading); + } + } + + public void Update() + { + bool flag = !this.m_bActive; + if (!flag) + { + bool flag2 = this.m_Entity == null && this.m_MemberData != null; + if (flag2) + { + this.m_Entity = XSingleton.singleton.GetEntityConsiderDeath(this.m_MemberData.entityID); + bool flag3 = this.m_Entity == null; + if (flag3) + { + this._SetState(); + return; + } + bool flag4 = !this.m_Entity.Deprecated; + if (flag4) + { + bool flag5 = this.m_BuffMonitor != null; + if (flag5) + { + this.m_BuffMonitor.OnBuffChanged(this.m_Entity.Buffs.GetUIBuffList()); + } + this.m_StateMgr.SetState(this.m_MemberData.uid, XTeamMonitorState.TMS_Normal); + } + } + bool flag6 = this.m_Entity == null || this.m_Entity.Deprecated; + if (flag6) + { + this.m_Entity = null; + this._SetBasicUI(); + this._SetState(); + } + else + { + bool flag7 = this.m_BuffMonitor != null; + if (flag7) + { + this.m_BuffMonitor.OnUpdate(); + } + this._SetState(); + bool flag8 = this.m_uiHpBar != null; + if (flag8) + { + int num = (int)this.m_Entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxHP_Total); + int num2 = (int)this.m_Entity.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentHP_Basic); + bool flag9 = num2 < 0; + if (flag9) + { + num2 = 0; + } + this.m_uiHpBar.value = (float)num2 / (float)num; + } + bool flag10 = !XSingleton.singleton.bSpectator && this.m_uiMpBar != null; + if (flag10) + { + int num3 = (int)this.m_Entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxMP_Total); + int num4 = (int)this.m_Entity.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentMP_Basic); + bool flag11 = num4 < 0; + if (flag11) + { + num4 = 0; + } + this.m_uiMpBar.value = (float)num4 / (float)num3; + } + bool flag12 = this.m_uiDead != null; + if (flag12) + { + this.m_uiDead.SetActive(!XEntity.ValideEntity(this.m_Entity)); + this.m_uiAvatar.SetEnabled(XEntity.ValideEntity(this.m_Entity)); + } + } + } + } + + public void OnBuffChange(List buffList) + { + bool flag = this.m_BuffMonitor != null; + if (flag) + { + this.m_BuffMonitor.OnBuffChanged(buffList); + } + } + + public void CheckToggleState() + { + bool flag = XSingleton.singleton.Player != null && XSingleton.singleton.Player.WatchTo != null && this.m_MemberData.uid == XSingleton.singleton.Player.WatchTo.ID; + if (flag) + { + this.m_uiCheckBox.bChecked = true; + } + else + { + this.m_uiCheckBox.bChecked = false; + } + } + + public void Unload() + { + DlgHandlerBase.EnsureUnload(ref this.m_BuffMonitor); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMemberMonitor.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamMemberMonitor.cs.meta new file mode 100644 index 00000000..a4dfbbd7 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMemberMonitor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e96898f851eb2ec43916e3be3ea2c961 +timeCreated: 1611404756 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorHandler.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorHandler.cs new file mode 100644 index 00000000..3f20f776 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorHandler.cs @@ -0,0 +1,448 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamMonitorHandler : DlgHandlerBase + { + private XTeamDocument _TeamDoc; + + private XUIPool m_TeamUIPool = new XUIPool(XSingleton.singleton.m_uiTool); + + private List m_Members = new List(); + + private XTeamMonitorStateMgr m_StateMgr = new XTeamMonitorStateMgr(); + + private float m_LastStateQueryTime = 0f; + + private bool m_bShowMonitor = true; + + private bool m_bTempHide = false; + + public XSceneDamageRankHandler m_DamageRankHandler; + + private GameObject m_TeamGo; + + private IXUICheckBox m_RankCheckBox; + + private IXUICheckBox m_TeamCheckBox; + + private List _teamList = new List(); + + protected override void Init() + { + base.Init(); + this.m_TeamGo = base.PanelObject.transform.Find("TeamPanel").gameObject; + Transform transform = this.m_TeamGo.transform.Find("TeammateTpl"); + this.m_TeamUIPool.SetupPool(transform.parent.gameObject, transform.gameObject, 2u, false); + this._TeamDoc = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + transform = base.PanelObject.transform.Find("RankPanel"); + bool flag = transform != null; + if (flag) + { + DlgHandlerBase.EnsureCreate(ref this.m_DamageRankHandler, transform.gameObject, this, false); + } + bool flag2 = DlgBase.singleton.IsLoaded(); + if (flag2) + { + this.m_RankCheckBox = (base.PanelObject.transform.Find("TabList/Rank").GetComponent("XUICheckBox") as IXUICheckBox); + this.m_TeamCheckBox = (base.PanelObject.transform.Find("TabList/Team").GetComponent("XUICheckBox") as IXUICheckBox); + SceneType sceneType = XSingleton.singleton.SceneType; + if (sceneType == SceneType.SCENE_PKTWO || sceneType == SceneType.SCENE_CUSTOMPKTWO) + { + this.m_RankCheckBox.SetVisible(false); + this.m_TeamCheckBox.SetVisible(false); + } + } + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + bool flag = !XSingleton.singleton.bSpectator; + if (flag) + { + this.m_RankCheckBox.ID = 0UL; + this.m_TeamCheckBox.ID = 1UL; + this.m_RankCheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this._OnTabSelectionChanged)); + this.m_TeamCheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this._OnTabSelectionChanged)); + } + } + + public override void OnUnload() + { + DlgHandlerBase.EnsureUnload(ref this.m_DamageRankHandler); + for (int i = 0; i < this.m_Members.Count; i++) + { + this.m_Members[i].Unload(); + } + base.OnUnload(); + } + + private bool _OnTabSelectionChanged(IXUICheckBox ckb) + { + bool flag = !ckb.bChecked; + bool result; + if (flag) + { + result = true; + } + else + { + bool flag2 = ckb.ID == 0UL; + if (flag2) + { + bool flag3 = this.m_DamageRankHandler != null; + if (flag3) + { + this.m_DamageRankHandler.SetVisible(true); + } + this.m_TeamGo.SetActive(false); + } + else + { + bool flag4 = this.m_DamageRankHandler != null; + if (flag4) + { + this.m_DamageRankHandler.SetVisible(false); + } + this.m_TeamGo.SetActive(true); + } + result = true; + } + return result; + } + + public override void OnUpdate() + { + bool flag = !this.active; + if (!flag) + { + base.OnUpdate(); + for (int i = 0; i < this.m_Members.Count; i++) + { + this.m_Members[i].Update(); + } + bool flag2 = this.m_DamageRankHandler != null && this.m_DamageRankHandler.active; + if (flag2) + { + this.m_DamageRankHandler.OnUpdate(); + } + this._ReqQueryRoleStates(); + } + } + + private void _ReqQueryRoleStates() + { + bool flag = this.m_StateMgr.HasLoadingEntity(); + if (flag) + { + float realtimeSinceStartup = Time.realtimeSinceStartup; + bool flag2 = realtimeSinceStartup - this.m_LastStateQueryTime < 1f; + if (!flag2) + { + this.m_LastStateQueryTime = realtimeSinceStartup; + PtcC2G_QueryRoleStateReq ptcC2G_QueryRoleStateReq = new PtcC2G_QueryRoleStateReq(); + for (int i = 0; i < this.m_Members.Count; i++) + { + XTeamMemberMonitor xteamMemberMonitor = this.m_Members[i]; + bool flag3 = xteamMemberMonitor.Entity == null && this.m_StateMgr.GetState(xteamMemberMonitor.Data.entityID) == XTeamMonitorState.TMS_Loading; + if (flag3) + { + ptcC2G_QueryRoleStateReq.Data.roleids.Add(xteamMemberMonitor.Data.entityID); + } + } + bool flag4 = ptcC2G_QueryRoleStateReq.Data.roleids.Count > 0; + if (flag4) + { + XSingleton.singleton.Send(ptcC2G_QueryRoleStateReq); + } + } + } + } + + public void OnQueryRoleStates(QueryRoleStateAck data) + { + bool flag = data.roleids.Count != data.state.Count; + if (flag) + { + XSingleton.singleton.AddErrorLog("data.roleids.Count != data.state.Count ", data.roleids.Count.ToString(), " != ", data.state.Count.ToString(), null, null); + } + else + { + for (int i = 0; i < data.roleids.Count; i++) + { + this.m_StateMgr.SetState(data.roleids[i], (XTeamMonitorState)data.state[i]); + } + } + } + + public void TemporarilyHide(bool bHide) + { + this.m_bTempHide = bHide; + this.OnTeamInfoChanged(); + } + + public void TeamInfoChangeOnBattle(XTeam team) + { + bool flag = team == null; + if (flag) + { + this._teamList.Clear(); + this.OnTeamInfoChanged(); + } + else + { + bool flag2 = team.members.Count != this._teamList.Count; + if (flag2) + { + int count = this._teamList.Count; + bool flag3 = team.members.Count < count; + if (flag3) + { + for (int i = count - 1; i >= team.members.Count; i--) + { + this._teamList.RemoveAt(i); + } + } + else + { + for (int j = count; j < team.members.Count; j++) + { + XTeamBloodUIData item = new XTeamBloodUIData(); + this._teamList.Add(item); + } + } + } + for (int k = 0; k < this._teamList.Count; k++) + { + this._teamList[k].uid = team.members[k].uid; + this._teamList[k].entityID = team.members[k].entityID; + this._teamList[k].level = (uint)team.members[k].level; + this._teamList[k].name = team.members[k].name; + this._teamList[k].profession = team.members[k].profession; + this._teamList[k].bIsLeader = team.members[k].bIsLeader; + } + this.OnTeamInfoChanged(); + } + } + + public void TeamInfoChangeOnSpectate(List list) + { + bool flag = list.Count != this._teamList.Count; + if (flag) + { + int count = this._teamList.Count; + bool flag2 = list.Count < count; + if (flag2) + { + for (int i = count - 1; i >= list.Count; i--) + { + this._teamList.RemoveAt(i); + } + } + else + { + for (int j = count; j < list.Count; j++) + { + XTeamBloodUIData item = new XTeamBloodUIData(); + this._teamList.Add(item); + } + } + } + for (int k = 0; k < this._teamList.Count; k++) + { + this._teamList[k] = list[k]; + } + this.OnTeamInfoChanged(); + } + + public void InitWhenShowMainUIByTeam(XTeam team) + { + this.InitWhenShowMainUI(); + this.TeamInfoChangeOnBattle(team); + } + + public void InitWhenShowMainUIByBloodList(List list) + { + this.InitWhenShowMainUI(); + this.TeamInfoChangeOnSpectate(list); + } + + public void InitWhenShowMainUI() + { + SceneTable.RowData sceneData = XSingleton.singleton.GetSceneData(XSingleton.singleton.SceneID); + SceneType type = (SceneType)sceneData.type; + if (type <= SceneType.SCENE_TOWER) + { + if (type == SceneType.SCENE_ABYSSS) + { + this.m_bShowMonitor = (XSingleton.singleton.SyncMode || XSingleton.singleton.HasRobot); + goto IL_8A; + } + if (type != SceneType.SCENE_TOWER) + { + goto IL_78; + } + } + else if (type != SceneType.SCENE_GMF && type != SceneType.SCENE_GPR && type != SceneType.SCENE_LEAGUE_BATTLE) + { + goto IL_78; + } + this.m_bShowMonitor = XSingleton.singleton.bSpectator; + goto IL_8A; + IL_78: + this.m_bShowMonitor = XSingleton.singleton.SyncMode; + IL_8A: + this.m_bTempHide = false; + bool flag = !XSingleton.singleton.bSpectator; + if (flag) + { + byte teamInfoDefaultTab = sceneData.TeamInfoDefaultTab; + if (teamInfoDefaultTab != 0) + { + if (teamInfoDefaultTab == 1) + { + this.m_RankCheckBox.bChecked = true; + } + } + else + { + this.m_TeamCheckBox.bChecked = true; + } + } + } + + public void OnTeamInfoChanged() + { + bool flag = XSingleton.singleton.SceneType == SceneType.SCENE_MOBA; + if (flag) + { + base.SetVisible(false); + } + else + { + bool flag2 = (!XSingleton.singleton.bSpectator && !this._TeamDoc.bInTeam && XSingleton.singleton.SceneType != SceneType.SCENE_PVP && XSingleton.singleton.SceneType != SceneType.SCENE_HEROBATTLE && XSingleton.singleton.SceneType != SceneType.SCENE_PKTWO && XSingleton.singleton.SceneType != SceneType.SCENE_WEEKEND4V4_CRAZYBOMB && XSingleton.singleton.SceneType != SceneType.SCENE_WEEKEND4V4_GHOSTACTION && XSingleton.singleton.SceneType != SceneType.SCENE_WEEKEND4V4_HORSERACING && XSingleton.singleton.SceneType != SceneType.SCENE_WEEKEND4V4_LIVECHALLENGE && XSingleton.singleton.SceneType != SceneType.SCENE_WEEKEND4V4_MONSTERFIGHT && XSingleton.singleton.SceneType != SceneType.SCENE_WEEKEND4V4_DUCK) || !this.m_bShowMonitor || this.m_bTempHide; + if (flag2) + { + base.SetVisible(false); + } + else + { + bool flag3 = (this._TeamDoc.bInTeam || XSingleton.singleton.bSpectator || XSingleton.singleton.SceneType == SceneType.SCENE_PVP || XSingleton.singleton.SceneType == SceneType.SCENE_HEROBATTLE || XSingleton.singleton.SceneType == SceneType.SCENE_PKTWO || XSingleton.singleton.SceneType == SceneType.SCENE_WEEKEND4V4_CRAZYBOMB || XSingleton.singleton.SceneType == SceneType.SCENE_WEEKEND4V4_GHOSTACTION || XSingleton.singleton.SceneType == SceneType.SCENE_WEEKEND4V4_HORSERACING || XSingleton.singleton.SceneType == SceneType.SCENE_WEEKEND4V4_LIVECHALLENGE || XSingleton.singleton.SceneType == SceneType.SCENE_WEEKEND4V4_MONSTERFIGHT || XSingleton.singleton.SceneType == SceneType.SCENE_WEEKEND4V4_DUCK) && !this.active; + if (flag3) + { + base.SetVisible(true); + } + bool bSpectator = XSingleton.singleton.bSpectator; + int num; + if (bSpectator) + { + num = this._teamList.Count; + } + else + { + num = this._teamList.Count - 1; + } + this.m_StateMgr.SetTotalCount(this._teamList); + bool flag4 = this.m_Members.Count < num; + if (flag4) + { + for (int i = this.m_Members.Count; i < num; i++) + { + XTeamMemberMonitor xteamMemberMonitor = new XTeamMemberMonitor(this.m_StateMgr); + GameObject gameObject = this.m_TeamUIPool.FetchGameObject(false); + gameObject.transform.localPosition = new Vector3(this.m_TeamUIPool.TplPos.x, this.m_TeamUIPool.TplPos.y - (float)(this.m_TeamUIPool.TplHeight * i)); + xteamMemberMonitor.SetGo(gameObject); + this.m_Members.Add(xteamMemberMonitor); + } + } + int j = 0; + int num2 = 0; + while (num2 < this._teamList.Count && j < this.m_Members.Count) + { + bool flag5 = this._teamList[num2].uid == XSingleton.singleton.XPlayerData.RoleID; + if (!flag5) + { + this.m_Members[j].SetMemberData(this._teamList[num2]); + this.m_Members[j].SetActive(true); + j++; + } + num2++; + } + while (j < num) + { + this.m_Members[j].SetMemberData(null); + this.m_Members[j].SetActive(true); + j++; + } + while (j < this.m_Members.Count) + { + this.m_Members[j].SetActive(false); + j++; + } + this.HideVoice(); + } + } + } + + public void OnTeamMemberBuffChange(ulong memberID, List buff) + { + for (int i = 0; i < this.m_Members.Count; i++) + { + bool flag = this.m_Members[i].EntityID == memberID; + if (flag) + { + this.m_Members[i].OnBuffChange(buff); + } + } + } + + public void CheckToggleState() + { + for (int i = 0; i < this.m_Members.Count; i++) + { + this.m_Members[i].CheckToggleState(); + } + } + + public void RefreshVoice(ulong[] roleids, int[] states) + { + bool flag = DlgBase.singleton.IsLoaded(); + if (flag) + { + for (int i = 0; i < roleids.Length; i++) + { + this.Play(roleids[i], states[i]); + } + } + } + + public void HideVoice() + { + for (int i = 0; i < this.m_Members.Count; i++) + { + this.m_Members[i].PlaySound(0); + } + } + + private void Play(ulong roleid, int state) + { + for (int i = 0; i < this.m_Members.Count; i++) + { + bool flag = this.m_Members[i].EntityID == roleid; + if (flag) + { + this.m_Members[i].PlaySound(state); + break; + } + } + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorHandler.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorHandler.cs.meta new file mode 100644 index 00000000..255a5a5c --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 76e1a7679dc55ae4c824e5f2c47ec920 +timeCreated: 1611403951 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorState.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorState.cs new file mode 100644 index 00000000..41def556 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorState.cs @@ -0,0 +1,11 @@ +using System; + +namespace XMainClient +{ + internal enum XTeamMonitorState + { + TMS_Normal = 1, + TMS_Loading, + TMS_Left + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorState.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorState.cs.meta new file mode 100644 index 00000000..3ada348a --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorState.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 81a11c489e88b0b40b2948ce7a259b0a +timeCreated: 1611404037 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs new file mode 100644 index 00000000..0778bae2 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamMonitorStateMgr + { + private Dictionary m_EntityStates = new Dictionary(); + + private HashSet m_LoadingEntities = new HashSet(); + + private HashSet m_Entities = new HashSet(); + + public void SetState(ulong uid, XTeamMonitorState state) + { + bool flag = !this.m_Entities.Contains(uid); + if (!flag) + { + this.m_EntityStates[uid] = state; + bool flag2 = state == XTeamMonitorState.TMS_Loading; + if (flag2) + { + this.m_LoadingEntities.Add(uid); + } + else + { + this.m_LoadingEntities.Remove(uid); + } + } + } + + public void SetTotalCount(List list) + { + this.m_Entities.Clear(); + for (int i = 0; i < list.Count; i++) + { + bool flag = list[i].uid != XSingleton.singleton.XPlayerData.RoleID; + if (flag) + { + this.m_Entities.Add(list[i].uid); + } + } + } + + public void Reset() + { + this.m_EntityStates.Clear(); + this.m_LoadingEntities.Clear(); + this.m_Entities.Clear(); + } + + public XTeamMonitorState GetState(ulong uid) + { + XTeamMonitorState xteamMonitorState; + bool flag = this.m_EntityStates.TryGetValue(uid, out xteamMonitorState); + XTeamMonitorState result; + if (flag) + { + result = xteamMonitorState; + } + else + { + result = XTeamMonitorState.TMS_Loading; + } + return result; + } + + public bool HasLoadingEntity() + { + return this.m_LoadingEntities.Count > 0 || this.m_EntityStates.Count < this.m_Entities.Count; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs.meta new file mode 100644 index 00000000..8a6588a9 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamMonitorStateMgr.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 74c107ee0242a1a44b7b34484e1d1757 +timeCreated: 1611403944 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamPartnerBonusHandler.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamPartnerBonusHandler.cs new file mode 100644 index 00000000..06ae58c8 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamPartnerBonusHandler.cs @@ -0,0 +1,289 @@ +using System; +using System.Collections.Generic; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamPartnerBonusHandler : DlgHandlerBase + { + private GameObject m_CurrentBuff; + + private GameObject m_DisableBuff; + + private IXUILabel[] m_Levels; + + private List m_QualityLevels; + + private IXUILabel m_DisableLevel; + + private GameObject m_Active; + + private GameObject m_Disactive; + + private GameObject m_PopActive; + + private GameObject m_PopDisactive; + + private IXUISprite m_BtnOpenPop; + + private GameObject m_PopPanel; + + private IXUISprite m_PopClose; + + private GameObject m_PopEmpty; + + private GameObject m_PopCurrentBuff; + + private GameObject m_PopNextBuff; + + private GameObject m_PopFinalBuff; + + private XTeamDocument _TeamDoc; + + private XDragonGuildDocument _Doc; + + private DragonGuildTable.RowData m_CurrentBuffData; + + private DragonGuildTable.RowData m_NextBuffData; + + private bool m_bFullLevel; + + private bool m_bActive; + + public bool bConsiderTeam = false; + + protected override void Init() + { + base.Init(); + this.m_Active = base.PanelObject.transform.Find("Active").gameObject; + this.m_Disactive = base.PanelObject.transform.Find("Disactive").gameObject; + this.m_CurrentBuff = this.m_Active.transform.Find("Buff").gameObject; + this.m_DisableBuff = this.m_Disactive.transform.Find("Buff").gameObject; + this.m_BtnOpenPop = (base.PanelObject.transform.Find("BtnOpenPop").GetComponent("XUISprite") as IXUISprite); + this.m_PopPanel = base.PanelObject.transform.Find("FriendBonusPop").gameObject; + this.m_PopClose = (this.m_PopPanel.transform.Find("Close").GetComponent("XUISprite") as IXUISprite); + this.m_PopActive = this.m_PopPanel.transform.Find("Active").gameObject; + this.m_PopDisactive = this.m_PopPanel.transform.Find("Disactive").gameObject; + this.m_PopEmpty = this.m_PopDisactive.transform.Find("Empty").gameObject; + IXUILabel ixuilabel = this.m_PopEmpty.transform.Find("Slogan").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(XSingleton.singleton.ReplaceReturn(XStringDefineProxy.GetString("TeamBonusNoPartner"))); + IXUIButton ixuibutton = this.m_PopEmpty.transform.Find("BtnPartner").GetComponent("XUIButton") as IXUIButton; + ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnGotoPartnerClicked)); + this.m_PopCurrentBuff = this.m_PopActive.transform.Find("CurrentBuff").gameObject; + this.m_PopNextBuff = this.m_PopActive.transform.Find("NextBuff").gameObject; + this.m_PopFinalBuff = this.m_PopActive.transform.Find("FinalBuff").gameObject; + this.m_QualityLevels = XSingleton.singleton.GetIntList("TeamFriendDegreeBuffQuality"); + this.m_Levels = new IXUILabel[this.m_QualityLevels.Count]; + for (int i = 0; i < this.m_Levels.Length; i++) + { + this.m_Levels[i] = (this.m_Active.transform.Find(XSingleton.singleton.StringCombine("Level", i.ToString())).GetComponent("XUILabel") as IXUILabel); + } + this.m_DisableLevel = (this.m_Disactive.transform.Find("Level0").GetComponent("XUILabel") as IXUILabel); + this._TeamDoc = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + this._Doc = XDragonGuildDocument.Doc; + this.m_PopPanel.SetActive(false); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this.m_PopClose.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnPopCloseClicked)); + this.m_BtnOpenPop.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnPopOpenClicked)); + } + + private void _OnPopCloseClicked(IXUISprite iSp) + { + this.m_PopPanel.SetActive(false); + } + + private void _OnPopOpenClicked(IXUISprite iSp) + { + bool flag = this.IsHadDragonGuildMemberInTeam(); + if (!flag) + { + bool flag2 = !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_GuildCollectSummon); + if (flag2) + { + OpenSystemTable.RowData sysData = XSingleton.singleton.GetSysData(XFastEnumIntEqualityComparer.ToInt(XSysDefine.XSys_GuildCollectSummon)); + bool flag3 = sysData != null; + if (flag3) + { + XSingleton.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("LEVEL_REQUIRE_LEVEL"), sysData.PlayerLevel), "fece00"); + } + } + else + { + this.m_PopPanel.SetActive(true); + this.RefreshPop(); + } + } + } + + public void RefreshCurrent() + { + this.m_CurrentBuffData = null; + bool bActive = this.IsHadDragonGuildMemberInTeam(); + uint level = this._Doc.BaseData.level; + DragonGuildTable.RowData bylevel = XDragonGuildDocument.DragonGuildBuffTable.GetBylevel(level); + bool flag = bylevel != null; + if (flag) + { + this.m_CurrentBuffData = bylevel; + this.m_bFullLevel = ((ulong)level == (ulong)((long)XDragonGuildDocument.DragonGuildBuffTable.Table.Length)); + } + this.m_bActive = bActive; + this.m_NextBuffData = bylevel; + bool flag2 = this.m_CurrentBuffData == null; + if (flag2) + { + this.m_CurrentBuffData = this.m_NextBuffData; + } + this.m_Active.SetActive(this.m_bActive); + this.m_Disactive.SetActive(!this.m_bActive); + bool flag3 = this.m_CurrentBuffData != null; + if (flag3) + { + bool bActive2 = this.m_bActive; + if (bActive2) + { + int num = 0; + for (int i = this.m_QualityLevels.Count - 1; i >= 0; i--) + { + bool flag4 = (ulong)this.m_CurrentBuffData.level >= (ulong)((long)this.m_QualityLevels[i]); + if (flag4) + { + num = i; + break; + } + } + for (int j = 0; j < this.m_Levels.Length; j++) + { + this.m_Levels[j].SetVisible(j == num); + } + this.m_Levels[num].SetText(this.m_CurrentBuffData.level.ToString()); + this._RefreshBuff(this.m_CurrentBuff, this.m_CurrentBuffData); + } + else + { + this.m_DisableLevel.SetText(this.m_CurrentBuffData.level.ToString()); + this._RefreshBuff(this.m_DisableBuff, this.m_CurrentBuffData); + } + } + else + { + bool flag5 = this.m_NextBuffData != null; + if (flag5) + { + this.m_DisableLevel.SetText(this.m_NextBuffData.level.ToString()); + this._RefreshBuff(this.m_DisableBuff, this.m_NextBuffData); + } + } + } + + private bool IsHadDragonGuildMemberInTeam() + { + bool result = false; + bool flag = this.bConsiderTeam; + if (flag) + { + bool flag2 = this._TeamDoc.bInTeam && this._Doc.IsInDragonGuild(); + if (flag2) + { + for (int i = 0; i < this._TeamDoc.MyTeam.members.Count; i++) + { + XTeamMember xteamMember = this._TeamDoc.MyTeam.members[i]; + bool flag3 = xteamMember == this._TeamDoc.MyTeam.myData; + if (!flag3) + { + bool flag4 = this._Doc.IsMyDragonGuildMember(xteamMember.dragonGuildID); + if (flag4) + { + result = true; + break; + } + } + } + } + } + else + { + result = true; + } + return result; + } + + public void RefreshPop() + { + bool flag = !this.m_PopPanel.activeSelf; + if (!flag) + { + this.m_PopActive.SetActive(this.m_bActive); + this.m_PopDisactive.SetActive(!this.m_bActive); + bool flag2 = !this.m_bActive; + if (!flag2) + { + bool bFullLevel = this.m_bFullLevel; + if (bFullLevel) + { + this.m_PopFinalBuff.SetActive(true); + this.m_PopCurrentBuff.SetActive(false); + this.m_PopNextBuff.SetActive(false); + this._RefreshDetailInfo(this.m_PopFinalBuff, this.m_CurrentBuffData); + } + else + { + this.m_PopFinalBuff.SetActive(false); + this.m_PopCurrentBuff.SetActive(true); + this.m_PopNextBuff.SetActive(true); + this._RefreshDetailInfo(this.m_PopCurrentBuff, this.m_CurrentBuffData); + this._RefreshDetailInfo(this.m_PopNextBuff, this.m_NextBuffData); + } + } + } + } + + public override void RefreshData() + { + base.RefreshData(); + this.RefreshCurrent(); + this.RefreshPop(); + } + + private void _RefreshDetailInfo(GameObject go, DragonGuildTable.RowData rowData) + { + IXUILabel ixuilabel = go.transform.Find("Level").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel2 = go.transform.Find("Value").GetComponent("XUILabel") as IXUILabel; + GameObject gameObject = go.transform.Find("Buff").gameObject; + ixuilabel.SetText(rowData.level.ToString()); + this._RefreshBuff(gameObject, rowData); + } + + private void _RefreshBuff(GameObject go, DragonGuildTable.RowData rowData) + { + IXUILabel ixuilabel = go.GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel2 = go.transform.Find("Value").GetComponent("XUILabel") as IXUILabel; + BuffTable.RowData buffData = XSingleton.singleton.GetBuffData(rowData.buf[0], rowData.buf[1]); + bool flag = buffData == null; + if (flag) + { + ixuilabel.SetText(string.Empty); + ixuilabel2.SetText(string.Empty); + } + else + { + ixuilabel.SetText(buffData.BuffName); + ixuilabel2.SetText(string.Empty); + } + } + + private bool _OnGotoPartnerClicked(IXUIButton btn) + { + DlgBase.singleton.ShowTab(XSysDefine.XSys_GuildCollectSummon); + return true; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamPartnerBonusHandler.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamPartnerBonusHandler.cs.meta new file mode 100644 index 00000000..25719b7d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamPartnerBonusHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dbe17952164919740885952a8c1f2c33 +timeCreated: 1611404676 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamPasswordHandler.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamPasswordHandler.cs new file mode 100644 index 00000000..ffe9689d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamPasswordHandler.cs @@ -0,0 +1,133 @@ +using System; +using KKSG; +using UILib; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamPasswordHandler : DlgHandlerBase + { + public IXUICheckBox m_BtnNeedPwd; + + public IXUIInput m_IptPwd; + + public IXUITweenTool m_PwdTween; + + private XTeamDocument doc; + + private XOptionsDocument optionsDoc; + + protected override void Init() + { + base.Init(); + this.m_BtnNeedPwd = (base.PanelObject.transform.Find("BtnNeedPwd").GetComponent("XUICheckBox") as IXUICheckBox); + this.m_IptPwd = (base.PanelObject.transform.Find("Input").GetComponent("XUIInput") as IXUIInput); + this.m_PwdTween = (base.PanelObject.transform.Find("BtnNeedPwd").GetComponent("XUIPlayTween") as IXUITweenTool); + this.doc = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + this.optionsDoc = XDocuments.GetSpecificDocument(XOptionsDocument.uuID); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this.m_BtnNeedPwd.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this._OnUsePasswordChanged)); + } + + protected override void OnShow() + { + base.OnShow(); + this.RefreshData(); + } + + public void RefreshState() + { + bool bIsLeader = this.doc.bIsLeader; + if (bIsLeader) + { + bool flag = base.IsVisible(); + if (flag) + { + this.RefreshData(); + } + else + { + base.SetVisible(true); + } + } + else + { + base.SetVisible(false); + } + } + + public override void RefreshData() + { + base.RefreshData(); + bool flag = !this.doc.bInTeam; + if (flag) + { + this.m_BtnNeedPwd.bChecked = false; + this.m_PwdTween.ResetTweenByCurGroup(false); + this.m_IptPwd.SetText(this.optionsDoc.GetStrValue(XOptionsDefine.OD_TEAM_PASSWORD)); + } + else + { + bool flag2 = string.IsNullOrEmpty(this.doc.password); + if (flag2) + { + base.SetVisible(false); + } + bool hasPwd = this.doc.MyTeam.teamBrief.hasPwd; + this.m_BtnNeedPwd.bChecked = hasPwd; + this.m_PwdTween.ResetTweenByCurGroup(hasPwd); + this.m_IptPwd.SetText(this.doc.MyTeam.teamBrief.password); + } + } + + public string GetPassword() + { + return this.m_BtnNeedPwd.bChecked ? this.m_IptPwd.GetText() : string.Empty; + } + + public string GetInputPassword() + { + return this.m_IptPwd.GetText(); + } + + private bool _OnUsePasswordChanged(IXUICheckBox ckb) + { + this.m_PwdTween.PlayTween(!ckb.bChecked, -1f); + bool bIsLeader = this.doc.bIsLeader; + if (bIsLeader) + { + bool bChecked = ckb.bChecked; + if (bChecked) + { + bool flag = !this.doc.MyTeam.teamBrief.hasPwd; + if (flag) + { + this.doc.ReqTeamOp(TeamOperate.TEAM_CHANGE_PASSWORD, 0UL, this.doc.password, TeamMemberType.TMT_NORMAL, null); + } + } + else + { + bool hasPwd = this.doc.MyTeam.teamBrief.hasPwd; + if (hasPwd) + { + this.doc.ReqTeamOp(TeamOperate.TEAM_CHANGE_PASSWORD, 0UL, string.Empty, TeamMemberType.TMT_NORMAL, null); + } + } + } + return true; + } + + private void _OnInputSubmit(IXUIInput input) + { + bool bIsLeader = this.doc.bIsLeader; + if (bIsLeader) + { + XSingleton.singleton.AddGreenLog("Change password to ", input.GetText(), null, null, null, null); + } + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamPasswordHandler.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamPasswordHandler.cs.meta new file mode 100644 index 00000000..e2c23087 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamPasswordHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2e44955c0c9b92d43af2a3f1cc306296 +timeCreated: 1611403509 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamPosition.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamPosition.cs new file mode 100644 index 00000000..c0f63601 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamPosition.cs @@ -0,0 +1,10 @@ +using System; + +namespace XMainClient +{ + internal enum XTeamPosition + { + TP_LEADER, + TP_MEMBER + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamPosition.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamPosition.cs.meta new file mode 100644 index 00000000..31019780 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamPosition.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d567c5befa4850d46ad51f93123da2f5 +timeCreated: 1611404627 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamRelation.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamRelation.cs new file mode 100644 index 00000000..807c5838 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamRelation.cs @@ -0,0 +1,170 @@ +using System; +using XMainClient.UI.UICommon; + +namespace XMainClient +{ + internal class XTeamRelation : IComparable + { + public bool bIsFriend + { + get + { + return this.HasRelation(XTeamRelation.Relation.TR_FRIEND); + } + } + + public bool bIsGuild + { + get + { + return this.HasRelation(XTeamRelation.Relation.TR_GUILD); + } + } + + public XTeamRelation.Relation ActualRelation + { + get + { + return this.m_Relation; + } + } + + public XTeamRelation.Relation FinalRelation + { + get + { + return this.m_FinalRelation; + } + } + + public XTeamRelation.Relation FinalRelation2 + { + get + { + return this.m_FinalRelation2; + } + } + + private XTeamRelation.Relation m_Relation = XTeamRelation.Relation.TR_NONE; + + private XTeamRelation.Relation m_FinalRelation = XTeamRelation.Relation.TR_NONE; + + private XTeamRelation.Relation m_FinalRelation2 = XTeamRelation.Relation.TR_NONE; + + public enum Relation + { + TR_NONE, + TR_FRIEND, + TR_GUILD, + TR_PARTNER = 4 + } + + public void Reset() + { + this.m_Relation = XTeamRelation.Relation.TR_NONE; + this.m_FinalRelation = XTeamRelation.Relation.TR_NONE; + this.m_FinalRelation2 = XTeamRelation.Relation.TR_NONE; + } + + public void DirectSet(XTeamRelation.Relation relation) + { + this.m_Relation = relation; + this.RefreshFinalRelation(); + } + + public void Append(XTeamRelation.Relation relation, bool bRefreshFinalImm = true) + { + this.m_Relation |= relation; + if (bRefreshFinalImm) + { + this.RefreshFinalRelation(); + } + } + + public void UpdateRelation(ulong roleUID, ulong guildUID, ulong roledragonguildid) + { + this.Reset(); + XGuildDocument specificDocument = XDocuments.GetSpecificDocument(XGuildDocument.uuID); + XPartnerDocument specificDocument2 = XDocuments.GetSpecificDocument(XPartnerDocument.uuID); + bool flag = specificDocument.bInGuild && guildUID == specificDocument.UID; + if (flag) + { + this.Append(XTeamRelation.Relation.TR_GUILD, false); + } + bool flag2 = DlgBase.singleton.IsMyFriend(roleUID); + if (flag2) + { + this.Append(XTeamRelation.Relation.TR_FRIEND, false); + } + bool flag3 = XDragonGuildDocument.Doc.IsMyDragonGuildMember(roledragonguildid); + if (flag3) + { + this.Append(XTeamRelation.Relation.TR_PARTNER, false); + } + this.RefreshFinalRelation(); + } + + public void RefreshFinalRelation() + { + bool flag = XTeamRelation.HasRelation(this.m_Relation, XTeamRelation.Relation.TR_PARTNER); + if (flag) + { + this.m_FinalRelation = XTeamRelation.Relation.TR_PARTNER; + } + else + { + bool flag2 = XTeamRelation.HasRelation(this.m_Relation, XTeamRelation.Relation.TR_GUILD); + if (flag2) + { + this.m_FinalRelation = XTeamRelation.Relation.TR_GUILD; + } + else + { + bool flag3 = XTeamRelation.HasRelation(this.m_Relation, XTeamRelation.Relation.TR_FRIEND); + if (flag3) + { + this.m_FinalRelation = XTeamRelation.Relation.TR_FRIEND; + } + else + { + this.m_FinalRelation = XTeamRelation.Relation.TR_NONE; + } + } + } + this.m_FinalRelation2 = XTeamRelation.Relation.TR_NONE; + bool flag4 = XTeamRelation.HasRelation(this.m_Relation, XTeamRelation.Relation.TR_GUILD); + if (flag4) + { + this.m_FinalRelation2 = XTeamRelation.Relation.TR_GUILD; + } + bool flag5 = XTeamRelation.HasRelation(this.m_Relation, XTeamRelation.Relation.TR_PARTNER); + if (flag5) + { + this.m_FinalRelation2 |= XTeamRelation.Relation.TR_PARTNER; + } + else + { + bool flag6 = XTeamRelation.HasRelation(this.m_Relation, XTeamRelation.Relation.TR_FRIEND); + if (flag6) + { + this.m_FinalRelation2 |= XTeamRelation.Relation.TR_FRIEND; + } + } + } + + public static bool HasRelation(XTeamRelation.Relation relation0, XTeamRelation.Relation relation1) + { + return (relation0 & relation1) > XTeamRelation.Relation.TR_NONE; + } + + public bool HasRelation(XTeamRelation.Relation relation) + { + return XTeamRelation.HasRelation(this.m_Relation, relation); + } + + public int CompareTo(XTeamRelation other) + { + return -this.m_FinalRelation.CompareTo(other.m_FinalRelation); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamRelation.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamRelation.cs.meta new file mode 100644 index 00000000..44c166ef --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamRelation.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 845dd9ffb1d1a3542832740d1ecf54b6 +timeCreated: 1611404048 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamRift.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamRift.cs new file mode 100644 index 00000000..58c148f6 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamRift.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UILib; +using UnityEngine; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamRift : XDataBase + { + public uint id; + + public int floor; + + public uint sceneID; + + public List buffs = new List(); + + public void SetData(TeamSynRift riftInfo, ExpeditionTable.RowData rowData) + { + bool flag = riftInfo == null; + if (!flag) + { + bool flag2 = riftInfo.floorinfo == null; + if (flag2) + { + XSingleton.singleton.AddErrorLog("floorinfo is null, while riftid == ", riftInfo.riftid.ToString(), null, null, null, null); + } + else + { + this.id = riftInfo.riftid; + this.floor = riftInfo.floorinfo.floor; + this.sceneID = riftInfo.floorinfo.sceneid; + this.buffs.Clear(); + for (int i = 0; i < riftInfo.floorinfo.buffs.Count; i++) + { + MapIntItem mapIntItem = riftInfo.floorinfo.buffs[i]; + BuffDesc item = default(BuffDesc); + item.BuffID = (int)mapIntItem.key; + item.BuffLevel = (int)mapIntItem.value; + this.buffs.Add(item); + } + } + } + } + + public override void Recycle() + { + base.Recycle(); + this.id = 0u; + this.floor = 0; + this.sceneID = 0u; + this.buffs.Clear(); + } + + public void SetUI(GameObject go) + { + IXUILabel ixuilabel = go.transform.Find("Floor").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(XStringDefineProxy.GetString("TEAMTOWER_LEVEL", new object[] + { + this.floor.ToString() + })); + } + + public string GetSceneName(string originName) + { + return XStringDefineProxy.GetString("SCENE_NAME_WITH_RIFT_FLOOR", new object[] + { + originName, + this.floor.ToString() + }); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamRift.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamRift.cs.meta new file mode 100644 index 00000000..a85ed376 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamRift.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 755c260231be708458fb961b8ef3e4db +timeCreated: 1611403946 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamSettingHandler.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamSettingHandler.cs new file mode 100644 index 00000000..4f5b594b --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamSettingHandler.cs @@ -0,0 +1,331 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamSettingHandler : DlgHandlerBase + { + protected override string FileName + { + get + { + return "Team/TeamSetting"; + } + } + + private IXUISprite m_Close; + + private IXUIButton m_BtnOK; + + private List m_RewardList = new List(); + + private IXUICheckBox m_OpenReward; + + private IXUICheckBox m_OpenPPT; + + private IXUISprite m_AddPPT; + + private IXUISprite m_SubPPT; + + private IXUILabel m_PPT; + + private GameObject m_DisableReward; + + private XTeamDocument doc; + + private int m_RewardCount; + + private uint m_CurPPT; + + private uint m_MinPPT; + + private uint m_StepPPT; + + protected override void Init() + { + base.Init(); + this.m_Close = (base.PanelObject.transform.Find("Close").GetComponent("XUISprite") as IXUISprite); + this.m_BtnOK = (base.PanelObject.transform.Find("BtnOK").GetComponent("XUIButton") as IXUIButton); + int num = 1; + for (;;) + { + Transform transform = base.PanelObject.transform.Find(XSingleton.singleton.StringCombine("TeamReward/BtnLevel", num.ToString())); + bool flag = transform == null; + if (flag) + { + break; + } + IXUICheckBox ixuicheckBox = transform.GetComponent("XUICheckBox") as IXUICheckBox; + ixuicheckBox.ID = (ulong)((long)(num - 1)); + this.m_RewardList.Add(ixuicheckBox); + num++; + } + this.m_OpenReward = (base.PanelObject.transform.Find("TeamReward/BtnOpen").GetComponent("XUICheckBox") as IXUICheckBox); + this.m_OpenPPT = (base.PanelObject.transform.Find("PPTSetting/BtnOpen").GetComponent("XUICheckBox") as IXUICheckBox); + this.m_DisableReward = base.PanelObject.transform.Find("TeamRewardDisable").gameObject; + this.m_AddPPT = (base.PanelObject.transform.Find("PPTSetting/Count/Add").GetComponent("XUISprite") as IXUISprite); + this.m_SubPPT = (base.PanelObject.transform.Find("PPTSetting/Count/Sub").GetComponent("XUISprite") as IXUISprite); + this.m_PPT = (base.PanelObject.transform.Find("PPTSetting/Count/Label").GetComponent("XUILabel") as IXUILabel); + this.m_StepPPT = (uint)XSingleton.singleton.GetInt("TeamSettingPPTStep"); + this.doc = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this.m_Close.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnCloseClicked)); + this.m_BtnOK.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnOKClicked)); + this.m_OpenPPT.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this._OnOpenPPTChanged)); + this.m_OpenReward.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this._OnOpenRewardChanged)); + for (int i = 0; i < this.m_RewardList.Count; i++) + { + this.m_RewardList[i].RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this._OnRewardChanged)); + } + this.m_AddPPT.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnAddPPTClicked)); + this.m_SubPPT.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnSubPPTClicked)); + } + + protected override void OnShow() + { + base.OnShow(); + this.RefreshData(); + } + + public override void RefreshData() + { + base.RefreshData(); + bool flag = !this.doc.bInTeam || this.doc.currentExpInfo == null; + if (flag) + { + base.SetVisible(false); + } + else + { + for (int i = 0; i < this.m_RewardList.Count; i++) + { + this.m_RewardList[i].ForceSetFlag(false); + } + bool flag2 = this.doc.currentExpInfo.CostType.Count == 0; + if (flag2) + { + this.m_OpenReward.ForceSetFlag(false); + this.m_DisableReward.SetActive(true); + this.m_RewardCount = 0; + } + else + { + this.m_DisableReward.SetActive(false); + this.m_OpenReward.ForceSetFlag(this.doc.MyTeam.teamBrief.goldGroup.bActive); + this.m_RewardCount = Math.Min(this.doc.currentExpInfo.CostType.Count, this.m_RewardList.Count); + int i; + for (i = 0; i < this.m_RewardCount; i++) + { + this.m_RewardList[i].gameObject.SetActive(true); + IXUILabel ixuilabel = this.m_RewardList[i].gameObject.transform.Find("Level").GetComponent("XUILabel") as IXUILabel; + IXUISprite ixuisprite = this.m_RewardList[i].gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite; + ItemList.RowData itemConf = XBagDocument.GetItemConf((int)this.doc.currentExpInfo.CostType[i, 1]); + bool flag3 = this.doc.currentExpInfo.CostType[i, 0] == 2u; + string text; + if (flag3) + { + text = ((itemConf == null) ? string.Empty : XSingleton.singleton.ChooseProfString(itemConf.ItemName, 0u)); + } + else + { + text = this.doc.currentExpInfo.CostType[i, 2].ToString(); + } + ixuilabel.SetText(text); + ixuisprite.SetSprite((itemConf == null) ? string.Empty : XSingleton.singleton.ChooseProfString(itemConf.ItemIcon1, 0u)); + ixuisprite.MakePixelPerfect(); + bool flag4 = this.doc.MyTeam.teamBrief.goldGroup.bActive && i == this.doc.MyTeam.teamBrief.goldGroup.index; + if (flag4) + { + this.m_RewardList[i].bChecked = true; + } + } + while (i < this.m_RewardList.Count) + { + this.m_RewardList[i].gameObject.SetActive(false); + i++; + } + } + this.m_MinPPT = this.doc.currentExpInfo.DisplayPPT; + this.m_CurPPT = this.doc.MyTeam.teamBrief.teamPPT; + this.m_OpenPPT.bChecked = (this.doc.MyTeam.teamBrief.teamPPT > 0u); + } + } + + private void _OnCloseClicked(IXUISprite iSp) + { + base.SetVisible(false); + } + + private bool _OnOKClicked(IXUIButton btn) + { + bool flag = !this.doc.bInTeam; + bool result; + if (flag) + { + result = true; + } + else + { + int num = -1; + bool bChecked = this.m_OpenReward.bChecked; + if (bChecked) + { + for (int i = 0; i < this.m_RewardCount; i++) + { + bool bChecked2 = this.m_RewardList[i].bChecked; + if (bChecked2) + { + num = i; + break; + } + } + } + bool flag2 = num >= 0 && num < this.doc.currentExpInfo.CostType.Count; + if (flag2) + { + bool flag3 = this.doc.MyTeam.teamBrief.goldGroup.index != num; + if (flag3) + { + string key = XSingleton.singleton.StringCombine("TeamGoldGroup", this.doc.currentExpInfo.CostType[num, 0].ToString(), "SettingConfirm"); + ItemList.RowData itemConf = XBagDocument.GetItemConf((int)this.doc.currentExpInfo.CostType[num, 1]); + bool flag4 = itemConf == null; + if (flag4) + { + return true; + } + XSingleton.singleton.ShowModalDialog(XStringDefineProxy.GetString(key, new object[] + { + XGoldGroupData.GetName(ref this.doc.currentExpInfo.CostType, num), + XSingleton.singleton.ChooseProfString(itemConf.ItemName, 0u), + this.doc.currentExpInfo.CostType[num, 2].ToString() + }), XStringDefineProxy.GetString(XStringDefine.COMMON_OK), XStringDefineProxy.GetString(XStringDefine.COMMON_CANCEL), new ButtonClickEventHandler(this._DoOK)); + return true; + } + } + this._DoOK(btn); + result = true; + } + return result; + } + + private bool _DoOK(IXUIButton btn) + { + TeamExtraInfo teamExtraInfo = new TeamExtraInfo(); + bool bChecked = this.m_OpenReward.bChecked; + if (bChecked) + { + for (int i = 0; i < this.m_RewardCount; i++) + { + bool bChecked2 = this.m_RewardList[i].bChecked; + if (bChecked2) + { + teamExtraInfo.costindex = (uint)i; + break; + } + } + } + else + { + teamExtraInfo.costindex = uint.MaxValue; + } + bool bChecked3 = this.m_OpenPPT.bChecked; + if (bChecked3) + { + teamExtraInfo.pptlimit = this.m_CurPPT; + } + else + { + teamExtraInfo.pptlimit = 0u; + } + this.doc.ReqTeamOp(TeamOperate.TEAM_PPTLIMIT, 0UL, teamExtraInfo, TeamMemberType.TMT_NORMAL, null); + bool flag = this.doc.bInTeam && this.doc.MyTeam.teamBrief.goldGroup.index != (int)teamExtraInfo.costindex; + if (flag) + { + this.doc.ReqTeamOp(TeamOperate.TEAM_COSTTYPE, 0UL, teamExtraInfo, TeamMemberType.TMT_NORMAL, null); + } + base.SetVisible(false); + XSingleton.singleton.CloseModalDlg(); + return true; + } + + private bool _OnOpenRewardChanged(IXUICheckBox ckb) + { + bool bChecked = ckb.bChecked; + if (bChecked) + { + bool flag = this.m_RewardCount > 0; + if (flag) + { + this.m_RewardList[0].bChecked = true; + } + } + else + { + for (int i = 0; i < this.m_RewardCount; i++) + { + this.m_RewardList[i].bChecked = false; + } + } + return true; + } + + private bool _OnOpenPPTChanged(IXUICheckBox ckb) + { + bool flag = ckb.bChecked && this.m_CurPPT < this.m_MinPPT; + if (flag) + { + this.m_CurPPT = this.m_MinPPT; + } + this._RefreshPPT(); + return true; + } + + private bool _OnRewardChanged(IXUICheckBox ckb) + { + this.m_OpenReward.bChecked = ckb.bChecked; + return true; + } + + private void _OnAddPPTClicked(IXUISprite iSp) + { + bool flag = !this.m_OpenPPT.bChecked; + if (!flag) + { + bool flag2 = this.m_CurPPT >= uint.MaxValue - this.m_StepPPT; + if (!flag2) + { + this.m_CurPPT += this.m_StepPPT; + this._RefreshPPT(); + } + } + } + + private void _OnSubPPTClicked(IXUISprite iSp) + { + bool flag = !this.m_OpenPPT.bChecked; + if (!flag) + { + bool flag2 = this.m_CurPPT <= this.m_MinPPT; + if (!flag2) + { + this.m_CurPPT -= this.m_StepPPT; + this._RefreshPPT(); + } + } + } + + private void _RefreshPPT() + { + this.m_PPT.SetText(this.m_OpenPPT.bChecked ? this.m_CurPPT.ToString() : "0"); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamSettingHandler.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamSettingHandler.cs.meta new file mode 100644 index 00000000..8da0b0db --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamSettingHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6893011d7c474cc48b8d3c164b7c7269 +timeCreated: 1611403882 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamSmallChatHandler.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamSmallChatHandler.cs new file mode 100644 index 00000000..dc3a67aa --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamSmallChatHandler.cs @@ -0,0 +1,202 @@ +using System; +using System.Collections.Generic; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XTeamSmallChatHandler : DlgHandlerBase + { + private ChatChannelType CurrentChannel + { + get + { + return this.teamDoc.bInTeam ? ChatChannelType.Team : ChatChannelType.World; + } + } + + private static int MSG_DISPLAY_COUNT = 3; + + private XUIPool m_TextPool = new XUIPool(XSingleton.singleton.m_uiTool); + + private XUIPool m_AudioPool = new XUIPool(XSingleton.singleton.m_uiTool); + + private IXUIButton m_BtnVoice; + + private GameObject m_SpeakInfo; + + private List m_ChatList = new List(); + + private XChatDocument chatDoc; + + private XTeamDocument teamDoc; + + private Vector2 m_DragDistance = Vector2.zero; + + private bool m_CancelRecord = false; + + protected override void Init() + { + base.Init(); + this.chatDoc = XDocuments.GetSpecificDocument(XChatDocument.uuID); + this.teamDoc = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + this.m_BtnVoice = (base.PanelObject.transform.Find("BtnVoice").GetComponent("XUIButton") as IXUIButton); + this.m_SpeakInfo = base.PanelObject.transform.Find("SpeakPanel/SpeakInfo").gameObject; + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this.m_BtnVoice.RegisterPressEventHandler(new ButtonPressEventHandler(this._OnVoiceBtn)); + this.m_BtnVoice.RegisterDragEventHandler(new ButtonDragEventHandler(this._OnVoiceButtonDrag)); + } + + public override void OnUnload() + { + base.OnUnload(); + } + + protected override void OnShow() + { + base.OnShow(); + this.m_SpeakInfo.SetActive(false); + } + + private void _OnVoiceButtonDrag(IXUIButton sp, Vector2 delta) + { + this.m_DragDistance += delta; + bool flag = this.m_DragDistance.magnitude >= 100f; + if (flag) + { + this.m_CancelRecord = true; + } + else + { + this.m_CancelRecord = false; + } + } + + private void _OnVoiceBtn(IXUIButton btn, bool state) + { + if (state) + { + this.m_DragDistance = Vector2.zero; + bool useApollo = XChatDocument.UseApollo; + if (useApollo) + { + XSingleton.singleton.StartRecord(VoiceUsage.CHAT, null); + } + else + { + XSingleton.singleton.StartRecord(VoiceUsage.CHAT, null); + } + } + else + { + DlgBase.singleton.SetActiveChannel(ChatChannelType.Team); + bool useApollo2 = XChatDocument.UseApollo; + if (useApollo2) + { + XSingleton.singleton.StopRecord(this.m_CancelRecord); + } + else + { + XSingleton.singleton.StopRecord(this.m_CancelRecord); + } + } + } + + private void _OnChatBgClicked(IXUISprite iSp) + { + DlgBase.singleton.ShowChannel(this.CurrentChannel); + } + + public void RefreshPage() + { + List chatInfoList = this.chatDoc.GetChatInfoList(this.CurrentChannel); + int num = (chatInfoList != null) ? Math.Min(chatInfoList.Count, XTeamSmallChatHandler.MSG_DISPLAY_COUNT) : 0; + int num2 = Math.Max(0, num - XTeamSmallChatHandler.MSG_DISPLAY_COUNT); + this.m_ChatList.Clear(); + this.m_TextPool.FakeReturnAll(); + this.m_AudioPool.FakeReturnAll(); + for (int i = num2; i < num; i++) + { + this._SetChatInfo(chatInfoList[i]); + } + this.m_TextPool.ActualReturnAll(false); + this.m_AudioPool.ActualReturnAll(false); + this._SetAllChatInfoPosition(); + } + + public void OnGetChatInfo(ChatInfo newInfo) + { + bool flag = newInfo.mChannelId != this.CurrentChannel; + if (!flag) + { + this._SetChatInfo(newInfo); + this._SetAllChatInfoPosition(); + } + } + + private void _SetChatInfo(ChatInfo info) + { + XSmallChatInfo xsmallChatInfo = this._CreateSmallChatInfo(); + xsmallChatInfo.info = info; + xsmallChatInfo.uiobject = (info.isAudioChat ? this.m_AudioPool.FetchGameObject(false) : this.m_TextPool.FetchGameObject(false)); + this._SetChatUI(xsmallChatInfo.info, xsmallChatInfo.uiobject); + this.m_ChatList.Add(xsmallChatInfo); + } + + private void _SetAllChatInfoPosition() + { + int num = 0; + for (int i = 0; i < this.m_ChatList.Count; i++) + { + GameObject uiobject = this.m_ChatList[i].uiobject; + IXUILabel ixuilabel = uiobject.transform.Find("content").GetComponent("XUILabel") as IXUILabel; + uiobject.transform.localPosition = new Vector3(0f, (float)(-(float)num)); + num += (int)ixuilabel.GetPrintSize().y; + } + } + + private XSmallChatInfo _CreateSmallChatInfo() + { + bool flag = this.m_ChatList.Count == XTeamSmallChatHandler.MSG_DISPLAY_COUNT; + XSmallChatInfo xsmallChatInfo; + if (flag) + { + xsmallChatInfo = this.m_ChatList[0]; + for (int i = 0; i < this.m_ChatList.Count - 1; i++) + { + this.m_ChatList[i] = this.m_ChatList[i + 1]; + } + this.m_ChatList.RemoveAt(this.m_ChatList.Count - 1); + } + else + { + xsmallChatInfo = new XSmallChatInfo(); + } + bool flag2 = xsmallChatInfo.info != null && xsmallChatInfo.uiobject != null; + if (flag2) + { + bool isAudioChat = xsmallChatInfo.info.isAudioChat; + if (isAudioChat) + { + this.m_AudioPool.ReturnInstance(xsmallChatInfo.uiobject, false); + } + else + { + this.m_TextPool.ReturnInstance(xsmallChatInfo.uiobject, false); + } + } + return xsmallChatInfo; + } + + private void _SetChatUI(ChatInfo info, GameObject go) + { + XChatSmallView.InitMiniChatUI(info, go); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamSmallChatHandler.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamSmallChatHandler.cs.meta new file mode 100644 index 00000000..517de95d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamSmallChatHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8989b1f3ccb28d64c8142e0c3f0e0252 +timeCreated: 1611404088 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamState.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamState.cs new file mode 100644 index 00000000..c79b8bac --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamState.cs @@ -0,0 +1,12 @@ +using System; + +namespace XMainClient +{ + internal enum XTeamState + { + TS_NOT_FULL, + TS_FULL, + TS_FIGHTING, + TS_VOTING + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamState.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamState.cs.meta new file mode 100644 index 00000000..fc2011df --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamState.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bd7621bc5304b894dbbfd03be047d6cc +timeCreated: 1611404452 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankInfo.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankInfo.cs new file mode 100644 index 00000000..b29a4814 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankInfo.cs @@ -0,0 +1,54 @@ +using System; +using KKSG; +using XMainClient.UI; +using XUtliPoolLib; + +namespace XMainClient +{ + public class XTeamTowerRankInfo : XBaseRankInfo + { + public ulong id1; + + public string name1; + + public string formatname1; + + public uint diff; + + public uint levelCount; + + public uint memberCount; + + private string m_Time; + + public override void ProcessData(RankData data) + { + this.memberCount = (uint)data.RoleIds.Count; + bool flag = this.memberCount > 0u; + if (flag) + { + this.name = data.RoleNames[0]; + this.id = data.RoleIds[0]; + this.formatname = XTitleDocument.GetTitleWithFormat((data.titleIDs.Count > 0) ? data.titleIDs[0] : 0u, XBaseRankInfo.GetUnderLineName(this.name)); + } + bool flag2 = this.memberCount > 1u; + if (flag2) + { + this.name1 = data.RoleNames[1]; + this.id1 = data.RoleIds[1]; + this.formatname1 = XTitleDocument.GetTitleWithFormat((data.titleIDs.Count > 1) ? data.titleIDs[1] : 0u, XBaseRankInfo.GetUnderLineName(this.name1)); + } + this.rank = data.Rank; + this.value = (ulong)data.towerThroughTime; + this.diff = data.towerHardLevel; + this.levelCount = data.towerFloor; + this.m_Time = XSingleton.singleton.TimeFormatString((int)this.value, 2, 3, 4, false, true); + this.startType = data.starttype; + } + + public override string GetValue() + { + return this.m_Time; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankInfo.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankInfo.cs.meta new file mode 100644 index 00000000..16c1f619 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankInfo.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4d402b9229098a24ba3b39e6a533d65d +timeCreated: 1611403694 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankList.cs b/Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankList.cs new file mode 100644 index 00000000..ff4a8150 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankList.cs @@ -0,0 +1,17 @@ +using System; + +namespace XMainClient +{ + public class XTeamTowerRankList : XBaseRankList + { + public XTeamTowerRankList() + { + this.type = XRankType.TeamTowerRank; + } + + public override XBaseRankInfo CreateNewInfo() + { + return new XTeamTowerRankInfo(); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankList.cs.meta b/Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankList.cs.meta new file mode 100644 index 00000000..a78ae912 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Team/XTeamTowerRankList.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 630f27ae0f66e8740bf746945fa10765 +timeCreated: 1611403843 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: -- cgit v1.1-26-g67d0