void OnQueryString(string value) { try { queryString = value; if (queryString != "") { queryString = queryString.Substring(1); //int queryFolderIndex = queryString.IndexOf("f=")+2; int queryPuzzleIndex = queryString.IndexOf("p=") + 2; int queryFunctionIndex = queryString.IndexOf("y=") + 2; int queryEditorIndex; if (queryString.Contains("e=")) { queryEditorIndex = queryString.IndexOf("e=") + 2; } else { queryEditorIndex = queryString.Length + 2; } //string queryFolder = queryString.Substring(queryFolderIndex, queryPuzzleIndex-queryFolderIndex-2); string queryPuzzle = queryString.Substring(queryPuzzleIndex, queryFunctionIndex - queryPuzzleIndex - 2); string queryFunction = queryString.Substring(queryFunctionIndex, queryEditorIndex - queryFunctionIndex - 2); string queryEditor; if (queryString.Contains("e=")) { queryEditor = queryString.Substring(queryEditorIndex); } else { queryEditor = ""; } //Debug.Log ("p: "+queryString.IndexOf("p=")+" | y: "+queryString.IndexOf("y=")); Debug.Log("Puzzle: " + queryPuzzle + " | Function: " + System.Uri.UnescapeDataString(queryFunction)); int i; int j; for (i = 0; i < puzzleGroups.Length; i++) { for (j = 0; j < puzzleGroups[i].puzzles.Length; j++) { if (puzzleGroups[i].puzzles[j].identifier == queryPuzzle) { SetGroup(i); puzzleGroup.SetPuzzle(j); } } } //SetGroup(int.Parse(queryFolder)); //puzzleGroup.SetPuzzle(int.Parse(queryPuzzle)); graph.string1 = System.Uri.UnescapeDataString(queryFunction); if (queryEditor != "" && puzzle.editable) { if (queryEditor.StartsWith("px=")) { int queryPlayerXIndex = queryEditor.IndexOf("px=") + 3; int queryPlayerYIndex = queryEditor.IndexOf("py=") + 3; int queryPolarIndex = queryEditor.IndexOf("cp=") + 3; int queryInvertedIndex = queryEditor.IndexOf("ci=") + 3; int queryParametricIndex = queryEditor.IndexOf("ca=") + 3; int querySwappedIndex = queryEditor.IndexOf("cs=") + 3; string queryPlayerX = queryEditor.Substring(queryPlayerXIndex, queryPlayerYIndex - queryPlayerXIndex - 3); string queryPlayerY = queryEditor.Substring(queryPlayerYIndex, queryPolarIndex - queryPlayerYIndex - 3); string queryPolar = queryEditor.Substring(queryPolarIndex, queryInvertedIndex - queryPolarIndex - 3); string queryInverted = queryEditor.Substring(queryInvertedIndex, queryParametricIndex - queryInvertedIndex - 3); string queryParametric = queryEditor.Substring(queryParametricIndex, querySwappedIndex - queryParametricIndex - 3); string querySwapped = queryEditor.Substring(querySwappedIndex); puzzle.playerMarker.transform.position = new Vector3(float.Parse(queryPlayerX), float.Parse(queryPlayerY), 0); if (queryPolar == "1") { puzzle.polar = true; } if (queryInverted == "1") { puzzle.inverted = true; } if (queryParametric == "1") { puzzle.parametric = true; } if (querySwapped.StartsWith("1")) { puzzle.swapped = true; } queryEditor = queryEditor.Substring(querySwappedIndex + 1); } puzzle.RemoveAll(); Objective newObjective; int objectiveXIndex; int objectiveYIndex; int objectiveDynamicIndex; int objectiveTimerIndex; int objectiveOrderIndex; int nextObjectiveIndex; string objectiveX; string objectiveY; string objectiveDynamic; string objectiveTimer; string objectiveOrder; while (queryEditor.Contains("o=")) { queryEditor = queryEditor.Substring(2); objectiveXIndex = queryEditor.IndexOf("ox=") + 3; objectiveYIndex = queryEditor.IndexOf("oy=") + 3; objectiveDynamicIndex = queryEditor.IndexOf("od=") + 3; objectiveTimerIndex = queryEditor.IndexOf("ot=") + 3; objectiveOrderIndex = queryEditor.IndexOf("oi=") + 3; if (queryEditor.Contains("o=")) { nextObjectiveIndex = queryEditor.IndexOf("o="); } else { nextObjectiveIndex = queryEditor.Length; } objectiveX = queryEditor.Substring(objectiveXIndex, objectiveYIndex - objectiveXIndex - 3); objectiveY = queryEditor.Substring(objectiveYIndex, objectiveDynamicIndex - objectiveYIndex - 3); objectiveDynamic = queryEditor.Substring(objectiveDynamicIndex, objectiveTimerIndex - objectiveDynamicIndex - 3); objectiveTimer = queryEditor.Substring(objectiveTimerIndex, objectiveOrderIndex - objectiveTimerIndex - 3); objectiveOrder = queryEditor.Substring(objectiveOrderIndex, nextObjectiveIndex - objectiveOrderIndex); Debug.Log(objectiveX + " | " + objectiveY + " | " + objectiveDynamic + " | " + objectiveTimer + " | " + objectiveOrder); newObjective = puzzle.AddObjective(); newObjective.transform.position = new Vector3(float.Parse(objectiveX), float.Parse(objectiveY), 1); if (objectiveDynamic == "0") { newObjective.MakeStatic(); } else { newObjective.MakeDynamic(); } newObjective.timeRequired = float.Parse(objectiveTimer); newObjective.orderIndex = int.Parse(objectiveOrder); queryEditor = queryEditor.Substring(nextObjectiveIndex); } } } } catch (Exception ex) { Debug.Log(ex.Message); SetGroup(0); puzzleGroup.SetPuzzle(0); } }