public void OnChatMsg(LobbyChatMsg_t pCallback) { CSteamID sender; EChatEntryType entryType; byte[] pvData = new byte[4096]; SteamMatchmaking.GetLobbyChatEntry( (CSteamID)pCallback.m_ulSteamIDLobby, (int)pCallback.m_iChatID, out sender, pvData, pvData.Length, out entryType ); if (SteamMatches.s_OnChatMsg != null) { string msg = StringHelper.GetString(pvData); var id = sender.m_SteamID; string name = SteamFriends.GetFriendPersonaName(sender); SteamMatches.s_OnChatMsg.Invoke(msg, id, name); } }
void OnLobbyChatMsg(LobbyChatMsg_t lobbyChatMsg_T) { CSteamID Sayer; byte[] hua = new byte[4096]; EChatEntryType ctype; if (Sender.roomid == (CSteamID)lobbyChatMsg_T.m_ulSteamIDLobby) { SteamMatchmaking.GetLobbyChatEntry(Sender.roomid, (int)lobbyChatMsg_T.m_iChatID, out Sayer, hua, hua.Length, out ctype); Bond.IO.Safe.InputBuffer inputBuffer = new Bond.IO.Safe.InputBuffer(hua); Bond.Protocols.CompactBinaryReader <Bond.IO.Safe.InputBuffer> compactBinaryReader = new Bond.Protocols.CompactBinaryReader <Bond.IO.Safe.InputBuffer>(inputBuffer); theword = Deserialize <UserWord> .From(compactBinaryReader); foreach (GameObject a in ULS.UDs) { if (a.GetComponent <UserDetailScript>().ido(Sayer)) { a.GetComponent <UserDetailScript>().ClassWork(theword.myWord); theword = null; return; } } } }
private void OnLobbyChatMsg(LobbyChatMsg_t pCallback) { CSteamID SteamIDUser; byte[] Data = new byte[4096]; EChatEntryType ChatEntryType; int ret = SteamMatchmaking.GetLobbyChatEntry((CSteamID)pCallback.m_ulSteamIDLobby, (int)pCallback.m_iChatID, out SteamIDUser, Data, Data.Length, out ChatEntryType); if (DebugTextOn) { Debug.Log("SteamMatchmaking.GetLobbyChatEntry(" + (CSteamID)pCallback.m_ulSteamIDLobby + ", " + (int)pCallback.m_iChatID + ", out SteamIDUser, Data, Data.Length, out ChatEntryType) : " + ret + " -- " + SteamIDUser + " -- " + System.Text.Encoding.UTF8.GetString(Data) + " -- " + ChatEntryType); } //create a new lobby chat and add it to the chat message list LobbyChatMessageValue _chat = new LobbyChatMessageValue(); _chat.steamPersonaName = SteamFriends.GetFriendPersonaName(SteamIDUser); _chat.message = System.Text.Encoding.UTF8.GetString(Data); m_Lobby.m_ChatMessages.Add(_chat); if (DebugTextOn) { Debug.Log("Chat Messages Total: " + m_Lobby.m_ChatMessages.Count + "| Newest Message: " + _chat.message); } }
void OnLobbyChatMsg(LobbyChatMsg_t pCallback) { Debug.Log("[" + LobbyChatMsg_t.k_iCallback + " - LobbyChatMsg] - " + pCallback.m_ulSteamIDLobby + " -- " + pCallback.m_ulSteamIDUser + " -- " + pCallback.m_eChatEntryType + " -- " + pCallback.m_iChatID); CSteamID SteamIDUser; byte[] Data = new byte[4096]; EChatEntryType ChatEntryType; int ret = SteamMatchmaking.GetLobbyChatEntry((CSteamID)pCallback.m_ulSteamIDLobby, (int)pCallback.m_iChatID, out SteamIDUser, Data, Data.Length, out ChatEntryType); Debug.Log("SteamMatchmaking.GetLobbyChatEntry(" + (CSteamID)pCallback.m_ulSteamIDLobby + ", " + (int)pCallback.m_iChatID + ", out SteamIDUser, Data, Data.Length, out ChatEntryType) : " + ret + " -- " + SteamIDUser + " -- " + System.Text.Encoding.UTF8.GetString(Data) + " -- " + ChatEntryType); }
public byte[] GetMessage(int index) { CSteamID csteamId; EChatEntryType echatEntryType; int lobbyChatEntry = SteamMatchmaking.GetLobbyChatEntry(this.Id, index, ref csteamId, this._messageBuffer, this._messageBuffer.Length, ref echatEntryType); byte[] numArray = new byte[lobbyChatEntry]; Array.Copy((Array)this._messageBuffer, (Array)numArray, lobbyChatEntry); return(numArray); }
public byte[] GetMessage(int index) { CSteamID pSteamIDUser; EChatEntryType peChatEntryType; int lobbyChatEntry = SteamMatchmaking.GetLobbyChatEntry(Id, index, out pSteamIDUser, _messageBuffer, _messageBuffer.Length, out peChatEntryType); byte[] array = new byte[lobbyChatEntry]; Array.Copy(_messageBuffer, array, lobbyChatEntry); return(array); }
public byte[] GetMessage(int index) { CSteamID cSteamID; EChatEntryType eChatEntryType; int lobbyChatEntry = SteamMatchmaking.GetLobbyChatEntry(this.Id, index, out cSteamID, this._messageBuffer, (int)this._messageBuffer.Length, out eChatEntryType); byte[] numArray = new byte[lobbyChatEntry]; Array.Copy(this._messageBuffer, numArray, lobbyChatEntry); return(numArray); }
/*public void Join(CSteamID lobbyId, APIDispatchDelegate<LobbyEnter_t> callResult) * { * //IL_0017: Unknown result type (might be due to invalid IL or missing references) * //IL_0018: Unknown result type (might be due to invalid IL or missing references) * //IL_001d: 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) * if (State == LobbyState.Inactive) * { * State = LobbyState.Connecting; * _lobbyEnterExternalCallback = callResult; * SteamAPICall_t val = SteamMatchmaking.JoinLobby(lobbyId); * _lobbyEnter.Set(val, (APIDispatchDelegate<LobbyEnter_t>)null); * } * }*/ public byte[] GetMessage(int index) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) CSteamID val = default(CSteamID); EChatEntryType val2 = default(EChatEntryType); int lobbyChatEntry = SteamMatchmaking.GetLobbyChatEntry(Id, index, out val, _messageBuffer, _messageBuffer.Length, out val2); byte[] array = new byte[lobbyChatEntry]; Array.Copy(_messageBuffer, array, lobbyChatEntry); return(array); }
private void OnLobbyChatMessage(LobbyChatMsg_t message) { byte[] messageData = new byte[32]; SteamMatchmaking.GetLobbyChatEntry(global.global_lobbyID, (int)message.m_iChatID, out CSteamID user, messageData, messageData.Length, out EChatEntryType type); string messageString = System.Text.Encoding.UTF8.GetString(messageData); chatBox.AddText("\n" + SteamFriends.GetFriendPersonaName((CSteamID)message.m_ulSteamIDUser) + ": " + messageString); if (messageString.Contains("CONTINUE_SESSION") && (CSteamID)message.m_ulSteamIDUser == global.player1) { GetTree().ChangeScene("Scenes/game.tscn"); } }
private void OnLobbyChatMsg(LobbyChatMsg_t pCallback) { CSteamID SteamIDUser; var Data = new byte[4096]; EChatEntryType ChatEntryType; var ret = SteamMatchmaking.GetLobbyChatEntry((CSteamID)pCallback.m_ulSteamIDLobby, (int)pCallback.m_iChatID, out SteamIDUser, Data, Data.Length, out ChatEntryType); chatstring = Encoding.Default.GetString(Data); if (lobby_chat_msg_recevied != null) { lobby_chat_msg_recevied.Invoke(chatstring); } }
/// <summary> /// Called when the lobby receives a message. /// </summary> /// <param name="pCallback"></param> private void OnLobbyMessaged(LobbyChatMsg_t pCallback) { if (NetLogFilter.logInfo) { Debug.Log($"Recieved message from {SteamFriends.GetFriendPersonaName(new CSteamID(pCallback.m_ulSteamIDUser))}. ({Time.time})"); } byte[] msg = new byte[1024]; SteamMatchmaking.GetLobbyChatEntry(network.LocalConnection.LobbyID, (int)pCallback.m_iChatID, out CSteamID id, msg, msg.Length, out EChatEntryType type); var segment = new ArraySegment <byte>(msg); var incMsg = MessageHelper.FromBytes(segment, network.LocalConnection.connectedPeers[id]); OnLobbyMessageReceived(incMsg); }
void ReceiveChatMessage(LobbyChatMsg_t cb) { CSteamID user; EChatEntryType chatType; int dataLenght = SteamMatchmaking.GetLobbyChatEntry((CSteamID)cb.m_ulSteamIDLobby, (int)cb.m_iChatID, out user, chatData, chatData.Length, out chatType); string name = SteamFriends.GetFriendPersonaName(user); if (chatType == EChatEntryType.k_EChatEntryTypeChatMsg) { int n; string message = ByteManipulator.ReadString(chatData, 0, encoder, out n); Text.text += "\n" + name + " : " + message; } }
void ReceiveChatMessage(LobbyChatMsg_t cb) { CSteamID user; byte[] data = new byte[4096]; EChatEntryType chatType; int dataLenght = SteamMatchmaking.GetLobbyChatEntry((CSteamID)cb.m_ulSteamIDLobby, (int)cb.m_iChatID, out user, data, data.Length, out chatType); string name = SteamFriends.GetFriendPersonaName(user); if (chatType == EChatEntryType.k_EChatEntryTypeChatMsg) { string message = Encoding.UTF8.GetString(data, 0, dataLenght); Text.text += "\n" + name + " : " + message; } }
void OnLobbyChatMsg(LobbyChatMsg_t pCallback) { // Debug.Log("[" + LobbyChatMsg_t.k_iCallback + " - LobbyChatMsg] - " + pCallback.m_ulSteamIDLobby + " -- " + pCallback.m_ulSteamIDUser + " -- " + pCallback.m_eChatEntryType + " -- " + pCallback.m_iChatID); CSteamID SteamIDUser; byte[] Data = new byte[4096]; EChatEntryType ChatEntryType; int ret = SteamMatchmaking.GetLobbyChatEntry((CSteamID)pCallback.m_ulSteamIDLobby, (int)pCallback.m_iChatID, out SteamIDUser, Data, Data.Length, out ChatEntryType); // Debug.Log("SteamMatchmaking.GetLobbyChatEntry(" + (CSteamID)pCallback.m_ulSteamIDLobby + ", " + (int)pCallback.m_iChatID + ", out SteamIDUser, Data, Data.Length, out ChatEntryType) : " + ret + " -- " + SteamIDUser + " -- " + System.Text.Encoding.UTF8.GetString(Data) + " -- " + ChatEntryType); LobbyChatMessageValue _chat = new LobbyChatMessageValue(); _chat.steamPersonaName = SteamFriends.GetFriendPersonaName(SteamIDUser); _chat.message = System.Text.Encoding.UTF8.GetString(Data); m_ChatMessages.Add(_chat); Debug.Log("Chat Messages Total: " + m_ChatMessages.Count + "| Newest Message: " + _chat.message); //clear the chat lobbyChatMessage = ""; }
private void OnLobbyChatMsg(LobbyChatMsg_t result) { byte[] data = new byte[4096]; CSteamID senderID; EChatEntryType eChatEntryType; SteamMatchmaking.GetLobbyChatEntry(_steamLobbyID, (int)result.m_iChatID, out senderID, data, data.Length, out eChatEntryType); Debug.LogFormat("[STEAM] Received message : {0} {1}", Encoding.UTF8.GetString(data, 0, _lobbyKickAllFlag.Length), "."); Debug.Log("[STEAM] Length : " + Encoding.UTF8.GetString(data, 0, _lobbyKickAllFlag.Length).Length + "."); if (Encoding.UTF8.GetString(data, 0, _lobbyKickAllFlag.Length).Equals(_lobbyKickAllFlag)) { Debug.Log("[STEAM] Received SteamKicked event."); QuitSteamLobby(); if (BoltNetwork.IsClient || BoltNetwork.IsServer) { BoltLauncher.Shutdown(); } } }
private void processLobbyMessage(LobbyChatMsg_t msg) { Debug.Log("Retrieving message " + msg.m_iChatID.ToString() + " for Lobby#" + msg.m_ulSteamIDLobby); CSteamID steamLobbyMessageSenderId; // Will be set by SteamMatchmaking.GetLobbyChatEntry() byte[] chatMessageAsBytes = new byte[256]; // Will be passed to SteamMatchmaking.GetLobbyChatEntry() EChatEntryType chatEntryType; // Will be set by SteamMatchmaking.GetLobbyChatEntry() // Check there is an active lobby var activeLobby = SteamHub.LobbyActive; if (activeLobby == null) { return; } // See if message is to our active lobby if ((CSteamID)msg.m_ulSteamIDLobby != activeLobby.LobbyId) { Debug.Log("Not our active lobby so ignoring"); return; } int messageLengthInBytes = SteamMatchmaking.GetLobbyChatEntry(activeLobby.LobbyId, (int)msg.m_iChatID, // TODO: CHECK FOR OVERFLOW out steamLobbyMessageSenderId, chatMessageAsBytes, chatMessageAsBytes.Length, out chatEntryType); string chatMessageAsString = Encoding.ASCII.GetString(chatMessageAsBytes, 0, messageLengthInBytes); Debug.Log("Chat message is " + chatMessageAsString); if (chatMessageAsString.StartsWith(KICK_LOBBY_MESSAGE_COMMAND)) { ulong userIdToKick = ulong.Parse(chatMessageAsString.Substring(KICK_LOBBY_MESSAGE_COMMAND.Length)); Debug.Log("KICK COMMAND: KICK USER#" + userIdToKick.ToString()); // Check if KICK was sent by Lobby owner if (msg.m_ulSteamIDUser == activeLobby.OwnerId.m_SteamID) { Debug.Log("KICK COMMAND: SENT BY LOBBY OWNER OK #" + msg.m_ulSteamIDUser); if (userIdToKick == SteamUser.GetSteamID().m_SteamID) { Debug.Log("KICK COMMAND: WE HAVE BEEN KICKED BY LOBBY OWNER OK #" + msg.m_ulSteamIDUser); ui_do_leaveLobby(); } } else { Debug.Log("KICK COMMAND IGNORED - WAS SENT BY NON-OWNER #" + msg.m_ulSteamIDUser); } return; } if (chatMessageAsString.StartsWith("enteredGame")) { ulong userIdEnteredGame = ulong.Parse(chatMessageAsString.Substring(11)); Debug.Log("ENTERED GAME: " + userIdEnteredGame); SteamHub.LobbyActive.SetData <string>(userIdEnteredGame.ToString(), "true"); return; } noMessagesHint.SetActive(false); GameObject chatMessage = (GameObject)Instantiate(chatMessagePrefab, new Vector3(1, 1, 1), Quaternion.identity); chatMessage.transform.SetParent(chatBox.transform, false); // lobbyRow.transform.localScale = new Vector3(1, 1, 1); chatMessage.GetComponent <Text>().text = chatMessageAsString; chatMessage.name = "Lobby message for Lobby ID #" + SteamHub.LobbyActive.LobbyId.ToString(); }