init() приватный Метод

private init ( ) : void
Результат void
Пример #1
0
    public static void CheckPicker()
    {
        if (EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isCompiling)
        {
            // Skip if not in the right mode, wait for the next callback to see if we can proceed then.
            EditorApplication.delayCall += CheckPicker;
            return;
        }

        WwiseSettings settings = WwiseSettings.LoadSettings();

        if (!settings.CreatedPicker)
        {
            // Delete all the ghost tabs (Failed to load).
            EditorWindow[] windows = Resources.FindObjectsOfTypeAll <EditorWindow>();
            if (windows != null && windows.Length > 0)
            {
                foreach (EditorWindow window in windows)
                {
                    string windowTitle = window.titleContent.text;

                    if (windowTitle.Equals("Failed to load") || windowTitle.Equals("AkWwisePicker"))
                    {
                        try
                        {
                            window.Close();
                        }
                        catch (Exception)
                        {
                            // Do nothing here, this shoudn't cause any problem, however there has been
                            // occurences of Unity crashing on a null reference inside that method.
                        }
                    }
                }
            }

            ClearConsole();

            // TODO: If no scene is loaded and we are using the demo scene, automatically load it to display it.

            // Populate the picker
            AkWwiseProjectInfo.GetData();             // Load data
            if (!String.IsNullOrEmpty(settings.WwiseProjectPath))
            {
                AkWwiseProjectInfo.Populate();
                AkWwisePicker.init();

                if (AkWwiseProjectInfo.GetData().autoPopulateEnabled)
                {
                    AkWwiseWWUBuilder.StartWWUWatcher();
                }

                settings.CreatedPicker = true;
                WwiseSettings.SaveSettings(settings);
            }
        }

        EditorApplication.delayCall += CheckPendingExecuteMethod;
    }
    void OnGUI()
    {
        // Make sure everything is initialized
        // Use soundbank path, because Wwise project path can be empty.
        if (String.IsNullOrEmpty(WwiseSetupWizard.Settings.SoundbankPath) && WwiseSetupWizard.Settings.WwiseProjectPath == null)
        {
            WwiseSetupWizard.Settings = WwiseSettings.LoadSettings();
        }

        string initialProject = WwiseSetupWizard.Settings.WwiseProjectPath;

        if (VersionStyle == null)
        {
            InitGuiStyles();
        }
        GUILayout.Label(m_WwiseVersionString, VersionStyle);

        DrawSettingsPart();

        string newProject = WwiseSetupWizard.Settings.WwiseProjectPath;         // DrawSettingsPart modifies WwiseSetupWizard.Settings.WwiseProjectPath directly.

        if (initialProject != newProject)
        {
            ApplyNewProject = true;
        }

        GUILayout.BeginVertical();
        GUILayout.FlexibleSpace();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("OK", GUILayout.Width(60)))
        {
            if (string.IsNullOrEmpty(WwiseSetupWizard.Settings.SoundbankPath))
            {
                EditorUtility.DisplayDialog("Error", "Please fill in the required settings", "Ok");
            }

            if (AkWwiseSettingsWindow.m_oldCreateWwiseGlobal != WwiseSetupWizard.Settings.CreateWwiseGlobal)
            {
                AkInitializer[] AkInitializers = UnityEngine.Object.FindObjectsOfType(typeof(AkInitializer)) as AkInitializer[];
                if (WwiseSetupWizard.Settings.CreateWwiseGlobal == true)
                {
                    if (AkInitializers.Length == 0)
                    {
                        //No Wwise object in this scene, create one so that the sound engine is initialized and terminated properly even if the scenes are loaded
                        //in the wrong order.
                        GameObject objWwise = new GameObject("WwiseGlobal");

                        //Attach initializer and terminator components
                        AkInitializer init = objWwise.AddComponent <AkInitializer>();
                        AkWwiseProjectInfo.GetData().CopyInitSettings(init);
                    }
                }
                else
                {
                    if (AkInitializers.Length != 0 && AkInitializers[0].gameObject.name == "WwiseGlobal")
                    {
                        GameObject.DestroyImmediate(AkInitializers[0].gameObject);
                    }
                }
            }

            if (AkWwiseSettingsWindow.m_oldCreateWwiseListener != WwiseSetupWizard.Settings.CreateWwiseListener)
            {
                if (Camera.main != null)
                {
                    AkAudioListener akListener = Camera.main.GetComponentInChildren <AkAudioListener>();

                    if (WwiseSetupWizard.Settings.CreateWwiseListener)
                    {
                        if (akListener == null)
                        {
                            akListener = Undo.AddComponent <AkAudioListener>(Camera.main.gameObject);
                            AkGameObj akGameObj = akListener.GetComponentInChildren <AkGameObj>();
                            akGameObj.isEnvironmentAware = false;
                        }

                        // If Unity had already an audio listener, we want to remove it when adding our own.
                        AudioListener unityListener = Camera.main.GetComponentInChildren <AudioListener>();
                        if (unityListener != null)
                        {
                            Component.DestroyImmediate(unityListener);
                        }
                    }
                }
            }

            if (m_oldShowMissingRigidBodyWarning != WwiseSetupWizard.Settings.ShowMissingRigidBodyWarning)
            {
                InternalEditorUtility.RepaintAllViews();
            }

            WwiseSettings.SaveSettings(WwiseSetupWizard.Settings);

            CloseWindow();

            // Pop the Picker window so the user can start working right away
            AkWwiseProjectInfo.GetData();             // Load data
            if (ApplyNewProject)
            {
                //Clear the data, the project path changed.
                AkWwiseProjectInfo.GetData().Reset();
                ApplyNewProject = false;
                AkWwisePicker.WwiseProjectFound = true;
            }
            AkWwiseProjectInfo.Populate();
            AkWwisePicker.PopulateTreeview();
            AkWwisePicker.init();
        }

        if (GUILayout.Button("Cancel", GUILayout.Width(60)))
        {
            WwiseSetupWizard.Settings = WwiseSettings.LoadSettings(true);
            CloseWindow();
        }
        GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
        GUILayout.EndHorizontal();

        GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
        GUILayout.EndVertical();
    }
Пример #3
0
    private void OnGUI()
    {
        // Make sure everything is initialized
        // Use soundbank path, because Wwise project path can be empty.
        if (string.IsNullOrEmpty(WwiseSetupWizard.Settings.SoundbankPath) &&
            WwiseSetupWizard.Settings.WwiseProjectPath == null)
        {
            WwiseSetupWizard.Settings = WwiseSettings.LoadSettings();
        }

        var initialProject = WwiseSetupWizard.Settings.WwiseProjectPath;

        if (VersionStyle == null)
        {
            InitGuiStyles();
        }
        UnityEngine.GUILayout.Label(m_WwiseVersionString, VersionStyle);

        DrawSettingsPart();

        // DrawSettingsPart modifies WwiseSetupWizard.Settings.WwiseProjectPath directly.
        var newProject = WwiseSetupWizard.Settings.WwiseProjectPath;

        if (initialProject != newProject)
        {
            ApplyNewProject = true;
        }

        using (new UnityEngine.GUILayout.VerticalScope())
        {
            UnityEngine.GUILayout.FlexibleSpace();

            using (new UnityEngine.GUILayout.HorizontalScope())
            {
                UnityEngine.GUILayout.FlexibleSpace();
                if (UnityEngine.GUILayout.Button("OK", UnityEngine.GUILayout.Width(60)))
                {
                    if (string.IsNullOrEmpty(WwiseSetupWizard.Settings.SoundbankPath))
                    {
                        UnityEditor.EditorUtility.DisplayDialog("Error", "Please fill in the required settings", "Ok");
                    }

                    if (m_oldCreateWwiseGlobal != WwiseSetupWizard.Settings.CreateWwiseGlobal)
                    {
//						var AkInitializers = FindObjectsOfType<AkInitializer>();
//						if (WwiseSetupWizard.Settings.CreateWwiseGlobal)
//						{
//							if (AkInitializers.Length == 0)
//							{
//								//No Wwise object in this scene, create one so that the sound engine is initialized and terminated properly even if the scenes are loaded
//								//in the wrong order.
//								//var objWwise = new UnityEngine.GameObject("WwiseGlobal");
//
//								//UnityEditor.Undo.AddComponent<AkInitializer>(objWwise);
//							}
//						}
//						else if (AkInitializers.Length != 0 && AkInitializers[0].gameObject.name == "WwiseGlobal")
//							UnityEditor.Undo.DestroyObjectImmediate(AkInitializers[0].gameObject);
                    }

                    if (m_oldCreateWwiseListener != WwiseSetupWizard.Settings.CreateWwiseListener)
                    {
                        if (WwiseSetupWizard.Settings.CreateWwiseListener)
                        {
                            AkUtilities.RemoveUnityAudioListenerFromMainCamera();
                            AkUtilities.AddAkAudioListenerToMainCamera();
                        }
                    }

                    if (m_oldShowMissingRigidBodyWarning != WwiseSetupWizard.Settings.ShowMissingRigidBodyWarning)
                    {
                        UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
                    }

                    WwiseSettings.SaveSettings(WwiseSetupWizard.Settings);

                    CloseWindow();

                    // Pop the Picker window so the user can start working right away
                    AkWwiseProjectInfo.GetData();                     // Load data
                    if (ApplyNewProject)
                    {
                        //Clear the data, the project path changed.
                        AkWwiseProjectInfo.GetData().Reset();
                        ApplyNewProject = false;
                        AkUtilities.IsWwiseProjectAvailable = true;
                    }

                    AkWwiseProjectInfo.Populate();
                    AkWwisePicker.PopulateTreeview();
                    AkWwisePicker.init();
                }

                if (UnityEngine.GUILayout.Button("Cancel", UnityEngine.GUILayout.Width(60)))
                {
                    WwiseSetupWizard.Settings = WwiseSettings.LoadSettings(true);
                    CloseWindow();
                }

                UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);
            }

            UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);
        }
    }
Пример #4
0
    void OnGUI()
    {
        // Make sure everything is initialized
        if (m_Logo == null)
        {
            FetchWwiseLogo();
        }
        if (WelcomeStyle == null)
        {
            InitGuiStyles();
        }
        // Use soundbank path, because Wwise project path can be empty.
        if (String.IsNullOrEmpty(Settings.SoundbankPath) && Settings.WwiseProjectPath == null)
        {
            Settings = WwiseSettings.LoadSettings();
        }

        GUILayout.BeginHorizontal("box");
        GUILayout.Label(m_Logo, GUILayout.Width(m_Logo.width));
        GUILayout.Label("Welcome to the Wwise Unity Integration " + m_newIntegrationVersion + "!", WelcomeStyle, GUILayout.Height(m_Logo.height));
        GUILayout.EndHorizontal();

        // Make the HelpBox font size a little bigger
        GUILayout.Label(
            @"This setup wizard will perform the first-time setup of the Wwise Unity integration. 
If this is the first time the Wwise Unity integration is installed for this game project, simply fill in the required fields, and click ""Start Installation"".

If a previous version of the integration has already been installed on this game project, it is still recommended to fill out the required settings below and completing the installation. The game project will be updated to match the new version of the Wwise Unity integration.

To get more information on the installation process, please refer to the ""Install the integration in a Unity project"" section of the integration documentation, found under the menu Help -> Wwise Help.

This integration relies on data from a " + m_newIntegrationVersion + @" Wwise project. Note that it is recommended for the Wwise project to reside in the game project's root folder.
        
For more information on a particular setting, hover your mouse over it.",
            HelpStyle);

        DrawSettingsPart();

        GUILayout.BeginVertical();
        GUILayout.FlexibleSpace();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Start Installation", GUILayout.Width(200)))
        {
            if (string.IsNullOrEmpty(Settings.WwiseProjectPath) || string.IsNullOrEmpty(Settings.SoundbankPath))
            {
                EditorUtility.DisplayDialog("Error", "Please fill all mandatory settings", "Ok");
            }
            else
            {
                WwiseSettings.SaveSettings(Settings);
                if (Setup())
                {
                    Debug.Log("WwiseUnity integration installation completed successfully");
                }
                else
                {
                    Debug.LogError("Could not complete Wwise Unity integration installation");
                }

                // Setup done; close the window
                WwiseSetupWizard.CloseWindow();

                if (!string.IsNullOrEmpty(Settings.WwiseProjectPath))
                {
                    // Pop the Picker window so the user can start working right away
                    AkWwisePicker.init();
                }

                ShowHelp();
            }
        }

        if (GUILayout.Button("Cancel Installation", GUILayout.Width(200)))
        {
            // Ask "Are you sure?"
            if (EditorUtility.DisplayDialog("Warning", "This will completely remove the Wwise Unity Integration. Are you sure?", "Yes", "No"))
            {
                UninstallIntegration();
                WwiseSetupWizard.CloseWindow();
            }
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.Space(5);
        GUILayout.EndVertical();
    }
Пример #5
0
    void OnGUI()
    {
        // Make sure everything is initialized
        // Use soundbank path, because Wwise project path can be empty.
        if (String.IsNullOrEmpty(WwiseSetupWizard.Settings.SoundbankPath) && WwiseSetupWizard.Settings.WwiseProjectPath == null)
        {
            WwiseSetupWizard.Settings = WwiseSettings.LoadSettings();
        }

        if (VersionStyle == null)
        {
            InitGuiStyles();
        }
        GUILayout.Label(m_WwiseVersionString, VersionStyle);

        DrawSettingsPart();

        GUILayout.BeginVertical();
        GUILayout.FlexibleSpace();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("OK", GUILayout.Width(60)))
        {
            if (string.IsNullOrEmpty(WwiseSetupWizard.Settings.SoundbankPath))
            {
                EditorUtility.DisplayDialog("Error", "Please fill in the required settings", "Ok");
            }

            if (WwiseUpdateSettings.m_oldCreateWwiseGlobal != WwiseSetupWizard.Settings.CreateWwiseGlobal)
            {
                AkInitializer[] AkInitializers = UnityEngine.Object.FindObjectsOfType(typeof(AkInitializer)) as AkInitializer[];
                if (WwiseSetupWizard.Settings.CreateWwiseGlobal == true)
                {
                    if (AkInitializers.Length == 0)
                    {
                        //No Wwise object in this scene, create one so that the sound engine is initialized and terminated properly even if the scenes are loaded
                        //in the wrong order.
                        GameObject objWwise = new GameObject("WwiseGlobal");

                        //Attach initializer and terminator components
                        AkInitializer init = objWwise.AddComponent <AkInitializer>();
                        AkWwiseProjectInfo.GetData().CopyInitSettings(init);
                    }
                }
                else
                {
                    if (AkInitializers.Length != 0 && AkInitializers[0].gameObject.name == "WwiseGlobal")
                    {
                        GameObject.DestroyImmediate(AkInitializers[0].gameObject);
                    }
                }
            }

            if (WwiseUpdateSettings.m_oldCreateWwiseListener != WwiseSetupWizard.Settings.CreateWwiseListener)
            {
                if (Camera.main != null)
                {
                    AkAudioListener akListener = Camera.main.GetComponentInChildren <AkAudioListener>();
                    if (akListener != null && WwiseSetupWizard.Settings.CreateWwiseListener == false)
                    {
                        Component.DestroyImmediate(akListener);
                    }

                    if (WwiseSetupWizard.Settings.CreateWwiseListener == true)
                    {
                        Camera.main.gameObject.AddComponent <AkAudioListener>();
                    }
                }
            }

            WwiseSettings.SaveSettings(WwiseSetupWizard.Settings);

            CloseWindow();

            // Pop the Picker window so the user can start working right away
            AkWwiseProjectInfo.GetData(); // Load data
            AkWwiseProjectInfo.Populate();
            AkWwisePicker.PopulateTreeview();
            AkWwisePicker.init();
        }

        if (GUILayout.Button("Cancel", GUILayout.Width(60)))
        {
            WwiseSetupWizard.Settings = WwiseSettings.LoadSettings(true);
            CloseWindow();
        }
        GUILayout.Space(5);
        GUILayout.EndHorizontal();

        GUILayout.Space(5);
        GUILayout.EndVertical();
    }