public override void SubscribeToUserManager(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.user_manager.SubscribeToUserManagerRequest request, System.Action <bnet.protocol.user_manager.SubscribeToUserManagerResponse> done) { Logger.Trace("SubscribeToUserManager()"); // temp hack: send him all online players on server where he should be normally get list of player he met in his last few games /raist. var builder = SubscribeToUserManagerResponse.CreateBuilder(); foreach (var player in OnlinePlayers.Players) { if (player == this.Client) { continue; // Don't add the requester to the list } var recentPlayer = RecentPlayer.CreateBuilder(); if (player.CurrentToon != null) { recentPlayer.SetPlayer(player.CurrentToon.BnetEntityID); Logger.Warn("RecentPlayer => " + player.CurrentToon); builder.AddRecentPlayers(recentPlayer); } } done(builder.Build()); }
public void AddRecentPlayer(RecentPlayer recentPlayer) { IRCUser iu = connectionManager.UserList.Find(u => u.Name == recentPlayer.PlayerName); bool isOnline = true; if (iu == null) { iu = new IRCUser(recentPlayer.PlayerName); isOnline = false; } var textColor = isOnline ? UISettings.ActiveSettings.AltColor : UISettings.ActiveSettings.DisabledItemColor; AddItem(new List <XNAListBoxItem>() { new XNAListBoxItem(recentPlayer.PlayerName, textColor) { Tag = iu }, new XNAListBoxItem(recentPlayer.GameName, textColor), new XNAListBoxItem(recentPlayer.GameTime.ToLocalTime().ToString("ddd, MMM d, yyyy @ h:mm tt"), textColor) }); }