コード例 #1
0
 public static void OnLobbyEnter(LobbyEnter_t pCallback)
 {
     Logger.Debug($"You have entered lobby {pCallback.m_ulSteamIDLobby}");
     Controllers.PlayerController.Instance.StartBroadcasting();
     SteamAPI.SetConnectionState(SteamAPI.ConnectionState.CONNECTED);
     SteamAPI.SendPlayerInfo(Controllers.PlayerController.Instance._playerInfo);
 }
コード例 #2
0
    void OnLobbyEnter(LobbyEnter_t cb)
    {
        INetworkIdentity id = GameObject.Instantiate(voiceUserPrefab.gameObject).GetComponent <INetworkIdentity>();

        id.IsLocalPlayer = true;
        id.NetworkId     = self.m_SteamID;

        if ((EChatRoomEnterResponse)cb.m_EChatRoomEnterResponse == EChatRoomEnterResponse.k_EChatRoomEnterResponseSuccess)
        {
            CSteamID lobbyId = new CSteamID(cb.m_ulSteamIDLobby);
            int      n       = SteamMatchmaking.GetNumLobbyMembers(lobbyId);

            for (int i = 0; i < n; i++)
            {
                CSteamID client = SteamMatchmaking.GetLobbyMemberByIndex(lobbyId, i);
                if (client.m_SteamID != self.m_SteamID)
                {
                    others.Add(client.m_SteamID, client);
                    id = GameObject.Instantiate(voiceUserPrefab.gameObject).GetComponent <INetworkIdentity>();
                    id.IsLocalPlayer = false;
                    id.NetworkId     = client.m_SteamID;
                }
            }
        }
    }
コード例 #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
    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());
        }
    }
コード例 #5
0
 void EnterCall(LobbyEnter_t cb)
 {
     enterLobby = false;
     #if UNITY_EDITOR
     Debug.Log("Lobby ID : " + cb.m_ulSteamIDLobby);
     #endif
 }
コード例 #6
0
        public void LobbyEntered(LobbyEnter_t enterLobby)
        {
            connectedPlayers.Clear();
            otherPlayers.Clear();

            lobbyID = (CSteamID)enterLobby.m_ulSteamIDLobby;
            int playerCount = SteamMatchmaking.GetNumLobbyMembers(lobbyID);

            MultiplayerChat.chatStrings.Add("Entered Lobby!");

            //Send packets to all players, to establish P2P connections with them
            if (playerCount > 1)
            {
                for (int i = 0; i < playerCount; i++)
                {
                    CSteamID lobbyMember = SteamMatchmaking.GetLobbyMemberByIndex(lobbyID, i);
                    SteamNetworking.SendP2PPacket(lobbyMember, new byte[] { 255 }, 1, EP2PSend.k_EP2PSendReliable, 0);
                    connectedPlayers.Add(lobbyMember.m_SteamID);

                    if (lobbyMember != SteamUser.GetSteamID())
                    {
                        otherPlayers.Add(lobbyMember.m_SteamID);
                    }
                }
            }

            //Set up network data
            NetworkGameManager.managerID = ulong.Parse(SteamMatchmaking.GetLobbyData(lobbyID, MANAGER_ID));
            NetworkGameManager.playerID  = SteamUser.GetSteamID().m_SteamID;

            connectedPlayers.Add(SteamUser.GetSteamID().m_SteamID);

            MultiplayerChat.chatStrings.Add("This game's manager is " + SteamFriends.GetFriendPersonaName((CSteamID)NetworkGameManager.managerID));
            isInGame = true;
        }
コード例 #7
0
        public void LobbyEntered(LobbyEnter_t enterLobby)
        {
            connectedPlayers.Clear();
            otherPlayers.Clear();
            ResetManagers();
            {
                if (!(RainWorldHK.mainRW.processManager.currentMainLoop is SteamMultiplayerMenu))
                {
                    ProcessManagerHK.ImmediateSwitchCustom(RainWorldHK.mainRW.processManager, new SteamMultiplayerMenu(RainWorldHK.mainRW.processManager));
                }
            }

            joining = false;
            lobbyID = (CSteamID)enterLobby.m_ulSteamIDLobby;
            int playerCount = SteamMatchmaking.GetNumLobbyMembers((CSteamID)enterLobby.m_ulSteamIDLobby);

            MultiplayerChat.AddChat("Entered Lobby!");

            //Send packets to all players, to establish P2P connections with them
            if (playerCount > 1)
            {
                for (int i = 0; i < playerCount; i++)
                {
                    CSteamID lobbyMember = SteamMatchmaking.GetLobbyMemberByIndex(lobbyID, i);
                    SteamNetworking.SendP2PPacket(lobbyMember, new byte[] { 255 }, 1, EP2PSend.k_EP2PSendReliable, 0);
                    SteamNetworking.SendP2PPacket(lobbyMember, new byte[] { 255 }, 1, EP2PSend.k_EP2PSendReliable, 1);
                    SteamNetworking.SendP2PPacket(lobbyMember, new byte[] { 255 }, 1, EP2PSend.k_EP2PSendReliable, 2);
                    if (!connectedPlayers.Contains(lobbyMember.m_SteamID))
                    {
                        connectedPlayers.Add(lobbyMember.m_SteamID);
                        PlayerJoinedManagers(lobbyMember.m_SteamID);
                    }
                    if (lobbyMember != SteamUser.GetSteamID())
                    {
                        otherPlayers.Add(lobbyMember.m_SteamID);
                    }
                }
            }

            //Set up network data
            NetworkGameManager.managerID = ulong.Parse(SteamMatchmaking.GetLobbyData(lobbyID, MANAGER_ID));
            NetworkGameManager.playerID  = SteamUser.GetSteamID().m_SteamID;
            if (NetworkGameManager.managerID != NetworkGameManager.playerID)
            {
                lobbyInfo = new LobbyInfo((CSteamID)enterLobby.m_ulSteamIDLobby);
                lobbyInfo.UpdateLobbyInfo((CSteamID)enterLobby.m_ulSteamIDLobby);
                lobbyInfo.owner = new CSteamID(NetworkGameManager.managerID);
            }

            if (!connectedPlayers.Contains(SteamUser.GetSteamID().m_SteamID))
            {
                connectedPlayers.Add(SteamUser.GetSteamID().m_SteamID);
                PlayerJoinedManagers(SteamUser.GetSteamID().m_SteamID);
            }

            MultiplayerChat.AddChat("This game's manager is " + SteamFriends.GetFriendPersonaName((CSteamID)NetworkGameManager.managerID));
            isInGame = true;
            Log("Entered Lobby! \nThis game's manager is " + SteamFriends.GetFriendPersonaName((CSteamID)NetworkGameManager.managerID));
        }
コード例 #8
0
 private unsafe static void OnJoinLobby(LobbyEnter_t result, bool ioFailure)
 {
     if (!_initialized)
     {
         return;
     }
     lobby?.OnProcessingComplete(result.m_ulSteamIDLobby, (SteamLobbyJoinResult)result.m_EChatRoomEnterResponse);
 }
コード例 #9
0
 void OnLobbyEntered(LobbyEnter_t result)
 {
     currentID = result.m_ulSteamIDLobby;
     if (result.m_EChatRoomEnterResponse == 1)
     {
         print("Lobby joined");
     }
 }
コード例 #10
0
        private void OnLobbyEntered(LobbyEnter_t result, bool failure)
        {
            //IL_001e: Unknown result type (might be due to invalid IL or missing references)
            //IL_002c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0082: Unknown result type (might be due to invalid IL or missing references)
            //IL_0094: Unknown result type (might be due to invalid IL or missing references)
            //IL_00a4: Unknown result type (might be due to invalid IL or missing references)
            //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
            //IL_00ca: Unknown result type (might be due to invalid IL or missing references)
            //IL_00db: Unknown result type (might be due to invalid IL or missing references)
            //IL_0127: Unknown result type (might be due to invalid IL or missing references)
            WeGameHelper.WriteDebugString(" OnLobbyEntered");
            SteamNetworking.AllowP2PPacketRelay(true);
            SendAuthTicket(_lobby.Owner);
            int num = 0;
            P2PSessionState_t val = default(P2PSessionState_t);

            while (SteamNetworking.GetP2PSessionState(_lobby.Owner, ref val) && val.m_bConnectionActive != 1)
            {
                switch (val.m_eP2PSessionError)
                {
                case 2:
                    ClearAuthTicket();
                    return;

                case 1:
                    ClearAuthTicket();
                    return;

                case 3:
                    ClearAuthTicket();
                    return;

                case 5:
                    ClearAuthTicket();
                    return;

                case 4:
                    if (++num > 5)
                    {
                        ClearAuthTicket();
                        return;
                    }
                    SteamNetworking.CloseP2PSessionWithUser(_lobby.Owner);
                    SendAuthTicket(_lobby.Owner);
                    break;
                }
            }
            _connectionStateMap[_lobby.Owner] = ConnectionState.Connected;
            SteamFriends.SetPlayedWith(_lobby.Owner);
            SteamFriends.SetRichPresence("status", Language.GetTextValue("Social.StatusInGame"));
            Main.clrInput();
            Netplay.ServerPassword = "";
            Main.GetInputText("");
            Main.autoPass = false;
            Main.netMode  = 1;
            Netplay.OnConnectedToSocialServer(new SocialSocket(new SteamAddress(_lobby.Owner)));
        }
コード例 #11
0
 void OnLobbyEnter(LobbyEnter_t pCallback)
 {
     if (pCallback.m_EChatRoomEnterResponse == (uint)EChatRoomEnterResponse.k_EChatRoomEnterResponseSuccess)
     {
         Connected  = true;
         LobbyOwner = SteamMatchmaking.GetLobbyOwner(new CSteamID(LobbyID));
         SteamNetworking.SendP2PPacket(LobbyOwner, new byte[1], 1, EP2PSend.k_EP2PSendReliable, 0);
     }
 }
コード例 #12
0
 void ChangeLobbyState(LobbyEnter_t cb)
 {
     if (cb.m_ulSteamIDLobby != 0)
     {
         EnterLobby.gameObject.SetActive(false);
         AvatarSelection.gameObject.SetActive(true);
         Chat.gameObject.SetActive(true);
     }
 }
コード例 #13
0
ファイル: SteamCallback.cs プロジェクト: versus-fm/xna-game
        public static void OnLobbyEntered(LobbyEnter_t lobby)
        {
            var client = ServiceLocator.Get <IClient>();

            client.Lobby = new CSteamID(lobby.m_ulSteamIDLobby);
            client.Host  = SteamMatchmaking.GetLobbyOwner(new CSteamID(lobby.m_ulSteamIDLobby));
            client.UpdateLobbyInformation();
            LuaContext.FireEvent(LuaConstants.STEAM_LOBBY_ENTERED);
        }
コード例 #14
0
        public void OnJoinLobby(LobbyEnter_t pCallback, bool bIOFailure)
        {
            if (!bIOFailure && !SteamCore.InOfflineMode())
            {
                SteamMatches.s_CurrentLobby = new SteamLobby(pCallback.m_ulSteamIDLobby);
            }

            SteamMatches.s_OnJoinLobby.Invoke(bIOFailure);
        }
コード例 #15
0
 void OnLobbyEntered(LobbyEnter_t result)
 {
     if (!isHost)
     {
         networkAddress = SteamMatchmaking.GetLobbyData((CSteamID)result.m_ulSteamIDLobby, "ServerIP");
         awaitMsg.gameObject.SetActive(false);
         StartClient();
     }
 }
コード例 #16
0
 private void OnLobbyJoined(LobbyEnter_t pCallbacks, bool bIOFailure)
 {
     NetworkControl.CreateConnections(lobby);
     if (events.lobby_just_joined != null)
     {
         events.lobby_just_joined.Invoke();
     }
     SendChatMessage(SteamFriends.GetPersonaName() + " Joined the Lobby", false);
     NetworkControl.instance.CheckJoinedLobby();
 }
コード例 #17
0
        public void LobbyEntered(LobbyEnter_t pCallback)
        {
            inLobby = true;
            lobbyID = new CSteamID(pCallback.m_ulSteamIDLobby);

            DiscordManager.instance.SetPartyID(lobbyName);
            DiscordManager.instance.SetLobbyID(pCallback.m_ulSteamIDLobby);
            DiscordManager.instance.SetPartyNumber(SteamMatchmaking.GetNumLobbyMembers(lobbyID));
            DiscordManager.instance.SetPartyMaxNumber(4);
        }
コード例 #18
0
        private void OnLobbyEntered(LobbyEnter_t result, bool failure)
        {
            SteamNetworking.AllowP2PPacketRelay(true);
            this.SendAuthTicket(this._lobby.Owner);
            var num = 0;
            P2PSessionState_t p2PsessionStateT;

            while (SteamNetworking.GetP2PSessionState(this._lobby.Owner, out p2PsessionStateT) &&
                   p2PsessionStateT.m_bConnectionActive != 1)
            {
                switch ((byte)p2PsessionStateT.m_eP2PSessionError)
                {
                case 1:
                    this.ClearAuthTicket();
                    return;

                case 2:
                    this.ClearAuthTicket();
                    return;

                case 3:
                    this.ClearAuthTicket();
                    return;

                case 4:
                    if (++num > 5)
                    {
                        this.ClearAuthTicket();
                        return;
                    }

                    SteamNetworking.CloseP2PSessionWithUser(this._lobby.Owner);
                    this.SendAuthTicket(this._lobby.Owner);
                    continue;

                case 5:
                    this.ClearAuthTicket();
                    return;

                default:
                    continue;
                }
            }

            this._connectionStateMap[this._lobby.Owner] = NetSocialModule.ConnectionState.Connected;
            SteamFriends.SetPlayedWith(this._lobby.Owner);
            SteamFriends.SetRichPresence("status", Language.GetTextValue("Social.StatusInGame"));
            Main.clrInput();
            Netplay.ServerPassword = "";
            Main.GetInputText("");
            Main.autoPass = false;
            Main.netMode  = 1;
            Netplay.OnConnectedToSocialServer(
                (ISocket) new SocialSocket((RemoteAddress) new SteamAddress(this._lobby.Owner)));
        }
コード例 #19
0
ファイル: Lobby.cs プロジェクト: woodcrafter123/place
 private void OnLobbyEntered(LobbyEnter_t result, bool failure)
 {
     if (this.State != LobbyState.Connecting)
     {
         return;
     }
     this.State = !failure ? LobbyState.Active : LobbyState.Inactive;
     this.Id    = new CSteamID((ulong)result.m_ulSteamIDLobby);
     this.Owner = SteamMatchmaking.GetLobbyOwner(this.Id);
     this._lobbyEnterExternalCallback.Invoke(result, failure);
 }
コード例 #20
0
ファイル: InviteFriends.cs プロジェクト: strebern/starwheels
        private void OnLobbyEntered(LobbyEnter_t result)
        {
            _steamLobbyID = (CSteamID)result.m_ulSteamIDLobby;
            Debug.LogFormat("[STEAM] Entered lobby with SteamID {0}", _steamLobbyID.ToString());

            if (!BoltNetwork.IsServer && !BoltNetwork.IsClient)
            {
                Debug.Log("[BOLT] Starting client ...");
                BoltLauncher.StartClient();
            }
        }
コード例 #21
0
    private void OnLobbyEntered(LobbyEnter_t callback)
    {
        if (NetworkServer.active)
        {
            return;
        }

        string hostAddress = SteamMatchmaking.GetLobbyData(new CSteamID(callback.m_ulSteamIDLobby), HOST_ADDRESS_KEY);

        MyNetworkManager.singleton.networkAddress = hostAddress;
        MyNetworkManager.singleton.StartClient();
    }
コード例 #22
0
    private void LoobyEnter(LobbyEnter_t callback)
    {
        if (NetworkServer.active)
        {
            return;
        }
        string hostAddress = SteamMatchmaking.GetLobbyData(new CSteamID(callback.m_ulSteamIDLobby), "HostAddress");

        NetworkManager.singleton.networkAddress = hostAddress;
        NetworkManager.singleton.StartClient();

        mainMenu.SetActive(false);
    }
コード例 #23
0
 void OnLobbyEntered(LobbyEnter_t result)
 {
     ///current_lobbyID = result.m_ulSteamIDLobby;
     Sender.roomid = (CSteamID)result.m_ulSteamIDLobby;
     if (result.m_EChatRoomEnterResponse == 1)
     {
         SwitchToMenu02();
     }
     else
     {
         Debug.Log("Failed to join lobby.");
     }
 }
コード例 #24
0
    void OnLobbyEntered(LobbyEnter_t result)
    {
        current_lobbyID = result.m_ulSteamIDLobby;

        if (result.m_EChatRoomEnterResponse == 1)
        {
            Debug.Log("Lobby joined!");
        }
        else
        {
            Debug.Log("Failed to join lobby.");
        }
    }
コード例 #25
0
            private void OnLobbyEntered(LobbyEnter_t result)
            {
                current_lobbyID = result.m_ulSteamIDLobby;

                if (result.m_EChatRoomEnterResponse == 1)
                {
                    Console.WriteLine("Lobby joined!");
                }
                else
                {
                    Console.WriteLine("Failed to join lobby.");
                }
            }
    private void OnLobbyEntered(LobbyEnter_t pCallback, bool ioFailed)
    {
        Debug.Log("enter room success");

        m_LobbyId = new CSteamID(pCallback.m_ulSteamIDLobby);

        var lobbyname = SteamMatchmaking.GetLobbyData(m_LobbyId, "name");

        Debug.Log("lobbyname: " + lobbyname);
        GameObject.Find("LobbyPanel").GetComponent <LobbyPanel>().createLobby(lobbyname);
        m_IsInLobby = true;
        UpdateLobby();
    }
コード例 #27
0
        // SteamAPICall_t
        public CallbackHandle JoinLobby(CSteamID steamIDLobby /*class CSteamID*/, Action <LobbyEnter_t, bool> CallbackFunction = null /*Action<LobbyEnter_t, bool>*/)
        {
            SteamAPICall_t callback = 0;

            callback = platform.ISteamMatchmaking_JoinLobby(steamIDLobby.Value);

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

            return(LobbyEnter_t.CallResult(steamworks, callback, CallbackFunction));
        }
コード例 #28
0
ファイル: Lobby.cs プロジェクト: LucasMess/PlatformerGame
 private static void OnLobbyEntered(LobbyEnter_t result)
 {
     LobbyId   = result.m_ulSteamIDLobby;
     IsInLobby = true;
     Session.Join(SteamMatchmaking.GetLobbyOwner(new CSteamID(LobbyId)));
     if (TMBAW_Game.CurrentGameState != GameState.MainMenu)
     {
         TMBAW_Game.GoToMainMenu();
     }
     MainMenu.CurrentMenuState = MainMenu.MenuState.MultiplayerLobby;
     Console.WriteLine("Entered lobby with id: " + LobbyId);
     OnLobbyChatUpdate(new LobbyChatUpdate_t());
 }
コード例 #29
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;
     }
 }
コード例 #30
0
        private void onLobbyEnter(LobbyEnter_t pCallback)
        {
            CSteamID lobbyID = new CSteamID(pCallback.m_ulSteamIDLobby);

            if (!(SteamMatchmaking.GetLobbyOwner(lobbyID) == SteamUser.GetSteamID()))
            {
                lobbyRequested = parseConnectionString(SteamMatchmaking.GetLobbyData(lobbyID, "connect"));
                SteamMatchmaking.LeaveLobby(lobbyID);
                if (lobbyRequested != null)
                {
                    Game1.multiplayer.inviteAccepted();
                }
            }
        }