Beispiel #1
0
    public override void OnChildInspectorGUI()
    {
        serializedObject.Update();

        m_LoadBankEventHandlerInspector.OnGUI();
        m_UnloadBankEventHandlerInspector.OnGUI();

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

        using (new UnityEditor.EditorGUILayout.VerticalScope("box"))
        {
            var oldDecodeValue      = decode.boolValue;
            var oldSaveDecodedValue = saveDecoded.boolValue;
            UnityEditor.EditorGUILayout.PropertyField(loadAsync, new UnityEngine.GUIContent("Asynchronous:"));
            UnityEditor.EditorGUILayout.PropertyField(decode, new UnityEngine.GUIContent("Decode compressed data:"));

            if (decode.boolValue)
            {
                if (decode.boolValue != oldDecodeValue && AkWwiseInitializationSettings.ActivePlatformSettings.AkInitializationSettings.preparePoolSize == 0)
                {
                    UnityEditor.EditorUtility.DisplayDialog("Warning",
                                                            "You will need to define a prepare pool size in the Wwise Initialization Settings.", "Ok");
                }

                UnityEditor.EditorGUILayout.PropertyField(saveDecoded, new UnityEngine.GUIContent("Save decoded bank:"));
                if (oldSaveDecodedValue && saveDecoded.boolValue == false)
                {
                    var decodedBankPath =
                        System.IO.Path.Combine(AkSoundEngineController.GetDecodedBankFullPath(), bankName.stringValue + ".bnk");
                    try
                    {
                        System.IO.File.Delete(decodedBankPath);
                    }
                    catch (System.Exception e)
                    {
                        UnityEngine.Debug.Log("WwiseUnity: Could not delete existing decoded SoundBank. Please delete it manually. " + e);
                    }
                }
            }
        }

        serializedObject.ApplyModifiedProperties();
    }
Beispiel #2
0
    public override void OnChildInspectorGUI()
    {
        serializedObject.Update();

        m_LoadBankEventHandlerInspector.OnGUI();
        m_UnloadBankEventHandlerInspector.OnGUI();

        GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);

        GUILayout.BeginVertical("Box");
        {
            bool oldDecodeValue      = decode.boolValue;
            bool oldSaveDecodedValue = saveDecoded.boolValue;
            EditorGUILayout.PropertyField(loadAsync, new GUIContent("Asynchronous:"));
            EditorGUILayout.PropertyField(decode, new GUIContent("Decode compressed data:"));

            if (decode.boolValue)
            {
                if (decode.boolValue != oldDecodeValue && AkWwiseProjectInfo.GetData().preparePoolSize == 0)
                {
                    EditorUtility.DisplayDialog("Warning", "You will need to define a prepare pool size in the AkInitializer component options.", "Ok");
                }
                EditorGUILayout.PropertyField(saveDecoded, new GUIContent("Save decoded bank:"));
                if (oldSaveDecodedValue == true && saveDecoded.boolValue == false)
                {
                    string decodedBankPath = System.IO.Path.Combine(AkSoundEngineController.GetDecodedBankFullPath(), bankName.stringValue + ".bnk");
                    try
                    {
                        System.IO.File.Delete(decodedBankPath);
                    }
                    catch (Exception e)
                    {
                        Debug.Log("WwiseUnity: Could not delete existing decoded SoundBank. Please delete it manually. " + e.ToString());
                    }
                }
            }
        }
        GUILayout.EndVertical();

        serializedObject.ApplyModifiedProperties();
    }
        public DecodableBankHandle(string name, bool save) : base(name)
        {
            saveDecodedBank = save;

            var bankFileName = bankName + ".bnk";

            // test language-specific decoded file path
            var language            = AkSoundEngine.GetCurrentLanguage();
            var decodedBankFullPath = AkSoundEngineController.GetDecodedBankFullPath();

            decodedBankPath = System.IO.Path.Combine(decodedBankFullPath, language);
            var decodedBankFilePath = System.IO.Path.Combine(decodedBankPath, bankFileName);

            var decodedFileExists = System.IO.File.Exists(decodedBankFilePath);

            if (!decodedFileExists)
            {
                // test non-language-specific decoded file path
                decodedBankPath     = decodedBankFullPath;
                decodedBankFilePath = System.IO.Path.Combine(decodedBankPath, bankFileName);
                decodedFileExists   = System.IO.File.Exists(decodedBankFilePath);
            }

            if (decodedFileExists)
            {
                try
                {
                    var decodedFileTime     = System.IO.File.GetLastWriteTime(decodedBankFilePath);
                    var defaultBankPath     = AkBasePathGetter.GetSoundbankBasePath();
                    var encodedBankFilePath = System.IO.Path.Combine(defaultBankPath, bankFileName);
                    var encodedFileTime     = System.IO.File.GetLastWriteTime(encodedBankFilePath);

                    decodeBank = decodedFileTime <= encodedFileTime;
                }
                catch
                {
                    // Assume the decoded bank exists, but is not accessible. Re-decode it anyway, so we do nothing.
                }
            }
        }