static void CreateInstanceIfNeeded() { if (instance == null) { instance = new EditorCoroutines(); instance.Initialize(); } }
public void AddMesh(string APIKey, string MapID, GameObject PlaneMesh, Transform MapParent = null) { mMapID = MapID.Trim(); mkey = APIKey.Trim(); mMapListUpdated = false; EditorCoroutines.StartCoroutine(GetMapListCoroutine(false), this); EditorCoroutines.StartCoroutine(AddMeshCoroutine(PlaneMesh, MapParent), this); }
IEnumerator GetMapListCoroutine(bool printList) { Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("APIKEY", mkey); using (WWW www = new WWW(baseURL + "apiKeyVerify", null, headers)) { yield return(www); WWWStatus ret_val = JsonConvert.DeserializeObject <WWWStatus>(www.text); if (ret_val.status == true) { Debug.Log("API Key Verified."); } else { Debug.LogError("API Key Not verified. Please get a key from developers.placenote.com and enter it under the GameObject Place Mesh in the Inspector"); EditorCoroutines.StopAllCoroutines(this); yield break; } } using (WWW www = new WWW(baseURL + "searchPlaces", null, headers)) { Debug.Log("Recalling Map List"); yield return(www); mMapIDList = JsonConvert.DeserializeObject <LibPlacenote.MapList> (www.text); mMapListUpdated = true; //tell any other co-routines waiting that map list is updated if (printList) { Debug.Log("Available MapIDs w/ Plane Data"); foreach (LibPlacenote.MapInfo map in mMapIDList.places) { if (map.metadata != null) { if (map.metadata.userdata != null) { if (map.metadata.userdata["planes"] != null) { Debug.Log(map.placeId); } } } else { Debug.Log("Metadata null"); } } } yield break; } }
public void DoSomething(bool start, bool stop, bool stopAll) { if (start) { EditorCoroutines.StartCoroutine(Example(), this); } if (stop) { EditorCoroutines.StopCoroutine("Example", this); } if (stopAll) { EditorCoroutines.StopAllCoroutines(this); } }
public void PrintMapList(string key) { mkey = key.Trim(); mMapListUpdated = false; EditorCoroutines.StartCoroutine(GetMapListCoroutine(true), this); }
public static EditorCoroutines.EditorCoroutine StartCoroutine(this EditorWindow thisRef, IEnumerator coroutine) { return(EditorCoroutines.StartCoroutine(coroutine, thisRef)); }
public static void StopAllCoroutines(this EditorWindow thisRef) { EditorCoroutines.StopAllCoroutines(thisRef); }
public static void StopCoroutine(this EditorWindow thisRef, string methodName) { EditorCoroutines.StopCoroutine(methodName, thisRef); }
public static void StopCoroutine(this EditorWindow thisRef, IEnumerator coroutine) { EditorCoroutines.StopCoroutine(coroutine, thisRef); }
public static EditorCoroutines.EditorCoroutine StartCoroutine(this EditorWindow thisRef, string methodName, object value) { return(EditorCoroutines.StartCoroutine(methodName, value, thisRef)); }