/// <summary> /// Generate a desk target from json file. /// </summary> /// <param name="json"></param> /// <returns></returns> public static Desk GetDeskFromJson(string json) { JsonSerializerSettings jsonSetting = new JsonSerializerSettings { CheckAdditionalContent = true, MissingMemberHandling = MissingMemberHandling.Error }; DeskCard outputDeskCard = JsonConvert.DeserializeObject <DeskCard>(json, jsonSetting); Desk outputDesk = new Desk { AllCardOnDesk = outputDeskCard }; outputDesk.CalculateParameters(); return(outputDesk); }
public bool CheckSame(DeskCard argDeskCard) => CheckSame(this, argDeskCard);
public static bool CheckSame(DeskCard argDeskCard1, DeskCard argDeskCard2) { for (int i = 0; i < argDeskCard1.FreeCard.Length; i++) { bool isSame = false; for (int j = 0; j < argDeskCard2.FreeCard.Length; j++) { if (Card.CheckSame(argDeskCard1.FreeCard[i], argDeskCard2.FreeCard[j])) { isSame = true; break; } } if (!isSame) { return(false); } } for (int i = 0; i < argDeskCard1.SortedCard.Length; i++) { bool isSame = false; for (int j = 0; j < argDeskCard2.SortedCard.Length; j++) { if (Card.CheckSame(argDeskCard1.SortedCard[i], argDeskCard2.SortedCard[j])) { isSame = true; break; } } if (!isSame) { return(false); } } for (int i = 0; i < argDeskCard1.ColoumCard.GetLength(0); i++) { bool isSame = false; for (int j = 0; j < argDeskCard2.ColoumCard.GetLength(0); j++) { bool IsColoumSame = true; for (int y = 0; y < argDeskCard1.ColoumCard.GetLength(1); y++) { if (!Card.CheckSame(argDeskCard1.ColoumCard[i, y], argDeskCard2.ColoumCard[j, y])) { IsColoumSame = false; break; } } if (IsColoumSame) { isSame = true; } } if (!isSame) { return(false); } } return(true); }
/// <summary> /// /// </summary> /// <param name="argDesk1"></param> /// <param name="argDesk2"></param> /// <returns></returns> public static bool CheckSame(Desk argDesk1, Desk argDesk2) { return(DeskCard.CheckSame(argDesk1.AllCardOnDesk, argDesk2.AllCardOnDesk)); }