public static void StartFromScratch(InCommonDataManager Manager) { SystemFolderHelper.CreateIfMissing(FolderSettings.BankCreateFolder); try { DataCleanup.Cleanup(DataCleanup.CleanupVerbose.Silent); } catch (Exception) { //Do nothing as something is seriously wrong } int levelSize = 3; GameObject audioGO = new GameObject(); GameObject eventGO = new GameObject(); GameObject busGO = new GameObject(); GameObject bankGO = new GameObject(); Manager.BusTree = AudioBusWorker.CreateTree(busGO); Manager.BankLinkTree = AudioBankWorker.CreateTree(bankGO); Manager.AudioTree = AudioNodeWorker.CreateTree(audioGO, levelSize, Manager.BusTree); Manager.EventTree = AudioEventWorker.CreateTree(eventGO, levelSize); SaveAndLoad.CreateDataPrefabs(Manager.AudioTree.gameObject, Manager.EventTree.gameObject, Manager.BusTree.gameObject, Manager.BankLinkTree.gameObject); Manager.Load(true); if (Manager.BankLinkTree != null) { var bankLink = Manager.BankLinkTree.Children[0]; bankLink.Name = "Default - Auto loaded"; bankLink.AutoLoad = true; NodeWorker.AssignToNodes(Manager.AudioTree, node => { var data = (node.NodeData as InFolderData); if (data != null) { data.BankLink = Manager.BankLinkTree.GetChildren[0]; } }); NodeWorker.AssignToNodes(Manager.AudioTree, node => node.Bus = Manager.BusTree); AssetDatabase.Refresh(); DataCleanup.Cleanup(DataCleanup.CleanupVerbose.Silent); EditorApplication.SaveCurrentSceneIfUserWantsTo(); } else { Debug.LogError("There was a problem creating the data."); } }
private void DrawStartFromScratch() { EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Start over from scratch", GUILayout.Height(30))) { if (EditorUtility.DisplayDialog("Create new project?", "This will delete ALL data!", "Start from scratch", "Do nothing")) { FolderSettings.DeleteFolderContent(Application.dataPath + FolderSettings.BankDeleteFolder); int levelSize = 3; GameObject go1 = new GameObject(); GameObject go2 = new GameObject(); GameObject go3 = new GameObject(); GameObject go4 = new GameObject(); Manager.BusTree = AudioBusWorker.CreateTree(go3); Manager.BankLinkTree = AudioBankWorker.CreateTree(go4); Manager.AudioTree = AudioNodeWorker.CreateTree(go1, levelSize, Manager.BusTree); Manager.EventTree = AudioEventWorker.CreateTree(go2, levelSize); SaveAndLoad.CreateDataPrefabs(Manager.AudioTree.gameObject, Manager.EventTree.gameObject, Manager.BusTree.gameObject, Manager.BankLinkTree.gameObject); Manager.Load(true); if (Manager.BankLinkTree != null) { var bankLink = AudioBankWorker.CreateBank(Manager.BankLinkTree.gameObject, Manager.BankLinkTree, GUIDCreator.Create()); bankLink.Name = "Default - Auto loaded"; bankLink.AutoLoad = true; var bankLink2 = AudioBankWorker.CreateBank(Manager.BankLinkTree.gameObject, Manager.BankLinkTree, GUIDCreator.Create()); bankLink2.Name = "Extra"; NodeWorker.AssignToNodes(Manager.AudioTree, node => node.BankLink = Manager.BankLinkTree.GetChildren[0]); } else { Debug.LogError("There was a problem creating the data."); } NodeWorker.AssignToNodes(Manager.AudioTree, node => node.Bus = Manager.BusTree); AssetDatabase.Refresh(); EditorApplication.SaveCurrentSceneIfUserWantsTo(); } } }
public static void StartFromScratch(InCommonDataManager Manager) { try { DataCleanup.Cleanup(DataCleanup.CleanupVerbose.Silent); } catch (Exception) { Debug.LogError("InAudio: Problem cleaning data before creating project.\nPlease report bug to [email protected] or via the feedback window."); } int levelSize = 3; GameObject audioGO = new GameObject(); GameObject eventGO = new GameObject(); GameObject bankGO = new GameObject(); GameObject musicGO = new GameObject(); Manager.BankLinkTree = AudioBankWorker.CreateTree(bankGO); Manager.AudioTree = AudioNodeWorker.CreateTree(audioGO, levelSize); Manager.MusicTree = MusicWorker.CreateTree(musicGO, levelSize); Manager.EventTree = AudioEventWorker.CreateTree(eventGO, levelSize); SaveAndLoad.CreateDataPrefabs(Manager.AudioTree.gameObject, Manager.MusicTree.gameObject, Manager.EventTree.gameObject, Manager.BankLinkTree.gameObject); Manager.Load(true); if (Manager.BankLinkTree != null) { var bankLink = Manager.BankLinkTree._children[0]; bankLink._name = "Default - Auto loaded"; bankLink._autoLoad = true; NodeWorker.AssignToNodes(Manager.AudioTree, node => { var data = (node._nodeData as InFolderData); if (data != null) { data.BankLink = Manager.BankLinkTree._getChildren[0]; } }); NodeWorker.AssignToNodes(Manager.MusicTree, musicNode => { var folder = musicNode as InMusicFolder; if (folder != null) { folder._bankLink = Manager.BankLinkTree._getChildren[0]; } }); var firstAudioFolder = Manager.AudioTree._children[0]; AudioNodeWorker.CreateChild(firstAudioFolder, AudioNodeType.Audio, "Empty Example Audio Node"); var random = AudioNodeWorker.CreateChild(firstAudioFolder, AudioNodeType.Random); random.Name = "Random Node Example"; AudioNodeWorker.CreateChild(random, AudioNodeType.Audio, "Empty Example Audio Node"); AudioNodeWorker.CreateChild(random, AudioNodeType.Audio, "Empty Example Audio Node"); AudioNodeWorker.CreateChild(random, AudioNodeType.Audio, "Empty Example Audio Node"); var multi = AudioNodeWorker.CreateChild(firstAudioFolder, AudioNodeType.Multi, "Multi-Sound Example"); AudioNodeWorker.CreateChild(multi, AudioNodeType.Audio, "Played simultaneously"); AudioNodeWorker.CreateChild(multi, AudioNodeType.Audio, "Played simultaneously"); var sequence = AudioNodeWorker.CreateChild(firstAudioFolder, AudioNodeType.Sequence, "Sequence-Sound Example"); AudioNodeWorker.CreateChild(sequence, AudioNodeType.Audio, "Played first"); AudioNodeWorker.CreateChild(sequence, AudioNodeType.Audio, "Played secondly"); var firstEventFolder = Manager.EventTree._children[0]; firstEventFolder.FoldedOut = true; var audioEvent = AudioEventWorker.CreateNode(firstEventFolder, EventNodeType.Event); audioEvent.Name = "Playing Random Audio Event"; var action = AudioEventWorker.AddEventAction <InEventAudioAction>(audioEvent, EventActionTypes.Play); audioEvent.FoldedOut = true; action.Node = random; var firstMusicFolder = Manager.MusicTree._children[0]; var musicGroup = MusicWorker.CreateMusicGroup(firstMusicFolder, "Empty Music Group"); firstMusicFolder.FoldedOut = true; MusicWorker.CreateMusicGroup(musicGroup, "Empty Music Group - Child 1"); MusicWorker.CreateMusicGroup(musicGroup, "Empty Music Group - Child 2"); musicGroup.FoldedOut = true; AssetDatabase.Refresh(); DataCleanup.Cleanup(DataCleanup.CleanupVerbose.Silent); #if !UNITY_5_2 EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo(); #else EditorApplication.MarkSceneDirty(); EditorApplication.SaveCurrentSceneIfUserWantsTo(); #endif } else { Debug.LogError("InAudio: There was a problem creating the data.\nPlease report this bug to [email protected] or via the feedback window."); } }