Просмотр исходного кода

fixes to deck import - to allow more than 4 copies

Michael8818 4 месяцев назад
Родитель
Сommit
8a8d7f88a2
2 измененных файлов с 6 добавлено и 2 удалено
  1. 4 1
      Assets/Editor/CheckDeckCodeParse.cs
  2. 2 1
      Assets/Scripts/Script/DeckCodeUtility.cs

+ 4 - 1
Assets/Editor/CheckDeckCodeParse.cs

@@ -58,10 +58,13 @@ public class CheckDeckCodeParse : MonoBehaviour
                     if(char.IsDigit(line[0]))
                     {
                         int count = 0;
+                        int spaceIndex = line.IndexOf(" ");
 
-                        if (int.TryParse(line[0].ToString(), out value))
+                        if (int.TryParse(line.Substring(0,spaceIndex).Trim(), out value))
                             count = value;
 
+                        Debug.Log($"Card Count: {count}");
+
                         for (int i = 0; i < 4; i++)
                         {
                             Debug.Log($"Found Card Count: {line}");

+ 2 - 1
Assets/Scripts/Script/DeckCodeUtility.cs

@@ -121,8 +121,9 @@ public class DeckCodeUtility
                     if (char.IsDigit(line[0]))
                     {
                         int count = 0;
+                        int spaceIndex = line.IndexOf(" ");
 
-                        if (int.TryParse(line[0].ToString(), out value))
+                        if (int.TryParse(line.Substring(0, spaceIndex).Trim(), out value))
                             count = value + plusCount;
 
                         for (int i = 0; i < 4; i++)