public static KgsChallenge FromChannel(GameChannel channel) { if (channel.GameType != GameType.Challenge) { return(null); } KgsChallenge challenge = new KgsChallenge(channel.InitialProposal, channel.ChannelId); if (channel.InitialProposal.GameType != GameType.Free && channel.InitialProposal.GameType != GameType.Ranked) { return(null); } return(challenge); }
public void AddChannel(GameChannel channel, KgsConnection connection) { var kChallenge = KgsChallenge.FromChannel(channel); if (kChallenge != null) { connection.Data.EnsureChannelExists(kChallenge); Challenges.Add(kChallenge); AllChannelsCollection.Add(kChallenge); return; } var kGame = KgsTrueGameChannel.FromChannel(channel); if (kGame != null) { connection.Data.EnsureChannelExists(kGame); Games.Add(kGame); AllChannelsCollection.Add(kGame); return; } }