From 16c0bd73d35cdfb18d7796c63653b02806296903 Mon Sep 17 00:00:00 2001
From: Bjoern Esswein <692-bessw@users.noreply.gl.kwarc.info>
Date: Mon, 11 Nov 2024 16:47:04 +0100
Subject: [PATCH] fixed typos

---
 .../FactHandling/FactWrapper/FactObjectUI.cs  |  2 +-
 Assets/Scripts/InventoryStuff/ActiveScroll.cs | 46 +++++++++----------
 Assets/Scripts/UI/InGame/PopupBehavior.cs     |  4 +-
 Assets/Scripts/UI/InGame/ScrollDetails.cs     |  2 +-
 Assets/Scripts/UI/InGame/WebViewController.cs | 16 +++----
 .../scrollView.html                           |  8 ++--
 Packages/bessw.unity.webview                  |  2 +-
 7 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObjectUI.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObjectUI.cs
index e90f6cc6..e609bb79 100644
--- a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObjectUI.cs
+++ b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObjectUI.cs
@@ -2,7 +2,7 @@
 using System.Linq;
 using UnityEngine.UI;
 
-public class FactObjectUI : FactObject, BrowserDropable
+public class FactObjectUI : FactObject, IBrowserDroppable
 {
     public Image[] Images;
 
diff --git a/Assets/Scripts/InventoryStuff/ActiveScroll.cs b/Assets/Scripts/InventoryStuff/ActiveScroll.cs
index 20d58547..6b1d6a18 100644
--- a/Assets/Scripts/InventoryStuff/ActiveScroll.cs
+++ b/Assets/Scripts/InventoryStuff/ActiveScroll.cs
@@ -11,8 +11,8 @@
 #nullable enable annotations
 
 /// <summary>
-/// This class keeps track of the currently active scroll and comunicates with the FrameIT Server.
-/// It represents the model of the Model-View-Controler pattern.
+/// This class keeps track of the currently active scroll and communicates with the FrameIT Server.
+/// It represents the model of the Model-View-Controller pattern.
 /// </summary>
 [Serializable]
 public class ActiveScroll : MonoBehaviour
@@ -20,17 +20,17 @@ public class ActiveScroll : MonoBehaviour
 
     /** <summary>Event that is invoked when a scroll button is clicked, e.g. magic button. You can use it to handle custom buttons.</summary> */
     public UnityEvent<ScrollButton> OnButtonClick = new();
-    /** <summary>Notifies about availible hints.</summary> */
+    /** <summary>Notifies about available hints.</summary> */
     public UnityEvent<IReadOnlyList<string>> HintAvailableEvent = new();
     /** <summary>Event that is invoked when a fact has been assigned to a slot and the ui needs to update.</summary> */
     public UnityEvent<string,SlotAssignment> OnFactAssignmentUpdated = new();
     /** <summary>Event that is invoked when the MMT server returned an error.</summary> */
-    public UnityEvent<string> OnMMTServerComunicationError = new();
+    public UnityEvent<string> OnMMTServerCommunicationError = new();
     /** <summary>Event that is invoked when the scroll dynamic info returned errors in the current scroll assignment.</summary> */
     public UnityEvent<ScrollApplicationCheckingError[]> OnScrollDynamicInfoError = new();
     /** <summary>Event that is invoked when the scroll application returned errors in the current assignment.</summary> */
     public UnityEvent<ScrollApplicationCheckingError[]> OnScrollApplicationError = new();
-    /** <summary>Event that is invoked when the OnMMTServerError or OnScrollApplicationFailed error state has been resolved and e.g. the error popup can be cloesed.</summary> */
+    /** <summary>Event that is invoked when the OnMMTServerError or OnScrollApplicationFailed error state has been resolved and e.g. the error popup can be closed.</summary> */
     public UnityEvent OnCancelErrorState = new();
     /** <summary>Event that is invoked when the scroll has been solved.</summary> */
     public UnityEvent<IReadOnlyList<Fact>> OnScrollSolved = new();
@@ -65,7 +65,7 @@ public class ActiveScroll : MonoBehaviour
 
     /** <summary>List of available hints for the current partial assignment.</summary> */
     private List<Fact> LatestRenderedHints;
-    /** <summary>List of available auto comletions for the current partial assignment. Used to generate hints.</summary> */
+    /** <summary>List of available auto completions for the current partial assignment. Used to generate hints.</summary> */
     private List<ScrollAssignment> LatestBackwartsCompletions;
 
     private Scroll _Scroll;
@@ -79,7 +79,7 @@ public Scroll Scroll
             _Scroll = value;
             
             // initialize the assignments dictionary with the references to the required fact slots as keys
-            // and an empty SlottAssignment
+            // and an empty SlotAssignment
             _Assignments = value.requiredFacts
                 .ToDictionary(fact => fact.@ref.uri, _ => new SlotAssignment());
             
@@ -129,7 +129,7 @@ public void ButtonClicked(ScrollButton button)
         switch (button)
         {
             // Magic button to apply the scroll
-            case MagicScrollButton:
+            case ApplyScrollButton:
                 if ((Scroll is not null) && ! MagicInQue) StartCoroutine(SendScrollApplication());
                 break;
             case HintScrollButton:
@@ -153,7 +153,7 @@ public void AssignFact(string slotUri, Fact fact)
         {
             var slot = _Assignments[slotUri];
 
-            // return if the slot is already assigned to the given value (avoid unnecessary ui updates and frameit Server requests)
+            // return if the slot is already assigned to the given value (avoid unnecessary ui updates and FrameIT Server requests)
             //if ((fact is null && !slot.IsSet) || (slot.IsSet && slot.fact.Id == fact.Id)) return;
             if (fact is null && !slot.IsSet) return;
 
@@ -209,7 +209,7 @@ private IEnumerator SendScrollApplication()
 
         if (currentMmtAnswer == null)
         {
-            // OnMMTServerComunicationError is already invoked in SendView
+            // OnMMTServerCommunicationError is already invoked in SendView
             Debug.LogError("Magic FAILED");
             yield break;
         }
@@ -220,7 +220,7 @@ private IEnumerator SendScrollApplication()
 
             System.DateTime deserializeTime = System.DateTime.UtcNow;
             ScrollApplicationInfo scrollApplication = JsonConvert.DeserializeObject<ScrollApplicationInfo>(currentMmtAnswer);
-            Debug.LogFormat($"Answerd deserialized in : {(System.DateTime.UtcNow - deserializeTime).TotalMilliseconds}ms");
+            Debug.LogFormat($"Answer deserialized in : {(System.DateTime.UtcNow - deserializeTime).TotalMilliseconds}ms");
 
             if (scrollApplication.acquiredFacts.Count == 0
                 || scrollApplication.errors.Length > 0)
@@ -246,7 +246,7 @@ private List<Fact> __GenerateUnityFactsForAcquiredMMTFacts(List<MMTFact> pushout
         Dictionary<string, string> old_to_new = new();
         System.DateTime parseTime = System.DateTime.UtcNow;
 
-        bool samestep = false;
+        bool sameStep = false;
         for (int i = 0; i < pushoutFacts.Count; i++)
         {
             List<Fact> new_list = Fact.MMTFactory(pushoutFacts[i].MapURIs(old_to_new));
@@ -259,16 +259,16 @@ private List<Fact> __GenerateUnityFactsForAcquiredMMTFacts(List<MMTFact> pushout
 
             foreach (Fact new_fact in new_list)
             {
-                Fact added = FactAdder.AddFactIfNotFound(new_fact, out bool exists, samestep, null, Scroll.label);
+                Fact added = FactAdder.AddFactIfNotFound(new_fact, out bool exists, sameStep, null, Scroll.label);
                 if (!exists)
                 {
                     new_facts.Add(added);
                     CommunicationEvents.AnimateExistingFactEvent.Invoke(added.Id, FactWrapper.FactMaterials.Solution);
-                    samestep = true;
+                    sameStep = true;
                 }
                 else
                 {
-                    // AnimateExistingFactEvent.Invoke(_new, FactWrapper.FactMaterials.Hint); // Automaticly done in FactRecorder
+                    // AnimateExistingFactEvent.Invoke(_new, FactWrapper.FactMaterials.Hint); // Automatically done in FactRecorder
                     old_to_new.Add(new_fact.Id, added.Id);
                 }
             }
@@ -349,14 +349,14 @@ private IEnumerator _SendAssignments()
 
         DynamicScrollInQue = true;
         while (!SendingViewDone)
-            yield return null; // if we dont wait => server will crash
+            yield return null; // if we don't wait => server will crash
         DynamicScrollInQue = false;
 
         yield return SendView("/scroll/dynamic");
 
         if (currentMmtAnswer == null)
         {
-            // OnMMTServerComunicationError is already invoked in SendView
+            // OnMMTServerCommunicationError is already invoked in SendView
             Debug.LogError("Dynamic Scroll FAILED");
             yield break;
         }
@@ -371,8 +371,8 @@ private IEnumerator _SendAssignments()
             catch (JsonSerializationException ex)
             {
                 Debug.LogException(ex);
-                Debug.LogError("Could not Deserialize MMT aswer for /scroll/dynamic\n" + currentMmtAnswer);
-                OnMMTServerComunicationError.Invoke("MMT Server communication error: could not deserialize message.");
+                Debug.LogError("Could not Deserialize MMT answer for /scroll/dynamic\n" + currentMmtAnswer);
+                OnMMTServerCommunicationError.Invoke("MMT Server communication error: could not deserialize message.");
                 yield break;
             }
 
@@ -453,7 +453,7 @@ private IEnumerator SendView(string endpoint)
         System.DateTime sendTime = System.DateTime.UtcNow;
         yield return www.SendWebRequest();
         //if (VerboseURI)
-        Debug.LogFormat("Server answerd in : {0}ms"
+        Debug.LogFormat("Server answered in : {0}ms"
             , (System.DateTime.UtcNow - sendTime).TotalMilliseconds);
 
         if (www.result == UnityWebRequest.Result.ConnectionError
@@ -461,7 +461,7 @@ private IEnumerator SendView(string endpoint)
         {
             Debug.LogWarning(www.error);
             currentMmtAnswer = null;
-            OnMMTServerComunicationError.Invoke($"Server communication error: {www.error}");
+            OnMMTServerCommunicationError.Invoke($"Server communication error: {www.error}");
             SendingViewDone = true;
             yield break;
         }
@@ -491,11 +491,11 @@ string prepareScrollAssignments()
 }
 
 /// <summary>
-/// Parrent class for all scroll buttons, inherit from this class to implement custom buttons.
+/// Parent class for all scroll buttons, inherit from this class to implement custom buttons.
 /// </summary>
 public abstract class ScrollButton {}
 
-public class MagicScrollButton : ScrollButton {}
+public class ApplyScrollButton : ScrollButton {}
 public class HintScrollButton : ScrollButton
 {
     public readonly string SlotUri;
diff --git a/Assets/Scripts/UI/InGame/PopupBehavior.cs b/Assets/Scripts/UI/InGame/PopupBehavior.cs
index 6ef35929..27eb7940 100644
--- a/Assets/Scripts/UI/InGame/PopupBehavior.cs
+++ b/Assets/Scripts/UI/InGame/PopupBehavior.cs
@@ -27,7 +27,7 @@ public string MessageText
 
     void OnEnable()
     {
-        SwitchScrollUI.activeScrollData.OnMMTServerComunicationError.AddListener(OnShowErrorMessage);
+        SwitchScrollUI.activeScrollData.OnMMTServerCommunicationError.AddListener(OnShowErrorMessage);
         SwitchScrollUI.activeScrollData.OnScrollDynamicInfoError.AddListener(OnFailedScrollInput);
         SwitchScrollUI.activeScrollData.OnScrollApplicationError.AddListener(OnFailedScrollInput);
         SwitchScrollUI.activeScrollData.OnCancelErrorState.AddListener(HidePopUp);
@@ -35,7 +35,7 @@ void OnEnable()
 
     void OnDisable()
     {
-        SwitchScrollUI.activeScrollData.OnMMTServerComunicationError.RemoveListener(OnShowErrorMessage);
+        SwitchScrollUI.activeScrollData.OnMMTServerCommunicationError.RemoveListener(OnShowErrorMessage);
         SwitchScrollUI.activeScrollData.OnScrollDynamicInfoError.RemoveListener(OnFailedScrollInput);
         SwitchScrollUI.activeScrollData.OnScrollApplicationError.RemoveListener(OnFailedScrollInput);
         SwitchScrollUI.activeScrollData.OnCancelErrorState.RemoveListener(HidePopUp);
diff --git a/Assets/Scripts/UI/InGame/ScrollDetails.cs b/Assets/Scripts/UI/InGame/ScrollDetails.cs
index ccf2176e..ec1fd977 100644
--- a/Assets/Scripts/UI/InGame/ScrollDetails.cs
+++ b/Assets/Scripts/UI/InGame/ScrollDetails.cs
@@ -120,6 +120,6 @@ private void OnFactAssignmentUpdated(string slotUri, ActiveScroll.SlotAssignment
     [ContextMenu("MagicButtonClicked")]
     public void MagicButtonClicked()
     {
-        SwitchScrollUI.activeScrollData.ButtonClicked(new MagicScrollButton());
+        SwitchScrollUI.activeScrollData.ButtonClicked(new ApplyScrollButton());
     }
 }
diff --git a/Assets/Scripts/UI/InGame/WebViewController.cs b/Assets/Scripts/UI/InGame/WebViewController.cs
index f6b3c582..353a40c0 100644
--- a/Assets/Scripts/UI/InGame/WebViewController.cs
+++ b/Assets/Scripts/UI/InGame/WebViewController.cs
@@ -109,17 +109,17 @@ private async void SetScrollContent(Scroll scroll)
         }
         else
         {
-            // scroll is a lagacy plain text scroll, generate html with slots for the required facts
+            // scroll is a legacy plain text scroll, generate html with slots for the required facts
             var factSlots = SwitchScrollUI.activeScrollData.Assignments
                 .Where(pair => pair.Value.IsVisible)
                 .Select(pair =>
-                    @$"<span class='lagacySlot' dropzone='copy' data-slot-id='{pair.Key}' {(pair.Value.IsSet ? $"data-fact-id='{pair.Value.fact.Id}'" : "")}>
+                    @$"<span class='legacySlot' dropzone='copy' data-slot-id='{pair.Key}' {(pair.Value.IsSet ? $"data-fact-id='{pair.Value.fact.Id}'" : "")}>
                         {(pair.Value.IsSet ?
                             pair.Value.fact.GetLabel(StageStatic.stage.factState) :
                             scroll.requiredFacts.Find(fact => fact.@ref.uri == pair.Key).label )}
                     </span>");
 
-            description = $"<scroll-description><p>{scroll.description}</p><div id='lagacySlots'>{String.Join("", factSlots)}</div></scroll-description>";
+            description = $"<scroll-description><p>{scroll.description}</p><div id='legacySlots'>{String.Join("", factSlots)}</div></scroll-description>";
         }
         // display the scroll description
         dropzones = null;
@@ -130,7 +130,7 @@ private async void SetScrollContent(Scroll scroll)
 
     private async void DropzoneAttributeModifiedHandler(attributeModifiedEvent attributeModifiedEvent)
     {
-        Debug.LogWarning($"dropzoneAtrributeModifiedHandler: '{attributeModifiedEvent.name}'");
+        Debug.LogWarning($"dropzoneAttributeModifiedHandler: '{attributeModifiedEvent.name}'");
 
         // call the onFactAssignment event if the data-fact-id attribute was modified
         if (attributeModifiedEvent.name == "data-fact-id")
@@ -140,11 +140,11 @@ private async void DropzoneAttributeModifiedHandler(attributeModifiedEvent attri
             if (! (node.Node.attributes.TryGetValue("data-slot-id", out string slot)
                 || (await node.getAttributesAsync()).TryGetValue("data-slot-id", out slot)))
             {
-                Debug.LogError($"dropzoneAtrributeModifiedHandler: data-slot-id attribute not found on dropzone");
+                Debug.LogError($"dropzoneAttributeModifiedHandler: data-slot-id attribute not found on dropzone");
                 throw new Exception("data-slot-id attribute not found on dropzone");
             }
 
-            // if fact has been unasigned from the scroll
+            // if fact has been unassigned from the scroll
             if (attributeModifiedEvent.value == "null")
             {
                 // remove fact from slot
@@ -155,7 +155,7 @@ private async void DropzoneAttributeModifiedHandler(attributeModifiedEvent attri
             // get the fact from the fact id
             if (!FactRecorder.AllFacts.TryGetValue(attributeModifiedEvent.value, out Fact fact))
             {
-                Debug.LogError($"dropzoneAtrributeModifiedHandler: fact with id '{attributeModifiedEvent.value}' not found");
+                Debug.LogError($"dropzoneAttributeModifiedHandler: fact with id '{attributeModifiedEvent.value}' not found");
                 throw new Exception($"fact with id '{attributeModifiedEvent.value}' not found");
             }
 
@@ -182,7 +182,7 @@ private async void OnHintAvailable(IReadOnlyList<string> url)
 
     private void ApplyScrollHandler(string button)
     {
-        SwitchScrollUI.activeScrollData.ButtonClicked(new MagicScrollButton());
+        SwitchScrollUI.activeScrollData.ButtonClicked(new ApplyScrollButton());
     }
 
     private void GetHintHandler(string url)
diff --git a/Assets/StreamingAssets/StreamToDataPath_withHandler/scrollView.html b/Assets/StreamingAssets/StreamToDataPath_withHandler/scrollView.html
index 28a9b5d1..ab6b51d0 100644
--- a/Assets/StreamingAssets/StreamToDataPath_withHandler/scrollView.html
+++ b/Assets/StreamingAssets/StreamToDataPath_withHandler/scrollView.html
@@ -21,7 +21,7 @@
       align-items: center;
       flex-wrap: wrap;
     }
-    .lagacySlot {
+    .legacySlot {
       width: 100px;
       height: 100px;
       margin: 50px;
@@ -79,7 +79,7 @@
       </mtable>
     </math>
   </div>
-  <button type="button" title="Apply the scroll" onclick="applyScroll('')">Magic</button><br>
+  <button type="button" title="Apply the scroll" onclick="applyScroll('')">Apply</button><br>
   <p>You can right click on yellow slots to get a hint.</p>
 </body>
   <script>
@@ -203,11 +203,11 @@
 
     const data = event.dataTransfer.getData("application/json")
     //const data = event.dataTransfer.getData("text/plain")
-    console.log(`Droped data: '${event.dataTransfer.types}'`, event.dataTransfer.types)
+    console.log(`Dropped data: '${event.dataTransfer.types}'`, event.dataTransfer.types)
 
     /** @type {Fact} */
     const fact = JSON.parse(data)
-    console.warn(`Droped Fact '${fact.label}':`, fact)
+    console.warn(`Dropped Fact '${fact.label}':`, fact)
 
     /** @type {HTMLElement} */
     const element = event.target
diff --git a/Packages/bessw.unity.webview b/Packages/bessw.unity.webview
index 5004257d..c2220c67 160000
--- a/Packages/bessw.unity.webview
+++ b/Packages/bessw.unity.webview
@@ -1 +1 @@
-Subproject commit 5004257d58f35d6c32eaf5a0a4afd7f42fc7d049
+Subproject commit c2220c67983c8152fe5052cf5981fe680772c4f0
-- 
GitLab