source: binary-improvements/AllocsCommands/PrivateMessageConnections.cs@ 364

Last change on this file since 364 was 326, checked in by alloc, 6 years ago

More cleanup, allocation improvements

File size: 716 bytes
RevLine 
[251]1using System.Collections.Generic;
[309]2using Steamworks;
[251]3
[325]4namespace AllocsFixes.CustomCommands {
5 public class PrivateMessageConnections {
6 private static readonly Dictionary<CSteamID, CSteamID> senderOfLastPM = new Dictionary<CSteamID, CSteamID> ();
[251]7
[325]8 public static void SetLastPMSender (ClientInfo _sender, ClientInfo _receiver) {
[309]9 senderOfLastPM [_receiver.steamId] = _sender.steamId;
[251]10 }
11
[325]12 public static ClientInfo GetLastPMSenderForPlayer (ClientInfo _player) {
[326]13 if (!senderOfLastPM.ContainsKey (_player.steamId)) {
14 return null;
[309]15 }
[325]16
[326]17 CSteamID recSteamId = senderOfLastPM [_player.steamId];
18 ClientInfo recInfo = ConnectionManager.Instance.Clients.ForSteamId (recSteamId);
19 return recInfo;
[251]20 }
21 }
[325]22}
Note: See TracBrowser for help on using the repository browser.