private IEnumerator DisplayText(string fullText)
        {
            string currentText = "";
            int    charIndex   = 0;

            displayAll = false;

            while (charIndex < fullText.Length)
            {
                if (displayAll)
                {
                    textbox.SetText(fullText);
                    break;
                }

                if (fullText[charIndex] == escapeChar)
                {
                    // do something special here for formating and other fun stuff
                    Debug.Log("escapeChar found!");
                }

                currentText += fullText[charIndex++];
                textbox.SetText(currentText);
#if UNITY_EDITOR
                if (!Application.isPlaying)
                {
                    yield return(null);
                }
                else
#endif
                yield return(waitForChar);
            }

            continueTextImage.gameObject.SetActive(true);
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                editorCoroutine = null;
            }
            else
#endif
            typingCoroutine = null;
        }
Ejemplo n.º 2
0
    static void FetchWorlds(int offset = 0)
    {
        ApiWorld.FetchList(
            delegate(List <ApiWorld> obj)
        {
            Debug.LogFormat("<color=yellow>Fetching World Bucket {0}</color>", offset);
            if (obj.Count > 0)
            {
                fetchingWorlds = EditorCoroutine.Start(() =>
                {
                    int count = obj.Count;
                    SetupWorldData(obj);
                    FetchWorlds(offset + count);
                });
            }
            else
            {
                fetchingWorlds = null;

                foreach (ApiWorld w in uploadedWorlds)
                {
                    DownloadImage(w.id, w.thumbnailImageUrl);
                }
            }
        },
            delegate(string obj)
        {
            Debug.LogError("Error fetching your uploaded worlds:\n" + obj);
            fetchingWorlds = null;
        },
            ApiWorld.SortHeading.Updated,
            ApiWorld.SortOwnership.Mine,
            ApiWorld.SortOrder.Descending,
            offset,
            PageLimit,
            "",
            null,
            null,
            "",
            ApiWorld.ReleaseStatus.All,
            false,
            true);
    }
Ejemplo n.º 3
0
        void OnUpdate()
        {
            float deltaTime = (float)(DateTime.Now.Subtract(previousTimeSinceStartup).TotalMilliseconds / 1000.0f);

            previousTimeSinceStartup = DateTime.Now;
            if (coroutineDict.Count == 0)
            {
                return;
            }

            tempCoroutineList.Clear();
            foreach (var pair in coroutineDict)
            {
                tempCoroutineList.Add(pair.Value);
            }

            for (var i = tempCoroutineList.Count - 1; i >= 0; i--)
            {
                List <EditorCoroutine> coroutines = tempCoroutineList[i];

                for (int j = coroutines.Count - 1; j >= 0; j--)
                {
                    EditorCoroutine coroutine = coroutines[j];

                    if (!coroutine.currentYield.IsDone(deltaTime))
                    {
                        continue;
                    }

                    if (!MoveNext(coroutine))
                    {
                        coroutines.RemoveAt(j);
                        coroutine.currentYield = null;
                        coroutine.finished     = true;
                    }

                    if (coroutines.Count == 0)
                    {
                        coroutineDict.Remove(coroutine.ownerUniqueHash);
                    }
                }
            }
        }
        /// <summary>
        /// The Inspector of the Parent Class, call in override public void OnInspectorGUI() of the cild
        /// </summary>
        override public void OnInspectorGUI()
        {
            url = EditorGUILayout.TextField("URL: ", url);

            if (GUILayout.Button("Load values"))
            {
                if (!run)
                {
                    run = true;
                    EditorCoroutine.StartCoroutine(LoadFunction());
                }
            }

            if (GUILayout.Button("Stop run"))
            {
                run = false;
            }
            EditorGUILayout.Space();
        }
Ejemplo n.º 5
0
        IEnumerator CaptureScreenshot()
        {
            if (!EditorApplication.isPlaying)
            {
                Logger.LogError(Logger.Priority.High, () => "Please Must Run at playmode...");
                yield break;
            }

            yield return(new WaitForEndOfFrame());

            var       path       = Path.Combine("Assets", Path.ChangeExtension(_assetPath, ".png"));
            Texture2D screenshot = null;

            if (_useCamera == null)
            {
                ScreenCapture.CaptureScreenshot(path, _superSize);
            }
            else
            {
                var cachedActiveRT = RenderTexture.active;
                var cachedCameraRT = _useCamera.targetTexture;

                var RT = new RenderTexture(_imageSize.x, _imageSize.y, 1, RenderTextureFormat.Default);
                RenderTexture.active     = RT;
                _useCamera.targetTexture = RT;
                _useCamera.Render();

                screenshot = new Texture2D(RT.width, RT.height, TextureFormat.RGBA32, 1, false);
                screenshot.ReadPixels(new Rect(0, 0, RT.width, RT.height), 0, 0);
                screenshot.Apply();

                _useCamera.targetTexture = cachedCameraRT;
                RenderTexture.active     = cachedActiveRT;

                File.WriteAllBytes(path, ImageConversion.EncodeToPNG(screenshot));
            }
            AssetDatabase.ImportAsset(path);
            AssetDatabase.Refresh();
            Logger.Log(Logger.Priority.Low, () => $"Success Take screenshot! path={path}");

            _captureScreenshotCoroutine = null;
            yield break;
        }
Ejemplo n.º 6
0
    void ProcessCoroutine(EditorCoroutine item)
    {
        IEnumerator ie = item.routine;

        if (item.endTime < DateTime.Now)
        {
            if (ie.MoveNext())
            {
                if (ie.Current is WaitForSecondsInEditor)
                {
                    item.endTime = DateTime.Now.AddSeconds(((WaitForSecondsInEditor)(ie.Current)).seconds);
                }
            }
            else
            {
                stop();
            }
        }
    }
Ejemplo n.º 7
0
 public override void OnGUI()
 {
     base.OnGUI();
     GUILayout.BeginHorizontal();
     {
         GUILayout.BeginVertical();
         {
             GUILayout.Label("定时器,定时10秒,每0.5秒一次回调");
             GUILayout.Label(count.ToString());
             if (GUILayout.Button("Start"))
             {
                 EditorCoroutine.Start(Timer());
             }
         }
         GUILayout.EndVertical();
         GUILayout.BeginVertical();
         {
             GUILayout.Label("等待 定时器 >5");
             if (GUILayout.Button("Start"))
             {
                 EditorCoroutine.Start(waitCounting());
             }
             GUILayout.Label(!countend ? "等待中.." : "✓");
         }
         GUILayout.EndVertical();
         GUILayout.BeginVertical();
         {
             GUILayout.Label("等1帧");
             if (GUILayout.Button("Start"))
             {
                 EditorCoroutine.Start(waitForNextFrame());
             }
         }
         GUILayout.EndVertical();
     }
     GUILayout.EndHorizontal();
     if (GUILayout.Button("整合两个携程的序列"))
     {
         EditorCoroutine.Start(sequnce());
     }
     OnGUIUtility.ScriptField("Script", this.GetType());
 }
Ejemplo n.º 8
0
            public void DrawGUI()
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUILayout.LabelField("Calculate prime numbers");
                numPrimes = EditorGUILayout.IntField("Stop After", numPrimes);
                numPrimes = Mathf.Clamp(numPrimes, 100, 100000);
                if (runningRoutine == null || runningRoutine.State == EditorCoroutineState.Canceled || runningRoutine.State == EditorCoroutineState.Done)
                {
                    if (GUILayout.Button("Start"))
                    {
                        runningRoutine = EditorCoroutine.Start(FindPrimeNumber(numPrimes));
                    }
                }
                else
                {
                    if (runningRoutine != null && GUILayout.Button("Cancel"))
                    {
                        runningRoutine.Cancel();
                    }
                }
                if (runningRoutine != null)
                {
                    var prevColor = GUI.backgroundColor;
                    switch (runningRoutine.State)
                    {
                    case EditorCoroutineState.Running:
                        GUI.backgroundColor = Color.yellow;
                        break;

                    case EditorCoroutineState.Canceled:
                        GUI.backgroundColor = Color.red;
                        break;

                    case EditorCoroutineState.Done:
                        GUI.backgroundColor = Color.green;
                        break;
                    }
                    EditorGUILayout.LabelField(runningRoutine.State.ToString(), EditorStyles.helpBox);
                    GUI.backgroundColor = prevColor;
                }
                EditorGUILayout.EndVertical();
            }
Ejemplo n.º 9
0
    public void Play()
    {
        if (isPlaying)
        {
            return;
        }
        Reset();

        isPlaying = true;
        StopAllCoroutines();

        if (Application.isEditor && !Application.isPlaying)
        {
            EditorCoroutine.StartCoroutine(FpsStepper(), this);
        }
        else
        {
            StartCoroutine(FpsStepper());
        }
    }
Ejemplo n.º 10
0
        public void GetLaunchingInfo <T>(LaunchingConfigurations launchingConfigurations, Action <T> callback)
        {
            var request = UnityWebRequest.Get(
                string.Format("{0}/{1}/appkeys/{2}/configurations",
                              launchingConfigurations.uri,
                              launchingConfigurations.version,
                              launchingConfigurations.appKey));

            request.method = UnityWebRequest.kHttpVerbGET;

            var helper = new UnityWebRequestHelper(request);

            EditorCoroutine.Start(
                helper.SendWebRequest(
                    (result) =>
            {
                var launchingInfo = JsonUtility.FromJson <T>(result.downloadHandler.text);
                callback(launchingInfo);
            }));
        }
Ejemplo n.º 11
0
    private static void OnEnable()
    {
        if (!AssetDatabase.IsValidFolder("Assets/Autosave"))
        {
            AssetDatabase.CreateFolder("Assets", "Autosave");
        }
        if (prefs == null)
        {
            prefs = CreateInstance <AutosavePrefs>(); SavePrefs();
        }

        LoadPrefs();

        EditorApplication.playModeStateChanged += OnPlayModeToggle;

        if (saveRoutine == null)
        {
            saveRoutine = EditorCoroutineUtility.StartCoroutineOwnerless(SaveOpenScenesCoroutine());
        }
    }
Ejemplo n.º 12
0
        static void OnPostprocessAllAssets(
            string[] importedAssets,
            string[] deletedAssets,
            string[] movedAssets,
            string[] movedFromAssetPaths
            )
        {
            if (isPostProcessing)
            {
                return;
            }

            isPostProcessing = true;

            bool anyDirty = false;

            using (var dirtyPrefabs = TempList <GameObject> .Get())
            {
                PostProcessAssets(importedAssets, dirtyPrefabs.buffer);

                anyDirty = dirtyPrefabs.Count > 0;

                for (int i = 0; i < dirtyPrefabs.Count; ++i)
                {
                    GameObject prefab = dirtyPrefabs[i];

                    EditorUtility.SetDirty(prefab);
                }

                UpdateSceneObjects(dirtyPrefabs.buffer);
            }

            if (anyDirty)
            {
                EditorCoroutine.Start(SaveProjectAndWaitForFrame());
            }
            else
            {
                isPostProcessing = false;
            }
        }
Ejemplo n.º 13
0
 static void FetchAvatars(int offset = 0)
 {
     ApiAvatar.FetchList(
         delegate(IEnumerable <ApiAvatar> obj)
     {
         Debug.LogFormat("<color=yellow>Fetching Avatar Bucket {0}</color>", offset);
         if (obj.FirstOrDefault() != null)
         {
             fetchingAvatars = EditorCoroutine.Start(() =>
             {
                 var l     = obj.ToList();
                 int count = l.Count;
                 SetupAvatarData(l);
                 FetchAvatars(offset + count);
             });
         }
         else
         {
             fetchingAvatars = null;
             foreach (ApiAvatar a in uploadedAvatars)
             {
                 DownloadImage(a.id, a.thumbnailImageUrl);
             }
         }
     },
         delegate(string obj)
     {
         Debug.LogError("Error fetching your uploaded avatars:\n" + obj);
         fetchingAvatars = null;
     },
         ApiAvatar.Owner.Mine,
         ApiAvatar.ReleaseStatus.All,
         null,
         PageLimit,
         offset,
         ApiAvatar.SortHeading.None,
         ApiAvatar.SortOrder.Descending,
         null,
         null,
         true);
 }
Ejemplo n.º 14
0
        public void NextTextBlock(string image, string textBlock)
        {
            if (!gameObject.activeInHierarchy)
            {
                Show(true);
            }

            if (typingCoroutine != null)
            {
                Debug.LogError("Should not be pushing a line will "
                               + "other line is not finished displaying");
                StopCoroutine(typingCoroutine);
            }
#if UNITY_EDITOR
            else if (editorCoroutine != null)
            {
                EditorCoroutineUtility.StopCoroutine(editorCoroutine);
            }
#endif

            Sprite sprite = spriteAtlas.GetSprite(image);
            if (sprite != null)
            {
                portrait.sprite = sprite;
            }
            else
            {
                portrait.sprite = missingPortrait;
            }

            continueTextImage.gameObject.SetActive(false);

#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                editorCoroutine = EditorCoroutineUtility.StartCoroutineOwnerless(DisplayText(textBlock));
            }
            else
#endif
            typingCoroutine = StartCoroutine(DisplayText(textBlock));
        }
    void ShowContent()
    {
        if (uploadedWorlds == null || uploadedAvatars == null)
        {
            if (uploadedWorlds == null)
            {
                uploadedWorlds = new List <ApiWorld>();
            }
            if (uploadedAvatars == null)
            {
                uploadedAvatars = new List <ApiAvatar>();
            }

            EditorCoroutine.Start(FetchUploadedData());
        }

        if (fetchingWorlds != null || fetchingAvatars != null)
        {
            GUILayout.BeginVertical(boxGuiStyle, GUILayout.Width(SdkWindowWidth));
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Fetching Records", titleGuiStyle);
            EditorGUILayout.Space();
            GUILayout.EndVertical();
        }
        else
        {
            GUILayout.BeginVertical(boxGuiStyle, GUILayout.Width(SdkWindowWidth));
            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Fetch updated records from the VRChat server");
            if (GUILayout.Button("Fetch"))
            {
                ClearContent();
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();
            GUILayout.EndVertical();
        }

        OnGUIUserInfo();
    }
Ejemplo n.º 16
0
 public void Clean()
 {
     Stop();
     if (decoding != null)
     {
         decoding.Stop();
         decoding = null;
     }
     if (Currrent)
     {
         GameObject.DestroyImmediate(Currrent);
         Currrent = null;
     }
     textures.Clear();
     Index = 0;
     if (img != null)
     {
         img.Dispose();
         img = null;
     }
 }
        IEnumerator PatchVenue()
        {
            isProcessing = true;
            isUploading  = false;

            if (!string.IsNullOrEmpty(thumbnailImagePath))
            {
                var uploadThumbnail = new UploadThumbnailService(
                    accessToken,
                    thumbnailImagePath,
                    policy =>
                {
                    isUploading           = false;
                    payload.thumbnailUrls = new List <ThumbnailUrl>()
                    {
                        new ThumbnailUrl(policy.url)
                    };
                },
                    exception =>
                {
                    isUploading = false;
                    HandleError(exception);
                }
                    );
                isUploading = true;
                uploadThumbnail.Run();

                while (isUploading)
                {
                    yield return(null);
                }

                if (!isProcessing)
                {
                    yield break;
                }
            }

            EditorCoroutine.Start(PatchVenueCore());
        }
Ejemplo n.º 18
0
    IEnumerator FpsStepper()
    {
        while (true)
        {
            if (wrapMode == WrapMode.Oneshot && frameIndex == frames.Count - 1)
            {
                if (Application.isEditor && !Application.isPlaying)
                {
                    EditorCoroutine.StopAllCoroutines(this);
                }
                else
                {
                    StopAllCoroutines();
                }
            }
            Next();



            yield return(new WaitForSeconds(1 / fps));
        }
    }
Ejemplo n.º 19
0
        /// <summary>
        /// Launch the scanning process.
        /// </summary>
        public void LaunchScanningProcess(bool ConsoleOutput)
        {
            OutputInConsole = ConsoleOutput;

            if (OutputInConsole)
            {
                Debug.Log("Project Scanner: Downloading Assets Description");
            }

            _isScanning = true;
            AssetsList  = new Dictionary <string, AssetItem>();

            _wwwWrapper = new HttpWrapper();

            WWWForm _form = new WWWForm();

            _form.AddField("UnityVersion", Application.unityVersion);
            _form.AddField("PlayMakerVersion", MyUtils.GetPlayMakerVersion());

            _wwwWrapper.GET
            (
                "http://www.fabrejean.net/projects/playmaker_ecosystem/assetsDescription"
                ,
                _form
                ,
                (WWW www) =>
            {
                if (!string.IsNullOrEmpty(www.error))
                {
                    Debug.LogError("Project Scanner: Error downloading assets definition :" + www.error);
                    _isScanning = false;
                }
                else
                {
                    EditorCoroutine.start(DoScanProject(www.text));
                }
            }
            );
        }
        private static string CheckForPlatformUtil(string dataPath)
        {
            string toolDataPath = dataPath + "/Oculus/VR/Editor/Tools";

            if (!Directory.Exists(toolDataPath))
            {
                Directory.CreateDirectory(toolDataPath);
            }

            string platformUtil = toolDataPath + "/ovr-platform-util.exe";

            if (!System.IO.File.Exists(platformUtil))
            {
                OVRPlugin.SendEvent("oculus_platform_tool", "provision_util");
                EditorCoroutine downloadCoroutine = EditorCoroutine.Start(ProvisionPlatformUtil(platformUtil));
                while (!downloadCoroutine.GetCompleted())
                {
                }
            }

            return(platformUtil);
        }
        public void EditorApplyCheck()
        {
            //Starts loop during editor or pause
            if (editorApply) // starts loop if not already looping
            {
                if (editModeLoop == null)
                {
                    SetPrevious();

                    RecordParent();

                    editModeLoop = EditorCoroutineUtility.StartCoroutineOwnerless(EditModeLoop() /*, this*/);
                }
            }
            else //stops loop if exists
            {
                if (editModeLoop != null)
                {
                    EditorCoroutineUtility.StopCoroutine(editModeLoop);
                    editModeLoop = null;
                }
            }
        }
Ejemplo n.º 22
0
    public static RoleObject CreateRole(Role Config)
    {
        if (!Config)
        {
            return(null);
        }

        GameObject role = Object.Instantiate(Config.gameObject);

        role.name = Config.name;
        RoleObject ro = role.AddComponent <RoleObject>();

        ro.mActionPerformer            = role.AddComponent <ActionPerformer>();
        ro.mActionPerformer.owerObject = ro;
        ro.Config = ro.GetComponent <Role>();
        role.transform.position         = Vector3.zero;
        role.transform.localPosition    = Vector3.zero;
        role.transform.localEulerAngles = Vector3.zero;
        role.transform.localScale       = Vector3.one;
        EditorCoroutine.Execute(AsyncCreateRole(ro, ro.Config));

        return(ro);
    }
        public IEnumerator StopCoroutine_EditorCoroutineArg_StopsCorrectly()
        {
            RefBool isTestComplete = new RefBool();
            RefBool wasCancelled   = new RefBool();

            // Test coroutine will be stopped. Check in 1 second for expected results. Test coroutine should finish by then, successfully or not.
            EditorCoroutineService.StartCoroutine(ReturnAfterSecondsToBeStopped(1f, isTestComplete));

            TestContext.WriteLine("Starting SimpleIteratorToBeStopped routine.\nWill automatically attempt to stop it after a frame.");
            // This coroutine will be attempted to be cancelled after 1 frame, in the line after the following `yield return null`.
            EditorCoroutine editorCoroutine = EditorCoroutineService.StartCoroutine(SimpleIteratorToBeStopped(wasCancelled));

            yield return(null);

            EditorCoroutineService.StopCoroutine(editorCoroutine);

            while (!isTestComplete.Value)
            {
                yield return(null);
            }

            Assert.IsTrue(wasCancelled.Value, "EditorCoroutine was not stopped correctly via Editor Coroutine reference arg.");
        }
Ejemplo n.º 24
0
        private IEnumerator SendLogPolling()
        {
            while (true)
            {
                if (sendDataQueue.Count > 0)
                {
                    SendData sendData = sendDataQueue.Dequeue();

                    if (sendData != null)
                    {
                        yield return(EditorCoroutine.Start(
                                         SendHTTPPost(
                                             sendData.url,
                                             sendData.logVersion,
                                             sendData.GetData())));
                    }
                }
                else
                {
                    yield return(new WaitForSecondsRealtime(LONG_INTERVAL));
                }
            }
        }
        private void OnSelectionChanged()
        {
            #if EDITOR_COROUTINES
            if (_coroutine != null)
            {
                this.StopCoroutine(_coroutine);
            }
            _taskQueue.Clear();

            GetSelection();

            _coroutine = this.StartCoroutine(RunQueue());
            #else
            _taskQueue.Clear();

            GetSelection();

            while (_taskQueue.Count > 0)
            {
                _taskQueue.Dequeue()();
            }
            #endif
        }
        private static void CompleteImportMappings(string mappingsPath)
        {
            EditorPrefs.DeleteKey("RTSL_ImportMappings");

            PersistentClassMapping[] classMappings     = null;
            PersistentClassMapping[] surrogateMappings = null;

            try
            {
                MappingsUtility.Import(mappingsPath, out classMappings, out surrogateMappings);
                MappingsUtility.MergeClassMappings(classMappings);
                MappingsUtility.MergeSurrogateMappings(surrogateMappings);
            }
            finally
            {
                Cleanup(classMappings);
                Cleanup(surrogateMappings);
                File.Delete(mappingsPath);
                File.Delete(mappingsPath + ".meta");
            }

            EditorCoroutine.Start(CoBuildAll());
        }
Ejemplo n.º 27
0
    static void OnPlayModeToggle(PlayModeStateChange state)
    {
        if (state == PlayModeStateChange.ExitingEditMode)
        {
            SavePrefs();

            if (saveOnPlay)
            {
                SaveAllOpenScenes();
                Debug.Log("Saved on play at: " + System.DateTime.Now);
            }
        }

        if (state == PlayModeStateChange.ExitingPlayMode)
        {
            LoadPrefs();
            if (saveRoutine != null)
            {
                EditorCoroutineUtility.StopCoroutine(saveRoutine);
            }
            saveRoutine = EditorCoroutineUtility.StartCoroutineOwnerless(SaveOpenScenesCoroutine());
        }
    }
Ejemplo n.º 28
0
        public virtual void DefaultSetupElements()
        {
            var elementName = UIRoot.Q <Foldout>("ElementName");

            elementName.text = TemplateName;
            var ElementsContainer = UIRoot.Q <VisualElement>("ElementsContainer");

            UIRoot.Q <Button>("Delete").clickable.clicked += () => lab.DeleteElement(this);
            UIRoot.Q <Button>("Help").clickable.clicked   += () =>
            {
                EditorCoroutine.Start(OpenHelper());
            };

            var ToolBox  = ElementsContainer.Q("ToolBox");
            var KEYWORDS = UIRoot.Q("KeyWords");

            KEYWORDS.Clear();
            foreach (var kw in keyWords)
            {
                if (kw._(KeyWord.Flag.HideInInspector))
                {
                    continue;
                }
                var kwInput = new KeyWordInput(lab, kw, this);
                kwInput.RegisterValueChangedCallback((e) =>
                {
                    this.SetValue(kw.key, e.newValue);
                });
                KEYWORDS.Add(kwInput);
            }
            var Des = ElementsContainer.Q <TextField>("Description");

            Des.value = TemplateDes;
            Des.SetEnabled(false);
            //工具箱
            ToolBox.Q <Button>("Preview").clickable.clicked += () => SetPreview();
        }
Ejemplo n.º 29
0
        void GoStartCoroutine(EditorCoroutine coroutine)
        {
            if (!coroutineDict.ContainsKey(coroutine.routineUniqueHash))
            {
                List <EditorCoroutine> newCoroutineList = new List <EditorCoroutine>();
                coroutineDict.Add(coroutine.routineUniqueHash, newCoroutineList);
            }
            coroutineDict[coroutine.routineUniqueHash].Add(coroutine);

            if (!coroutineOwnerDict.ContainsKey(coroutine.ownerUniqueHash))
            {
                Dictionary <string, EditorCoroutine> newCoroutineDict = new Dictionary <string, EditorCoroutine>();
                coroutineOwnerDict.Add(coroutine.ownerUniqueHash, newCoroutineDict);
            }

            // If the method from the same owner has been stored before, it doesn't have to be stored anymore,
            // One reference is enough in order for "StopAllCoroutines" to work
            if (!coroutineOwnerDict[coroutine.ownerUniqueHash].ContainsKey(coroutine.routineUniqueHash))
            {
                coroutineOwnerDict[coroutine.ownerUniqueHash].Add(coroutine.routineUniqueHash, coroutine);
            }

            MoveNext(coroutine);
        }
Ejemplo n.º 30
0
 static void HandleLog(string logString, string stackTrace, string type = "")
 {
     output = logString;
     stack  = stackTrace;
     lm     = new LogMessage
     {
         st   = stack,
         src  = "unity",
         msg  = output,
         type = type
     };
     logMessages.log.Add(lm);
     if (logCount == 0)
     {
         logMessages.ts = DateTime.UtcNow.ToString();
         coroutine      = EditorCoroutineUtility.StartCoroutineOwnerless(EditorAttempt(0.5f));
     }
     else
     {
         EditorCoroutineUtility.StopCoroutine(coroutine);
         coroutine = EditorCoroutineUtility.StartCoroutineOwnerless(EditorAttempt(0.5f));
     }
     // sw.Close();
 }
 public static EditorCoroutine Start(IEnumerator routine)
 {
     var coroutine = new EditorCoroutine(routine);
     coroutine.Start();
     return coroutine;
 }
	public static EditorCoroutine StartEditorCoroutine( IEnumerator _routine )
	{
		EditorCoroutine coroutine = new EditorCoroutine(_routine);
		coroutine.StartEditorCoroutine();
		return coroutine;
	}