diff --git a/Assets/Plugins/NaturePackLite/Prefabs/Tree_01.prefab b/Assets/Plugins/NaturePackLite/Prefabs/Tree_01.prefab index d63ec606ee001bb5931444b276b9ae749f4cf4b0..3b451c095ea711349cecebb6aae90ef05f2d3806 100644 --- a/Assets/Plugins/NaturePackLite/Prefabs/Tree_01.prefab +++ b/Assets/Plugins/NaturePackLite/Prefabs/Tree_01.prefab @@ -109,7 +109,7 @@ GameObject: - component: {fileID: 7455726115425455088} - component: {fileID: 933372636075482527} - component: {fileID: 539717056228735193} - m_Layer: 0 + m_Layer: 16 m_Name: TopSnapZone m_TagString: SnapZone m_Icon: {fileID: 0} diff --git a/Assets/Scenes/RiverWorld.unity b/Assets/Scenes/RiverWorld.unity index a44f23726bc6aff29bdbae85b8a5c600df9bd0dd..fb99d299995018226244620e368b317c4cb0e37d 100644 --- a/Assets/Scenes/RiverWorld.unity +++ b/Assets/Scenes/RiverWorld.unity @@ -3544,6 +3544,7 @@ MonoBehaviour: ignoreLayerMask: serializedVersion: 2 m_Bits: 96768 + maxHeight: 2.5 Cursor: {fileID: 1324548121420804703} lineRenderer: {fileID: 492903072} linePreviewMaterial: {fileID: 2100000, guid: a8a7bf60a30970f469a9c9d3ae2de6ef, type: 2} @@ -59786,6 +59787,11 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 75 objectReference: {fileID: 0} + - target: {fileID: 798194300259120277, guid: b996060e27da25c498842defc1996d84, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 798194300310305303, guid: b996060e27da25c498842defc1996d84, type: 3} propertyPath: m_AnchoredPosition.x diff --git a/Assets/Scripts/InteractionEngine/Character_Animations/TaskCharakterAnimation.cs b/Assets/Scripts/InteractionEngine/Character_Animations/TaskCharakterAnimation.cs index 95100e226e4fced509ec37b55daffaba57a90949..f26c70979652bb1b474742752892427670eb5296 100644 --- a/Assets/Scripts/InteractionEngine/Character_Animations/TaskCharakterAnimation.cs +++ b/Assets/Scripts/InteractionEngine/Character_Animations/TaskCharakterAnimation.cs @@ -75,7 +75,7 @@ void Update() if(taskCharacterAddressed && !LelvelVerifiedSolved && checkGameSolved()) { startHappy(); - //LelvelVerifiedSolved = true; + LelvelVerifiedSolved = true; } return; diff --git a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs index b114c50134a041bb5b51f12d757724d3a60db7e8..2904c10b51e33b20cab1ba6c64d0a0b5bc40e540 100644 --- a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs +++ b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs @@ -48,12 +48,15 @@ public class AnimationEventWithUris : UnityEvent<List<string>> { } //------------------------------------------------------------------------------------ //-------------------------------Global Variables------------------------------------- - //Global Level-List of Facts + // Global Level-List of Facts public static FactOrganizer LevelFacts = new FactOrganizer(true); public static FactOrganizer SolutionManager = new FactOrganizer(false); - //TODO? List<[HashSet<string>, FactComparer]> + //TODO? [SolutionManager, List<[HashSet<string>, FactComparer]>] public static List<Fact> Solution = new List<Fact>(); public static bool ServerRunning = true; public static string ServerAdress = "localhost:8085"; + + // Configs + public static bool VerboseURI = false; } diff --git a/Assets/Scripts/InteractionEngine/Fact.cs b/Assets/Scripts/InteractionEngine/Fact.cs index f9481f1732253ad4df4945515c094dab45497dc9..8d691daf230176e362a2e87f4bcdfb2814aef2f9 100644 --- a/Assets/Scripts/InteractionEngine/Fact.cs +++ b/Assets/Scripts/InteractionEngine/Fact.cs @@ -6,6 +6,7 @@ using static JSONManager; using static CommunicationEvents; + public class ParsingDictionary { public static Dictionary<string, Func<Scroll.ScrollFact, Fact>> parseFactDictionary = new Dictionary<string, Func<Scroll.ScrollFact, Fact>>() { @@ -27,14 +28,24 @@ public class AddFactResponse // public string factValUri; public string uri; - public static AddFactResponse sendAdd(string path, string body) + public static bool sendAdd(MMTDeclaration mmtDecl, out string uri) + { + string body = MMTSymbolDeclaration.ToJson(mmtDecl); + return sendAdd(CommunicationEvents.ServerAdress + "/fact/add", body, out uri); + } + + public static bool sendAdd(string path, string body, out string uri) { if (!CommunicationEvents.ServerRunning) { Debug.LogWarning("Server not running"); - return new AddFactResponse(); + uri = null; + return false; } - Debug.Log(body); + + if(VerboseURI) + Debug.Log("Sending to Server:\n" + body); + //Put constructor parses stringbody to byteArray internally (goofy workaround) UnityWebRequest www = UnityWebRequest.Put(path, body); www.method = UnityWebRequest.kHttpVerbPOST; @@ -49,12 +60,19 @@ public static AddFactResponse sendAdd(string path, string body) || www.result == UnityWebRequest.Result.ProtocolError) { Debug.LogWarning(www.error); - return new AddFactResponse(); + uri = null; + return false; } else { string answer = www.downloadHandler.text; - return JsonUtility.FromJson<AddFactResponse>(answer); + AddFactResponse res = JsonUtility.FromJson<AddFactResponse>(answer); + + if (VerboseURI) + Debug.Log("Server added Fact:\n" + res.uri); + + uri = res.uri; + return true; } } } @@ -92,6 +110,8 @@ public void rename(string newLabel) public virtual void delete() { //TODO: MMT: delete over there + if (VerboseURI) + Debug.Log("Server removed Fact:\n" + this.URI); } public abstract bool Equivalent(Fact f2); @@ -102,6 +122,7 @@ public virtual void delete() protected abstract string generateLabel(); + // TODO: "ID"/ Letter Management protected string generateLetter() { return ((char)(64 + LabelId++ + 1)).ToString(); @@ -231,11 +252,7 @@ public PointFact(Vector3 P, Vector3 N, FactOrganizer organizer) : base(organizer //TODO: rework fact list + labeling MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df); - string body = MMTSymbolDeclaration.ToJson(mmtDecl); - - AddFactResponse res = AddFactResponse.sendAdd(CommunicationEvents.ServerAdress+"/fact/add", body); - this._URI = res.uri; - Debug.Log(this.URI); + AddFactResponse.sendAdd(mmtDecl, out this._URI); } public PointFact(float a, float b, float c, string uri, FactOrganizer organizer) : base(organizer) @@ -327,10 +344,7 @@ public LineFact(string pid1, string pid2, FactOrganizer organizer) : base(pid1, //see point label MMTValueDeclaration mmtDecl = new MMTValueDeclaration(this.Label, lhs, valueTp, value); - string body = MMTDeclaration.ToJson(mmtDecl); - AddFactResponse res = AddFactResponse.sendAdd(CommunicationEvents.ServerAdress + "/fact/add", body); - this._URI = res.uri; - Debug.Log(this.URI); + AddFactResponse.sendAdd(mmtDecl, out this._URI); } public static LineFact parseFact(Scroll.ScrollFact fact) @@ -407,11 +421,7 @@ public RayFact(string pid1, string pid2, FactOrganizer organizer) : base(pid1, p //TODO: rework fact list + labeling MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df); - string body = MMTSymbolDeclaration.ToJson(mmtDecl); - - AddFactResponse res = AddFactResponse.sendAdd(CommunicationEvents.ServerAdress + "/fact/add", body); - this._URI = res.uri; - Debug.Log(this.URI); + AddFactResponse.sendAdd(mmtDecl, out this._URI); } public static RayFact parseFact(Scroll.ScrollFact fact) @@ -491,11 +501,7 @@ public OnLineFact(string pid, string rid, FactOrganizer organizer) : base(organi //TODO: rework fact list + labeling MMTSymbolDeclaration mmtDecl = new MMTSymbolDeclaration(this.Label, tp, df); - string body = MMTSymbolDeclaration.ToJson(mmtDecl); - - AddFactResponse res = AddFactResponse.sendAdd(CommunicationEvents.ServerAdress + "/fact/add", body); - this._URI = res.uri; - Debug.Log(this.URI); + AddFactResponse.sendAdd(mmtDecl, out this._URI); } public OnLineFact(string pid, string rid, string uri, FactOrganizer organizer) : base(organizer) @@ -591,14 +597,7 @@ public AngleFact(string pid1, string pid2, string pid3, FactOrganizer organizer) else mmtDecl = generateNot90DegreeAngleDeclaration(v, p1URI, p2URI, p3URI); - Debug.Log("angle: " + v); - - string body = MMTDeclaration.ToJson(mmtDecl); - - Debug.Log(body); - AddFactResponse res = AddFactResponse.sendAdd(CommunicationEvents.ServerAdress+"/fact/add", body); - this._URI = res.uri; - Debug.Log(this.URI); + AddFactResponse.sendAdd(mmtDecl, out this._URI); } public AngleFact(string Pid1, string Pid2, string Pid3, string backendURI, FactOrganizer organizer) : base(organizer) diff --git a/Assets/Scripts/InteractionEngine/FactComparer.cs b/Assets/Scripts/InteractionEngine/FactComparer.cs index 7259946f0fbd04e5daf53ba80f828a215498cd40..414ba098920b9c803a801ff1e0ec9b44ddd27461 100644 --- a/Assets/Scripts/InteractionEngine/FactComparer.cs +++ b/Assets/Scripts/InteractionEngine/FactComparer.cs @@ -44,7 +44,7 @@ protected override bool Compare (Fact search, Fact fact) { return fact is LineFact && search is LineFact && Math3d.IsApproximatelyParallel(((LineFact) fact).Dir, ((LineFact) search).Dir) - && ((LineFact) fact).Distance > ((LineFact) search).Distance + Math3d.vectorPrecission; + && ((LineFact) fact).Distance + Math3d.vectorPrecission >= ((LineFact) search).Distance; // && Mathf.Approximately(((LineFact) x).Distance, ((LineFact) y).Distance); } } diff --git a/Assets/Scripts/InteractionEngine/FactOrganizer.cs b/Assets/Scripts/InteractionEngine/FactOrganizer.cs index dbe47e92e744019ba9c13199e84237ac3a53feea..6e17f3827a8d76da10a6d48312ec228c14d74b83 100644 --- a/Assets/Scripts/InteractionEngine/FactOrganizer.cs +++ b/Assets/Scripts/InteractionEngine/FactOrganizer.cs @@ -133,10 +133,10 @@ private void WorkflowAdd(stepnote note) private void PruneWorkflow() // set current (displayed) state in stone; resets un-redo parameters { - if (soft_resetted) - this.hardreset(false); + /*if (soft_resetted) + this.hardreset(false); // musn't clear - else if (backlog > 0) + else*/ if (backlog > 0) { worksteps -= backlog; backlog = 0; @@ -424,10 +424,10 @@ private void InvokeFactEvent(bool creation, string Id) CommunicationEvents.RemoveFactEvent.Invoke(this[Id]); } - public bool StaticlySovled(List<Fact> StaticSolution, out List<Fact> MissingElements) + public bool StaticlySovled(List<Fact> StaticSolution, out List<Fact> MissingElements, out List<Fact> Solutions) // QoL for simple Levels { - return DynamiclySolved(StaticSolution, out MissingElements, out _, new FactEquivalentsComparer()); + return DynamiclySolved(StaticSolution, out MissingElements, out Solutions, new FactEquivalentsComparer()); } //TODO: PERF: see CommunicationEvents.Solution diff --git a/Assets/Scripts/InteractionEngine/FactSpawner.cs b/Assets/Scripts/InteractionEngine/FactSpawner.cs index 0500cac89b3599026e8b6b36448ff86171c30f49..7242dc98d17319da0bef801f7201328ffa934936 100644 --- a/Assets/Scripts/InteractionEngine/FactSpawner.cs +++ b/Assets/Scripts/InteractionEngine/FactSpawner.cs @@ -122,7 +122,7 @@ public Fact SpawnRay(Fact fact) //Get the Line-GameObject as the first Child of the Line-Prefab -> That's the Collider var v3T = line.transform.GetChild(0).localScale; v3T.x = (point2 - point1).magnitude; - Debug.Log(v3T.x); + //For every Coordinate x,y,z we have to devide it by the LocalScale of the Child, //because actually the Child should be of this length and not the parent, which is only the Collider v3T.x = v3T.x / line.transform.GetChild(0).GetChild(0).localScale.x; @@ -197,7 +197,6 @@ public Fact SpawnAngle(Fact fact) public void DeleteObject(Fact fact) { - Debug.Log("delete obj of "+ fact.URI); GameObject factRepresentation = fact.Representation; GameObject.Destroy(factRepresentation); } diff --git a/Assets/Scripts/InteractionEngine/Gadgets/GadgetManager.cs b/Assets/Scripts/InteractionEngine/Gadgets/GadgetManager.cs index 9e8b43b97ec4418754e874f75765c179e39f87ec..3b85d12f618aa0f399df33c77c3e66f816387ac5 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/GadgetManager.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/GadgetManager.cs @@ -13,7 +13,6 @@ void Start() CommunicationEvents.ToolModeChangedEvent.AddListener(OnToolModeChanged); gadgets = GetComponentsInChildren<Gadget>(); - Debug.Log(gadgets.Length); for (int i = 0; i < gadgets.Length; i++) { gadgets[i].id = i; diff --git a/Assets/Scripts/InteractionEngine/ShinyThings.cs b/Assets/Scripts/InteractionEngine/ShinyThings.cs index 0ff9960a4866477ed21cfd0681ed7ba8bee77d42..29efa1d7873752ad2bef4f282f28700295f96206 100644 --- a/Assets/Scripts/InteractionEngine/ShinyThings.cs +++ b/Assets/Scripts/InteractionEngine/ShinyThings.cs @@ -276,7 +276,7 @@ public void CheckPushoutHighlighting() { StopHighlighting(); } //After this.timerDuration: Slow Down Fireworks - else + else if (this.extraHighlight != null) { ParticleSystem main1 = this.extraHighlight.transform.GetChild(0).GetComponent<ParticleSystem>(); ParticleSystem main2 = this.extraHighlight.transform.GetChild(1).GetComponent<ParticleSystem>(); diff --git a/Assets/Scripts/Level.cs b/Assets/Scripts/Level.cs index 8832fabc94fa1aad5d49df804ad492b5732f2256..b68c87a6aacd3fc2516cac47256f4bb4e26c89f8 100644 --- a/Assets/Scripts/Level.cs +++ b/Assets/Scripts/Level.cs @@ -15,6 +15,7 @@ public class Level : MonoBehaviour void Start() // Start is called before the first frame update { + // TODO: do not generate! -> load from somewhere PointFact buttom = new PointFact(Vector3.zero, Vector3.up, SolutionManager), top = new PointFact(Vector3.zero + Vector3.up * minimalSolutionHight, Vector3.up, SolutionManager); diff --git a/Assets/Scripts/Restart.cs b/Assets/Scripts/Restart.cs index 47e919b45b077349bb4d2836a84856621f9dcfaa..36df6d4cb2bf58d0d1b4862efd5c99971a83b0cc 100644 --- a/Assets/Scripts/Restart.cs +++ b/Assets/Scripts/Restart.cs @@ -6,8 +6,13 @@ public class Restart : MonoBehaviour public void LevelReset() { CommunicationEvents.LevelReset.Invoke(); // currently unused - Level.solved = false; // needed? - CommunicationEvents.LevelFacts.hardreset(false); // delete Facts at Server + Level.solved = false; // needed since static + + // delete Facts at Server + CommunicationEvents.LevelFacts.hardreset(false); + // only when generated! (in Level.cs) + CommunicationEvents.SolutionManager.hardreset(false); + SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex); } diff --git a/Packages/manifest.json b/Packages/manifest.json index 5aa002905261f60083a3d72e224de865675bb68f..186d3a79bb32e12b5dad9f992a0941f69c7c59fc 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -6,7 +6,7 @@ "com.unity.analytics": "3.5.3", "com.unity.collab-proxy": "1.7.1", "com.unity.ide.rider": "2.0.7", - "com.unity.ide.visualstudio": "2.0.9", + "com.unity.ide.visualstudio": "2.0.11", "com.unity.ide.vscode": "1.2.3", "com.unity.multiplayer-hlapi": "1.0.8", "com.unity.nuget.newtonsoft-json": "2.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index e79090dd560c90c86d6441efeb9b6586debd0bf8..99eb41fa6ed3b51366be93529933bc22e8a09c09 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -56,7 +56,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.visualstudio": { - "version": "2.0.9", + "version": "2.0.11", "depth": 0, "source": "registry", "dependencies": {