public void CheckNumInArea1() { ArrayList Nums = new ArrayList(); foreach (Transform Num in Area1.GetComponentsInChildren <Transform>()) { if (Num.tag == "CardNum") { Nums.Add(Num.GetComponent <Text>().text.ToString()); } } string tmp = Nums[0].ToString(); for (int i = 0; i < Nums.Count; i++) { if (Regex.Match(Nums[i].ToString(), @"\d").Success) { tmp = Nums[i].ToString(); break; } } for (int i = 0; i < Nums.Count; i++) { if (Nums[i].ToString() != "" && (Nums[i].ToString() == tmp || Nums[i].ToString() == "☆")) { continue; } else { return; } } for (int i = 0; i < Nums.Count; i++) { if (Nums[i].ToString() == "☆") { continue; } else { tmp = Nums[i].ToString(); break; } } AddScore(tmp); foreach (Transform Num in Area1.GetComponentsInChildren <Transform>()) { if (Num.tag == "CardNum") { Num.GetComponentInChildren <Text>().text = ""; } } }
public void CheckNumInSumArea(GameObject area) { ArrayList Nums = new ArrayList(); int sum = 0; foreach (Transform Num in area.GetComponentsInChildren <Transform>()) { if (Num.tag == "CardNum") { Nums.Add(Num.GetComponent <Text>().text.ToString()); } } for (int i = 0; i < Nums.Count; i++) { if (Regex.Match(Nums[i].ToString(), @"\d").Success) { sum += (int)float.Parse(Nums[i].ToString()); } } if (sum == 15) { AddScore("2"); foreach (Transform Num in area.GetComponentsInChildren <Transform>()) { if (Num.tag == "CardNum") { Num.GetComponentInChildren <Text>().text = ""; } } } else if (sum == 14) { AddScore("5"); foreach (Transform Num in area.GetComponentsInChildren <Transform>()) { if (Num.tag == "CardNum") { Num.GetComponentInChildren <Text>().text = ""; } } } }