GetCurrentLanguage() public static méthode

public static GetCurrentLanguage ( ) : string
Résultat string
Exemple #1
0
    /// Load a language-specific bank from WWW object
    public void LoadLocalizedBank(string in_bankFilename)
    {
        var bankPath = "file://" + System.IO.Path.Combine(
            System.IO.Path.Combine(AkBasePathGetter.GetPlatformBasePath(), AkInitializer.GetCurrentLanguage()),
            in_bankFilename);

        DoLoadBank(bankPath);
    }
Exemple #2
0
    public bool LoadBank(string inBankFileName, bool localized = false)
    {
        if (_DicBankLoad.ContainsKey(inBankFileName.ToLower()))
        {
            return(true);
        }

        /*
         * string bankPath;
         *
         * if (!localized)
         *  bankPath = HobaText.Format("{0}/{1}/{2}/{3}", EntryPoint.Instance.ResPath, AkInitializer.GetBasePath(), AkBasePathGetter.GetPlatformName(), in_bankFileName);
         * else
         *  bankPath = HobaText.Format("{0}/{1}/{2}/{3}/{4}", EntryPoint.Instance.ResPath, AkInitializer.GetBasePath(), AkBasePathGetter.GetPlatformName(), AkInitializer.GetCurrentLanguage(), in_bankFileName);
         *
         * SBankEntry entry = new SBankEntry();
         * if (DoLoadBankFromImage(bankPath, entry))
         * {
         *  string name = localized ? HobaText.Format("{0}/{1}", AkInitializer.GetCurrentLanguage(), in_bankFileName.ToLower()) : in_bankFileName.ToLower();
         *  entry.gameObject = new GameObject(name);
         *  entry.gameObject.transform.parent = WwiseSoundMan.Instance.BanksLoaded.transform;
         *  _DicBankLoad.Add(in_bankFileName.ToLower(), entry);
         *  return true;
         * }
         *
         * HobaDebuger.LogWarningFormat("LoadBank Failed: {0}", bankPath);
         * return false;
         */


        CBankEntry entry = new CBankEntry();
        string     name  = localized ? HobaText.Format("{0}/{1}", AkInitializer.GetCurrentLanguage(), inBankFileName) : inBankFileName;
        AKRESULT   ret   = AkSoundEngine.LoadBank(name, AkSoundEngine.AK_DEFAULT_POOL_ID, out entry.BankID);

        if (ret == AKRESULT.AK_Success)
        {
            entry.GameObject = new GameObject(name);
            entry.GameObject.transform.parent = WwiseSoundMan.Instance.BanksLoaded.transform;
            _DicBankLoad.Add(inBankFileName.ToLower(), entry);
            return(true);
        }

        HobaDebuger.LogWarningFormat("LoadBank Failed: {0}", name);
        return(false);
    }
        public DecodableBankHandle(string name, bool save) : base(name)
        {
            saveDecodedBank = save;

            var bankFileName = bankName + ".bnk";

            // test language-specific decoded file path
            var language = AkInitializer.GetCurrentLanguage();

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

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

            if (!decodedFileExists)
            {
                // test non-language-specific decoded file path
                decodedBankPath     = AkInitializer.GetDecodedBankFullPath();
                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.
                }
            }
        }
Exemple #4
0
    public void LoadLocalizedBank(string in_bankFilename)
    {
        string in_bankPath = "file://" + Path.Combine(Path.Combine(AkBankPathUtil.GetPlatformBasePath(), AkInitializer.GetCurrentLanguage()), in_bankFilename);

        this.DoLoadBank(in_bankPath);
    }
Exemple #5
0
    /// Loads a bank.  This version blocks until the bank is loaded.  See AK::SoundEngine::LoadBank for more information
    public void LoadBank()
    {
        if (m_RefCount == 0)
        {
            AKRESULT res = AKRESULT.AK_Fail;

            // There might be a case where we were asked to unload the SoundBank, but then asked immediately after to load that bank.
            // If that happens, there will be a short amount of time where the ref count will be 0, but the bank will still be in memory.
            // In that case, we do not want to unload the bank, so we have to remove it from the list of pending bank unloads.
            if (AkBankManager.BanksToUnload.Contains(this))
            {
                AkBankManager.BanksToUnload.Remove(this);
                IncRef();
                return;
            }

#if UNITY_EDITOR
            res = AkSoundEngine.LoadBank(bankName, AkSoundEngine.AK_DEFAULT_POOL_ID, out m_BankID);
#else
            if (decodeBank == false)
            {
                string basePathToSet = null;

                if (!string.IsNullOrEmpty(relativeBasePath))
                {
                    basePathToSet = AkBasePathGetter.GetValidBasePath();
                    if (string.IsNullOrEmpty(basePathToSet))
                    {
                        Debug.LogWarning("WwiseUnity: Bank " + bankName + " failed to load (could not obtain base path to set).");
                        return;
                    }

                    res = AkSoundEngine.SetBasePath(System.IO.Path.Combine(basePathToSet, relativeBasePath));
                }
                else
                {
                    res = AKRESULT.AK_Success;
                }

                if (res == AKRESULT.AK_Success)
                {
                    res = AkSoundEngine.LoadBank(bankName, AkSoundEngine.AK_DEFAULT_POOL_ID, out m_BankID);

                    if (!string.IsNullOrEmpty(basePathToSet))
                    {
                        AkSoundEngine.SetBasePath(basePathToSet);
                    }
                }
            }
            else
            {
                if (saveDecodedBank == true)
                {
                    if (!System.IO.Directory.Exists(AkInitializer.GetDecodedBankFullPath()))
                    {
                        try
                        {
                            System.IO.Directory.CreateDirectory(AkInitializer.GetDecodedBankFullPath());
                            System.IO.Directory.CreateDirectory(System.IO.Path.Combine(AkInitializer.GetDecodedBankFullPath(), AkInitializer.GetCurrentLanguage()));
                        }
                        catch
                        {
                            Debug.LogWarning("Could not create decoded SoundBank directory, decoded SoundBank will not be saved.");
                            saveDecodedBank = false;
                        }
                    }
                }
                res = AkSoundEngine.LoadAndDecodeBank(bankName, saveDecodedBank, out m_BankID);
            }
#endif
            if (res != AKRESULT.AK_Success)
            {
                Debug.LogWarning("WwiseUnity: Bank " + bankName + " failed to load (" + res.ToString() + ")");
            }
        }
        IncRef();
    }
    /// Load a language-specific bank from WWW object
    public AKRESULT LoadLocalizedBank(string in_bankFilename)
    {
        string bankPath = Path.Combine(Path.Combine(AkBankPathUtil.GetPlatformBasePath(), AkInitializer.GetCurrentLanguage()), in_bankFilename);

        return(DoLoadBank(bankPath));
    }
Exemple #7
0
 public string GetLanguage()
 {
     return((this._overridedLanguage == null) ? AkInitializer.GetCurrentLanguage() : this._overridedLanguage);
 }