예제 #1
0
 static void CreateInstanceIfNeeded()
 {
     if (instance == null)
     {
         instance = new EditorCoroutines();
         instance.Initialize();
     }
 }
예제 #2
0
 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);
 }
예제 #3
0
        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);
     }
 }
예제 #5
0
 public void PrintMapList(string key)
 {
     mkey            = key.Trim();
     mMapListUpdated = false;
     EditorCoroutines.StartCoroutine(GetMapListCoroutine(true), this);
 }
예제 #6
0
 public static EditorCoroutines.EditorCoroutine StartCoroutine(this EditorWindow thisRef, IEnumerator coroutine)
 {
     return(EditorCoroutines.StartCoroutine(coroutine, thisRef));
 }
예제 #7
0
 public static void StopAllCoroutines(this EditorWindow thisRef)
 {
     EditorCoroutines.StopAllCoroutines(thisRef);
 }
예제 #8
0
 public static void StopCoroutine(this EditorWindow thisRef, string methodName)
 {
     EditorCoroutines.StopCoroutine(methodName, thisRef);
 }
예제 #9
0
 public static void StopCoroutine(this EditorWindow thisRef, IEnumerator coroutine)
 {
     EditorCoroutines.StopCoroutine(coroutine, thisRef);
 }
예제 #10
0
 public static EditorCoroutines.EditorCoroutine StartCoroutine(this EditorWindow thisRef, string methodName, object value)
 {
     return(EditorCoroutines.StartCoroutine(methodName, value, thisRef));
 }