Exemple #1
0
        public int getCoroutineIndex(object callbakFunc)
        {
            object key = getKey4InvokeMap(callbakFunc, coroutineIndex);
            int    ret = MapEx.getInt(coroutineIndex, key);

            coroutineIndex [key] = ret + 1;
            return(ret);
        }
Exemple #2
0
        public void switchByName(string cellName, Animator animator, object callback)
        {
            if (!isInited)
            {
                init();
            }
            int index = MapEx.getInt(mapIndex, cellName);

            if (needSwitchController)
            {
                if (animator != null)
                {
                    animator.runtimeAnimatorController = animatorControllers [index];
                }
                else
                {
                    Debug.LogError("animator is null");
                }
            }

            if (switchType == CLSwitchType.showOrHide)
            {
                for (int i = 0; i < partObjs.Count; i++)
                {
                    if (i == index)
                    {
                        NGUITools.SetActive(partObjs [i], true);
                    }
                    else
                    {
                        NGUITools.SetActive(partObjs [i], false);
                    }
                }
                Utl.doCallback(callback);
            }
            else if (switchType == CLSwitchType.switchShader)
            {
                if (render.sharedMaterial != null)
                {
                    string mName = render.sharedMaterial.name;
//					mName = mName.Replace(" (Instance)", "");
                    CLMaterialPool.returnObj(mName);
                    render.sharedMaterial = null;
                }
                setMat(render, materialNames [index], callback);
            }
        }
Exemple #3
0
        public void onGetNewstRes(UnityWebRequest www, string url, string path, CLAssetType type, object content, bool needSave, object onGetAsset, bool autoRealseAB, params object[] originals)
        {
            try
            {
                if (needSave)
                {
                    //说明是需要下载的资源
                    if (www != null && content == null && (MapEx.getInt(wwwTimesMap, path) + 1) < downLoadTimes4Failed)
                    {
                        //需要下载资源时,如查下载失败,且少于失败次数,则再次下载
                        wwwTimesMap[path] = MapEx.getInt(wwwTimesMap, path) + 1;
                        doGetContent(path, url, needSave, type, onGetAsset, autoRealseAB, originals);
                        return;
                    }
                    rmWWW(url);
                }
                if (content == null)
                {
                    Debug.LogError("get newstRes is null. url==" + url);
                }
                Utl.doCallback(onGetAsset, path, content, originals);
            }
            catch (System.Exception e)
            {
                Debug.LogError(e);
            }

            if (autoRealseAB && content != null && type == CLAssetType.assetBundle)
            {
                AssetBundle ab = content as AssetBundle;
                if (ab != null)
                {
                    ab.Unload(false);
                }
            }

            if (www != null)
            {
                www.Dispose();
                www = null;
            }

            wwwMap[path]      = false;
            wwwTimesMap[path] = 0;
        }
Exemple #4
0
 public void switch2xx(string partName, string cellName, object callback)
 {
     if (!isInited)
     {
         isInited = true;
         setMapindex();
     }
     try {
         int        index = MapEx.getInt(mapIndex, partName);
         CLBodyPart part  = bodyParts [index];
         if (part == null)
         {
             return;
         }
         part.switchByName(cellName, animator, callback);
     } catch (System.Exception e) {
         Debug.LogError(e);
     }
 }