diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgTeamMain.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgTeamMain.cs index 287ec596bd..f4e21db1f7 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgTeamMain.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgTeamMain.cs @@ -22,12 +22,21 @@ namespace BrewMonster.UI [SerializeField] private Button btnClose; private readonly List m_pMates = new List(); + private bool m_bPendingShow = false; + private bool m_bHasShowOnce = false; + public override void Awake() { base.Awake(); SetName("Win_TeamMain"); } + public void ShowTeamDialog() + { + m_bPendingShow = true; + UpdateTeamInfo(); + } + /// No-op until real implementation. public bool UpdateTeamInfo() { @@ -45,11 +54,8 @@ namespace BrewMonster.UI { HideTeamList(); ClearAllTeamMates(); - return true; - } - - if (!IsShow()) - { + m_bPendingShow = false; + m_bHasShowOnce = false; return true; } @@ -61,7 +67,9 @@ namespace BrewMonster.UI { CECTeamMember member = team.GetMemberByIndex(i); if (member == null) + { continue; + } int idPlayer = member.GetCharacterID(); if (idHost == idPlayer) @@ -70,6 +78,18 @@ namespace BrewMonster.UI displayMembers.Add(member); } + if (displayMembers.Count > 0 && !IsShow() && (m_bPendingShow || !m_bHasShowOnce)) + { + Show(true); + m_bPendingShow = false; + m_bHasShowOnce = true; + } + + if (!IsShow()) + { + return true; + } + int neededCount = displayMembers.Count; AdjustTeamMateCount(neededCount); @@ -82,7 +102,9 @@ namespace BrewMonster.UI DlgTeamMate pDlgMate = m_pMates[i]; if (pDlgMate == null) + { continue; + } pDlgMate.UpdateMemberDisplay(member); pDlgMate.SetMemberID(member.GetCharacterID()); @@ -198,6 +220,7 @@ namespace BrewMonster.UI private void OnClickClose() { Show(false); + m_bPendingShow = false; } } } diff --git a/Assets/Scripts/CECHostPlayer.Party.cs b/Assets/Scripts/CECHostPlayer.Party.cs index de54dc0072..c6823fd0db 100644 --- a/Assets/Scripts/CECHostPlayer.Party.cs +++ b/Assets/Scripts/CECHostPlayer.Party.cs @@ -23,7 +23,7 @@ namespace BrewMonster pTeam.AddMember(pCmd.idLeader); pTeam.SetPickupFlag(pCmd.wPickFlag); SetTeam(pTeam); - NotifyUIUpdateTeam(); + NotifyUIUpdateTeam(true); } private void OnMsgHstLeaveTeam(ECMSG Msg) @@ -50,7 +50,7 @@ namespace BrewMonster m_pTeam.AddUnknownID(cid); if (EC_ManMessageMono.Instance?.GetECManPlayer?.GetPlayer(cid, 0) == null && UnityGameSession.Instance != null) UnityGameSession.c2s_CmdTeamMemberPos(1, new[] { cid }); - NotifyUIUpdateTeam(); + NotifyUIUpdateTeam(true); } private void OnMsgHstTeamMemberData(ECMSG Msg) { diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index 16d97a01d8..93af8ce84e 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -636,7 +636,7 @@ namespace BrewMonster } }*/ } - private void NotifyUIUpdateTeam() + private void NotifyUIUpdateTeam(bool showDialog = false) { //try //{ @@ -652,7 +652,14 @@ namespace BrewMonster var dlgTeamMain = uiMan.GetDialog("Win_TeamMain") as DlgTeamMain; if (dlgTeamMain != null) { - dlgTeamMain.UpdateTeamInfo(); + if (showDialog) + { + dlgTeamMain.ShowTeamDialog(); + } + else + { + dlgTeamMain.UpdateTeamInfo(); + } } }