Exemple #1
0
    private void OnLobbyCreated(LobbyCreated_t callback)
    {
        if (callback.m_eResult != EResult.k_EResultOK)
        {
            landingPagePanel.SetActive(true);
            return;
        }

        NetworkManager.singleton.StartHost();

        SteamMatchmaking.SetLobbyData(
            new CSteamID(callback.m_ulSteamIDLobby),
            "HostAddress",
            SteamUser.GetSteamID().ToString());
    }
 public void OnLobbyCreated(LobbyCreated_t pCallback, bool bIOFailure)
 {
     if (bIOFailure == false)
     {
         Debug.Log("[" + LobbyCreated_t.k_iCallback + " - LobbyCreated] - " + pCallback.m_eResult + " -- " + pCallback.m_ulSteamIDLobby);
         //set the lobby to our class level
         m_Lobby      = (CSteamID)pCallback.m_ulSteamIDLobby;
         currentLobby = GetLobbyDataInfo(m_Lobby);
         //set the lobby name and summary
         SetLobbyData(currentLobby.lobby, lobbyName, lobbySummary);
     }
     else
     {
         Debug.LogError("Failed to create a lobby");
     }
 }
 private void OnLobbyCreated(LobbyCreated_t pCallback, bool bIOFailure)
 {
     if (bIOFailure == false)
     {
         Debug.Log("[" + LobbyCreated_t.k_iCallback + " - LobbyCreated] - " + pCallback.m_eResult + " -- " + pCallback.m_ulSteamIDLobby);
         // //set the lobby to our class level
         // m_Lobby = ;
         // currentLobby = GetLobbyDataInfo (
         m_Lobby       = new CurrentLobby();
         m_Lobby.lobby = (CSteamID)pCallback.m_ulSteamIDLobby;
     }
     else
     {
         Debug.LogError("Failed to create a lobby");
     }
 }
    private void OnLobbyCreated(LobbyCreated_t callback)
    {
        if (callback.m_eResult != EResult.k_EResultOK)
        {
            buttons.SetActive(true);
            return;
        }

        networkManager.StartHost();

        SteamMatchmaking.SetLobbyData(
            new CSteamID(callback.m_ulSteamIDLobby),
            HostAddressKey,
            SteamUser.GetSteamID().ToString()
            );
    }
Exemple #5
0
    private void OnLobbyCreated(LobbyCreated_t callback)
    {
        if (callback.m_eResult != EResult.k_EResultOK)
        {
            Debug.Log("Lobby could not be created.");
            connectionUI.SetActive(true);
            return;
        }

        networkManager.StartHost();
        SteamMatchmaking.SetLobbyData(
            new CSteamID(callback.m_ulSteamIDLobby),
            HostAddressKey,
            SteamUser.GetSteamID().ToString()
            );
    }
Exemple #6
0
        // SteamAPICall_t
        public CallbackHandle CreateLobby(LobbyType eLobbyType /*ELobbyType*/, int cMaxMembers /*int*/, Action <LobbyCreated_t, bool> CallbackFunction = null /*Action<LobbyCreated_t, bool>*/)
        {
            SteamAPICall_t callback = 0;

            callback = platform.ISteamMatchmaking_CreateLobby(eLobbyType, cMaxMembers);

            if (CallbackFunction == null)
            {
                return(null);
            }
            if (callback == 0)
            {
                return(null);
            }

            return(LobbyCreated_t.CallResult(steamworks, callback, CallbackFunction));
        }
Exemple #7
0
    void OnLobbyCreated(LobbyCreated_t result)
    {
        if (result.m_eResult == EResult.k_EResultOK)
        {
            Debug.Log("Lobby created -- SUCCESS!");
            lobby_canvas.enabled     = true;
            main_menu_canvas.enabled = false;
        }
        else
        {
            Debug.Log("Lobby created -- failure ...");
        }

        string personalName = SteamFriends.GetPersonaName();

        SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "name", personalName + "'s game");
    }
Exemple #8
0
 private void OnLobbyCreated(LobbyCreated_t result, bool failure)
 {
     if (State == LobbyState.Creating)
     {
         if (failure)
         {
             State = LobbyState.Inactive;
         }
         else
         {
             State = LobbyState.Active;
         }
         Id    = new CSteamID(result.m_ulSteamIDLobby);
         Owner = SteamMatchmaking.GetLobbyOwner(Id);
         _lobbyCreatedExternalCallback(result, failure);
     }
 }
Exemple #9
0
        //------------    When lobby was created (Callback to Host)    ------------
        private void OnLobbyCreated(LobbyCreated_t lobby)
        {
            if (lobby.m_eResult.Equals(EResult.k_EResultOK))
            {
                GD.Print($"OK: Created lobby with id: {lobby.m_ulSteamIDLobby}");

                // Assign global vars
                _globals.PlayingAsHost = true;
                _globals.HostId        = SteamUser.GetSteamID();
                _globals.OwnId         = _globals.HostId;
                _globals.LobbyId       = (CSteamID)lobby.m_ulSteamIDLobby;
            }
            else
            {
                GD.Print("ERR: Could not create lobby.");
            }
        }
    // When a lobby has been created (or failed to create)
    private void OnLobbyCreated(LobbyCreated_t lobby)
    {
        if (lobby.m_eResult == EResult.k_EResultOK)
        {
            global.playingAsHost        = true;
            hostSectionStatus.Text      = "Lobby ID: " + lobby.m_ulSteamIDLobby + "\nWaiting for player to join...";
            startHostingButton.Disabled = false;
            startHostingButton.Text     = "Cancel hosting";
            lobbyID = (CSteamID)lobby.m_ulSteamIDLobby;

            // Set global value
            global.player1 = SteamUser.GetSteamID();
        }
        else
        {
            hostSectionStatus.Text = "Failed to create lobby.\nReason: " + lobby.m_eResult;
        }
    }
Exemple #11
0
            private void OnLobbyCreated(LobbyCreated_t result)
            {
                if (result.m_eResult == EResult.k_EResultOK)
                {
                    Console.WriteLine("Lobby created -- SUCCESS!");
                }
                else
                {
                    Console.WriteLine("Lobby created -- failure ...");
                }

                string personalName = SteamFriends.GetPersonaName();

                if (SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "name", personalName + "'s game"))
                {
                    Console.WriteLine(SteamMatchmaking.GetLobbyData((CSteamID)result.m_ulSteamIDLobby, "name"));
                }
            }
Exemple #12
0
 private void OnLobbyCreated(LobbyCreated_t result, bool failure)
 {
     if (this.State != LobbyState.Creating)
     {
         return;
     }
     if (!failure)
     {
         this.State = LobbyState.Active;
     }
     else
     {
         this.State = LobbyState.Inactive;
     }
     this.Id    = new CSteamID(result.m_ulSteamIDLobby);
     this.Owner = SteamMatchmaking.GetLobbyOwner(this.Id);
     this._lobbyCreatedExternalCallback(result, failure);
 }
Exemple #13
0
    public void OnLobbyCreated(LobbyCreated_t callback)
    {
        Debug.Log("Lobby Created");
        switch (callback.m_eResult)
        {
        case EResult.k_EResultOK:
            if (!createdLobby)
            {
                Debug.Log("Successful creation, lobbyid: " + callback.m_ulSteamIDLobby);
                SetUpLobby(callback.m_ulSteamIDLobby);
            }
            break;

        default:
            Debug.Log("Lobby failed to create");
            break;
        }
    }
    private void OnLobbyCreated(LobbyCreated_t callback)
    {
        if (callback.m_eResult != EResult.k_EResultOK)
        {
            return;
        }

        LobbyID = new CSteamID(callback.m_ulSteamIDLobby);

        networkManager.StartHost();
        menuManager.NavigateToMenu("Lobby");
        menuManager.HideLoading();

        SteamMatchmaking.SetLobbyData(
            LobbyID,
            HostAdressKey,
            SteamUser.GetSteamID().ToString());
    }
Exemple #15
0
 private unsafe static void OnCreateLobby(LobbyCreated_t result, bool ioFailure)
 {
     if (!_initialized)
     {
         return;
     }
     if (lobby == null)
     {
         return;
     }
     if (result.m_eResult == EResult.k_EResultOK)
     {
         lobby.OnProcessingComplete(result.m_ulSteamIDLobby, SteamLobbyJoinResult.Success);
     }
     else
     {
         lobby.OnProcessingComplete(0, SteamLobbyJoinResult.Error);
     }
 }
Exemple #16
0
    void OnLobbyCreated(LobbyCreated_t result)
    {
        if (result.m_eResult == EResult.k_EResultOK)
        {
            Debug.Log("Lobby created -- SUCCESS!");
        }
        else
        {
            Debug.Log("Lobby created -- failure ...");
        }
        string personalName = SteamFriends.GetPersonaName();
        string ntr          = RoomName.text;

        if (ntr == "")
        {
            ntr = personalName + "'s game";
        }
        SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "name", ntr);
        SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "GameVersion", GameVersion);
    }
    void OnLobbyCreated(LobbyCreated_t result)
    {
        if (result.m_eResult == EResult.k_EResultOK)
        {
            Debug.Log("Lobby created -- SUCCESS!");
        }
        else
        {
            Debug.Log("Lobby created -- failure ...");
            return;
        }
        uint   serverIp = SteamGameServer.GetPublicIP();
        int    ipaddr   = System.Net.IPAddress.HostToNetworkOrder((int)serverIp);
        string ip       = new System.Net.IPAddress(BitConverter.GetBytes(ipaddr)).ToString();

        SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "ServerIP", ip);
        isHost        = true;
        awaitMsg.text = "";
        StartHost();
    }
Exemple #18
0
    void OnLobbyCreated(LobbyCreated_t result)
    {
        if (result.m_eResult == EResult.k_EResultOK)
        {
            SetText("roomMakeSucc");
            current_lobbyID   = result.m_ulSteamIDLobby;
            initializedStatus = 4;
        }
        else
        {
            SetText("roomMakeFail");
            initializedStatus = -2;
        }
        string   personalName = SteamFriends.GetPersonaName();
        CSteamID id           = (CSteamID)result.m_ulSteamIDLobby;

        SteamMatchmaking.SetLobbyData(id, "name", personalName);
        SteamMatchmaking.SetLobbyData(id, "status", "open");
        SteamMatchmaking.SetLobbyData(id, "playerone", ((int)PD.p1Char).ToString());
        SteamMatchmaking.SetLobbyData(id, "playertwo", "");
    }
    //添加的回调函数
    private void OnLobbyCreated(LobbyCreated_t pCallback, bool ioFailed)
    {
        if (pCallback.m_eResult == EResult.k_EResultOK)
        {
            Debug.Log("Lobby Create Success! LobbyId:" + pCallback.m_ulSteamIDLobby);

            GameObject.Find("LobbyPanel").gameObject.SetActive(true);

            var lobbyname = SteamFriends.GetPersonaName() + "'s Lobby";
            GameObject.Find("LobbyPanel").GetComponent <LobbyPanel>().createLobby(lobbyname);

            m_IsInLobby = true;
            m_LobbyId   = new CSteamID(pCallback.m_ulSteamIDLobby);
        }
        else
        {
            Debug.LogWarning("Lobby Create Failed!");
        }
        //test
        //SendNetMessage();
    }
 // Token: 0x06000969 RID: 2409 RVA: 0x00045400 File Offset: 0x00043600
 private void OnLobbyCreated(LobbyCreated_t data, bool ioError)
 {
     ZLog.Log(string.Concat(new object[]
     {
         "Lobby was created ",
         data.m_eResult,
         "  ",
         data.m_ulSteamIDLobby,
         "  error:",
         ioError.ToString()
     }));
     if (ioError)
     {
         return;
     }
     this.m_myLobby = new CSteamID(data.m_ulSteamIDLobby);
     SteamMatchmaking.SetLobbyData(this.m_myLobby, "name", this.m_registerServerName);
     SteamMatchmaking.SetLobbyData(this.m_myLobby, "password", this.m_registerPassword ? "1" : "0");
     SteamMatchmaking.SetLobbyData(this.m_myLobby, "version", this.m_registerVerson);
     SteamMatchmaking.SetLobbyGameServer(this.m_myLobby, 0U, 0, SteamUser.GetSteamID());
 }
        public void LobbyCreated(LobbyCreated_t result)
        {
            SteamMatchmaking.JoinLobby((CSteamID)result.m_ulSteamIDLobby);
            lobbyID   = (CSteamID)result.m_ulSteamIDLobby;
            lobbyInfo = new LobbyInfo((CSteamID)result.m_ulSteamIDLobby);
            MultiplayerChat.AddChat("Created Lobby!");
            joining = false;

            SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, MANAGER_ID, SteamUser.GetSteamID().ToString());
            lobbyInfo.owner = SteamUser.GetSteamID();
            SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "AllowDebug", (debugAllowed ? "True" : "False"));
            lobbyInfo.debugAllowed = debugAllowed;
            SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "SpearsHit", (spearsHit ? "True" : "False"));
            lobbyInfo.spearsHit = spearsHit;
            //SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "OtherStart", (otherStart ? "True" : "False"));
            //lobbyInfo.otherStart = otherStart;
            lobbyInfo.memberLimit = lobbyMax;
            lobbyInfo.memberNum   = 1;
            SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "Version", Monkland.VERSION);
            lobbyInfo.version = Monkland.VERSION;
        }
Exemple #22
0
 private void OnLobbyCreated(LobbyCreated_t result, bool failure)
 {
     //IL_001e: Unknown result type (might be due to invalid IL or missing references)
     //IL_0024: Unknown result type (might be due to invalid IL or missing references)
     //IL_0029: Unknown result type (might be due to invalid IL or missing references)
     //IL_0030: Unknown result type (might be due to invalid IL or missing references)
     //IL_0035: Unknown result type (might be due to invalid IL or missing references)
     //IL_003a: Unknown result type (might be due to invalid IL or missing references)
     //IL_0045: Unknown result type (might be due to invalid IL or missing references)
     if (State == LobbyState.Creating)
     {
         if (failure)
         {
             State = LobbyState.Inactive;
         }
         else
         {
             State = LobbyState.Active;
         }
         Id    = new CSteamID(result.m_ulSteamIDLobby);
         Owner = SteamMatchmaking.GetLobbyOwner(Id);
         //_lobbyCreatedExternalCallback.Invoke(result, failure);
     }
 }
 /// <summary>
 ///     Callback for when a steam lobby is created. Assign connection info and match info here for players to read when they connect.
 /// </summary>
 /// <param name="pCallback"></param>
 private void OnLobbyCreated(LobbyCreated_t pCallback)
 {
     // record which lobby we're in
     if (NetLogFilter.logInfo)
     {
         Debug.Log($"Lobby Created | ({Time.time})");
     }
     if (pCallback.m_eResult == EResult.k_EResultOK)
     {
         // success
         if (NetLogFilter.logInfo)
         {
             Debug.Log($"LobbyID: {pCallback.m_ulSteamIDLobby}. ({Time.time})");
         }
         LobbyCreated?.Invoke(new CSteamID(pCallback.m_ulSteamIDLobby));
     }
     else
     {
         if (NetLogFilter.logInfo)
         {
             Debug.Log($"Failed to create lobby (lost connection to Steam back-end servers) ({Time.time})");
         }
     }
 }
Exemple #24
0
 private void ActivateVoiceChatAtCreation(LobbyCreated_t cb)
 {
     GetComponent <VoiceChatSpawner>().enabled = true;
 }
Exemple #25
0
    void OnLobbyCreated(LobbyCreated_t pCallback, bool bIOFailure)
    {
        Debug.Log("[" + LobbyCreated_t.k_iCallback + " - LobbyCreated] - " + pCallback.m_eResult + " -- " + pCallback.m_ulSteamIDLobby);

        m_Lobby = (CSteamID)pCallback.m_ulSteamIDLobby;
    }
Exemple #26
0
 private static void OnCreatedLobby(LobbyCreated_t t, bool failed)
 {
     Debug.Log("Created lobby");
     Debug.Log("Lobby ID:" + t.m_ulSteamIDLobby);
 }
 void OnLobbyCreated(LobbyCreated_t pCallback, bool bIOFailure)
 {
     Console.WriteLine("[" + LobbyCreated_t.k_iCallback + " - LobbyCreated] - " + pCallback.m_eResult + " -- " + pCallback.m_ulSteamIDLobby);
     m_Lobby = (CSteamID)pCallback.m_ulSteamIDLobby;
     this.setGameServerSettings(m_Lobby, "127.0.0.1", "5000");  //TODO: We need to upgrade this. m_unIP should be avilable in new version > https://partner.steamgames.com/doc/api/ISteamMatchmaking
 }
Exemple #28
0
 void CreateLobby(LobbyCreated_t cb)
 {
     InitLobby((CSteamID)cb.m_ulSteamIDLobby);
 }
 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;
     }
 }
Exemple #30
0
 public void LobbyCreated(LobbyCreated_t pCallback)
 {
     lobbyName = new System.Random().Next().ToString();
 }