GetBool() private method

private GetBool ( string key, bool defaultValue ) : bool
key string
defaultValue bool
return bool
 private void InitializeLightingFields()
 {
     this.m_Lighting = new LightingSettingsInspector(base.serializedObject);
     this.m_Lighting.showSettings         = EditorPrefs.GetBool("MeshRendererEditor.Lighting.ShowSettings", false);
     this.m_Lighting.showChartingSettings = SessionState.GetBool("MeshRendererEditor.Lighting.ShowChartingSettings", true);
     this.m_Lighting.showLightmapSettings = SessionState.GetBool("MeshRendererEditor.Lighting.ShowLightmapSettings", true);
 }
示例#2
0
 public void OnEnable()
 {
     this.InitSettings();
     this.m_ShowGeneralLightmapSettings = SessionState.GetBool("ShowGeneralLightmapSettings", true);
     this.m_ShowRealtimeLightsSettings  = SessionState.GetBool("ShowRealtimeLightsSettings", true);
     this.m_ShowMixedLightsSettings     = SessionState.GetBool("ShowMixedLightsSettings", true);
 }
            static void InitializeProfilerSlaveProcessDomain()
            {
                Console.WriteLine("[UMPE] Initialize Profiler Slave Process Domain Triggered");

                if (!SessionState.GetBool("OOPP.Initialized", false))
                {
                    return;
                }

                EditorApplication.update -= InitializeProfilerSlaveProcessDomain;

                s_SlaveProfilerWindow = EditorWindow.GetWindow <ProfilerWindow>();
                SetupProfilerWindow(s_SlaveProfilerWindow);

                EventService.RegisterEventHandler(nameof(EventType.UmpProfilerRecordToggle), HandleToggleRecording);
                EventService.RegisterEventHandler(nameof(EventType.UmpProfilerRequestRecordState), HandleRequestRecordState);
                EventService.RegisterEventHandler(nameof(EventType.UmpProfilerPing), HandlePingEvent);
                EventService.RegisterEventHandler(nameof(EventType.UmpProfilerExit), HandleExitEvent);

                EditorApplication.update -= SetupProfilerDriver;
                EditorApplication.update += SetupProfilerDriver;
                EditorApplication.updateMainWindowTitle -= SetProfilerWindowTitle;
                EditorApplication.updateMainWindowTitle += SetProfilerWindowTitle;
                EditorApplication.quitting -= SaveWindowLayout;
                EditorApplication.quitting += SaveWindowLayout;

                Console.WriteLine("[UMPE] Initialize Profiler Slave Process Domain Completed");
            }
示例#4
0
        public void DeserializeState(string uid)
        {
            this.m_bFilterSelection = SessionState.GetBool(uid + SerializedPropertyTreeView.Styles.serializeFilterSelection, false);
            for (int i = 0; i < base.multiColumnHeader.state.columns.Length; i++)
            {
                SerializedPropertyFilters.IFilter filter = this.Col(i).filter;
                if (filter != null)
                {
                    string @string = SessionState.GetString(uid + SerializedPropertyTreeView.Styles.serializeFilter + i, null);
                    if (!string.IsNullOrEmpty(@string))
                    {
                        filter.DeserializeState(@string);
                    }
                }
            }
            string string2 = SessionState.GetString(uid + SerializedPropertyTreeView.Styles.serializeTreeViewState, "");
            string string3 = SessionState.GetString(uid + SerializedPropertyTreeView.Styles.serializeColumnHeaderState, "");

            if (!string.IsNullOrEmpty(string2))
            {
                JsonUtility.FromJsonOverwrite(string2, base.state);
            }
            if (!string.IsNullOrEmpty(string3))
            {
                JsonUtility.FromJsonOverwrite(string3, base.multiColumnHeader.state);
            }
        }
示例#5
0
        private void InitializeLightingFields()
        {
            m_Lighting = new LightingSettingsInspector(serializedObject);

            m_Lighting.showChartingSettings = SessionState.GetBool(kDisplayChartingKey, true);
            m_Lighting.showLightmapSettings = SessionState.GetBool(kDisplayLightmapKey, true);
        }
示例#6
0
        public void OnEnable()
        {
            InitSettings();

            m_ShowGeneralLightmapSettings = SessionState.GetBool(kShowGeneralLightmapSettingsKey, true);
            m_ShowRealtimeLightsSettings  = SessionState.GetBool(kShowRealtimeLightsSettingsKey, true);
            m_ShowMixedLightsSettings     = SessionState.GetBool(kShowMixedLightsSettingsKey, true);
        }
示例#7
0
 public void OnEnable()
 {
     this.m_BakeSettings = new LightingWindowBakeSettings();
     this.m_BakeSettings.OnEnable();
     this.m_ShowOtherSettings      = SessionState.GetBool("kShowOtherSettings", true);
     this.m_ShowDebugSettings      = SessionState.GetBool("kShowDebugSettings", false);
     this.m_ShouldUpdateStatistics = SessionState.GetBool("kUpdateStatistics", false);
 }
示例#8
0
 public virtual void OnEnable()
 {
     this.m_HaloStrength   = base.serializedObject.FindProperty("m_HaloStrength");
     this.m_FlareStrength  = base.serializedObject.FindProperty("m_FlareStrength");
     this.m_FlareFadeSpeed = base.serializedObject.FindProperty("m_FlareFadeSpeed");
     this.m_HaloTexture    = base.serializedObject.FindProperty("m_HaloTexture");
     this.m_SpotCookie     = base.serializedObject.FindProperty("m_SpotCookie");
     this.m_ShowEditor     = SessionState.GetBool("ShowOtherRenderingEditorFoldout", false);
 }
示例#9
0
 public virtual void OnEnable()
 {
     this.m_Fog            = base.serializedObject.FindProperty("m_Fog");
     this.m_FogColor       = base.serializedObject.FindProperty("m_FogColor");
     this.m_FogMode        = base.serializedObject.FindProperty("m_FogMode");
     this.m_FogDensity     = base.serializedObject.FindProperty("m_FogDensity");
     this.m_LinearFogStart = base.serializedObject.FindProperty("m_LinearFogStart");
     this.m_LinearFogEnd   = base.serializedObject.FindProperty("m_LinearFogEnd");
     this.m_ShowEditor     = SessionState.GetBool("ShowFogEditorFoldout", false);
 }
        public void OnEnable()
        {
            m_BakeSettings = new LightingWindowBakeSettings();
            m_BakeSettings.OnEnable();

            InitLightmapSettings();

            m_ShowOtherSettings = SessionState.GetBool(kShowOtherSettings, true);
            m_ShowDebugSettings = SessionState.GetBool(kShowDebugSettings, false);
        }
示例#11
0
        public static bool GetDialogOptOutDecision(DialogOptOutDecisionType dialogOptOutDecisionType, string dialogOptOutDecisionStorageKey)
        {
            switch (dialogOptOutDecisionType)
            {
            case DialogOptOutDecisionType.ForThisMachine:
                return(EditorPrefs.GetBool(dialogOptOutDecisionStorageKey, false));

            case DialogOptOutDecisionType.ForThisSession:
                return(SessionState.GetBool(dialogOptOutDecisionStorageKey, false));

            default:
                throw new NotImplementedException(string.Format("The DialogOptOut type named {0} has not been implemented.", dialogOptOutDecisionType));
            }
        }
示例#12
0
        public bool InitializeIfNeeded(ParticleSystem shuriken)
        {
            ParticleSystem root = ParticleSystemEditorUtils.GetRoot(shuriken);

            if (root == null)
            {
                return(false);
            }
            ParticleSystem[] particleSystems = GetParticleSystems(root);
            if (((root == this.GetRoot()) && (this.m_ParticleSystemCurveEditor != null)) && ((this.m_Emitters != null) && (particleSystems.Length == this.m_Emitters.Length)))
            {
                this.m_SelectedParticleSystem = shuriken;
                if (this.IsShowOnlySelectedMode())
                {
                    this.RefreshShowOnlySelected();
                }
                return(false);
            }
            if (this.m_ParticleSystemCurveEditor != null)
            {
                this.Clear();
            }
            this.m_SelectedParticleSystem = shuriken;
            ParticleSystemEditorUtils.PerformCompleteResimulation();
            this.m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor();
            this.m_ParticleSystemCurveEditor.Init();
            this.m_EmitterAreaWidth      = EditorPrefs.GetFloat("ParticleSystemEmitterAreaWidth", k_MinEmitterAreaSize.x);
            this.m_CurveEditorAreaHeight = EditorPrefs.GetFloat("ParticleSystemCurveEditorAreaHeight", k_MinCurveAreaSize.y);
            this.InitAllEmitters(particleSystems);
            this.m_ShowOnlySelectedMode = (this.m_Owner is ParticleSystemWindow) && SessionState.GetBool("ShowSelected" + root.GetInstanceID(), false);
            if (this.IsShowOnlySelectedMode())
            {
                this.RefreshShowOnlySelected();
            }
            this.m_EmitterAreaScrollPos.x = SessionState.GetFloat("CurrentEmitterAreaScroll", 0f);
            if (this.ShouldManagePlaybackState(root))
            {
                Vector3 vector = SessionState.GetVector3("SimulationState" + root.GetInstanceID(), Vector3.zero);
                if (root.GetInstanceID() == ((int)vector.x))
                {
                    float z = vector.z;
                    if (z > 0f)
                    {
                        ParticleSystemEditorUtils.editorPlaybackTime = z;
                    }
                }
                this.Play();
            }
            return(true);
        }
示例#13
0
        void Awake()
        {
            if (!Profiler.supported)
            {
                return;
            }

            // Track enabled state per Editor session
            m_Recording = SessionState.GetBool(kProfilerEnabledSessionKey, true);

            // This event gets called every time when some other window is maximized and then unmaximized
            ProfilerDriver.enabled = m_Recording;

            m_SelectedMemRecordMode = ProfilerDriver.memoryRecordMode;
        }
示例#14
0
 private void OnEnable()
 {
     this.titleContent         = this.GetLocalizedTitleContent();
     this.m_LightmapPreviewTab = new LightingWindowLightmapPreviewTab();
     this.m_ObjectTab          = new LightingWindowObjectTab();
     this.m_ObjectTab.OnEnable((EditorWindow)this);
     this.m_ShowRealtimeSettings = SessionState.GetBool("ShowRealtimeLightingSettings", true);
     this.m_ShowBakeSettings     = SessionState.GetBool("ShowBakedLightingSettings", true);
     this.m_ShowGeneralSettings  = SessionState.GetBool("ShowGeneralLightingSettings", true);
     this.UpdateAnimatedBools(true);
     this.autoRepaintOnSceneChange = true;
     this.m_PreviewResizer.Init("LightmappingPreview");
     EditorApplication.searchChanged += new EditorApplication.CallbackFunction(((EditorWindow)this).Repaint);
     this.Repaint();
 }
        public static bool GetDialogOptOutDecision(DialogOptOutDecisionType dialogOptOutDecisionType, string dialogOptOutDecisionStorageKey)
        {
#if UNITY_2019_4_OR_NEWER
            return(EditorUtility.GetDialogOptOutDecision((UnityEditor.DialogOptOutDecisionType)dialogOptOutDecisionType, dialogOptOutDecisionStorageKey));
#else
            switch (dialogOptOutDecisionType)
            {
            case DialogOptOutDecisionType.ForThisMachine:
                return(EditorPrefs.GetBool(dialogOptOutDecisionStorageKey, false));

            case DialogOptOutDecisionType.ForThisSession:
                return(SessionState.GetBool(dialogOptOutDecisionStorageKey, false));

            default:
                throw new NotImplementedException(string.Format("The DialogOptOut type named {0} has not been implemented.", dialogOptOutDecisionType));
            }
#endif
        }
示例#16
0
 public virtual void OnEnable()
 {
     this.m_Sun                         = base.serializedObject.FindProperty("m_Sun");
     this.m_AmbientSource               = base.serializedObject.FindProperty("m_AmbientMode");
     this.m_AmbientSkyColor             = base.serializedObject.FindProperty("m_AmbientSkyColor");
     this.m_AmbientEquatorColor         = base.serializedObject.FindProperty("m_AmbientEquatorColor");
     this.m_AmbientGroundColor          = base.serializedObject.FindProperty("m_AmbientGroundColor");
     this.m_AmbientIntensity            = base.serializedObject.FindProperty("m_AmbientIntensity");
     this.m_ReflectionIntensity         = base.serializedObject.FindProperty("m_ReflectionIntensity");
     this.m_ReflectionBounces           = base.serializedObject.FindProperty("m_ReflectionBounces");
     this.m_SkyboxMaterial              = base.serializedObject.FindProperty("m_SkyboxMaterial");
     this.m_DefaultReflectionMode       = base.serializedObject.FindProperty("m_DefaultReflectionMode");
     this.m_DefaultReflectionResolution = base.serializedObject.FindProperty("m_DefaultReflectionResolution");
     this.m_CustomReflection            = base.serializedObject.FindProperty("m_CustomReflection");
     this.m_LightmapSettings            = new SerializedObject(LightmapEditorSettings.GetLightmapSettings());
     this.m_ReflectionCompression       = this.m_LightmapSettings.FindProperty("m_LightmapEditorSettings.m_ReflectionCompression");
     this.m_AmbientLightingMode         = this.m_LightmapSettings.FindProperty("m_GISettings.m_EnvironmentLightingMode");
     this.m_bShowEnvironment            = SessionState.GetBool("ShowEnvironment", true);
 }
示例#17
0
            static void SetupProfilerDriver()
            {
                EditorApplication.update -= SetupProfilerDriver;

                if (s_ProfilerDriverSetup)
                    return;

                ProfilerDriver.profileEditor = ProfilerUserSettings.defaultTargetMode == ProfilerEditorTargetMode.Editmode;
                var playerConnectionInfo = new PlayerConnectionInfo
                {
                    recording = ProfilerDriver.enabled,
                    profileEditor = ProfilerDriver.profileEditor
                };
                if (!SessionState.GetBool("OOPP.PlayerConnectionOpened", false))
                    EventService.Request(nameof(EventType.UmpProfilerOpenPlayerConnection), HandlePlayerConnectionOpened, playerConnectionInfo, 5000L);
                s_ProfilerDriverSetup = true;

                ModeService.RefreshMenus();
            }
示例#18
0
        public void DeserializeState(string uid)
        {
            m_bFilterSelection    = SessionState.GetBool(uid + Styles.serializeFilterSelection, false);
            m_ShowInactiveObjects = SessionState.GetBool(uid + Styles.showInactiveObjects, false);

            MultiColumnHeaderState headerState = new MultiColumnHeaderState(multiColumnHeader.state.columns);
            string columnHeaderState           = EditorPrefs.GetString(uid + Styles.serializeColumnHeaderState, "");

            if (!string.IsNullOrEmpty(columnHeaderState))
            {
                JsonUtility.FromJsonOverwrite(columnHeaderState, headerState);
            }

            if (MultiColumnHeaderState.CanOverwriteSerializedFields(headerState, multiColumnHeader.state))
            {
                Column.OverwriteSerializedFields(headerState, multiColumnHeader.state);
            }

            for (int i = 0; i < multiColumnHeader.state.columns.Length; i++)
            {
                var filter = Col(i).filter;
                if (filter == null)
                {
                    continue;
                }

                string filterState = SessionState.GetString(uid + Styles.serializeFilter + i, null);
                if (string.IsNullOrEmpty(filterState))
                {
                    continue;
                }

                filter.DeserializeState(filterState);
            }

            string treeViewState = SessionState.GetString(uid + Styles.serializeTreeViewState, "");

            if (!string.IsNullOrEmpty(treeViewState))
            {
                JsonUtility.FromJsonOverwrite(treeViewState, state);
            }
        }
示例#19
0
            static void InitializeProfilerSlaveProcessDomain()
            {
                EditorApplication.update -= InitializeProfilerSlaveProcessDomain;

                if (!SessionState.GetBool("OOPP.Initialized", false))
                {
                    return;
                }

                s_SlaveProfilerWindow = EditorWindow.GetWindow <ProfilerWindow>();
                SetupProfilerWindow(s_SlaveProfilerWindow);

                EventService.On(nameof(EventType.UmpProfilerRecordToggle), HandleToggleRecording);
                EventService.On(nameof(EventType.UmpProfilerRequestRecordState), HandleRequestRecordState);
                EventService.On(nameof(EventType.UmpProfilerPing), HandlePingEvent);
                EventService.On(nameof(EventType.UmpProfilerExit), HandleExitEvent);

                EditorApplication.update -= SetupProfilerDriver;
                EditorApplication.update += SetupProfilerDriver;
                EditorApplication.updateMainWindowTitle -= SetProfilerWindowTitle;
                EditorApplication.updateMainWindowTitle += SetProfilerWindowTitle;
                EditorApplication.quitting -= SaveWindowLayout;
                EditorApplication.quitting += SaveWindowLayout;
            }
        private void InitSettings()
        {
            m_RenderSettings              = new SerializedObject(RenderSettings.GetRenderSettings());
            m_Sun                         = m_RenderSettings.FindProperty("m_Sun");
            m_AmbientSource               = m_RenderSettings.FindProperty("m_AmbientMode");
            m_AmbientSkyColor             = m_RenderSettings.FindProperty("m_AmbientSkyColor");
            m_AmbientEquatorColor         = m_RenderSettings.FindProperty("m_AmbientEquatorColor");
            m_AmbientGroundColor          = m_RenderSettings.FindProperty("m_AmbientGroundColor");
            m_AmbientIntensity            = m_RenderSettings.FindProperty("m_AmbientIntensity");
            m_ReflectionIntensity         = m_RenderSettings.FindProperty("m_ReflectionIntensity");
            m_ReflectionBounces           = m_RenderSettings.FindProperty("m_ReflectionBounces");
            m_SkyboxMaterial              = m_RenderSettings.FindProperty("m_SkyboxMaterial");
            m_DefaultReflectionMode       = m_RenderSettings.FindProperty("m_DefaultReflectionMode");
            m_DefaultReflectionResolution = m_RenderSettings.FindProperty("m_DefaultReflectionResolution");
            m_CustomReflection            = m_RenderSettings.FindProperty("m_CustomReflection");

            m_LightmapSettings      = new SerializedObject(LightmapEditorSettings.GetLightmapSettings());
            m_ReflectionCompression = m_LightmapSettings.FindProperty("m_LightmapEditorSettings.m_ReflectionCompression");
            m_AmbientLightingMode   = m_LightmapSettings.FindProperty("m_GISettings.m_EnvironmentLightingMode");
            m_EnabledBakedGI        = m_LightmapSettings.FindProperty("m_GISettings.m_EnableBakedLightmaps");
            m_EnabledRealtimeGI     = m_LightmapSettings.FindProperty("m_GISettings.m_EnableRealtimeLightmaps");

            m_bShowEnvironment = SessionState.GetBool(kShowEnvironment, true);
        }
示例#21
0
        // Should be called often to ensure we catch if selected Particle System is dragged in/out of root hierarchy
        public bool InitializeIfNeeded(IEnumerable <ParticleSystem> systems)
        {
            bool anyAdded = false;

            ParticleSystem[] allSystems     = systems.ToArray();
            bool             usingMultiEdit = (allSystems.Count() > 1);

            bool           initializeRequired = false;
            ParticleSystem mainSystem         = null;

            foreach (ParticleSystem shuriken in allSystems)
            {
                ParticleSystem[] shurikens;
                if (!usingMultiEdit)
                {
                    ParticleSystem root = ParticleSystemEditorUtils.GetRoot(shuriken);
                    if (root == null)
                    {
                        continue;
                    }

                    shurikens  = GetParticleSystems(root);
                    mainSystem = root;

                    // Check if we need to re-initialize?
                    if (m_SelectedParticleSystems != null && m_SelectedParticleSystems.Count > 0)
                    {
                        if (root == ParticleSystemEditorUtils.GetRoot(m_SelectedParticleSystems[0]))
                        {
                            if (m_ParticleSystemCurveEditor != null && m_Emitters != null && shurikens.Length == m_Emitters.Length && shuriken.gameObject.activeInHierarchy == m_EmittersActiveInHierarchy)
                            {
                                m_SelectedParticleSystems = new List <ParticleSystem>();
                                m_SelectedParticleSystems.Add(shuriken);

                                if (IsShowOnlySelectedMode())
                                {
                                    RefreshShowOnlySelected(); // always refresh
                                }
                                continue;
                            }
                        }
                    }
                }
                else
                {
                    // in multi-edit mode, we explicitly choose the systems to edit, so don't automatically add child systems or search for the root
                    shurikens  = new ParticleSystem[] { shuriken };
                    mainSystem = shuriken;
                }

                // Cleanup before initializing
                if (m_ParticleSystemCurveEditor != null)
                {
                    Clear();
                }

                // Now initialize
                initializeRequired = true;
                if (!anyAdded)
                {
                    m_SelectedParticleSystems = new List <ParticleSystem>();
                    anyAdded = true;
                }
                m_SelectedParticleSystems.Add(shuriken);

                // Single edit emitter setup
                if (!usingMultiEdit)
                {
                    // Init CurveEditor before modules (they may add curves during construction)
                    m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor();
                    m_ParticleSystemCurveEditor.Init();

                    int numEmitters = shurikens.Length;
                    if (numEmitters > 0)
                    {
                        m_Emitters = new ParticleSystemUI[numEmitters];

                        for (int i = 0; i < numEmitters; ++i)
                        {
                            m_Emitters[i] = new ParticleSystemUI();
                            m_Emitters[i].Init(this, new ParticleSystem[] { shurikens[i] });
                        }

                        m_EmittersActiveInHierarchy = shuriken.gameObject.activeInHierarchy;
                    }
                }
            }

            if (initializeRequired)
            {
                // Multi-edit emitter setup
                if (usingMultiEdit)
                {
                    // Init CurveEditor before modules (they may add curves during construction)
                    m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor();
                    m_ParticleSystemCurveEditor.Init();

                    int numEmitters = m_SelectedParticleSystems.Count;
                    if (numEmitters > 0)
                    {
                        m_Emitters    = new ParticleSystemUI[1];
                        m_Emitters[0] = new ParticleSystemUI();
                        m_Emitters[0].Init(this, m_SelectedParticleSystems.ToArray());
                        m_EmittersActiveInHierarchy = m_SelectedParticleSystems[0].gameObject.activeInHierarchy;
                    }
                }

                // Allow modules to validate their state (the user can have moved emitters around in the hierarchy)
                foreach (ParticleSystemUI e in m_Emitters)
                {
                    foreach (ModuleUI m in e.m_Modules)
                    {
                        if (m != null)
                        {
                            m.Validate();
                        }
                    }
                }

                // Sync to state
                if (GetAllModulesVisible())
                {
                    SetAllModulesVisible(true);
                }

                m_EmitterAreaWidth      = EditorPrefs.GetFloat("ParticleSystemEmitterAreaWidth", k_MinEmitterAreaSize.x);
                m_CurveEditorAreaHeight = EditorPrefs.GetFloat("ParticleSystemCurveEditorAreaHeight", k_MinCurveAreaSize.y);

                // For now only allow ShowOnlySelectedMode for ParticleSystemWindow
                SetShowOnlySelectedMode((m_Owner is ParticleSystemWindow) ? SessionState.GetBool(k_ShowSelectedId + mainSystem.GetInstanceID(), false) : false);

                m_EmitterAreaScrollPos.x = SessionState.GetFloat("CurrentEmitterAreaScroll", 0.0f);

                if (ShouldManagePlaybackState(mainSystem))
                {
                    // Restore lastPlayBackTime if available in session cache
                    Vector3 simulationState = SessionState.GetVector3(k_SimulationStateId + mainSystem.GetInstanceID(), Vector3.zero);
                    if (mainSystem.GetInstanceID() == (int)simulationState.x)
                    {
                        float lastPlayBackTime = simulationState.z;
                        if (lastPlayBackTime > 0f)
                        {
                            ParticleSystemEditorUtils.playbackTime = lastPlayBackTime;
                            ParticleSystemEditorUtils.PerformCompleteResimulation();
                        }
                    }

                    // Play when selecting a new particle effect
                    if (m_MainPlaybackSystem != mainSystem)
                    {
                        Play();
                    }
                }
            }

            m_MainPlaybackSystem = mainSystem;

            return(initializeRequired);
        }
示例#22
0
        public bool InitializeIfNeeded(IEnumerable <ParticleSystem> systems)
        {
            bool flag = false;

            ParticleSystem[] array          = systems.ToArray <ParticleSystem>();
            bool             flag2          = array.Count <ParticleSystem>() > 1;
            bool             flag3          = false;
            ParticleSystem   particleSystem = null;

            ParticleSystem[] array2 = array;
            int i = 0;

            while (i < array2.Length)
            {
                ParticleSystem particleSystem2 = array2[i];
                if (flag2)
                {
                    ParticleSystem[] array3 = new ParticleSystem[]
                    {
                        particleSystem2
                    };
                    particleSystem = particleSystem2;
                    goto IL_11F;
                }
                ParticleSystem root = ParticleSystemEditorUtils.GetRoot(particleSystem2);
                if (!(root == null))
                {
                    ParticleSystem[] array3 = ParticleEffectUI.GetParticleSystems(root);
                    particleSystem = root;
                    if (this.m_SelectedParticleSystems != null && this.m_SelectedParticleSystems.Count > 0)
                    {
                        if (root == ParticleSystemEditorUtils.GetRoot(this.m_SelectedParticleSystems[0]))
                        {
                            if (this.m_ParticleSystemCurveEditor != null && this.m_Emitters != null && array3.Length == this.m_Emitters.Length && particleSystem2.gameObject.activeInHierarchy == this.m_EmittersActiveInHierarchy)
                            {
                                this.m_SelectedParticleSystems = new List <ParticleSystem>();
                                this.m_SelectedParticleSystems.Add(particleSystem2);
                                if (this.IsShowOnlySelectedMode())
                                {
                                    this.RefreshShowOnlySelected();
                                }
                                goto IL_1E6;
                            }
                        }
                    }
                    goto IL_11F;
                }
IL_1E6:
                i++;
                continue;
IL_11F:
                if (this.m_ParticleSystemCurveEditor != null)
                {
                    this.Clear();
                }
                flag3 = true;
                if (!flag)
                {
                    this.m_SelectedParticleSystems = new List <ParticleSystem>();
                    flag = true;
                }
                this.m_SelectedParticleSystems.Add(particleSystem2);
                if (!flag2)
                {
                    this.m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor();
                    this.m_ParticleSystemCurveEditor.Init();
                    ParticleSystem[] array3;
                    int num = array3.Length;
                    if (num > 0)
                    {
                        this.m_Emitters = new ParticleSystemUI[num];
                        for (int j = 0; j < num; j++)
                        {
                            this.m_Emitters[j] = new ParticleSystemUI();
                            this.m_Emitters[j].Init(this, new ParticleSystem[]
                            {
                                array3[j]
                            });
                        }
                        this.m_EmittersActiveInHierarchy = particleSystem2.gameObject.activeInHierarchy;
                    }
                }
                goto IL_1E6;
            }
            if (flag3)
            {
                if (flag2)
                {
                    this.m_ParticleSystemCurveEditor = new ParticleSystemCurveEditor();
                    this.m_ParticleSystemCurveEditor.Init();
                    int count = this.m_SelectedParticleSystems.Count;
                    if (count > 0)
                    {
                        this.m_Emitters    = new ParticleSystemUI[1];
                        this.m_Emitters[0] = new ParticleSystemUI();
                        this.m_Emitters[0].Init(this, this.m_SelectedParticleSystems.ToArray());
                        this.m_EmittersActiveInHierarchy = this.m_SelectedParticleSystems[0].gameObject.activeInHierarchy;
                    }
                }
                ParticleSystemUI[] emitters = this.m_Emitters;
                for (int k = 0; k < emitters.Length; k++)
                {
                    ParticleSystemUI particleSystemUI = emitters[k];
                    ModuleUI[]       modules          = particleSystemUI.m_Modules;
                    for (int l = 0; l < modules.Length; l++)
                    {
                        ModuleUI moduleUI = modules[l];
                        if (moduleUI != null)
                        {
                            moduleUI.Validate();
                        }
                    }
                }
                if (ParticleEffectUI.GetAllModulesVisible())
                {
                    this.SetAllModulesVisible(true);
                }
                this.m_EmitterAreaWidth      = EditorPrefs.GetFloat("ParticleSystemEmitterAreaWidth", ParticleEffectUI.k_MinEmitterAreaSize.x);
                this.m_CurveEditorAreaHeight = EditorPrefs.GetFloat("ParticleSystemCurveEditorAreaHeight", ParticleEffectUI.k_MinCurveAreaSize.y);
                this.SetShowOnlySelectedMode(this.m_Owner is ParticleSystemWindow && SessionState.GetBool("ShowSelected" + particleSystem.GetInstanceID(), false));
                this.m_EmitterAreaScrollPos.x = SessionState.GetFloat("CurrentEmitterAreaScroll", 0f);
                if (this.ShouldManagePlaybackState(particleSystem))
                {
                    Vector3 vector = SessionState.GetVector3("SimulationState" + particleSystem.GetInstanceID(), Vector3.zero);
                    if (particleSystem.GetInstanceID() == (int)vector.x)
                    {
                        float z = vector.z;
                        if (z > 0f)
                        {
                            ParticleSystemEditorUtils.playbackTime = z;
                            ParticleSystemEditorUtils.PerformCompleteResimulation();
                        }
                    }
                    if (ParticleEffectUI.m_MainPlaybackSystem != particleSystem)
                    {
                        this.Play();
                    }
                }
            }
            ParticleEffectUI.m_MainPlaybackSystem = particleSystem;
            return(flag3);
        }
示例#23
0
 public virtual void OnEnable()
 {
     m_bShowEnvironment = SessionState.GetBool(kShowEnvironment, true);
 }