예제 #1
0
        public DecodableBankHandle(string name, bool save) : base(name)
        {
            if (string.IsNullOrEmpty(decodedBankPath))
            {
                decodedBankPath = AkUtilities.GetWiseBankFolder_Full_Decode();
            }
            saveDecodedBank = save;
            bankNameExt     = Path.HasExtension(bankName) ? bankName + ".bnk" : bankName;
            // test language-specific decoded file path
            // var language = AkSoundEngine.GetCurrentLanguage();
            // var decodedBankFullPath = AkUtilities.GetWiseBankFolder_Full_Decode();

            var decodedBankFilePath = Path.Combine(decodedBankPath, bankNameExt);

            if (File.Exists(decodedBankFilePath))
            {
                try
                {
                    var decodedFileTime     = File.GetLastWriteTime(decodedBankFilePath);
                    var defaultBankPath     = AkUtilities.GetWiseBankFolder_Full();
                    var encodedBankFilePath = Path.Combine(defaultBankPath, bankNameExt);
                    var encodedFileTime     = File.GetLastWriteTime(encodedBankFilePath);

                    decodeBank = decodedFileTime <= encodedFileTime;
                }
                catch
                {
                    // Assume the decoded bank exists, but is not accessible. Re-decode it anyway, so we do nothing.
                }
            }
        }
    public static string GetDecodedBankFullPath()
    {
//#if UNITY_SWITCH && !UNITY_EDITOR
//		// Calling Application.persistentDataPath crashes Switch
//		return null;
//#elif (UNITY_ANDROID || PLATFORM_LUMIN || UNITY_IOS) && !UNITY_EDITOR
//		// This is for platforms that only have a specific file location for persistent data.
//		return System.IO.Path.Combine(UnityEngine.Application.persistentDataPath, GetDecodedBankFolder());
//#else
//        return System.IO.Path.Combine(AkBasePathGetter.GetPlatformBasePath(), GetDecodedBankFolder());
//#endif
        return(AkUtilities.GetWiseBankFolder_Full_Decode());
    }
예제 #3
0
        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 = AkUtilities.GetWiseBankFolder_Full_Decode();

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

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

            if (!decodedFileExists)
            {
                // test non-language-specific decoded file path
                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     = AkUtilities.GetWiseBankFolder_Full();
                    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.
                }
            }
        }