diff --git a/Assets/Scripts/InventoryStuff/Scroll.cs b/Assets/Scripts/InventoryStuff/Scroll.cs index 8ccdd9766c01c550e3a565ca91d60cbdf7390fcd..5be3eb98ab05d869d70be5058a34e0ac01641579 100644 --- a/Assets/Scripts/InventoryStuff/Scroll.cs +++ b/Assets/Scripts/InventoryStuff/Scroll.cs @@ -7,38 +7,6 @@ using JsonSubTypes; using Newtonsoft.Json; - -/* -[Serializable] -public class Declaration -{ - public string name; - public string isProof; - public string value; - public string identifier; - public string description; -} - - -[Serializable] -public class Scroll -{ - public string problemTheory; - public string solutionTheory; - public string label; - public string description; - public Declaration[] declarations; - //public string output; - - public static Scroll generateFromJson(string json) { - return JsonUtility.FromJson<Scroll>(json); - } - - public string toJson() { - return JsonUtility.ToJson(this); - } -} -*/ public class Scroll : LightScroll { public string label; @@ -65,52 +33,6 @@ public static void InitDynamicScroll(int n) FactOccurences = new List<KeyValuePair<int, int>>[n]; } - - //also collects occurences to be changed later - public static string ParseString(int stringId, string raw, List<ScrollFact> scrollFacts) - { - - int i = 0; - while(true) - { - char[] rawChars = raw.ToCharArray(); - i = Array.FindIndex(rawChars,i, c => c == '$'); - if (i == -1) break; - // Debug.Log(i); - - //id of Fact, specified after the $ - int toChange = (int) Char.GetNumericValue(raw[i + 1]); - - //label of this Fact - string label = scrollFacts[toChange].label; - - raw = raw.Remove(i,2); - raw = raw.Insert(i,label); - - if(FactOccurences[toChange] == null) - { - FactOccurences[toChange] = new List<KeyValuePair<int, int>>(); - } - //if (toChange >= 0) Debug.Log(stringId); - FactOccurences[toChange].Add(new KeyValuePair<int, int>(stringId,i)); - - - } - - return raw; - } - - - - - -/* - public class ScrollList - { - public List<Scroll> scrolls; - - }*/ - public class ScrollAssignment { public KeyValuePair<string, JSONManager.MMTTerm> assignment; diff --git a/Assets/Scripts/InventoryStuff/ScrollDetails.cs b/Assets/Scripts/InventoryStuff/ScrollDetails.cs index f084068040050a7c600032ef28cc0c2e27aa8141..cb40cbbf05c0f335d390be95dbde6bcc965d5d40 100644 --- a/Assets/Scripts/InventoryStuff/ScrollDetails.cs +++ b/Assets/Scripts/InventoryStuff/ScrollDetails.cs @@ -56,7 +56,11 @@ public void setScroll(Scroll s) Transform scrollView = gameObject.transform.GetChild(2); Transform viewport = scrollView.GetChild(0); this.scroll = s; - + + //Clear all current ScrollFacts + foreach (Transform child in viewport.GetChild(0).transform) + GameObject.Destroy(child.gameObject); + ParameterDisplays = new List<GameObject>(); Scroll.InitDynamicScroll(s.requiredFacts.Count); for (int i = 0; i < s.requiredFacts.Count; i++) @@ -67,15 +71,12 @@ public void setScroll(Scroll s) scrollFact.ID = i; //obj.GetComponent<RectTransform>().localPosition = GetPosition(i); - scrollFact.Label = Scroll.ParseString(i,s.requiredFacts[i].label,s.requiredFacts); + scrollFact.Label = s.requiredFacts[i].label; obj.transform.SetParent(viewport.GetChild(0)); - //this is from benni, I dont know if the hack is the commented line below or the line above.... - //TODO: Remvoe this reaaaaly bad hack - //obj.transform.localScale = Vector3.one; ParameterDisplays.Add(obj); } //scroll description - ScrollDescription = Scroll.ParseString(-1, s.description, s.requiredFacts); + ScrollDescription = s.description; }