示例#1
0
    private IEnumerator DelayedInviteReceived(CoopLobbyInfo lobby)
    {
        lobby.RequestData();
        while (!lobby.Destroyed && (string.IsNullOrEmpty(lobby.Name) || string.IsNullOrEmpty(lobby.Guid) || this._inviteReceivedScreen._screen.activeSelf))
        {
            lobby.UpdateData();
            yield return(null);
        }
        if (lobby.Destroyed)
        {
            this._inviteReceivedScreen._screen.SetActive(false);
            yield break;
        }
        yield return(YieldPresets.WaitPointFiveSeconds);

        lobby.UpdateData();
        Debug.Log(string.Concat(new string[]
        {
            "Received MP invite for lobby name='",
            lobby.Name,
            "', guid='",
            lobby.Guid,
            "'"
        }));
        this._currentInvitelobby = lobby;
        this._inviteReceivedScreen._continueSaveButton.isEnabled = SaveSlotUtils.GetPreviouslyPlayedServers().Contains(lobby.Guid);
        this._inviteReceivedScreen._gameName.text = lobby.Name;
        this.OpenScreen(CoopSteamNGUI.Screens.InviteReceivedScreen);
        yield break;
    }
示例#2
0
 public void OnClientNewGame(CoopLobbyInfo lobby)
 {
     if (CoopLobby.IsInLobby)
     {
         CoopLobby.LeaveActive();
     }
     TitleScreen.StartGameSetup.Type   = TitleScreen.GameSetup.InitTypes.New;
     TitleScreen.StartGameSetup.MpType = TitleScreen.GameSetup.MpTypes.Client;
     this.RefreshUI();
     if (this._currentScreen == CoopSteamNGUI.Screens.InviteReceivedScreen)
     {
         this._currentScreen = this._prevScreen;
         this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
     }
     this.SetLoadingText(string.Format("Joining Lobby {0} ...", lobby.Name));
     lobby.UpdateData();
     CoopLobbyManager.Join(lobby, delegate
     {
         lobby.UpdateData();
         this.ClearLoadingAndError();
     }, delegate
     {
         this.ClearLoadingAndError();
         this.SetErrorText("Could not join Steam lobby.");
     });
 }
示例#3
0
 private static void LobbyEnter(LobbyEnter_t param)
 {
     try
     {
         CSteamID id = new CSteamID(param.m_ulSteamIDLobby);
         if (id.IsValid() && param.m_EChatRoomEnterResponse == 1u)
         {
             CoopLobbyInfo lobbyInfo = CoopLobbyManager.GetLobbyInfo(id);
             lobbyInfo.UpdateData();
             CoopLobby.SetActive(lobbyInfo);
             if (CoopLobbyManager.enterCallback != null)
             {
                 CoopLobbyManager.enterCallback();
             }
         }
         else if (CoopLobbyManager.enterFailCallback != null)
         {
             CoopLobbyManager.enterFailCallback();
         }
     }
     finally
     {
         CoopLobbyManager.enterCallback     = null;
         CoopLobbyManager.enterFailCallback = null;
     }
 }
示例#4
0
 private static void LobbyDataUpdate(LobbyDataUpdate_t param)
 {
     if (param.m_bSuccess == 1)
     {
         CoopLobbyInfo coopLobbyInfo = CoopLobbyManager.FindLobby(param.m_ulSteamIDLobby);
         if (coopLobbyInfo != null)
         {
             coopLobbyInfo.UpdateData();
         }
     }
 }
示例#5
0
    private static CoopLobbyInfo GetLobbyInfo(CSteamID id)
    {
        CoopLobbyInfo coopLobbyInfo = CoopLobbyManager.FindLobby(id);

        if (coopLobbyInfo == null)
        {
            coopLobbyInfo = new CoopLobbyInfo(id);
            coopLobbyInfo.UpdateData();
            CoopLobbyManager.LobbyMatchList_Result.Add(coopLobbyInfo);
        }
        return(coopLobbyInfo);
    }
示例#6
0
 private static void LobbyEnter(LobbyEnter_t param)
 {
     Debug.Log("LobbyEnter");
     try
     {
         CSteamID id = new CSteamID(param.m_ulSteamIDLobby);
         if (id.IsValid() && param.m_EChatRoomEnterResponse == 1u)
         {
             CoopLobbyInfo lobbyInfo = CoopLobbyManager.GetLobbyInfo(id);
             lobbyInfo.UpdateData();
             CoopLobby.SetActive(lobbyInfo);
             if (CoopLobbyManager.enterCallback != null)
             {
                 CoopLobbyManager.enterCallback();
             }
         }
         else
         {
             string obj = string.Empty;
             if (id.IsValid())
             {
                 if (param.m_EChatRoomEnterResponse == 4u)
                 {
                     obj = "FULL";
                 }
                 else
                 {
                     CoopLobbyInfo lobbyInfo2 = CoopLobbyManager.GetLobbyInfo(id);
                     if (lobbyInfo2 != null && lobbyInfo2.CurrentMembers >= lobbyInfo2.MemberLimit)
                     {
                         obj = "FULL";
                     }
                 }
             }
             if (CoopLobbyManager.enterFailCallback != null)
             {
                 Debug.Log("calling fail callback");
                 CoopLobbyManager.enterFailCallback(obj);
             }
             else
             {
                 Debug.Log("no fail callback");
             }
         }
     }
     finally
     {
         CoopLobbyManager.enterCallback     = null;
         CoopLobbyManager.enterFailCallback = null;
     }
 }
示例#7
0
 public void OnClientNewGame(CoopLobbyInfo lobby)
 {
     if (CoopLobby.IsInLobby)
     {
         CoopLobby.LeaveActive();
     }
     GameSetup.SetInitType(InitTypes.New);
     GameSetup.SetMpType(MpTypes.Client);
     this.RefreshUI();
     if (this._currentScreen == CoopSteamNGUI.Screens.InviteReceivedScreen)
     {
         this._currentScreen = this._prevScreen;
         this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
     }
     else if (this._currentScreen == CoopSteamNGUI.Screens.JoinP2P)
     {
         this._currentScreen = this._prevScreen;
         this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
     }
     try
     {
         this.SetLoadingText(StringEx.TryFormat(UiTranslationDatabase.TranslateKey("JOINING_LOBBY_0____", "Joining Lobby {0}...", this._allCapsTexts), new object[]
         {
             lobby.Name
         }));
     }
     catch
     {
     }
     lobby.UpdateData();
     CoopLobbyManager.Join(lobby, delegate
     {
         lobby.UpdateData();
         this.ClearLoadingAndError();
     }, new Action <string>(this.OnFailedEnterLobby));
 }
示例#8
0
 private static CoopLobbyInfo GetLobbyInfo(CSteamID id)
 {
     CoopLobbyInfo coopLobbyInfo = CoopLobbyManager.FindLobby(id);
     if (coopLobbyInfo == null)
     {
         coopLobbyInfo = new CoopLobbyInfo(id);
         coopLobbyInfo.UpdateData();
         CoopLobbyManager.LobbyMatchList_Result.Add(coopLobbyInfo);
     }
     return coopLobbyInfo;
 }
示例#9
0
 public void OnClientNewGame(CoopLobbyInfo lobby)
 {
     if (CoopLobby.IsInLobby)
     {
         CoopLobby.LeaveActive();
     }
     TitleScreen.StartGameSetup.Type = TitleScreen.GameSetup.InitTypes.New;
     TitleScreen.StartGameSetup.MpType = TitleScreen.GameSetup.MpTypes.Client;
     this.RefreshUI();
     if (this._currentScreen == CoopSteamNGUI.Screens.InviteReceivedScreen)
     {
         this._currentScreen = this._prevScreen;
         this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
     }
     this.SetLoadingText(string.Format("Joining Lobby {0} ...", lobby.Name));
     lobby.UpdateData();
     CoopLobbyManager.Join(lobby, delegate
     {
         lobby.UpdateData();
         this.ClearLoadingAndError();
     }, delegate
     {
         this.ClearLoadingAndError();
         this.SetErrorText("Could not join Steam lobby.");
     });
 }