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); } } } } } } } }