CheckCircularReferences() private method

private CheckCircularReferences ( ParticleSystem subEmitter ) : string
subEmitter UnityEngine.ParticleSystem
return string
示例#1
0
 private void Update()
 {
     if (this.m_CheckObjectIndex >= 0)
     {
         if (!ObjectSelector.isVisible)
         {
             SerializedProperty arrayElementAtIndex  = this.m_SubEmitters.GetArrayElementAtIndex(this.m_CheckObjectIndex);
             SerializedProperty serializedProperty   = arrayElementAtIndex.FindPropertyRelative("emitter");
             UnityEngine.Object objectReferenceValue = serializedProperty.objectReferenceValue;
             ParticleSystem     particleSystem       = objectReferenceValue as ParticleSystem;
             if (particleSystem != null)
             {
                 bool flag = true;
                 if (this.ValidateSubemitter(particleSystem))
                 {
                     string text = ParticleSystemEditorUtils.CheckCircularReferences(particleSystem);
                     if (text.Length == 0)
                     {
                         if (!this.CheckIfChild(objectReferenceValue))
                         {
                             flag = false;
                         }
                     }
                     else
                     {
                         string message = string.Format("'{0}' could not be assigned as subemitter on '{1}' due to circular referencing!\nBacktrace: {2} \n\nReference will be removed.", particleSystem.gameObject.name, this.m_ParticleSystemUI.m_ParticleSystem.gameObject.name, text);
                         EditorUtility.DisplayDialog("Circular References Detected", message, "Ok");
                         flag = false;
                     }
                 }
                 else
                 {
                     flag = false;
                 }
                 if (!flag)
                 {
                     serializedProperty.objectReferenceValue = null;
                     this.m_ParticleSystemUI.ApplyProperties();
                     this.m_ParticleSystemUI.m_ParticleEffectUI.m_Owner.Repaint();
                 }
             }
             this.m_CheckObjectIndex  = -1;
             EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(this.Update));
         }
     }
 }
示例#2
0
        private void Update()
        {
            if ((this.m_CheckObjectIndex >= 0) && !ObjectSelector.isVisible)
            {
                SerializedProperty property2            = this.m_SubEmitters.GetArrayElementAtIndex(this.m_CheckObjectIndex).FindPropertyRelative("emitter");
                UnityEngine.Object objectReferenceValue = property2.objectReferenceValue;
                ParticleSystem     subEmitter           = objectReferenceValue as ParticleSystem;
                if (subEmitter != null)
                {
                    bool flag = true;
                    if (this.ValidateSubemitter(subEmitter))
                    {
                        string str = ParticleSystemEditorUtils.CheckCircularReferences(subEmitter);
                        if (str.Length == 0)
                        {
                            if (!this.CheckIfChild(objectReferenceValue))
                            {
                                flag = false;
                            }
                        }
                        else
                        {
                            string message = $"'{subEmitter.gameObject.name}' could not be assigned as subemitter on '{base.m_ParticleSystemUI.m_ParticleSystem.gameObject.name}' due to circular referencing!
Backtrace: {str} 

Reference will be removed.";
                            EditorUtility.DisplayDialog("Circular References Detected", message, "Ok");
                            flag = false;
                        }
                    }
                    else
                    {
                        flag = false;
                    }
                    if (!flag)
                    {
                        property2.objectReferenceValue = null;
                        base.m_ParticleSystemUI.ApplyProperties();
                        base.m_ParticleSystemUI.m_ParticleEffectUI.m_Owner.Repaint();
                    }
                }
                this.m_CheckObjectIndex  = -1;
                EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(this.Update));
            }
        }
示例#3
0
        private void Update()
        {
            if (this.m_CheckObjectIndex < 0 || this.m_CheckObjectTypeIndex < 0 || ObjectSelector.isVisible)
            {
                return;
            }
            Object         objectReferenceValue = this.m_SubEmitters[this.m_CheckObjectTypeIndex, this.m_CheckObjectIndex].objectReferenceValue;
            ParticleSystem subEmitter           = objectReferenceValue as ParticleSystem;

            if ((Object)subEmitter != (Object)null)
            {
                bool flag = true;
                if (this.ValidateSubemitter(subEmitter))
                {
                    string str = ParticleSystemEditorUtils.CheckCircularReferences(subEmitter);
                    if (str.Length == 0)
                    {
                        this.CheckIfChild(objectReferenceValue);
                    }
                    else
                    {
                        EditorUtility.DisplayDialog("Circular References Detected", string.Format("'{0}' could not be assigned as subemitter on '{1}' due to circular referencing!\nBacktrace: {2} \n\nReference will be removed.", (object)subEmitter.gameObject.name, (object)this.m_ParticleSystemUI.m_ParticleSystem.gameObject.name, (object)str), "Ok");
                        flag = false;
                    }
                }
                else
                {
                    flag = false;
                }
                if (!flag)
                {
                    this.m_SubEmitters[this.m_CheckObjectTypeIndex, this.m_CheckObjectIndex].objectReferenceValue = (Object)null;
                    this.m_ParticleSystemUI.ApplyProperties();
                    this.m_ParticleSystemUI.m_ParticleEffectUI.m_Owner.Repaint();
                }
            }
            this.m_CheckObjectIndex     = -1;
            this.m_CheckObjectTypeIndex = -1;
            EditorApplication.update   -= new EditorApplication.CallbackFunction(this.Update);
        }