protected override GameSpecificMovesData Deserialize(JContainer value, Type objectType) { if (value.IsNullOrEmpty()) { return(null); } if (value.Type.Equals(JTokenType.Array)) { if (value.Count != 2) { return(null); } var type = (ChainTypes.GameSpecificMoves)Convert.ToInt32(value.First); switch (type) { case ChainTypes.GameSpecificMoves.RockPaperScissorsThrowCommit: objectType = typeof(RockPaperScissorsThrowCommitData); break; case ChainTypes.GameSpecificMoves.RockPaperScissorsThrowReveal: objectType = typeof(RockPaperScissorsThrowRevealData); break; default: Unity.Console.Error("Unexpected game specific moves type:", type); return(null); } value = value.Last as JObject; } if (objectType.Equals(typeof(RockPaperScissorsThrowCommitData))) { return(RockPaperScissorsThrowCommitData.Create(value as JObject)); } if (objectType.Equals(typeof(RockPaperScissorsThrowRevealData))) { return(RockPaperScissorsThrowRevealData.Create(value as JObject)); } Unity.Console.Error("Unexpected game specific moves type:", objectType); return(null); }
public RockPaperScissorsGameDetailsData() { CommitMoves = new RockPaperScissorsThrowCommitData[0]; RevealMoves = new RockPaperScissorsThrowRevealData[0]; }