public static void SaveProject() => EditorApplication.ExecuteMenuItem("File/Save Project");
 void OpenPunWizard()
 {
     EditorApplication.ExecuteMenuItem("Window/Photon Unity Networking");
 }
 public static void OpenProjectSettings() => EditorApplication.ExecuteMenuItem("Edit/Project Settings...");
Exemple #4
0
 public static void MenuClick()
 {
     EditorApplication.ExecuteMenuItem("Lufy/6. MenuItem复用");
 }
 public void ExitGame()
 {
     EditorApplication.ExecuteMenuItem("Edit/Play");
 }
Exemple #6
0
 static void StartGame()
 {
     EditorSceneManager.OpenScene("Assets/Scenes/Login/Login.unity");
     EditorApplication.ExecuteMenuItem("Edit/Play");
 }
Exemple #7
0
        //-----------------------------------------------------------------------------

        private static void AddDefaultItems()
        {
            List <string> items = new List <string>();

            items.Add("Edit/Preferences...");
            items.Add("Edit/Modules...");
            items.Add("Edit/Project Settings/Input");
            items.Add("Edit/Project Settings/Tags and Layers");
            items.Add("Edit/Project Settings/Audio");
            items.Add("Edit/Project Settings/Time");
            items.Add("Edit/Project Settings/Player");
            items.Add("Edit/Project Settings/Physics");
            items.Add("Edit/Project Settings/Physics 2D");
            items.Add("Edit/Project Settings/Quality");
            items.Add("Edit/Project Settings/Graphics");
            items.Add("Edit/Project Settings/Network");
            items.Add("Edit/Project Settings/Editor");
            items.Add("Edit/Project Settings/Script Execution Order");


            items.Add("File/New Scene");
            items.Add("File/Open Scene");
            items.Add("File/Save Project");
            items.Add("File/Build Settings...");
            items.Add("File/Build % Run");
            items.Add("File/Exit");



            items.Add("GameObject/Create Empty");
            items.Add("GameObject/Create Empty Child");
            items.Add("GameObject/3D Object/Cube");
            items.Add("GameObject/3D Object/Sphere");
            items.Add("GameObject/3D Object/Capsule");
            items.Add("GameObject/3D Object/Cylinder");
            items.Add("GameObject/3D Object/Plane");
            items.Add("GameObject/3D Object/Quad");
            items.Add("GameObject/2D Object/Sprite");
            items.Add("GameObject/Light/Directional Light");
            items.Add("GameObject/Light/Point Light");
            items.Add("GameObject/Light/Spotlight");
            items.Add("GameObject/Light/Area Light");
            items.Add("GameObject/Light/Reflection Probe");
            items.Add("GameObject/Light/Light Probe Group");
            items.Add("GameObject/Audio/Audio Source");
            items.Add("GameObject/Audio/Audio Reverb Zone");
            items.Add("GameObject/Video/Video Player");
            items.Add("GameObject/Effects/Particle System");
            items.Add("GameObject/Effects/Trail");
            items.Add("GameObject/Effects/Line");
            items.Add("GameObject/Camera");

            items.Add("GameObject/Set as first sibling %=");
            items.Add("GameObject/Set as first sibling %");
            items.Add("GameObject/Set as last sibling");
            items.Add("GameObject/Set as last sibling %-");
            items.Add("GameObject/Move To View %&f");
            items.Add("GameObject/Move To View %&f");
            items.Add("GameObject/Align With View %#f");
            items.Add("GameObject/Align With View %#f");
            items.Add("GameObject/Align View to");
            items.Add("GameObject/Align View to Selected");
            items.Add("GameObject/Toggle Active State");
            items.Add("GameObject/Toggle Active State &#a");

            foreach (var item in items)
            {
                if (!SpotlightWindow.actionData.ContainsKey(item))
                {
                    SpotlightWindow.actionData.Add(item,
                                                   () => {
                        try {
                            EditorApplication.ExecuteMenuItem(item);
                        }
                        catch (Exception e) {
                            Debug.LogError(e.Message);
                        }
                    }
                                                   );
                }
            }
        }
Exemple #8
0
        public IEnumerator CreateEventStartAndStop()
        {
            EditorApplication.ExecuteMenuItem("Window/General/Game");
            var graph = MakeTemporaryGraph();

            var eventStart = ScriptableObject.CreateInstance <VFXBasicEvent>();

            eventStart.eventName = "Custom_Start";
            var eventStop = ScriptableObject.CreateInstance <VFXBasicEvent>();

            eventStop.eventName = "Custom_Stop";

            var spawnerContext    = ScriptableObject.CreateInstance <VFXBasicSpawner>();
            var blockConstantRate = ScriptableObject.CreateInstance <VFXSpawnerConstantRate>();
            var slotCount         = blockConstantRate.GetInputSlot(0);

            var spawnerInit   = ScriptableObject.CreateInstance <VFXBasicInitialize>();
            var spawnerOutput = ScriptableObject.CreateInstance <VFXPlanarPrimitiveOutput>();

            var spawnCountValue = 1984.0f;

            slotCount.value = spawnCountValue;

            spawnerContext.AddChild(blockConstantRate);
            graph.AddChild(eventStart);
            graph.AddChild(eventStop);
            graph.AddChild(spawnerContext);
            graph.AddChild(spawnerInit);
            graph.AddChild(spawnerOutput);
            spawnerInit.LinkFrom(spawnerContext);
            spawnerOutput.LinkFrom(spawnerInit);
            spawnerContext.LinkFrom(eventStart, 0, 0);
            spawnerContext.LinkFrom(eventStop, 0, 1);

            graph.RecompileIfNeeded();

            var gameObj      = new GameObject("CreateEventStartAndStop");
            var vfxComponent = gameObj.AddComponent <VisualEffect>();

            vfxComponent.visualEffectAsset = graph.visualEffectResource.asset;

            var cameraObj = new GameObject("CreateEventStartAndStop_Camera");
            var camera    = cameraObj.AddComponent <Camera>();

            camera.transform.localPosition = Vector3.one;
            camera.transform.LookAt(vfxComponent.transform);

            int maxFrame = 512;

            while (vfxComponent.culled && --maxFrame > 0)
            {
                yield return(null);
            }
            Assert.IsTrue(maxFrame > 0);
            yield return(null); //wait for exactly one more update if visible

            var spawnerState   = VisualEffectUtility.GetSpawnerState(vfxComponent, 0);
            var spawnCountRead = spawnerState.spawnCount / spawnerState.deltaTime;

            Assert.LessOrEqual(Mathf.Abs(spawnCountRead), 0.01f);

            vfxComponent.SendEvent("Custom_Start");
            for (int i = 0; i < 16; ++i)
            {
                yield return(null);
            }

            spawnerState   = VisualEffectUtility.GetSpawnerState(vfxComponent, 0);
            spawnCountRead = spawnerState.spawnCount / spawnerState.deltaTime;
            Assert.LessOrEqual(Mathf.Abs(spawnCountRead - spawnCountValue), 0.01f);

            vfxComponent.SendEvent("Custom_Stop");
            for (int i = 0; i < 16; ++i)
            {
                yield return(null);
            }

            spawnerState   = VisualEffectUtility.GetSpawnerState(vfxComponent, 0);
            spawnCountRead = spawnerState.spawnCount / spawnerState.deltaTime;
            Assert.LessOrEqual(Mathf.Abs(spawnCountRead), 0.01f);

            UnityEngine.Object.DestroyImmediate(gameObj);
            UnityEngine.Object.DestroyImmediate(cameraObj);
        }
Exemple #9
0
        public IEnumerator CreateCustomSpawnerAndComponent()
        {
            EditorApplication.ExecuteMenuItem("Window/General/Game");
            var graph = MakeTemporaryGraph();

            var spawnerContext     = ScriptableObject.CreateInstance <VFXBasicSpawner>();
            var blockCustomSpawner = ScriptableObject.CreateInstance <VFXSpawnerCustomWrapper>();

            blockCustomSpawner.SetSettingValue("m_customType", new SerializableType(typeof(VFXCustomSpawnerTest)));

            var spawnerInit       = ScriptableObject.CreateInstance <VFXBasicInitialize>();
            var spawnerOutput     = ScriptableObject.CreateInstance <VFXPlanarPrimitiveOutput>();
            var blockSetAttribute = ScriptableObject.CreateInstance <SetAttribute>();

            blockSetAttribute.SetSettingValue("attribute", "lifetime");
            spawnerInit.AddChild(blockSetAttribute);

            var blockAttributeSource = ScriptableObject.CreateInstance <VFXAttributeParameter>();

            blockAttributeSource.SetSettingValue("location", VFXAttributeLocation.Source);
            blockAttributeSource.SetSettingValue("attribute", "lifetime");

            spawnerContext.AddChild(blockCustomSpawner);
            graph.AddChild(spawnerContext);
            graph.AddChild(spawnerInit);
            graph.AddChild(spawnerOutput);
            graph.AddChild(blockAttributeSource);
            blockAttributeSource.outputSlots[0].Link(blockSetAttribute.inputSlots[0]);

            spawnerInit.LinkFrom(spawnerContext);
            spawnerOutput.LinkFrom(spawnerInit);

            var valueTotalTime = 187.0f;

            blockCustomSpawner.GetInputSlot(0).value = valueTotalTime;

            graph.RecompileIfNeeded();

            var gameObj      = new GameObject("CreateCustomSpawnerAndComponent");
            var vfxComponent = gameObj.AddComponent <VisualEffect>();

            vfxComponent.visualEffectAsset = graph.visualEffectResource.asset;

            var cameraObj = new GameObject("CreateCustomSpawnerAndComponent_Camera");
            var camera    = cameraObj.AddComponent <Camera>();

            camera.transform.localPosition = Vector3.one;
            camera.transform.LookAt(vfxComponent.transform);

            int maxFrame = 512;

            while (vfxComponent.culled && --maxFrame > 0)
            {
                yield return(null);
            }
            Assert.IsTrue(maxFrame > 0);
            yield return(null); //wait for exactly one more update if visible

            var spawnerState = VisualEffectUtility.GetSpawnerState(vfxComponent, 0);

            Assert.GreaterOrEqual(spawnerState.totalTime, valueTotalTime);
            Assert.AreEqual(VFXCustomSpawnerTest.s_LifeTime, spawnerState.vfxEventAttribute.GetFloat("lifetime"));
            Assert.AreEqual(VFXCustomSpawnerTest.s_SpawnCount, spawnerState.spawnCount);

            UnityEngine.Object.DestroyImmediate(gameObj);
            UnityEngine.Object.DestroyImmediate(cameraObj);
        }
Exemple #10
0
 static void RunApp()
 {
     EditorApplication.ExecuteMenuItem("XLua/Hotfix Inject In Editor");
     EditorApplication.isPlaying = !EditorApplication.isPlaying;
 }
Exemple #11
0
            public override void OnInspectorGUI()
            {
                ButtonIconSet bis = (ButtonIconSet)target;

                bool showQuadIconFoldout   = SessionState.GetBool(ShowQuadIconsFoldoutKey, false);
                bool showSpriteIconFoldout = SessionState.GetBool(ShowSpriteIconsFoldoutKey, false);
                bool showCharIconFoldout   = SessionState.GetBool(ShowCharIconsFoldoutKey, false);
                bool showAvailableIcons    = SessionState.GetBool(AvailableIconsFoldoutKey, true);
                bool showSelectedIcons     = SessionState.GetBool(SelectedIconsFoldoutKey, true);

#if UNITY_2019_3_OR_NEWER
                showQuadIconFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(showQuadIconFoldout, "Quad Icons");
#else
                showQuadIconFoldout = EditorGUILayout.Foldout(showQuadIconFoldout, "Quad Icons");
#endif
                if (showQuadIconFoldout)
                {
                    using (new EditorGUI.IndentLevelScope(1))
                    {
                        quadIconsProp.isExpanded = true;
                        EditorGUILayout.PropertyField(quadIconsProp, true);
                    }
                }
#if UNITY_2019_3_OR_NEWER
                EditorGUILayout.EndFoldoutHeaderGroup();
#endif

#if UNITY_2019_3_OR_NEWER
                showSpriteIconFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(showSpriteIconFoldout, "Sprite Icons");
#else
                showSpriteIconFoldout = EditorGUILayout.Foldout(showSpriteIconFoldout, "Sprite Icons");
#endif
                if (showSpriteIconFoldout)
                {
                    using (new EditorGUI.IndentLevelScope(1))
                    {
                        spriteIconsProp.isExpanded = true;

                        // Check if the sprite Icons were updated
                        EditorGUI.BeginChangeCheck();
                        EditorGUILayout.PropertyField(spriteIconsProp, true);
                        // End the code block and update the label if a change occurred
                        if (EditorGUI.EndChangeCheck())
                        {
                            serializedObject.ApplyModifiedProperties();
                            bis.UpdateSpriteIconTextures();
                        }
                    }
                }
#if UNITY_2019_3_OR_NEWER
                EditorGUILayout.EndFoldoutHeaderGroup();
#endif

#if UNITY_2019_3_OR_NEWER
                showCharIconFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(showCharIconFoldout, "Font Icons");
#else
                showCharIconFoldout = EditorGUILayout.Foldout(showCharIconFoldout, "Font Icons");
#endif


#if UNITY_2019_3_OR_NEWER
                EditorGUILayout.EndFoldoutHeaderGroup();
#endif

                if (showCharIconFoldout)
                {
                    EditorGUILayout.PropertyField(charIconFontProp);

                    if (charIconFontProp.objectReferenceValue == null)
                    {
                        EditorGUILayout.HelpBox(noIconFontMessage, MessageType.Warning);
                        if (!CheckIfHololensIconFontExists())
                        {
                            EditorGUILayout.HelpBox(downloadIconFontMessage, MessageType.Info);
                            if (GUILayout.Button("View Button Documentation"))
                            {
                                EditorApplication.ExecuteMenuItem(textMeshProMenuItem);
                                Application.OpenURL(hololensIconFontUrl);
                            }
                        }
                    }
                    else
                    {
                        TMP_FontAsset fontAsset = (TMP_FontAsset)charIconFontProp.objectReferenceValue;

#if UNITY_2019_3_OR_NEWER
                        showAvailableIcons = EditorGUILayout.BeginFoldoutHeaderGroup(showAvailableIcons, "Available Icons");
#else
                        showAvailableIcons = EditorGUILayout.Foldout(showAvailableIcons, "Available Icons");
#endif

                        if (showAvailableIcons)
                        {
                            if (fontAsset.characterTable.Count == 0)
                            {
                                EditorGUILayout.HelpBox("No icons are available in this font. The font may be configured incorrectly.", MessageType.Warning);
                                if (GUILayout.Button("Open Font Editor"))
                                {
                                    Selection.activeObject = bis.CharIconFont;
                                }
                            }
                            else
                            {
                                EditorGUILayout.HelpBox("Click an icon to add it to your selected icons.", MessageType.Info);
                                if (GUILayout.Button("Open Font Editor"))
                                {
                                    Selection.activeObject = bis.CharIconFont;
                                }

                                int removeIndex = -1;
                                int addIndex    = -1;
                                int column      = 0;

                                column = 0;
                                EditorGUILayout.BeginHorizontal();
                                for (int i = 0; i < fontAsset.characterTable.Count; i++)
                                {
                                    if (column >= maxButtonsPerColumn)
                                    {
                                        column = 0;
                                        EditorGUILayout.EndHorizontal();
                                        EditorGUILayout.BeginHorizontal();
                                    }
                                    if (GUILayout.Button(" ",
                                                         GUILayout.MinHeight(maxButtonSize),
                                                         GUILayout.MaxHeight(maxButtonSize),
                                                         GUILayout.MaxWidth(maxButtonSize)))
                                    {
                                        addIndex = i;
                                    }
                                    Rect textureRect = GUILayoutUtility.GetLastRect();
                                    EditorDrawTMPGlyph(textureRect, fontAsset, fontAsset.characterTable[i]);
                                    column++;
                                }

                                if (column > 0)
                                {
                                    EditorGUILayout.EndHorizontal();
                                }

                                if (removeIndex >= 0)
                                {
                                    List <CharIcon> charIconsSet = new List <CharIcon>(bis.charIcons);
                                    charIconsSet.RemoveAt(removeIndex);
                                    bis.charIcons = charIconsSet.ToArray();
                                    EditorUtility.SetDirty(target);
                                }

                                if (addIndex >= 0)
                                {
                                    uint unicode             = fontAsset.characterTable[addIndex].unicode;
                                    bool alreadyContainsIcon = false;
                                    foreach (CharIcon c in bis.charIcons)
                                    {
                                        if (c.Character == unicode)
                                        {
                                            alreadyContainsIcon = true;
                                            break;
                                        }
                                    }

                                    if (!alreadyContainsIcon)
                                    {
                                        charIconsProp.InsertArrayElementAtIndex(charIconsProp.arraySize);

                                        SerializedProperty newIconProp = charIconsProp.GetArrayElementAtIndex(charIconsProp.arraySize - 1);
                                        SerializedProperty charProp    = newIconProp.FindPropertyRelative("Character");
                                        SerializedProperty nameProp    = newIconProp.FindPropertyRelative("Name");

                                        charProp.intValue    = (int)unicode;
                                        nameProp.stringValue = "Icon " + charIconsProp.arraySize.ToString();

                                        serializedObject.ApplyModifiedProperties();
                                    }
                                }
                            }
                            EditorGUILayout.Space();
                        }
#if UNITY_2019_3_OR_NEWER
                        EditorGUILayout.EndFoldoutHeaderGroup();
                        showSelectedIcons = EditorGUILayout.BeginFoldoutHeaderGroup(showSelectedIcons, "Selected Icons");
#else
                        showSelectedIcons = EditorGUILayout.Foldout(showSelectedIcons, "Selected Icons");
#endif

                        if (showSelectedIcons)
                        {
                            int removeIndex = -1;

                            if (charIconsProp.arraySize > 0)
                            {
                                EditorGUILayout.HelpBox("These icons will appear in the button config helper inspector. Click an icon to remove it from this list.", MessageType.Info);

                                using (new EditorGUILayout.VerticalScope())
                                {
                                    for (int i = 0; i < charIconsProp.arraySize; i++)
                                    {
                                        SerializedProperty charIconNameprop = charIconsProp.GetArrayElementAtIndex(i).FindPropertyRelative("Name");

                                        using (new EditorGUILayout.HorizontalScope())
                                        {
                                            if (GUILayout.Button(" ", GUILayout.MinHeight(maxButtonSize), GUILayout.MaxHeight(maxButtonSize)))
                                            {
                                                removeIndex = i;
                                            }
                                            Rect textureRect = GUILayoutUtility.GetLastRect();
                                            EditorDrawTMPGlyph(textureRect, bis.charIcons[i].Character, fontAsset);
                                            charIconNameprop.stringValue = EditorGUILayout.TextField(charIconNameprop.stringValue);
                                            EditorGUILayout.Space();
                                        }

                                        EditorGUILayout.Space();
                                    }
                                }
                            }
                            else
                            {
                                EditorGUILayout.HelpBox("No icons added yet. Click available icons to add.", MessageType.Info);
                            }

                            if (removeIndex >= 0)
                            {
                                charIconsProp.DeleteArrayElementAtIndex(removeIndex);
                            }
                        }

#if UNITY_2019_3_OR_NEWER
                        EditorGUILayout.EndFoldoutHeaderGroup();
#endif
                    }
                }

                SessionState.SetBool(ShowQuadIconsFoldoutKey, showQuadIconFoldout);
                SessionState.SetBool(ShowSpriteIconsFoldoutKey, showSpriteIconFoldout);
                SessionState.SetBool(ShowCharIconsFoldoutKey, showCharIconFoldout);
                SessionState.SetBool(AvailableIconsFoldoutKey, showAvailableIcons);
                SessionState.SetBool(SelectedIconsFoldoutKey, showSelectedIcons);

                serializedObject.ApplyModifiedProperties();
            }
Exemple #12
0
        private void DisplayTagManagerErrors()
        {
            bool missingSortingLayers = TargetAssetImporter.MissingSortingLayers.Any();
            bool missingLayers        = TargetAssetImporter.MissingLayers.Any();
            bool missingTags          = TargetAssetImporter.MissingTags.Any();

            if (!missingSortingLayers && !missingLayers && !missingTags)
            {
                return;
            }

            EditorGUILayout.TextArea("", GUI.skin.horizontalSlider);

            using (new GuiScopedBackgroundColor(Color.yellow))
            {
                if (missingSortingLayers)
                {
                    EditorGUILayout.LabelField("Missing Sorting Layers!", EditorStyles.boldLabel);

                    using (new GuiScopedIndent())
                    {
                        StringBuilder message = new StringBuilder("Sorting Layers are missing in your project settings. Open the Tag Manager, add these missing sorting layer, and reimport:");
                        message.AppendLine();
                        message.AppendLine();

                        foreach (var layer in TargetAssetImporter.MissingSortingLayers)
                        {
                            message.AppendFormat("    {0}\n", layer);
                        }

                        EditorGUILayout.HelpBox(message.ToString(), MessageType.Warning);
                    }
                }

                if (missingLayers)
                {
                    EditorGUILayout.LabelField("Missing Layers!", EditorStyles.boldLabel);

                    using (new GuiScopedIndent())
                    {
                        StringBuilder message = new StringBuilder("Layers are missing in your project settings. Open the Tag Manager, add these missing layers, and reimport:");
                        message.AppendLine();
                        message.AppendLine();

                        foreach (var layer in TargetAssetImporter.MissingLayers)
                        {
                            message.AppendFormat("    {0}\n", layer);
                        }

                        EditorGUILayout.HelpBox(message.ToString(), MessageType.Warning);
                    }
                }

                if (missingTags)
                {
                    EditorGUILayout.LabelField("Missing Tags!", EditorStyles.boldLabel);

                    using (new GuiScopedIndent())
                    {
                        StringBuilder message = new StringBuilder("Tags are missing in your project settings. Open the Tag Manager, add these missing tags, and reimport:");
                        message.AppendLine();
                        message.AppendLine();

                        foreach (var tag in TargetAssetImporter.MissingTags)
                        {
                            message.AppendFormat("    {0}\n", tag);
                        }

                        EditorGUILayout.HelpBox(message.ToString(), MessageType.Warning);
                    }
                }
            }

            using (new GuiScopedHorizontal())
            {
                if (GUILayout.Button("Open Tag Manager"))
                {
#if UNITY_2018_3_OR_NEWER
                    SettingsService.OpenProjectSettings("Project/Tags and Layers");
#else
                    EditorApplication.ExecuteMenuItem("Edit/Project Settings/Tags and Layers");
#endif
                }

                if (GUILayout.Button("Reimport"))
                {
                    ApplyAndImport();
                }
            }

            EditorGUILayout.TextArea("", GUI.skin.horizontalSlider);
        }
 public static void Show()
 {
     EditorApplication.ExecuteMenuItem("Window/Lighting/Settings");
 }
Exemple #14
0
 private static void BehaviourDesignerShorcut()
 {
     EditorApplication.ExecuteMenuItem("Tools/Behavior Designer/Editor");
 }
 public static void SaveAll()
 {
     EditorApplication.ExecuteMenuItem("File/Save");
     EditorApplication.ExecuteMenuItem("File/Save Project");
 }
Exemple #16
0
        public IEnumerator CreateSpawner_Single_Burst_With_Delay()
        {
            //This test cover a regression : 1154292
            EditorApplication.ExecuteMenuItem("Window/General/Game");

            var graph = MakeTemporaryGraph();

            var spawnerContext    = ScriptableObject.CreateInstance <VFXBasicSpawner>();
            var blockSpawnerBurst = ScriptableObject.CreateInstance <VFXSpawnerBurst>();
            var slotCount         = blockSpawnerBurst.GetInputSlot(0);
            var delay             = blockSpawnerBurst.GetInputSlot(1);

            var spawnerInit   = ScriptableObject.CreateInstance <VFXBasicInitialize>();
            var spawnerOutput = ScriptableObject.CreateInstance <VFXPlanarPrimitiveOutput>();

            var spawnCountValue = 456.0f;

            slotCount.value = spawnCountValue;

            var delayValue = 1.2f;

            delay.value = delayValue;

            spawnerContext.AddChild(blockSpawnerBurst);
            graph.AddChild(spawnerContext);
            graph.AddChild(spawnerInit);
            graph.AddChild(spawnerOutput);
            spawnerInit.LinkFrom(spawnerContext);
            spawnerOutput.LinkFrom(spawnerInit);

            //Force issue due to uninitialized expression (otherwise, constant folding resolve it)
            graph.SetCompilationMode(VFXCompilationMode.Edition);
            graph.RecompileIfNeeded();

            var gameObj      = new GameObject("CreateSpawner_Single_Burst_With_Delay");
            var vfxComponent = gameObj.AddComponent <VisualEffect>();

            vfxComponent.visualEffectAsset = graph.visualEffectResource.asset;

            var cameraObj = new GameObject("CreateSpawner_Single_Burst_With_Delay_Camera");
            var camera    = cameraObj.AddComponent <Camera>();

            camera.transform.localPosition = Vector3.one;
            camera.transform.LookAt(vfxComponent.transform);

            int maxFrame = 512;

            while (vfxComponent.culled && --maxFrame > 0)
            {
                yield return(null);
            }
            Assert.IsTrue(maxFrame > 0);

            var spawnerState = VisualEffectUtility.GetSpawnerState(vfxComponent, 0);

            //Sleeping state
            maxFrame = 512;
            while (--maxFrame > 0)
            {
                spawnerState = VisualEffectUtility.GetSpawnerState(vfxComponent, 0);
                if (spawnerState.totalTime < delayValue)
                {
                    Assert.AreEqual(0.0f, spawnerState.spawnCount);
                }
                else
                {
                    break;
                }
                yield return(null);
            }
            Assert.IsTrue(maxFrame > 0);

            //Spawning supposed to occur
            maxFrame = 512;
            while (--maxFrame > 0)
            {
                spawnerState = VisualEffectUtility.GetSpawnerState(vfxComponent, 0);
                if (spawnerState.spawnCount == spawnCountValue)
                {
                    break;
                }
                yield return(null);
            }
            Assert.IsTrue(maxFrame > 0);

            UnityEngine.Object.DestroyImmediate(gameObj);
            UnityEngine.Object.DestroyImmediate(cameraObj);
        }
        private void OnGUI()
        {
            this.InitStyles();
            if (!WindowPending.s_DidReload)
            {
                WindowPending.s_DidReload = true;
                this.UpdateWindow();
            }
            this.CreateResources();
            Event current     = Event.current;
            float fixedHeight = EditorStyles.toolbar.fixedHeight;
            bool  flag        = false;

            GUILayout.BeginArea(new Rect(0f, 0f, base.position.width, fixedHeight));
            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            int num = (this.incomingList.Root != null) ? this.incomingList.Root.ChildCount : 0;

            this.m_ShowIncoming = !GUILayout.Toggle(!this.m_ShowIncoming, "Outgoing", EditorStyles.toolbarButton, new GUILayoutOption[0]);
            GUIContent content = GUIContent.Temp("Incoming" + ((num != 0) ? (" (" + num.ToString() + ")") : string.Empty));

            this.m_ShowIncoming = GUILayout.Toggle(this.m_ShowIncoming, content, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                flag = true;
            }
            GUILayout.FlexibleSpace();
            using (new EditorGUI.DisabledScope(Provider.activeTask != null))
            {
                CustomCommand[] customCommands = Provider.customCommands;
                for (int i = 0; i < customCommands.Length; i++)
                {
                    CustomCommand customCommand = customCommands[i];
                    if (customCommand.context == CommandContext.Global && GUILayout.Button(customCommand.label, EditorStyles.toolbarButton, new GUILayoutOption[0]))
                    {
                        customCommand.StartTask();
                    }
                }
            }
            bool flag2 = Mathf.FloorToInt(base.position.width - this.s_ToolbarButtonsWidth - this.s_SettingsButtonWidth - this.s_DeleteChangesetsButtonWidth) > 0 && this.HasEmptyPendingChangesets();

            if (flag2 && GUILayout.Button("Delete Empty Changesets", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                this.DeleteEmptyPendingChangesets();
            }
            bool flag3 = Mathf.FloorToInt(base.position.width - this.s_ToolbarButtonsWidth - this.s_SettingsButtonWidth) > 0;

            if (flag3 && GUILayout.Button("Settings", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                EditorApplication.ExecuteMenuItem("Edit/Project Settings/Editor");
                EditorWindow.FocusWindowIfItsOpen <InspectorWindow>();
                GUIUtility.ExitGUI();
            }
            Color color = GUI.color;

            GUI.color = new Color(1f, 1f, 1f, 0.5f);
            bool flag4 = GUILayout.Button(this.refreshIcon, EditorStyles.toolbarButton, new GUILayoutOption[0]);

            flag      = (flag || flag4);
            GUI.color = color;
            if (current.isKey && GUIUtility.keyboardControl == 0 && current.type == EventType.KeyDown && current.keyCode == KeyCode.F5)
            {
                flag = true;
                current.Use();
            }
            if (flag)
            {
                if (flag4)
                {
                    Provider.InvalidateCache();
                }
                this.UpdateWindow();
            }
            GUILayout.EndArea();
            Rect rect  = new Rect(0f, fixedHeight, base.position.width, base.position.height - fixedHeight - 17f);
            bool flag5 = false;

            GUILayout.EndHorizontal();
            if (!Provider.isActive)
            {
                Color color2 = GUI.color;
                GUI.color   = new Color(0.8f, 0.5f, 0.5f);
                rect.height = fixedHeight;
                GUILayout.BeginArea(rect);
                GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                string text = "DISABLED";
                if (Provider.enabled)
                {
                    if (Provider.onlineState == OnlineState.Updating)
                    {
                        GUI.color = new Color(0.8f, 0.8f, 0.5f);
                        text      = "CONNECTING...";
                    }
                    else
                    {
                        text = "OFFLINE";
                    }
                }
                GUILayout.Label(text, EditorStyles.miniLabel, new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
                rect.y += rect.height;
                if (!string.IsNullOrEmpty(Provider.offlineReason))
                {
                    GUI.Label(rect, Provider.offlineReason);
                }
                GUI.color = color2;
                flag5     = false;
            }
            else
            {
                if (this.m_ShowIncoming)
                {
                    flag5 |= this.incomingList.OnGUI(rect, base.hasFocus);
                }
                else
                {
                    flag5 |= this.pendingList.OnGUI(rect, base.hasFocus);
                }
                rect.y     += rect.height;
                rect.height = 17f;
                GUI.Label(rect, GUIContent.none, WindowPending.s_Styles.bottomBarBg);
                GUIContent content2 = new GUIContent("Apply All Incoming Changes");
                Vector2    vector   = EditorStyles.miniButton.CalcSize(content2);
                Rect       rect2    = new Rect(rect.x, rect.y - 2f, rect.width - vector.x - 5f, rect.height);
                WindowPending.ProgressGUI(rect2, Provider.activeTask, false);
                if (this.m_ShowIncoming)
                {
                    Rect position = rect;
                    position.width  = vector.x;
                    position.height = vector.y;
                    position.y      = rect.y + 2f;
                    position.x      = base.position.width - vector.x - 5f;
                    using (new EditorGUI.DisabledScope(this.incomingList.Size == 0))
                    {
                        if (GUI.Button(position, content2, EditorStyles.miniButton))
                        {
                            Asset item   = new Asset(string.Empty);
                            Task  latest = Provider.GetLatest(new AssetList
                            {
                                item
                            });
                            latest.SetCompletionAction(CompletionAction.OnGotLatestPendingWindow);
                        }
                    }
                }
            }
            if (flag5)
            {
                base.Repaint();
            }
        }
    void OnGUI()
    {
        GUILayout.Label("OVR Performance Lint Tool", EditorStyles.boldLabel);
        if (GUILayout.Button("Refresh", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
        {
            RunCheck();
        }

        string lastCategory = "";

        mScrollPosition = EditorGUILayout.BeginScrollView(mScrollPosition);

        for (int x = 0; x < mRecords.Count; x++)
        {
            FixRecord record = mRecords[x];

            if (!record.category.Equals(lastCategory))              // new category
            {
                lastCategory = record.category;
                EditorGUILayout.Separator();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(lastCategory, EditorStyles.label, GUILayout.Width(200));
                bool moreThanOne = (x + 1 < mRecords.Count && mRecords[x + 1].category.Equals(lastCategory));
                if (record.buttonNames != null && record.buttonNames.Length > 0)
                {
                    if (moreThanOne)
                    {
                        GUILayout.Label("Apply to all:", EditorStyles.label, GUILayout.Width(75));
                        for (int y = 0; y < record.buttonNames.Length; y++)
                        {
                            if (GUILayout.Button(record.buttonNames[y], EditorStyles.toolbarButton, GUILayout.Width(200)))
                            {
                                List <FixRecord> recordsToProcess = new List <FixRecord>();

                                for (int z = x; z < mRecords.Count; z++)
                                {
                                    FixRecord thisRecord = mRecords[z];
                                    bool      isLast     = false;
                                    if (z + 1 >= mRecords.Count || !mRecords[z + 1].category.Equals(lastCategory))
                                    {
                                        isLast = true;
                                    }

                                    if (!thisRecord.complete)
                                    {
                                        recordsToProcess.Add(thisRecord);
                                    }

                                    if (isLast)
                                    {
                                        break;
                                    }
                                }

                                UnityEngine.Object[] undoObjects = new UnityEngine.Object[recordsToProcess.Count];
                                for (int z = 0; z < recordsToProcess.Count; z++)
                                {
                                    undoObjects[z] = recordsToProcess[z].targetObject;
                                }
                                Undo.RecordObjects(undoObjects, record.category + " (Multiple)");
                                for (int z = 0; z < recordsToProcess.Count; z++)
                                {
                                    FixRecord thisRecord = recordsToProcess[z];
                                    thisRecord.fixMethod(thisRecord.targetObject, (z + 1 == recordsToProcess.Count), y);
                                    OVRPlugin.SendEvent("perf_lint_apply_fix", thisRecord.category);
                                    thisRecord.complete = true;
                                }
                            }
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();
                if (moreThanOne || record.targetObject)
                {
                    GUILayout.Label(record.message);
                }
            }

            EditorGUILayout.BeginHorizontal();
            GUI.enabled = !record.complete;
            if (record.targetObject)
            {
                EditorGUILayout.ObjectField(record.targetObject, record.targetObject.GetType(), true);
            }
            else
            {
                GUILayout.Label(record.message);
            }
            if (record.buttonNames != null)
            {
                for (int y = 0; y < record.buttonNames.Length; y++)
                {
                    if (GUILayout.Button(record.buttonNames[y], EditorStyles.toolbarButton, GUILayout.Width(200)))
                    {
                        if (record.targetObject != null)
                        {
                            Undo.RecordObject(record.targetObject, record.category);
                        }

                        if (record.editModeRequired)
                        {
                            // Add to the fix record list that requires edit mode
                            mRuntimeEditModeRequiredRecords.Add(record);
                        }
                        else
                        {
                            // Apply the fix directly
                            record.fixMethod(record.targetObject, true, y);
                            OVRPlugin.SendEvent("perf_lint_apply_fix", record.category);
                            record.complete = true;
                        }

                        if (mRuntimeEditModeRequiredRecords.Count != 0)
                        {
                            // Stop the scene to apply edit mode required records
                            EditorApplication.ExecuteMenuItem("Edit/Play");
                        }
                    }
                }
            }
            GUI.enabled = true;
            EditorGUILayout.EndHorizontal();
        }

        EditorGUILayout.EndScrollView();
    }