示例#1
0
 internal JoinLobbyCallback(JobID jobId, uint appId, EChatRoomEnterResponse res, Lobby?lobby)
 {
     JobID = jobId;
     AppID = appId;
     ChatRoomEnterResponse = res;
     Lobby = lobby;
 }
示例#2
0
            internal ChatEnterCallback(MsgClientChatEnter msg)
            {
                ChatID   = msg.SteamIdChat;
                FriendID = msg.SteamIdFriend;

                ChatRoomType = msg.ChatRoomType;

                OwnerID = msg.SteamIdOwner;
                ClanID  = msg.SteamIdClan;

                ChatFlags = msg.ChatFlags;

                EnterResponse = msg.EnterResponse;
            }
    private void OnLobbyEnter(LobbyEnter_t callback)
    {
        if (!SteamManager.Initialized)
        {
            return;
        }
        if (this.m_LobbyId != (CSteamID)callback.m_ulSteamIDLobby)
        {
            this.m_LobbyId = new CSteamID(callback.m_ulSteamIDLobby);
        }
        CSteamID lobbyOwner = SteamMatchmaking.GetLobbyOwner(this.m_LobbyId);

        this.m_LobbyOwner = lobbyOwner;
        CSteamID steamID = SteamUser.GetSteamID();

        if (lobbyOwner.m_SteamID == steamID.m_SteamID)
        {
            if (P2PLogFilter.logInfo)
            {
                Debug.Log("[TransportLayerSteam] Connected to Steam lobby as owner");
            }
            SteamMatchmaking.SetLobbyData(this.m_LobbyId, "game_ver", GreenHellGame.s_GameVersion.ToString());
            SteamMatchmaking.SetLobbyData(this.m_LobbyId, "name", SteamFriends.GetPersonaName());
            SteamMatchmaking.SetLobbyMemberData(this.m_LobbyId, "member_name", SteamFriends.GetPersonaName());
            SteamMatchmaking.SetLobbyData(this.m_LobbyId, "lobby_type", EnumUtils <P2PGameVisibility> .GetName(this.GetGameVisibility()));
            P2PTransportLayer.OnLobbyEnter(true);
            return;
        }
        if (callback.m_EChatRoomEnterResponse == 1u)
        {
            if (P2PLogFilter.logInfo)
            {
                Debug.Log(string.Format("[TransportLayerSteam] Connected to Steam lobby {0} as member", this.m_LobbyId));
            }
            this.m_JoiningDelayed = this.RequestP2PConnectionWithHost();
            SteamMatchmaking.SetLobbyMemberData(this.m_LobbyId, "member_name", SteamFriends.GetPersonaName());
            P2PTransportLayer.OnLobbyEnter(false);
            return;
        }
        if (P2PLogFilter.logWarn)
        {
            string str = "[TransportLayerSteam] Lobby enter failure: ";
            EChatRoomEnterResponse echatRoomEnterResponse = (EChatRoomEnterResponse)callback.m_EChatRoomEnterResponse;
            Debug.LogWarning(str + echatRoomEnterResponse.ToString());
        }
        this.Shutdown();
    }
示例#4
0
    // Callback for Matchmaking JoinLobby
    private void OnLobbyJoin(LobbyEnter_t lobbyEnter)
    {
        m_lobbyID = new CSteamID(lobbyEnter.m_ulSteamIDLobby);
        EChatRoomEnterResponse response = (EChatRoomEnterResponse)lobbyEnter.m_EChatRoomEnterResponse;

        print("joined lobby waiting to test 3secs...");

        string hostSteamID = SteamMatchmaking.GetLobbyData(m_lobbyID, "Host");
        ulong  steamid     = ulong.Parse(hostSteamID);

        int neededPlayers = int.Parse(SteamMatchmaking.GetLobbyData(m_lobbyID, "NeededPlayers"));
        int playerCount   = SteamMatchmaking.GetNumLobbyMembers(m_lobbyID);

        SteamMatchmaking.SetLobbyMemberData(m_lobbyID, "cid", ClientPlayer.Singleton.Cid.ToString());

        Match.InitMatch();

        Match.NetworkLobby.SetSteamIDToConnect(steamid);
        Match.MatchSettings = new MatchSettings(BallersGamemode.SP_BOTS, 5, 60.0f * 6.0f, 4);
        Match.PlayersNeeded = int.Parse(SteamMatchmaking.GetLobbyData(m_lobbyID, "NeededPlayers"));;
        Match.MatchID       = 1;

        if (steamid == ClientPlayer.Singleton.SteamID)
        {
            Match.HostServer = true;
            //Match.AddPlayer(steamid, ClientPlayer.Singleton.Cid);
            //StartCoroutine(Test());
        }
//         Debug.Log($"{playerCount} / {neededPlayers}");
//         if (playerCount >= neededPlayers)
//         {
//             Debug.Log($"Required players met. Starting...");
//             m_matchSetup.Setup(Match.HostID);
//         }


        ClientPlayer.Singleton.State = ServerPlayerState.JOINED;

        // FOR DEBUGGING
        //m_matchSetup.Setup(lobbyEnter, steamid);
    }
	void OnLobbyEnter(LobbyEnter_t pCallback, bool bIOFailure) {
		if (bIOFailure) {
			ESteamAPICallFailure reason = SteamUtils.GetAPICallFailureReason(m_LobbyEnterCallResult.Handle);
			Debug.LogError("OnLobbyEnter encountered an IOFailure due to: " + reason);
			return; // TODO: Recovery
		}

		Debug.Log("[" + LobbyEnter_t.k_iCallback + " - LobbyEnter] - " + pCallback.m_ulSteamIDLobby + " -- " + pCallback.m_rgfChatPermissions + " -- " + pCallback.m_bLocked + " -- " + (EChatRoomEnterResponse)pCallback.m_EChatRoomEnterResponse);
		
		m_LobbyEnterResponse = (EChatRoomEnterResponse)pCallback.m_EChatRoomEnterResponse;
		
		if(m_LobbyEnterResponse != EChatRoomEnterResponse.k_EChatRoomEnterResponseSuccess) {
			ChangeState(EChatClientState.FailedToJoin);
			return;
		}
		
		m_CurrentLobby.m_SteamID = (CSteamID)pCallback.m_ulSteamIDLobby;
		m_CurrentLobby.m_Members = new LobbyMembers[SteamMatchmaking.GetNumLobbyMembers(m_CurrentLobby.m_SteamID)];
		m_CurrentLobby.m_MemberLimit = SteamMatchmaking.GetLobbyMemberLimit(m_CurrentLobby.m_SteamID);

		ChangeState(EChatClientState.InLobby);
	}
示例#6
0
            internal ChatEnterCallback( MsgClientChatEnter msg )
            {
                ChatID = msg.SteamIdChat;
                FriendID = msg.SteamIdFriend;

                ChatRoomType = msg.ChatRoomType;

                OwnerID = msg.SteamIdOwner;
                ClanID = msg.SteamIdClan;

                ChatFlags = msg.ChatFlags;

                EnterResponse = msg.EnterResponse;
            }
		public void Deserialize( Stream stream )
		{
			BinaryReader br = new BinaryReader( stream );

			steamIdChat = br.ReadUInt64();
			steamIdFriend = br.ReadUInt64();
			ChatRoomType = (EChatRoomType)br.ReadInt32();
			steamIdOwner = br.ReadUInt64();
			steamIdClan = br.ReadUInt64();
			ChatFlags = br.ReadByte();
			EnterResponse = (EChatRoomEnterResponse)br.ReadInt32();
		}
		public MsgClientChatEnter()
		{
			steamIdChat = 0;
			steamIdFriend = 0;
			ChatRoomType = 0;
			steamIdOwner = 0;
			steamIdClan = 0;
			ChatFlags = 0;
			EnterResponse = 0;
		}