示例#1
0
        public void LoadAtom(string bankName, bool ignoreIfAssetNotExist,
                             AudioBank_LoadAction loadAction, AudioBank_LoadMode loadMode, Action <AKRESULT> handler)
        {
            AKRESULT   result;
            AKBankAtom atom = bankAtomSet.Get(bankName);

            if (atom == null)
            {
                if (ignoreIfAssetNotExist)
                {
                    if (handler != null)
                    {
                        handler(AKRESULT.AK_BankNotLoadYet);
                    }
                    return;
                }

                atom = bankAtomSet.Register(bankName, loadAction, loadMode);
            }
            else
            {
                result = bankAtomSet.Vertify(atom);
                if (result != AKRESULT.AK_Success)
                {
                    if (handler != null)
                    {
                        handler(result);
                    }
                    return;
                }
            }

            bankAtomSet.DoLoadBank(atom, handler);
        }
示例#2
0
        public void LoadAtom(BankLoadRequestStruct requrest, BankResultHandler handler, GameObject target, object userData = null)
        {
            AKRESULT   result;
            AKBankAtom atom = bankAtomSet.Get(requrest.bnkName);

            if (atom == null)
            {
                if (requrest.ignoreIfAssetNotExist)
                {
                    if (handler != null)
                    {
                        handler(BankLoadResponseStruct.Create(requrest.bnkName, AKRESULT.AK_BankNotLoadYet));
                    }
                    return;
                }
                atom = bankAtomSet.Register(requrest, false);
            }
            else
            {
                result = bankAtomSet.Vertify(atom);
                if (result != AKRESULT.AK_Success)
                {
                    if (handler != null)
                    {
                        handler(BankLoadResponseStruct.Create(requrest.bnkName, result, target, userData));
                    }
                    return;
                }
            }
            atom.Load(handler, target, userData);
        }
示例#3
0
 void LoadFinish(AKBankAtom atom, AKRESULT akresult)
 {
     loadingBanks.Remove(atom);
     if (akresult.Sucess())
     {
         loadedBanks.Add(atom);
     }
 }
示例#4
0
 public AKRESULT Vertify(AKBankAtom atom)
 {
     if (loadedBanks.Contains(atom))
     {
         return(AKRESULT.AK_BankAlreadyLoaded);
     }
     if (loadingBanks.Contains(atom))
     {
         return(AKRESULT.AK_BankInLoadingQueue);
     }
     return(AKRESULT.AK_Success);
 }
示例#5
0
        public AKBankAtom Register(string bnkName, AudioBank_LoadMode modeType)
        {
            AKBankAtom atom;

            if (!bankAtomContenter.TryGetValue(bnkName, out atom))
            {
                atom = new AKBankAtom(bnkName, modeType);
                bankAtomContenter.Add(bnkName, atom);
            }

            return(atom);
        }
示例#6
0
        public AKBankAtom Register(BankLoadRequestStruct requestData, bool loadIfSucess)
        {
            AKBankAtom atom;

            if (!bankAtomContenter.TryGetValue(requestData.bnkName, out atom))
            {
                atom = new AKBankAtom(requestData.bnkName, requestData.actionType, requestData.modelType);
                bankAtomContenter.Add(requestData.bnkName, atom);
                if (loadIfSucess)
                {
                    atom.Load(null, null);
                }
            }
            return(atom);
        }
示例#7
0
        public void DoLoadBank(AKBankAtom atom, WiseReusltHandler handler = null)
        {
            AKRESULT akresult;

            if (atom.Execute(handler, out akresult))
            {
                if (handler != null)
                {
                    handler(akresult);
                }
                else
                {
                    AudioUtil.VerifyAKResult(akresult, "load atom:{0}", atom.BankName);
                }
            }
        }
示例#8
0
        //TODO:支持多种加载方式
        public void DoLoadBank(AKBankAtom atom, System.Action <AKRESULT> handler)
        {
            LoadPrepare(atom);

            AKRESULT akresult = AkBankManager.LoadBankRes(atom.BankName, false, false);

            LoadFinish(atom, akresult);
            if (handler != null)
            {
                handler(akresult);
            }
            else
            {
                AudioUtil.VerifyAKResult(akresult, "Audio load atom:" + atom.BankName);
            }
        }
示例#9
0
        public AKRESULT Initialize()
        {
            if (IsInitialized)
            {
                return(AKRESULT.AK_Success);
            }
            if (!AkSoundEngine.IsInitialized())
            {
                return(AKRESULT.AK_Fail);
            }
            string[] assetNames = AudioUtil.GetBankAssetNamesByFolder(null);
            foreach (string bankName in assetNames)
            {
                AKBankAtom atom = bankAtomSet.Register(bankName, AudioBank_LoadAction.Normal, AudioBank_LoadMode.Sync);
                bankAtomSet.DoLoadBank(atom, null);
            }

            IsInitialized = true;
            return(AKRESULT.AK_Success);
        }
示例#10
0
        public void LoadAtom(string bankName, bool ignoreIfAssetNotExist,
                             AudioBank_LoadMode loadMode, WiseReusltHandler handler)
        {
            AKBankAtom atom = bankAtomSet.Get(bankName);

            if (atom == null)
            {
                if (ignoreIfAssetNotExist)
                {
                    if (handler != null)
                    {
                        handler(AKRESULT.AK_BankNotLoadYet);
                    }
                    return;
                }

                atom = bankAtomSet.Register(bankName, loadMode);
            }
            bankAtomSet.DoLoadBank(atom, handler);
        }
示例#11
0
        public AKRESULT Initialize()
        {
            if (IsInitialized)
            {
                return(AKRESULT.AK_Success);
            }
            if (!AkSoundEngine.IsInitialized())
            {
                return(AKRESULT.AK_Fail);
            }
            string[] assetNames = AudioUtil.GetBankAssetNamesByFolder(null);
            foreach (string bankName in assetNames)
            {
                if (bankName.StartsWith("Hall_") || bankName.StartsWith("Map_"))
                {
                    continue;
                }
                AKBankAtom atom = bankAtomSet.Register(bankName, AudioBank_LoadMode.Aync);
                bankAtomSet.DoLoadBank(atom);
            }

            IsInitialized = true;
            return(AKRESULT.AK_Success);
        }
示例#12
0
 void OnLoadPrepare(AKBankAtom atom)
 {
     loadingBanks.Add(atom);
 }