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); }
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); }
void LoadFinish(AKBankAtom atom, AKRESULT akresult) { loadingBanks.Remove(atom); if (akresult.Sucess()) { loadedBanks.Add(atom); } }
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); }
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); }
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); }
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); } } }
//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); } }
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); }
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); }
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); }
void OnLoadPrepare(AKBankAtom atom) { loadingBanks.Add(atom); }