Exemple #1
0
        void StartProgress()
        {
            if (m_ProgressId != k_NoProgressId)
            {
                Progress.Cancel(m_ProgressId);
                Progress.Remove(m_ProgressId);
            }

            m_ProgressId = Progress.Start(L10n.Tr(k_ProgressTitle), options: Progress.Options.Indefinite);
        }
Exemple #2
0
        /// <inheritdoc cref="IAsyncJob"/>
        public void Cancel()
        {
#if UNITY_2020_1_OR_NEWER
            m_IsCancelled = true;
            if (m_TaskId != 0)
            {
                Progress.Cancel(m_TaskId);
            }
            else
#endif
            Internal_Cancel();
        }
 async void ValidationCommandExecute()
 {
     if (!Progress.IsProgress)
     {
         await Task.Run(() => DoValidation());
     }
     else
     {
         if (ExDialogs.Question("中断しますか?"))
         {
             Progress.Cancel();
         }
     }
 }
Exemple #4
0
 public bool Cancel()
 {
     return(Progress.Cancel(Id));
 }
 private void btnCancel_Click(object sender, EventArgs e)
 {
     Progress.Cancel();
 }
Exemple #6
0
    private void DrawSceneProxyProperties()
    {
        EditorGUILayout.BeginVertical("GroupBox");

        EditorGUILayout.LabelField("Scene Proxy", m_resources.m_smallLabel);
        EditorGUILayout.Space(5);

        EditorGUILayout.HelpBox("Proxy set calculations are session based, meaning they won't be serialized and will not survive scene changes or editor restarts.", MessageType.Info);

        m_proxyBounds = EditorGUILayout.Vector3Field("Bounds", m_proxyBounds);
        EditorGUILayout.BeginHorizontal();

        if (m_shouldDisableButtons)
        {
            GUI.enabled = false;
        }

        if (GUILayout.Button("Calculate Proxy"))
        {
            if (Progress.Exists(m_proxyProgressID))
            {
                Progress.Cancel(m_proxyProgressID);
                EditorCoroutineUtility.StopCoroutine(m_proxyCalculationRoutine);
            }

            m_proxyCalculationRoutine = EditorCoroutineUtility.StartCoroutineOwnerless(m_simulator.CalculateSceneProxies(this, m_storyboardData, m_timeline, m_playableDirector, m_sceneProxy.transform.position, m_proxyBounds));
            m_displayProxyProgressBar = true;
            m_proxyProgressID         = Progress.Start("Calculating proxy sets...", "proxy");
        }

        if (m_shouldDisableButtons)
        {
            GUI.enabled = true;
        }

        if (GUILayout.Button("Clear Proxy Sets"))
        {
            m_proxySetToDraw = 0;

            if (Progress.Exists(m_proxyProgressID))
            {
                Progress.Cancel(m_proxyProgressID);
                EditorCoroutineUtility.StopCoroutine(m_proxyCalculationRoutine);
            }

            m_storyboardData.m_proxySets.Clear();
            m_playableDirector.time = 0;
            m_playableDirector.Evaluate();
        }

        m_markerCount = m_simulator.GetTimelineMarkerCount(m_timeline);

        m_proxiesValid = m_storyboardData.m_proxySets.Count == m_markerCount;

        if (m_displayProxyProgressBar)
        {
            Progress.Report(m_proxyProgressID, (float)m_storyboardData.m_proxySets.Count / (float)m_markerCount, "Calculating proxy sets...");
        }

        EditorGUILayout.EndHorizontal();

        Handles.color = Color.white;
        Handles.DrawWireCube(m_sceneProxy.transform.position, m_proxyBounds);

        // Invalidate sets if colliders are not found.
        for (int i = 0; i < m_storyboardData.m_proxySets.Count; i++)
        {
            ProxySet set = m_storyboardData.m_proxySets[i];

            for (int j = 0; j < set.m_proxies.Count; j++)
            {
                Proxy proxy = set.m_proxies[j];

                if (proxy.m_collider == null)
                {
                    set.m_proxies.RemoveAt(j);
                }
            }

            if (set.m_proxies.Count == 0)
            {
                m_storyboardData.m_proxySets.RemoveAt(i);
            }
        }

        m_visualizeProxyBoundaries = EditorGUILayout.Toggle("Visualize Boundaries", m_visualizeProxyBoundaries);

        if (m_storyboardData.m_proxySets.Count > 0)
        {
            m_visualizeProxyCollisions = EditorGUILayout.Toggle("Visualize Collisions", m_visualizeProxyCollisions);

            if (m_visualizeProxyCollisions)
            {
                m_proxySetToDraw            = EditorGUILayout.IntSlider("Set to Draw", m_proxySetToDraw, 0, m_storyboardData.m_proxySets.Count - 1);
                m_visualizeEvaluateTimeline = EditorGUILayout.Toggle("Evaluate Timeline", m_visualizeEvaluateTimeline);

                if (m_visualizeEvaluateTimeline)
                {
                    StoryboardMarker marker = m_storyboardData.m_proxySets[m_proxySetToDraw].m_marker;
                    m_playableDirector.time = marker.m_jumpsToTime ? marker.m_jumpTime : marker.time;
                    m_playableDirector.Evaluate();
                }
            }
        }

        GUIStyle labelStyle = new GUIStyle();

        if (m_storyboardData.m_proxySets.Count != m_markerCount)
        {
            labelStyle.normal.textColor = Color.yellow;
        }
        else
        {
            labelStyle.normal.textColor = Color.green;
        }

        GUILayout.Label(m_storyboardData.m_proxySets.Count + " proxy sets are calculated out of " + m_markerCount + " markers.", labelStyle);
        EditorGUILayout.EndVertical();
    }
    public void CreateImplementationDetails(string implementationResourcesPath, ref List <CinematographyTechniqueImplementation> implementations)
    {
        if (implementations == null)
        {
            implementations = new List <CinematographyTechniqueImplementation>();
        }

        System.Type[] types             = System.Reflection.Assembly.GetExecutingAssembly().GetTypes();
        System.Type[] derivedTechniques = (from System.Type type in types where type.IsSubclassOf(typeof(CinematographyTechniqueImplementation)) select type).ToArray();

        if (Progress.Exists(m_progressID))
        {
            Progress.Cancel(m_progressID);
        }

        m_progressID = Progress.Start("Cinematography Techniques", "Creating assets from derived cinematography techniques.");
        for (int i = 0; i < derivedTechniques.Length; i++)
        {
            System.Type type                   = derivedTechniques[i];
            string      assetName              = implementationResourcesPath + "/" + type.ToString() + ".asset";
            bool        fileExists             = File.Exists(assetName);
            bool        implementationContains = false;

            if (fileExists)
            {
                implementationContains = implementations.FindIndex(o => o != null && o.GetType().ToString().CompareTo(type.ToString()) == 0) >= 0;
            }

            if (!fileExists || !implementationContains)
            {
                if (!AssetDatabase.IsValidFolder(implementationResourcesPath))
                {
                    Debug.LogError("Implementation Resources Path is not valid. " + implementationResourcesPath);
                    return;
                }

                ScriptableObject instance = ScriptableObject.CreateInstance(type.ToString());

                if (instance != null)
                {
                    AssetDatabase.CreateAsset(instance, assetName);
                    AssetDatabase.SaveAssets();
                    implementations.Add((CinematographyTechniqueImplementation)instance);
                }
                else
                {
                    Debug.LogError("Asset instance is null. This usually means that your derived class does not have a script.cs file with it's own name.");
                }
            }
            else
            {
            }

            Progress.Report(m_progressID, (float)i / (float)derivedTechniques.Length);
        }

        for (int i = 0; i < implementations.Count; i++)
        {
            if (implementations[i] == null)
            {
                implementations.RemoveAt(i);
            }
        }

        Progress.Finish(m_progressID);
    }