SetExecutionOrder() private méthode

private SetExecutionOrder ( MonoScript script, int order ) : void
script MonoScript
order int
Résultat void
Exemple #1
0
        private void Apply()
        {
            List <int>        list  = new List <int>();
            List <MonoScript> list2 = new List <MonoScript>();

            for (int i = 0; i < this.m_AllScripts.Length; i++)
            {
                if (MonoImporter.GetExecutionOrder(this.m_AllScripts[i]) != this.m_AllOrders[i])
                {
                    list.Add(i);
                    list2.Add(this.m_AllScripts[i]);
                }
            }
            bool success = true;

            if (Provider.enabled)
            {
                Task task = Provider.Checkout(list2.ToArray(), CheckoutMode.Meta);
                task.Wait();
                success = task.success;
            }
            if (success)
            {
                foreach (int num2 in list)
                {
                    MonoImporter.SetExecutionOrder(this.m_AllScripts[num2], this.m_AllOrders[num2]);
                }
                this.PopulateScriptArray();
            }
            else
            {
                Debug.LogError("Could not checkout scrips in version control for changing script execution order");
            }
        }
Exemple #2
0
        private void Apply()
        {
            List <int>        list  = new List <int>();
            List <MonoScript> list2 = new List <MonoScript>();

            for (int i = 0; i < this.m_AllScripts.Length; i++)
            {
                if (MonoImporter.GetExecutionOrder(this.m_AllScripts[i]) != this.m_AllOrders[i])
                {
                    list.Add(i);
                    list2.Add(this.m_AllScripts[i]);
                }
            }
            bool flag = true;

            if (Provider.enabled)
            {
                Task task = Provider.Checkout(list2.ToArray(), CheckoutMode.Both);
                task.SetCompletionAction(CompletionAction.UpdatePendingWindow);
                task.Wait();
                flag = task.success;
            }
            if (flag)
            {
                foreach (int current in list)
                {
                    MonoImporter.SetExecutionOrder(this.m_AllScripts[current], this.m_AllOrders[current]);
                }
                this.PopulateScriptArray();
            }
            else
            {
                Debug.LogError("Could not checkout scrips in version control for changing script execution order");
            }
        }
Exemple #3
0
        private void Apply()
        {
            var changedIndices = new List <int>();
            var changedScripts = new List <MonoScript>();

            for (int i = 0; i < m_AllScripts.Length; i++)
            {
                if (MonoImporter.GetExecutionOrder(m_AllScripts[i]) != m_AllOrders[i])
                {
                    changedIndices.Add(i);
                    changedScripts.Add(m_AllScripts[i]);
                }
            }

            bool editable = true;

            if (Provider.enabled)
            {
                var needToCheckout = new AssetList();
                foreach (var s in changedScripts)
                {
                    var asset = Provider.GetAssetByPath(AssetDatabase.GetAssetPath(s));
                    if (asset == null) // script might be outside of the project (e.g. in a package)
                    {
                        continue;
                    }
                    if (AssetDatabase.IsMetaFileOpenForEdit(s, StatusQueryOptions.UseCachedIfPossible))
                    {
                        continue; // might not need a checkout (not connected, etc.)
                    }
                    needToCheckout.Add(asset);
                }
                if (needToCheckout.Any())
                {
                    var task = Provider.Checkout(needToCheckout, CheckoutMode.Meta);
                    task.Wait();
                    editable = task.success;
                }
            }

            if (editable)
            {
                foreach (int index in changedIndices)
                {
                    MonoImporter.SetExecutionOrder(m_AllScripts[index], m_AllOrders[index]);
                }

                PopulateScriptArray();
            }
            else
            {
                Debug.LogError("Could not checkout scrips in version control for changing script execution order");
            }
        }
        private void Apply()
        {
            var changedIndices = new List <int>();
            var changedPaths   = new List <string>();

            for (var i = 0; i < m_AllScripts.Length; i++)
            {
                var script = m_AllScripts[i];
                if (MonoImporter.GetExecutionOrder(script) == m_AllOrders[i])
                {
                    continue;
                }

                var assetPath = AssetDatabase.GetAssetPath(script);
                if (string.IsNullOrEmpty(assetPath)) // Script might be outside of the project (e.g. in a package).
                {
                    continue;
                }

                var metaPath = AssetDatabase.GetTextMetaFilePathFromAssetPath(assetPath);
                if (!AssetDatabase.CanOpenForEdit(metaPath))
                {
                    continue;
                }

                changedIndices.Add(i);
                if (!AssetDatabase.IsOpenForEdit(metaPath)) // No VCS enabled, not connected, already checked out, etc.
                {
                    changedPaths.Add(metaPath);
                }
            }

            if (!AssetDatabase.MakeEditable(changedPaths.ToArray()))
            {
                Debug.LogError("Could not make scrips editable for changing script execution order.");
                return;
            }

            foreach (var index in changedIndices)
            {
                MonoImporter.SetExecutionOrder(m_AllScripts[index], m_AllOrders[index]);
            }

            PopulateScriptArray();
        }
        private void Apply()
        {
            List <int>        intList        = new List <int>();
            List <MonoScript> monoScriptList = new List <MonoScript>();

            for (int index = 0; index < this.m_AllScripts.Length; ++index)
            {
                if (MonoImporter.GetExecutionOrder(this.m_AllScripts[index]) != this.m_AllOrders[index])
                {
                    intList.Add(index);
                    monoScriptList.Add(this.m_AllScripts[index]);
                }
            }
            bool flag = true;

            if (Provider.enabled)
            {
                Task task = Provider.Checkout((UnityEngine.Object[])monoScriptList.ToArray(), CheckoutMode.Meta);
                task.Wait();
                flag = task.success;
            }
            if (flag)
            {
                using (List <int> .Enumerator enumerator = intList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        int current = enumerator.Current;
                        MonoImporter.SetExecutionOrder(this.m_AllScripts[current], this.m_AllOrders[current]);
                    }
                }
                this.PopulateScriptArray();
            }
            else
            {
                Debug.LogError((object)"Could not checkout scrips in version control for changing script execution order");
            }
        }
Exemple #6
0
        private void Apply()
        {
            var changedIndices = new List <int>();
            var changedScripts = new List <MonoScript>();

            for (int i = 0; i < m_AllScripts.Length; i++)
            {
                if (MonoImporter.GetExecutionOrder(m_AllScripts[i]) != m_AllOrders[i])
                {
                    changedIndices.Add(i);
                    changedScripts.Add(m_AllScripts[i]);
                }
            }

            bool editable = true;

            if (Provider.enabled)
            {
                var task = Provider.Checkout(changedScripts.ToArray(), CheckoutMode.Meta);
                task.Wait();
                editable = task.success;
            }

            if (editable)
            {
                foreach (int index in changedIndices)
                {
                    MonoImporter.SetExecutionOrder(m_AllScripts[index], m_AllOrders[index]);
                }

                PopulateScriptArray();
            }
            else
            {
                Debug.LogError("Could not checkout scrips in version control for changing script execution order");
            }
        }