Example #1
0
        private static void OnLobbyCreated(LobbyCreated_t pCallback, bool bIOFailure)
        {
            if (!SteamManager.Initialized)
            {
                Logger.Error("CONNECTION FAILED");
                return;
            }
            if (!bIOFailure)
            {
                Scoreboard.Instance.UpsertScoreboardEntry(Controllers.PlayerController.Instance._playerInfo.playerId, Controllers.PlayerController.Instance._playerInfo.playerName);
                _lobbyInfo.LobbyID    = new CSteamID(pCallback.m_ulSteamIDLobby);
                _lobbyInfo.TotalSlots = SteamMatchmaking.GetLobbyMemberLimit(_lobbyInfo.LobbyID);
                _lobbyInfo.HostName   = GetUserName();
                Logger.Debug($"Lobby has been created");
                var hostUserId = SteamMatchmaking.GetLobbyOwner(_lobbyInfo.LobbyID);
                SteamMatchmaking.SetLobbyData(_lobbyInfo.LobbyID, "version", PACKET_VERSION);

                var me = SteamUser.GetSteamID();
                Connection = ConnectionState.CONNECTED;
                if (hostUserId.m_SteamID == me.m_SteamID)
                {
                    setLobbyStatus("Waiting In Menu");

                    SendLobbyInfo(true);
                }
            }
        }
Example #2
0
 public unsafe void SetLobbyData(string name, string value)
 {
     if (id != 0)
     {
         SteamMatchmaking.SetLobbyData(_id, name, value);
     }
 }
        public static void UpdateCurrentLobby(GameServer server)
        {
            lock (LOCK)
            {
                if (_currentLobby == null)
                {
                    return;
                }

                var id = _currentLobby.Value;

                SteamMatchmaking.SetLobbyJoinable(id, server.Valid);
                SteamMatchmaking.SetLobbyData(id, LobbyDataKeys.STEAM_SPY_INDICATOR, SteamConstants.INDICATOR);

                var hostId = SteamUser.GetSteamID().m_SteamID.ToString();
                SteamMatchmaking.SetLobbyData(id, LobbyDataKeys.HOST_STEAM_ID, hostId);

                Console.WriteLine("Задан HOST ID " + hostId);

                _currentServer.Valid = server.Valid;

                foreach (var item in server.Properties)
                {
                    SteamMatchmaking.SetLobbyData(id, item.Key, item.Value);

                    if (_currentServer != server)
                    {
                        _currentServer.Set(item.Key, item.Value);
                    }
                }
            }
        }
        public void LobbyCreated(LobbyCreated_t result)
        {
            SteamMatchmaking.JoinLobby((CSteamID)result.m_ulSteamIDLobby);
            MultiplayerChat.AddChat("Created Lobby!");

            SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, MANAGER_ID, SteamUser.GetSteamID().ToString());
        }
Example #5
0
    void OnLobbyEntered(LobbyEnter_t pCallback)
    {
        if (!SteamManager.Initialized)
        {
            lobbyConnectionState = SessionConnectionState.FAILED;
            return;
        }

        steamLobbyId = new CSteamID(pCallback.m_ulSteamIDLobby);

        Debug.Log("Connected to Steam lobby");
        lobbyConnectionState = SessionConnectionState.CONNECTED;

        var hostUserId = SteamMatchmaking.GetLobbyOwner(steamLobbyId);
        var me         = SteamUser.GetSteamID();

        if (hostUserId.m_SteamID == me.m_SteamID)
        {
            SteamMatchmaking.SetLobbyData(steamLobbyId, "game", GAME_ID);
            UNETServerController.StartUNETServer();
        }
        else
        {
            // joined friend's lobby.
            StartCoroutine(RequestP2PConnectionWithHost());
        }
    }
Example #6
0
 private void updateLobbyPrivacy()
 {
     if (lobbyOwner != selfId)
     {
         return;
     }
     if (lobby != null)
     {
         GalaxyInstance.Matchmaking().SetLobbyType(lobby, privacyToLobbyType(privacy));
     }
     if (lobby == null)
     {
         if (steamLobby.HasValue)
         {
             SteamMatchmaking.LeaveLobby(steamLobby.Value);
         }
     }
     else if (!steamLobby.HasValue)
     {
         if (steamLobbyEnterCallback == null)
         {
             steamLobbyEnterCallback = Callback <LobbyEnter_t> .Create(onSteamLobbyEnter);
         }
         SteamMatchmaking.CreateLobby(privacyToSteamLobbyType(privacy), (int)memberLimit);
     }
     else
     {
         SteamMatchmaking.SetLobbyType(steamLobby.Value, privacyToSteamLobbyType(privacy));
         SteamMatchmaking.SetLobbyData(steamLobby.Value, "connect", getConnectionString());
     }
 }
 public void SetLobbyData(string key, string data)
 {
     if (this.m_LobbyId != CSteamID.Nil && SteamMatchmaking.GetLobbyOwner(this.m_LobbyId) == SteamUser.GetSteamID())
     {
         SteamMatchmaking.SetLobbyData(this.m_LobbyId, key, data);
     }
 }
    public void SetGameVisibility(P2PGameVisibility visibility)
    {
        switch (visibility)
        {
        case P2PGameVisibility.Public:
            this.m_LobbyVisibility = ELobbyType.k_ELobbyTypePublic;
            break;

        case P2PGameVisibility.Friends:
            this.m_LobbyVisibility = ELobbyType.k_ELobbyTypeFriendsOnly;
            break;

        case P2PGameVisibility.Private:
            this.m_LobbyVisibility = ELobbyType.k_ELobbyTypePrivate;
            break;

        default:
            this.m_LobbyVisibility = ELobbyType.k_ELobbyTypePrivate;
            break;
        }
        if (this.m_LobbyId != CSteamID.Nil && SteamMatchmaking.GetLobbyOwner(this.m_LobbyId) == SteamUser.GetSteamID())
        {
            SteamMatchmaking.SetLobbyType(this.m_LobbyId, this.m_LobbyVisibility);
            SteamMatchmaking.SetLobbyData(this.m_LobbyId, "lobby_type", EnumUtils <P2PGameVisibility> .GetName(visibility));
        }
    }
        public async Task <Lobby> CreateLobby(LobbyCreateParams createParams)
        {
            ELobbyType type;

            switch (createParams.Type)
            {
            case LobbyType.Private: type = ELobbyType.k_ELobbyTypePrivate; break;

            default:
            case LobbyType.Public: type = ELobbyType.k_ELobbyTypePublic; break;
            }
            var size       = createParams.Capacity;
            var lobbyEnter = SteamUtility.WaitFor <LobbyEnter_t>();
            var result     = await SteamMatchmaking.CreateLobby(type, (int)size).ToTask <LobbyCreated_t>();

            SteamUtility.ThrowIfError(result.m_eResult);
            await lobbyEnter;
            var   lobbyId = new CSteamID(lobbyEnter.Result.m_ulSteamIDLobby);
            var   lobby   = new SteamLobby(lobbyId, this);

            if (createParams.Metadata != null)
            {
                foreach (var kvp in createParams.Metadata)
                {
                    if (kvp.Key == null || kvp.Value == null)
                    {
                        continue;
                    }
                    SteamMatchmaking.SetLobbyData(lobbyId, kvp.Key, kvp.Value.ToString());
                }
            }
            _connectedLobbies.Add(lobbyId, lobby);
            return(lobby);
        }
Example #10
0
 public void SetCurrentMembers(int value)
 {
     if (this.Info.CurrentMembers != value)
     {
         this.Info.CurrentMembers = value;
         SteamMatchmaking.SetLobbyData(this.Info.LobbyId, "currentmembers", this.Info.CurrentMembers.ToString());
     }
 }
Example #11
0
 public void SetBoltLobbyID() // Send the server Bolt ID to the friends lobby, so that they can join
 {
     if (BoltNetwork.IsServer)
     {
         SteamMatchmaking.SetLobbyData(_steamLobbyID, _lobbyNameParameterName, _lobbyData.ServerName);
         Debug.LogFormat("[STEAM] Sending Bolt server ID ({0}) to ({1}).", _lobbyData.ServerName, _steamLobbyID.ToString());
     }
 }
Example #12
0
 public void SetPrefabDbVersion(string value)
 {
     if (this.Info.PrefabDbVersion != value)
     {
         this.Info.PrefabDbVersion = value;
         SteamMatchmaking.SetLobbyData(this.Info.LobbyId, "prefabdbversion", this.Info.PrefabDbVersion);
     }
 }
Example #13
0
 public void SetMyData()
 {
     if (!isActiveAndEnabled || DataInput.text == DataNow.text)
     {
         return;
     }
     gameObject.SetActive(false);
     SteamMatchmaking.SetLobbyData(Sender.roomid, DataName, DataInput.text);
 }
    public void SetLobbyData(CSteamID lobby, string name, string summary)
    {
        SteamMatchmaking.SetLobbyData(lobby, name, summary);

        if (DebugTextOn)
        {
            Debug.Log("SteamMatchmaking.SetLobbyData() : " + name + " : " + summary);
        }
    }
    void OnLobbyCreated(LobbyCreated_t result)
    {
        if (result.m_eResult == EResult.k_EResultOK)
        {
        }
        string personalname = SteamFriends.GetPersonaName();

        SteamMatchmaking.SetLobbyData((CSteamID)result.m_ulSteamIDLobby, "name", personalname);
    }
Example #16
0
 private void SetData()
 {
     if (!isActiveAndEnabled)
     {
         return;
     }
     gameObject.GetComponent <CanvasGroup>().interactable = false;
     SteamMatchmaking.SetLobbyData(Sender.roomid, DataName, DataInput.text);
 }
Example #17
0
 private static void SendLobbyInfo(bool reqHost = false)
 {
     if (reqHost && !IsHost())
     {
         return;
     }
     Logger.Debug($"Sending {_lobbyInfo.ToString()}");
     SteamMatchmaking.SetLobbyData(_lobbyInfo.LobbyID, "LOBBY_INFO", _lobbyInfo.Serialize());
 }
Example #18
0
        // Private Utility Functions

        void SetLobbyData(CSteamID lobbyId)
        {
            var success = SteamMatchmaking.SetLobbyData(lobbyId, "name", $"{SteamFriends.GetPersonaName()}'s Lobby");

            success |= SteamMatchmaking.SetLobbyData(lobbyId, "owner_name", SteamFriends.GetPersonaName());
            if (!success)
            {
                Debug.LogWarning("Error setting lobby info.");
            }
        }
Example #19
0
 private void OnLobbyCreated(LobbyCreated_t pCallbacks, bool bIOFailure)
 {
     pCallbacks.m_ulSteamIDLobby.ToString();
     lobby = new CSteamID(pCallbacks.m_ulSteamIDLobby);
     print("設置大廳名稱為" + LobbyName + " " + SteamMatchmaking.SetLobbyData(lobby, "name", LobbyName));
     if (events.lobby_created != null)
     {
         events.lobby_created.Invoke();
     }
     JoinLobby(lobby);
 }
Example #20
0
 public void InviteTeamToFoundLobby(CSteamID lobbyId)
 {
     if (IsLobbyOwner())
     {
         if (C.LOG_INVITE)
         {
             Debug.Log("Inviting premade team to found game lobby");
         }
         SteamMatchmaking.SetLobbyData(teambuilderLobbyId, "foundLobby", lobbyId.m_SteamID.ToString());
     }
 }
Example #21
0
    public void OnGetHostingInfo(GamePublishingInfo info)
    {
        //Set basic info
        SteamMatchmaking.SetLobbyData(lobby, "name", info.name);
        SteamMatchmaking.SetLobbyData(lobby, "pwd", info.password);

        //Now that we have the password in place, we can make it public
        SteamMatchmaking.SetLobbyType(lobby, ELobbyType.k_ELobbyTypePublic);

        game.EnterGame(lobby);
    }
Example #22
0
    // Callback for Matchmaking CreateLobby
    private void OnLobbyCreated(LobbyCreated_t lobbyCreated, bool bIOfailure)
    {
        CSteamID lobbyID = new CSteamID(lobbyCreated.m_ulSteamIDLobby);


        // Sets lobby gamemode
        SteamMatchmaking.SetLobbyData(lobbyID, "Gamemode", "Ballers-1v1");
        // Sets lobby host steamid
        SteamMatchmaking.SetLobbyData(lobbyID, "Host", ClientPlayer.Singleton.SteamID.ToString());
        SteamMatchmaking.SetLobbyData(lobbyID, "NeededPlayers", $"{1}");
    }
Example #23
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());
    }
Example #24
0
    private void OnLobbyCreated(LobbyCreated_t callback)
    {
        if (callback.m_eResult != EResult.k_EResultOK)
        {
            return;
        }

        LobbyId = new CSteamID(callback.m_ulSteamIDLobby);
        MyNetworkManager.singleton.StartHost();

        SteamMatchmaking.SetLobbyData(LobbyId, HOST_ADDRESS_KEY, SteamUser.GetSteamID().ToString());
    }
Example #25
0
 public void SetName(string name)
 {
     this.Info.Name = name;
     if (CoopPeerStarter.Dedicated)
     {
         SteamGameServer.SetKeyValue("name", name);
     }
     else
     {
         SteamMatchmaking.SetLobbyData(this.Info.LobbyId, "name", name);
     }
 }
Example #26
0
 public void Destroy()
 {
     this.Info.Destroyed = true;
     SteamMatchmaking.SetLobbyJoinable(this.Info.LobbyId, false);
     if (CoopPeerStarter.Dedicated)
     {
         SteamGameServer.SetKeyValue("destroyed", "YES");
     }
     else
     {
         SteamMatchmaking.SetLobbyData(this.Info.LobbyId, "destroyed", "YES");
     }
 }
Example #27
0
        public static void SetLobbyData(string Key, string Value)
        {
            if (SteamCore.InOfflineMode())
            {
                s_LocalLobbyData[Key] = Value;
                //REMOVE//SteamStats.g_CallbackClassInstance.OnDataUpdate(null);
                return;
            }

            //REMOVE//if ( s_CurrentLobby.m_handle == null ) return;

            SteamMatchmaking.SetLobbyData(s_CurrentLobby.m_handle, Key, Value);
        }
Example #28
0
    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), HostAddresKey,
                                      SteamUser.GetSteamID().ToString());
    }
Example #29
0
 public void SetGuid(string guid)
 {
     CoopLobby.HostGuid = guid;
     this.Info.Guid     = guid;
     if (CoopPeerStarter.Dedicated)
     {
         SteamGameServer.SetKeyValue("guid", guid);
     }
     else
     {
         SteamMatchmaking.SetLobbyData(this.Info.LobbyId, "guid", guid);
     }
 }
Example #30
0
 private void onSteamLobbyEnter(LobbyEnter_t pCallback)
 {
     if (pCallback.m_EChatRoomEnterResponse == 1)
     {
         Console.WriteLine("Steam lobby entered: {0}", pCallback.m_ulSteamIDLobby);
         steamLobbyEnterCallback.Unregister();
         steamLobbyEnterCallback = null;
         steamLobby = new CSteamID(pCallback.m_ulSteamIDLobby);
         if (SteamMatchmaking.GetLobbyOwner(steamLobby.Value) == SteamUser.GetSteamID())
         {
             SteamMatchmaking.SetLobbyType(steamLobby.Value, privacyToSteamLobbyType(privacy));
             SteamMatchmaking.SetLobbyData(steamLobby.Value, "connect", getConnectionString());
         }
     }
 }