Exemple #1
0
        public GameObject CreateParticleSystem(ParticleSystem parentOfNewParticleSystem, SubModuleUI.SubEmitterType defaultType)
        {
            string     nextParticleSystemName = this.GetNextParticleSystemName();
            GameObject gameObject             = new GameObject(nextParticleSystemName, new Type[]
            {
                typeof(ParticleSystem)
            });

            if (gameObject)
            {
                if (parentOfNewParticleSystem)
                {
                    gameObject.transform.parent = parentOfNewParticleSystem.transform;
                }
                gameObject.transform.localPosition = Vector3.zero;
                gameObject.transform.localRotation = Quaternion.identity;
                ParticleSystem component = gameObject.GetComponent <ParticleSystem>();
                if (defaultType != SubModuleUI.SubEmitterType.None)
                {
                    component.SetupDefaultType((int)defaultType);
                }
                InspectorState.SetFloat("CurrentEmitterAreaScroll", this.m_EmitterAreaScrollPos.x);
                return(gameObject);
            }
            return(null);
        }
 private void OnDisable()
 {
     this.ClearCachedProperties();
     this.m_ObjectTab.OnDisable();
     InspectorState.SetBool("ShowRealtimeLightingSettings", this.m_ShowRealtimeSettings);
     InspectorState.SetBool("ShowBakedLightingSettings", this.m_ShowBakeSettings);
     InspectorState.SetBool("ShowGeneralLightingSettings", this.m_ShowGeneralSettings);
     EditorApplication.searchChanged = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.searchChanged, new EditorApplication.CallbackFunction(base.Repaint));
 }
Exemple #3
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     = InspectorState.GetBool("ShowOtherRenderingEditorFoldout", false);
 }
Exemple #4
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     = InspectorState.GetBool("ShowFogEditorFoldout", false);
 }
Exemple #5
0
 private void LoadExpandedState()
 {
     int[] intArray = InspectorState.GetIntArray(AudioMixerGroupTreeView.GetUniqueAudioMixerName(this.m_Controller), null);
     if (intArray != null)
     {
         this.m_AudioGroupTreeState.expandedIDs = new List <int>(intArray);
     }
     else
     {
         this.m_AudioGroupTree.state.expandedIDs = new List <int>();
         this.m_AudioGroupTree.data.SetExpandedWithChildren(this.m_AudioGroupTree.data.root, true);
     }
 }
 private void OnEnable()
 {
     this.m_LightmapPreviewTab = new LightingWindowLightmapPreviewTab();
     this.m_ObjectTab          = new LightingWindowObjectTab();
     this.m_ObjectTab.OnEnable(this);
     this.m_ShowRealtimeSettings = InspectorState.GetBool("ShowRealtimeLightingSettings", true);
     this.m_ShowBakeSettings     = InspectorState.GetBool("ShowBakedLightingSettings", true);
     this.m_ShowGeneralSettings  = InspectorState.GetBool("ShowGeneralLightingSettings", true);
     this.UpdateAnimatedBools(true);
     base.autoRepaintOnSceneChange = true;
     this.m_PreviewResizer.Init("LightmappingPreview");
     EditorApplication.searchChanged = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.searchChanged, new EditorApplication.CallbackFunction(base.Repaint));
     base.Repaint();
 }
Exemple #7
0
        public bool InitializeIfNeeded(ParticleSystem shuriken)
        {
            ParticleSystem root = ParticleSystemEditorUtils.GetRoot(shuriken);

            ParticleSystem[] particleSystems = ParticleSystem.GetParticleSystems(root);
            if (particleSystems == null || particleSystems.Length == 0)
            {
                return(false);
            }
            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", ParticleEffectUI.k_MinEmitterAreaSize.x);
            this.m_CurveEditorAreaHeight = EditorPrefs.GetFloat("ParticleSystemCurveEditorAreaHeight", ParticleEffectUI.k_MinCurveAreaSize.y);
            this.InitAllEmitters(particleSystems);
            this.m_ShowOnlySelectedMode = (this.m_Owner is ParticleSystemWindow && InspectorState.GetBool("ShowSelected" + root.GetInstanceID(), false));
            if (this.IsShowOnlySelectedMode())
            {
                this.RefreshShowOnlySelected();
            }
            this.m_EmitterAreaScrollPos.x = InspectorState.GetFloat("CurrentEmitterAreaScroll", 0f);
            if (this.ShouldManagePlaybackState(root))
            {
                Vector3 vector = InspectorState.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);
        }
 public virtual void OnEnable()
 {
     this.m_Sun                         = base.serializedObject.FindProperty("m_Sun");
     this.m_AmbientMode                 = 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_EnvironmentLightingMode     = this.m_lightmapSettings.FindProperty("m_GISettings.m_EnvironmentLightingMode");
     this.m_ShowEditor                  = InspectorState.GetBool("ShowLightingEditor", true);
 }
Exemple #9
0
 private void Setup(ParticleSystemUI owner, SerializedObject o, string name, string displayName, ModuleUI.VisibilityState defaultVisibilityState)
 {
     this.m_ParticleSystemUI = owner;
     this.m_DisplayName      = displayName;
     if (this is RendererModuleUI)
     {
         this.m_Enabled = base.GetProperty0("m_Enabled");
     }
     else
     {
         this.m_Enabled = base.GetProperty("enabled");
     }
     this.m_VisibilityState = (ModuleUI.VisibilityState)InspectorState.GetInt(base.GetUniqueModuleName(), (int)defaultVisibilityState);
     this.CheckVisibilityState();
     if (this.foldout)
     {
         this.Init();
     }
 }
Exemple #10
0
 protected virtual void SetVisibilityState(ModuleUI.VisibilityState newState)
 {
     if (newState != this.m_VisibilityState)
     {
         if (newState == ModuleUI.VisibilityState.VisibleAndFolded)
         {
             ParticleSystemCurveEditor particleSystemCurveEditor = this.m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();
             foreach (SerializedProperty current in this.m_ModuleCurves)
             {
                 if (particleSystemCurveEditor.IsAdded(current))
                 {
                     this.m_CurvesRemovedWhenFolded.Add(current);
                     particleSystemCurveEditor.SetVisible(current, false);
                 }
             }
             particleSystemCurveEditor.Refresh();
         }
         else
         {
             if (newState == ModuleUI.VisibilityState.VisibleAndFoldedOut)
             {
                 ParticleSystemCurveEditor particleSystemCurveEditor2 = this.m_ParticleSystemUI.m_ParticleEffectUI.GetParticleSystemCurveEditor();
                 foreach (SerializedProperty current2 in this.m_CurvesRemovedWhenFolded)
                 {
                     particleSystemCurveEditor2.SetVisible(current2, true);
                 }
                 this.m_CurvesRemovedWhenFolded.Clear();
                 particleSystemCurveEditor2.Refresh();
             }
         }
         this.m_VisibilityState = newState;
         InspectorState.SetInt(base.GetUniqueModuleName(), (int)this.m_VisibilityState);
         if (newState == ModuleUI.VisibilityState.VisibleAndFoldedOut)
         {
             this.Init();
         }
     }
 }
Exemple #11
0
        public void Clear()
        {
            ParticleSystem root = this.GetRoot();

            if (this.ShouldManagePlaybackState(root) && root != null)
            {
                ParticleEffectUI.PlayState playState;
                if (this.IsPlaying())
                {
                    playState = ParticleEffectUI.PlayState.Playing;
                }
                else
                {
                    if (this.IsPaused())
                    {
                        playState = ParticleEffectUI.PlayState.Paused;
                    }
                    else
                    {
                        playState = ParticleEffectUI.PlayState.Stopped;
                    }
                }
                int instanceID = root.GetInstanceID();
                InspectorState.SetVector3("SimulationState" + instanceID, new Vector3((float)instanceID, (float)playState, ParticleSystemEditorUtils.editorPlaybackTime));
            }
            this.m_ParticleSystemCurveEditor.OnDisable();
            ParticleEffectUtils.ClearPlanes();
            Tools.s_Hidden = false;
            if (root != null)
            {
                InspectorState.SetBool("ShowSelected" + root.GetInstanceID(), this.m_ShowOnlySelectedMode);
            }
            this.SetShowOnlySelectedMode(false);
            GameView.RepaintAll();
            SceneView.RepaintAll();
        }
Exemple #12
0
 public virtual void OnDisable()
 {
     InspectorState.SetBool("ShowFogEditorFoldout", this.m_ShowEditor);
 }
Exemple #13
0
 internal static Vector3 GetVector3(string key, Vector3 defaultValue)
 {
     return(InspectorState.INTERNAL_CALL_GetVector3(key, ref defaultValue));
 }
Exemple #14
0
 internal static void SetVector3(string key, Vector3 value)
 {
     InspectorState.INTERNAL_CALL_SetVector3(key, ref value);
 }
Exemple #15
0
 private void SaveExpandedState()
 {
     InspectorState.SetIntArray(AudioMixerGroupTreeView.GetUniqueAudioMixerName(this.m_Controller), this.m_AudioGroupTreeState.expandedIDs.ToArray());
 }
 public virtual void OnDisable()
 {
     InspectorState.SetBool("ShowLightingEditor", this.m_ShowEditor);
 }