protected virtual void OnLobbyChatMessage(LobbyChatMsg_t result) { if (result.m_ulSteamIDLobby != this._lobby.Id.m_SteamID || result.m_eChatEntryType != 1 || result.m_ulSteamIDUser != this._lobby.Owner.m_SteamID) { return; } byte[] message = this._lobby.GetMessage((int)result.m_iChatID); if (message.Length == 0) { return; } using (MemoryStream memoryStream = new MemoryStream(message)) { using (BinaryReader binaryReader = new BinaryReader((Stream)memoryStream)) { if ((int)binaryReader.ReadByte() != 1) { return; } while ((long)message.Length - memoryStream.Position >= 8L) { // ISSUE: explicit reference operation CSteamID userId = (CSteamID)binaryReader.ReadUInt64(); if (userId != SteamUser.GetSteamID()) { this._lobby.SetPlayedWith(userId); } } } } }
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); } }
private unsafe void OnLobbyChatMessageRecievedAPI(LobbyChatMsg_t callback, bool error) { //from Client.Networking if (error || callback.SteamIDLobby != CurrentLobby) { return; } byte[] ReceiveBuffer = new byte[1024]; SteamNative.CSteamID steamid = 1; ChatEntryType chatEntryType; //not used int readData = 0; fixed(byte *p = ReceiveBuffer) { readData = client.native.matchmaking.GetLobbyChatEntry(CurrentLobby, (int)callback.ChatID, out steamid, (IntPtr)p, ReceiveBuffer.Length, out chatEntryType); while (ReceiveBuffer.Length < readData) { ReceiveBuffer = new byte[readData + 1024]; readData = client.native.matchmaking.GetLobbyChatEntry(CurrentLobby, (int)callback.ChatID, out steamid, (IntPtr)p, ReceiveBuffer.Length, out chatEntryType); } } if (OnChatMessageRecieved != null) { OnChatMessageRecieved(steamid, ReceiveBuffer, readData); } }
protected virtual void OnLobbyChatMessage(LobbyChatMsg_t result) { if (result.m_ulSteamIDLobby != this._lobby.Id.m_SteamID || result.m_eChatEntryType != 1 || result.m_ulSteamIDUser != this._lobby.Owner.m_SteamID) { return; } var message = this._lobby.GetMessage((int)result.m_iChatID); if (message.Length == 0) { return; } using (var memoryStream = new MemoryStream(message)) { using (var binaryReader = new BinaryReader((Stream)memoryStream)) { if (binaryReader.ReadByte() != (byte)1) { return; } while ((long)message.Length - memoryStream.Position >= 8L) { var userId = new CSteamID(binaryReader.ReadUInt64()); if (userId != SteamUser.GetSteamID()) { this._lobby.SetPlayedWith(userId); } } } } }
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; } } } }
protected virtual void OnLobbyChatMessage(LobbyChatMsg_t result) { if (result.m_ulSteamIDLobby != this._lobby.Id.m_SteamID || result.m_eChatEntryType != 1 || result.m_ulSteamIDUser != this._lobby.Owner.m_SteamID) { return; } byte[] message = this._lobby.GetMessage((int)result.m_iChatID); if (message.Length == 0) { return; } using (MemoryStream memoryStream = new MemoryStream(message)) { using (BinaryReader binaryReader = new BinaryReader((Stream)memoryStream)) { if (binaryReader.ReadByte() != (byte)1) { return; } while ((long)message.Length - memoryStream.Position >= 8L) { CSteamID userId; ((CSteamID) ref userId).\u002Ector(binaryReader.ReadUInt64()); if (CSteamID.op_Inequality(userId, SteamUser.GetSteamID())) { this._lobby.SetPlayedWith(userId); } } } } }
private void OnLobbyChatMessage(LobbyChatMsg_t pCallback) { if (C.LOG_INVITE) { Debug.Log("Teambuilder chat ping"); } }
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); } }
protected virtual void OnLobbyChatMessage(LobbyChatMsg_t result) { if (result.m_ulSteamIDLobby == _lobby.Id.m_SteamID && result.m_eChatEntryType == 1 && result.m_ulSteamIDUser == _lobby.Owner.m_SteamID) { byte[] message = _lobby.GetMessage((int)result.m_iChatID); if (message.Length != 0) { using (MemoryStream memoryStream = new MemoryStream(message)) { using (BinaryReader binaryReader = new BinaryReader(memoryStream)) { byte b = binaryReader.ReadByte(); byte b2 = b; if (b2 == 1) { while (message.Length - memoryStream.Position >= 8) { CSteamID cSteamID = new CSteamID(binaryReader.ReadUInt64()); if (cSteamID != SteamUser.GetSteamID()) { _lobby.SetPlayedWith(cSteamID); } } } } } } } }
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); }
static private unsafe void OnLobbyChatMessageRecievedAPI(LobbyChatMsg_t callback) { SteamId steamid = default; ChatEntryType chatEntryType = default; var buffer = Helpers.TakeMemory(); var readData = Internal.GetLobbyChatEntry(callback.SteamIDLobby, (int)callback.ChatID, ref steamid, buffer, Helpers.MemoryBufferSize, ref chatEntryType); if (readData > 0) { OnChatMessage?.Invoke(new Lobby(callback.SteamIDLobby), new Friend(steamid), Helpers.MemoryToString(buffer)); } }
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 unsafe void OnLobbyChatMessageRecievedAPI(LobbyChatMsg_t callback, bool error) { //from Client.Networking if (error || callback.SteamIDLobby != CurrentLobby) { return; } SteamNative.CSteamID steamid = 1; ChatEntryType chatEntryType; // "If set then this will just always return k_EChatEntryTypeChatMsg. This can usually just be set to NULL." int readData = 0; fixed(byte *p = chatMessageData) { readData = client.native.matchmaking.GetLobbyChatEntry(CurrentLobby, (int)callback.ChatID, out steamid, (IntPtr)p, chatMessageData.Length, out chatEntryType); } OnChatMessageRecieved?.Invoke(steamid, chatMessageData, readData); OnChatStringRecieved?.Invoke(steamid, Encoding.UTF8.GetString(chatMessageData)); }
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(); } } }
protected virtual void OnLobbyChatMessage(LobbyChatMsg_t result) { if (result.m_ulSteamIDLobby != this._lobby.Id.m_SteamID) { return; } if (result.m_eChatEntryType != 1) { return; } if (result.m_ulSteamIDUser != this._lobby.Owner.m_SteamID) { return; } byte[] message = this._lobby.GetMessage((int)result.m_iChatID); if ((int)message.Length == 0) { return; } using (MemoryStream memoryStream = new MemoryStream(message)) { using (BinaryReader binaryReader = new BinaryReader(memoryStream)) { if (binaryReader.ReadByte() == 1) { while ((long)((int)message.Length) - memoryStream.Position >= (long)8) { CSteamID cSteamID = new CSteamID(binaryReader.ReadUInt64()); if (cSteamID == SteamUser.GetSteamID()) { continue; } this._lobby.SetPlayedWith(cSteamID); } } } } }
protected virtual void OnLobbyChatMessage(LobbyChatMsg_t result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (result.m_ulSteamIDLobby != _lobby.Id.m_SteamID || result.m_eChatEntryType != 1 || result.m_ulSteamIDUser != _lobby.Owner.m_SteamID) { return; } byte[] message = _lobby.GetMessage((int)result.m_iChatID); if (message.Length == 0) { return; } using MemoryStream memoryStream = new MemoryStream(message); using BinaryReader binaryReader = new BinaryReader(memoryStream); byte b = binaryReader.ReadByte(); if (b != 1) { return; } CSteamID val = default(CSteamID); while (message.Length - memoryStream.Position >= 8) { val = new CSteamID(binaryReader.ReadUInt64()); if (val != SteamUser.GetSteamID()) { _lobby.SetPlayedWith(val); } } }
protected virtual void OnLobbyChatMessage(LobbyChatMsg_t result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (result.m_ulSteamIDLobby == _lobby.Id.m_SteamID && result.m_eChatEntryType == 1 && result.m_ulSteamIDUser == _lobby.Owner.m_SteamID) { byte[] message = _lobby.GetMessage((int)result.m_iChatID); if (message.Length != 0) { using (MemoryStream memoryStream = new MemoryStream(message)) { using (BinaryReader binaryReader = new BinaryReader(memoryStream)) { byte b = binaryReader.ReadByte(); if (b == 1) { CSteamID val = default(CSteamID); while (message.Length - memoryStream.Position >= 8) { ((CSteamID)(ref val))._002Ector(binaryReader.ReadUInt64()); if (val != SteamUser.GetSteamID()) { _lobby.SetPlayedWith(val); } } } } } } } }
private void MyCallbacks_LobbyChatMessage(LobbyChatMsg_t chatMsg) { // Debug.Log("MyCallbacks_LobbyChatMessage"); processLobbyMessage(chatMsg); }
public void LobbyChatMsg(LobbyChatMsg_t message) { }
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(); }
private void OnLobbyChatMsg(LobbyChatMsg_t result) { }