예제 #1
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;
     }
 }
예제 #2
0
    private void Launch()
    {
        CoopSteamManager.Initialize();
        CoopPeerStarter.Dedicated     = true;
        CoopPeerStarter.DedicatedHost = true;
        CoopLobby.SetActive(new CoopLobbyInfo(SteamGameServer.GetSteamID())
        {
            Name        = SteamDSConfig.ServerName,
            Joinable    = true,
            MemberLimit = SteamDSConfig.ServerPlayers
        });
        if (GameSetup.IsSavedGame)
        {
            SaveSlotUtils.LoadHostGameGUID();
        }
        if (string.IsNullOrEmpty(CoopLobby.Instance.Info.Guid) || GameSetup.IsNewGame)
        {
            CoopLobby.Instance.SetGuid(Guid.NewGuid().ToString());
        }
        SteamDSConfig.ServerGUID = CoopLobby.Instance.Info.Guid;
        GameSetup.SetMpType(MpTypes.Server);
        GameSetup.SetPlayerMode(PlayerModes.Multiplayer);
        FMOD_StudioSystem.ForceFmodOff = true;
        GameObject             gameObject             = new GameObject("CoopSteamServerStarter");
        CoopSteamServerStarter coopSteamServerStarter = gameObject.AddComponent <CoopSteamServerStarter>();

        coopSteamServerStarter.mapState = CoopPeerStarter.MapState.None;
        coopSteamServerStarter._async   = this.loadAsync;
        UnityEngine.Object.DontDestroyOnLoad(gameObject);
    }
예제 #3
0
 private static void LobbyCreated(LobbyCreated_t param)
 {
     Debug.Log(string.Concat(new object[]
     {
         "LobbyCreated param.m_eResult=",
         param.m_eResult,
         ", lobbyId=",
         param.m_ulSteamIDLobby
     }));
     try
     {
         if (param.m_eResult == EResult.k_EResultOK)
         {
             CSteamID cSteamID = new CSteamID(param.m_ulSteamIDLobby);
             if (cSteamID.IsValid())
             {
                 CoopLobbyInfo coopLobbyInfo = new CoopLobbyInfo(param.m_ulSteamIDLobby);
                 coopLobbyInfo.IsOwner     = true;
                 coopLobbyInfo.Name        = CoopLobbyManager.createValues.Name;
                 coopLobbyInfo.MemberLimit = CoopLobbyManager.createValues.MemberLimit;
                 CoopLobbyManager.LobbyMatchList_Result = new List <CoopLobbyInfo>();
                 CoopLobbyManager.LobbyMatchList_Result.Add(coopLobbyInfo);
                 CoopLobby.SetActive(coopLobbyInfo);
                 if (TitleScreen.StartGameSetup.Type == TitleScreen.GameSetup.InitTypes.Continue)
                 {
                     SaveSlotUtils.LoadHostGameGUID();
                 }
                 if (CoopLobbyManager.createCallback != null)
                 {
                     try
                     {
                         CoopLobbyManager.createCallback();
                     }
                     catch (Exception var_1_E2)
                     {
                     }
                 }
                 goto IL_10C;
             }
         }
         if (CoopLobbyManager.createFailCallback != null)
         {
             try
             {
                 CoopLobbyManager.createFailCallback();
             }
             catch (Exception var_2_106)
             {
             }
         }
         IL_10C :;
     }
     finally
     {
         CoopLobbyManager.createValues       = null;
         CoopLobbyManager.createCallback     = null;
         CoopLobbyManager.createFailCallback = null;
     }
 }
예제 #4
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;
     }
 }
예제 #5
0
 private static void LobbyCreated(LobbyCreated_t param)
 {
     Debug.Log(string.Concat(new object[]
     {
         "LobbyCreated param.m_eResult=",
         param.m_eResult,
         ", lobbyId=",
         param.m_ulSteamIDLobby
     }));
     try
     {
         if (param.m_eResult == EResult.k_EResultOK)
         {
             CSteamID csteamID = new CSteamID(param.m_ulSteamIDLobby);
             if (csteamID.IsValid())
             {
                 CoopLobbyInfo coopLobbyInfo = new CoopLobbyInfo(param.m_ulSteamIDLobby);
                 coopLobbyInfo.IsOwner     = true;
                 coopLobbyInfo.Name        = CoopLobbyManager.createValues.Name;
                 coopLobbyInfo.MemberLimit = CoopLobbyManager.createValues.MemberLimit;
                 CoopLobbyManager.LobbyMatchList_Result = new List <CoopLobbyInfo>();
                 CoopLobbyManager.LobbyMatchList_Result.Add(coopLobbyInfo);
                 CoopLobby.SetActive(coopLobbyInfo);
                 if (GameSetup.IsSavedGame)
                 {
                     SaveSlotUtils.LoadHostGameGUID();
                 }
                 if (CoopLobbyManager.createCallback != null)
                 {
                     try
                     {
                         CoopLobbyManager.createCallback();
                     }
                     catch (Exception exception)
                     {
                         BoltLog.Exception(exception);
                     }
                 }
                 goto IL_112;
             }
         }
         if (CoopLobbyManager.createFailCallback != null)
         {
             try
             {
                 CoopLobbyManager.createFailCallback();
             }
             catch (Exception exception2)
             {
                 BoltLog.Exception(exception2);
             }
         }
         IL_112 :;
     }
     finally
     {
         CoopLobbyManager.createValues       = null;
         CoopLobbyManager.createCallback     = null;
         CoopLobbyManager.createFailCallback = null;
     }
 }