Beispiel #1
0
        public NativeResCallBackNode(bool tmpSingle, string tmpSceneName, string tmpBundleName, string tmpResName, ushort tmpBackId, NativeResCallBack tmpCallBack, NativeResCallBackNode tmpNode)
        {
            this.isSingle   = tmpSingle;
            this.sceneName  = tmpSceneName;
            this.bundleName = tmpBundleName;
            this.resName    = tmpResName;
            this.backMsgId  = tmpBackId;

            this.nextValue = tmpNode;
            this.callBack  = tmpCallBack;
        }
Beispiel #2
0
 public void CallBackRes(string bundleName)
 {
     if (manager.ContainsKey(bundleName))
     {
         NativeResCallBackNode curNode = manager[bundleName];
         do
         {
             curNode.callBack(curNode);
             curNode = curNode.nextValue;
         } while (curNode != null);
     }
 }
Beispiel #3
0
        public void GetResources(string sceneName, string bundleName, string resName, bool isSingle, ushort backId)
        {
            if (!ILoadManager.Instance.IsLoadingBundle(sceneName, bundleName))
            {//没有加载
                ILoadManager.Instance.LoadAsset(sceneName, bundleName, LoadProgress);

                string bundleFullName = ILoadManager.Instance.GetBundleReateName(sceneName, bundleName);

                if (bundleFullName != null)
                {
                    NativeResCallBackNode tmpNode = new NativeResCallBackNode(isSingle, sceneName, bundleName, resName, backId, SendToBackMsg, null);

                    CallBack.AddBundle(bundleFullName, tmpNode);
                }
                else
                {
                    Debug.Log("Dont contain bundle ==" + bundleName);
                }
            }
            else if (ILoadManager.Instance.IsLoadingBundleFinish(sceneName, bundleName))
            {//已经加载
                if (isSingle)
                {
                    UnityEngine.Object obj = ILoadManager.Instance.GetSingleResources(sceneName, bundleName, resName);
                    this.ReleaseBackMsg.Changer(backId, obj);
                    SendMsg(ReleaseBackMsg);
                }
                else
                {
                    UnityEngine.Object[] objs = ILoadManager.Instance.GetMutResources(sceneName, bundleName, resName);
                    this.ReleaseBackMsg.Changer(backId, objs);
                    SendMsg(ReleaseBackMsg);
                }
            }
            else
            { //已经加载 但是没有完成
                string bundleFullName = ILoadManager.Instance.GetBundleReateName(sceneName, bundleName);
                if (bundleFullName != null)
                {
                    NativeResCallBackNode tmpNode = new NativeResCallBackNode(isSingle, sceneName, bundleName, resName, backId, SendToBackMsg, null);

                    CallBack.AddBundle(bundleFullName, tmpNode);
                }
                else
                {
                    Debug.Log("Dont contain bundle ==" + bundleName);
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// 加载完成后 消息向上层传递释放bundle
        /// </summary>
        /// <param name="bundleName"></param>
        public void Dispose(string bundleName)
        {
            if (manager.ContainsKey(bundleName))
            {
                NativeResCallBackNode curNode = manager[bundleName];
                while (curNode.nextValue != null)
                {
                    NativeResCallBackNode tmpNode = curNode;
                    curNode = curNode.nextValue;
                    tmpNode.Dispose();
                }

                curNode.Dispose();

                manager.Remove(bundleName);
            }
        }
Beispiel #5
0
        public void SendToBackMsg(NativeResCallBackNode node)
        {
            if (node.isSingle)
            {
                UnityEngine.Object obj = ILoadManager.Instance.GetSingleResources(node.sceneName, node.bundleName, node.resName);
                this.ReleaseBackMsg.Changer(node.backMsgId, obj);

                SendMsg(ReleaseBackMsg);
            }
            else
            {
                UnityEngine.Object[] objs = ILoadManager.Instance.GetMutResources(node.sceneName, node.bundleName, node.resName);
                this.ReleaseBackMsg.Changer(node.backMsgId, objs);

                SendMsg(ReleaseBackMsg);
            }
        }
Beispiel #6
0
        public void AddBundle(string bundleName, NativeResCallBackNode tmpNode)
        {
            if (manager.ContainsKey(bundleName))
            {
                NativeResCallBackNode node = manager[bundleName];

                while (node.nextValue != null)
                {
                    node = node.nextValue;
                }

                node.nextValue = tmpNode;
            }
            else
            {
                manager.Add(bundleName, tmpNode);
            }
        }
Beispiel #7
0
 public void Dispose()
 {
     callBack  = null;
     nextValue = null;
 }