static unsafe void OnFriendChatMessage(GameConnectedFriendChatMsg_t data) { if (OnChatMessage == null) { return; } var friend = new Friend(data.SteamIDUser); var buffer = Helpers.TakeBuffer(1024 * 32); var type = ChatEntryType.ChatMsg; fixed(byte *ptr = buffer) { var len = Internal.GetFriendMessage(data.SteamIDUser, data.MessageID, (IntPtr)ptr, buffer.Length, ref type); if (len == 0 && type == ChatEntryType.Invalid) { return; } var typeName = type.ToString(); var message = Encoding.UTF8.GetString(buffer, 0, len); OnChatMessage(friend, typeName, message); } }
internal static void InstallEvents() { FriendStateChange_t.Install(x => OnPersonaStateChange?.Invoke(new Friend(x.SteamID))); GameRichPresenceJoinRequested_t.Install(x => OnGameRichPresenceJoinRequested?.Invoke(new Friend(x.SteamIDFriend), x.Connect)); GameConnectedFriendChatMsg_t.Install(OnFriendChatMessage); GameOverlayActivated_t.Install(x => OnGameOverlayActivated?.Invoke()); GameServerChangeRequested_t.Install(x => OnGameServerChangeRequested?.Invoke(x.Server, x.Password)); GameLobbyJoinRequested_t.Install(x => OnGameLobbyJoinRequested?.Invoke(x.SteamIDLobby, x.SteamIDFriend)); FriendRichPresenceUpdate_t.Install(x => OnFriendRichPresenceUpdate?.Invoke(new Friend(x.SteamIDFriend))); }
static unsafe void OnFriendChatMessage(GameConnectedFriendChatMsg_t data) { if (OnChatMessage == null) { return; } var friend = new Friend(data.SteamIDUser); var buffer = Helpers.TakeMemory(); var type = ChatEntryType.ChatMsg; var len = Internal.GetFriendMessage(data.SteamIDUser, data.MessageID, buffer, Helpers.MemoryBufferSize, ref type); if (len == 0 && type == ChatEntryType.Invalid) { return; } var typeName = type.ToString(); var message = Helpers.MemoryToString(buffer); OnChatMessage(friend, typeName, message); }
private static unsafe void OnFriendChatMessage(GameConnectedFriendChatMsg_t data) { // // Current member / type: System.Void Steamworks.SteamFriends::OnFriendChatMessage(Steamworks.Data.GameConnectedFriendChatMsg_t) // File path: D:\GameServers\Rust\RustDedicated_Data\Managed\Facepunch.Steamworks.dll // // Product version: 2019.1.118.0 // Exception in: System.Void OnFriendChatMessage(Steamworks.Data.GameConnectedFriendChatMsg_t) // // Specified argument was out of the range of valid values. // Parameter name: Target of array indexer expression is not an array. // at ..() in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\Expressions\ArrayIndexerExpression.cs:line 129 // at ..() in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\Expressions\UnaryExpression.cs:line 109 // at ..() in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\Expressions\UnaryExpression.cs:line 95 // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.() in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\ExpressionDecompilerStep.cs:line 143 // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.(DecompilationContext , ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\ExpressionDecompilerStep.cs:line 73 // at ..(MethodBody , , ILanguage ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:line 88 // at ..(MethodBody , ILanguage ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:line 70 // at Telerik.JustDecompiler.Decompiler.Extensions.( , ILanguage , MethodBody , DecompilationContext& ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\Extensions.cs:line 95 // at Telerik.JustDecompiler.Decompiler.Extensions.(MethodBody , ILanguage , DecompilationContext& , ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\Extensions.cs:line 58 // at ..(ILanguage , MethodDefinition , ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 117 // // mailto: [email protected] }
void OnGameConnectedFriendChatMsg(GameConnectedFriendChatMsg_t pCallback) { Debug.Log("[" + GameConnectedFriendChatMsg_t.k_iCallback + " - GameConnectedFriendChatMsg] - " + pCallback.m_steamIDUser + " -- " + pCallback.m_iMessageID); string Text; EChatEntryType ChatEntryType; int ret = SteamFriends.GetFriendMessage(pCallback.m_steamIDUser, pCallback.m_iMessageID, out Text, 2048, out ChatEntryType); // Must be called from within OnGameConnectedFriendChatMsg print(ret + " " + pCallback.m_steamIDUser + ": " + Text); }
internal static void InstallEvents() { FriendStateChange_t.Install((FriendStateChange_t x) => { Action <Friend> onPersonaStateChange = SteamFriends.OnPersonaStateChange; if (onPersonaStateChange != null) { onPersonaStateChange(new Friend(x.SteamID)); } else { } }, false); GameRichPresenceJoinRequested_t.Install((GameRichPresenceJoinRequested_t x) => { Action <Friend, string> onGameRichPresenceJoinRequested = SteamFriends.OnGameRichPresenceJoinRequested; if (onGameRichPresenceJoinRequested != null) { onGameRichPresenceJoinRequested(new Friend(x.SteamIDFriend), x.Connect); } else { } }, false); GameConnectedFriendChatMsg_t.Install(new Action <GameConnectedFriendChatMsg_t>(SteamFriends.OnFriendChatMessage), false); GameOverlayActivated_t.Install((GameOverlayActivated_t x) => { Action onGameOverlayActivated = SteamFriends.OnGameOverlayActivated; if (onGameOverlayActivated != null) { onGameOverlayActivated(); } else { } }, false); GameServerChangeRequested_t.Install((GameServerChangeRequested_t x) => { Action <string, string> onGameServerChangeRequested = SteamFriends.OnGameServerChangeRequested; if (onGameServerChangeRequested != null) { onGameServerChangeRequested(x.Server, x.Password); } else { } }, false); GameLobbyJoinRequested_t.Install((GameLobbyJoinRequested_t x) => { Action <Lobby, SteamId> onGameLobbyJoinRequested = SteamFriends.OnGameLobbyJoinRequested; if (onGameLobbyJoinRequested != null) { onGameLobbyJoinRequested(new Lobby(x.SteamIDLobby), x.SteamIDFriend); } else { } }, false); FriendRichPresenceUpdate_t.Install((FriendRichPresenceUpdate_t x) => { Action <Friend> onFriendRichPresenceUpdate = SteamFriends.OnFriendRichPresenceUpdate; if (onFriendRichPresenceUpdate != null) { onFriendRichPresenceUpdate(new Friend(x.SteamIDFriend)); } else { } }, false); }