/// <summary> /// Register match data /// </summary> /// <param name="match">Match.</param> public abstract void SetMatch(VersusMatch match);
public static VersusMatch ParseMatch(GKTurnBasedMatch match) { VersusMatch existingMatch = new VersusMatch (); existingMatch.GKMatch = match; if (match.MatchData == null) { return null; } // Match has data: it's not the first turn if (match.MatchData.Length > 0) { try { string jsonBase64 = NSString.FromData (match.MatchData, NSStringEncoding.UTF8); string json = System.Text.Encoding.UTF8.GetString (Convert.FromBase64String (jsonBase64)); existingMatch.FromJson (json.ToString ()); } catch (Exception e) { Logger.E ("GameCenterHelper.ParseMatch", e); return null; } } // No data: new match, else { existingMatch.MatchId = match.MatchID; existingMatch.Player1Id = match.Participants [0].PlayerID; existingMatch.Player2Id = match.Participants [1].PlayerID; // Set up outcomes match.Participants [0].MatchOutcome = GKTurnBasedMatchOutcome.First; match.Participants [1].MatchOutcome = GKTurnBasedMatchOutcome.Second; // TODO Select filter existingMatch.Filter = new Filter ("0", "MP Filter", "defaultIcon", // Test data 1990, 2050, null, new System.Collections.Generic.List<string> () { "combat" }, null); } return existingMatch; }
public override void SetMatch(VersusMatch match) { Logger.I("Setting current match to player: " + match.MatchId); this.CurrentMatch = match; this.CurrentGKMatch = match.GKMatch; }