示例#1
0
        public Action <P0, P1> AddListener(string eventName, Action <P0, P1> handler)
        {
            var handlerInfo = PoolCatManagerUtil.Spawn <KeyValuePairCat <Action <P0, P1>, bool> >().Init(handler, true);

            listenerDict.Add(eventName, handlerInfo);
            return(handler);
        }
示例#2
0
 public void AddOnLoadDoneCallback(Action <AssetCat> onLoadDoneCallback, object callbackCause = null)
 {
     if (onLoadDoneCallback == null)
     {
         return;
     }
     this.onLoadDoneCallback += onLoadDoneCallback;
     if (callbackCause == null)
     {
         callbackCause = this;
     }
     onLoadDoneCallbackListDict.Add(callbackCause, onLoadDoneCallback);
 }
示例#3
0
        public void Initialize(string content)
        {
            if (content.IsNullOrWhiteSpace())
            {
                LogCat.LogError("ResourceNameMap empty!!");
                return;
            }

            fileContent = content;
            content     = content.Replace("\r\n", "\n");
            var mapList = content.Split('\n');

            for (var i = 0; i < mapList.Length; i++)
            {
                var map = mapList[i];
                if (map.IsNullOrWhiteSpace())
                {
                    continue;
                }

                var splits = map.Split(new[] { StringConst.String_Comma }, StringSplitOptions.None);
                if (splits.Length < 2)
                {
                    LogCat.LogError("splitArr length < 2 : " + map);
                    continue;
                }

                var item = new AssetPathItem();
                // 如:UI/Prefab/Login.assetbundle
                item.assetBundleName = splits[0];
                // 如:Assets/AssetsPackage/UI/Prefab/Login.prefab
                item.assetPath = splits[1];

                assetBundleName2AssetPathListDict.Add(item.assetBundleName, item.assetPath, true);
                assetPath2AssetBundleNameDict.Add(item.assetPath, item.assetBundleName);
            }
        }