mbunch_kascope 1 год назад
Родитель
Сommit
0dfa6a4ac1
2 измененных файлов с 30 добавлено и 2 удалено
  1. 29 2
      Assets/Editor/JSONLoader_CardEntity.cs
  2. 1 0
      Assets/Scripts/JsonSerializedClass.cs

+ 29 - 2
Assets/Editor/JSONLoader_CardEntity.cs

@@ -128,7 +128,7 @@ namespace DCGO.CardEntities
 
             cardEntity.Form_ENG = GetCardInfo(card.form);
             cardEntity.Attribute_ENG = GetCardInfo(card.attribute);
-            cardEntity.Type_ENG = GetCardInfo(card.type);
+            cardEntity.Type_ENG = GetCardInfo(card.type, card.rule);
 
             cardEntity.CardSpriteName = GetImageURL(card.cardImage, imageID, card.AAs);
 
@@ -296,7 +296,7 @@ namespace DCGO.CardEntities
             return effect;
         }
         //Parse card info split by "/" to list
-        List<string> GetCardInfo(string str)
+        List<string> GetCardInfo(string str, string rule = "")
         {
             List<string> strings = new List<string>();
 
@@ -305,6 +305,33 @@ namespace DCGO.CardEntities
                 strings.Add(data.Trim().Replace("\n","").Replace("\r", ""));
             }
 
+            if (!String.IsNullOrEmpty(rule))
+                strings.AddRange(GetRuleText(rule));
+
+            string debugTxt = "";
+            foreach (string data in strings)
+                debugTxt += data + "\n";
+
+            return strings;
+        }
+
+        //Parse RULE text
+        List<string> GetRuleText(string str)
+        {
+            List<string> strings = new List<string>();
+
+            if (!str.Contains("[Rule] Trait:"))
+                return new List<string>();
+
+            string traitRule = str.Split("[Rule] Trait:")[1];
+            int startIndex = traitRule.IndexOf("[");
+            traitRule = traitRule.Substring(startIndex, traitRule.LastIndexOf("]") - startIndex)
+                .Replace("[","")
+                .Replace("]", "");
+       
+            foreach (string data in traitRule.Split("/"))
+                strings.Add(data.Trim().Replace("\n", "").Replace("\r", ""));
+
             return strings;
         }
 

+ 1 - 0
Assets/Scripts/JsonSerializedClass.cs

@@ -39,6 +39,7 @@ namespace DCGO.CardEntities
         public string playCost;
         public string rarity;
         public Restriction restrictions;
+        public string rule;
         public string securityEffect;
         public string specialDigivolve;
         public string type;