/// <summary> /// 构造函数 /// </summary> /// <param name="_defaultSelfActive">默认激活状态</param> /// <param name="_input">输入</param> /// <param name="_callback">回调</param> /// <param name="_extraParameter">额外参数</param> public ResultCallback(bool _defaultSelfActive, IAssetBundleInput _input, Action <IAssetBundleResult> _callback, object[] _extraParameter) { defaultSelfActive = _defaultSelfActive; input = _input; callback = _callback; extraParameter = _extraParameter; }
/// <summary> /// 资源输出请求实例化事件句柄 /// </summary> /// <param name="_defaultSelfActive">默认激活状态</param> /// <param name="_input">输入</param> /// <param name="_callback">回调</param> /// <param name="_extraParameter">额外参数</param> /// <param name="_type">资源类型</param> void Output_OnInstantiate(bool _defaultSelfActive, IAssetBundleInput _input, Action <IAssetBundleResult> _callback, object[] _extraParameter, Type _type) { if (mAssetBundleResultMonoBehaviour.ContainsKey(_input.uniqueId)) { mAssetBundleResultMonoBehaviour[_input.uniqueId].RequestInstantiate(_defaultSelfActive, _input, _callback, _extraParameter, _type, mAssetBundle); } }
/// <summary> /// 构造函数 /// </summary> /// <param name="_input">输入</param> /// <param name="_outputEvent">输出事件</param> /// <param name="_progressEvent">进度事件</param> public AssetBundleRequestInMemory(IAssetBundleInput _input, Action <IAssetBundleOutput> _outputEvent, Action <float, IAssetBundleInput> _progressEvent) { input = _input; outputEvent = _outputEvent; progressEvent = _progressEvent; }
/// <summary> /// 请求实例化 /// </summary> /// <param name="_defaultSelfActive">默认激活状态</param> /// <param name="_input">输入</param> /// <param name="_callback">回调</param> /// <param name="_extraParameter">额外参数</param> /// <param name="_type">资源类型</param> /// <param name="_assetBundle">资源包</param> public void RequestInstantiate(bool _defaultSelfActive, IAssetBundleInput _input, Action <IAssetBundleResult> _callback, object[] _extraParameter, Type _type, AssetBundle _assetBundle) { int key = _type.GetHashCode(); if (!mQueueResultCallback.ContainsKey(key)) { mQueueResultCallback.Add(key, new Queue <ResultCallback>()); } mQueueResultCallback[key].Enqueue(new ResultCallback(_defaultSelfActive, _input, _callback, _extraParameter)); if (!mExecuteQueueResultCallback.ContainsKey(key)) { mExecuteQueueResultCallback.Add(key, false); } if (mAssetMaping.ContainsKey(key) && mAssetMaping[key] == null) { mHasRequest.Remove(key); } if (!mHasRequest.Contains(key)) { mHasRequest.Add(key); if (!mFileParameter.isUseAssetBundle) { #if UNITY_EDITOR UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(mFileParameter.assetBundlePath, _type); mAssetMaping.Add(key, obj); OnCallQueue(key); #endif } else if (!mRequestKeyForTypeKeyMaping.ContainsKey(key)) { AssetBundleRequest request = _assetBundle.LoadAssetAsync(_input.config.fileName, _type); request.allowSceneActivation = false; request.completed += Request_completed; int reqKey = request.GetHashCode(); mRequestKeyForTypeKeyMaping.Add(reqKey, key); } } else { OnCallQueue(key); } }
/// <summary> /// 构造函数 /// </summary> /// <param name="_input">输入</param> /// <param name="_extraParemeter">额外参数</param> /// <param name="_asset">资源</param> public AssetBundleResult(IAssetBundleInput _input, object[] _extraParemeter, Object _asset) { input = _input; extraParemeter = _extraParemeter; asset = _asset; }
/// <summary> /// 构造函数 /// </summary> /// <param name="_input">输入</param> public AssetBundleOutput(IAssetBundleInput _input) { input = _input; }