Example #1
0
        static void checkVervers()
        {
            progress = 0;
            needUpgradeVerver.Clear();
            isNeedUpgradePriority = false;
            string    ver      = null;
            ArrayList keysList = MapEx.keys2List(serververVer);
            int       count    = keysList.Count;
            string    basePath = CLPathCfg.self.basePath;
            string    key      = "";

            for (int i = 0; i < count; i++)
            {
                key = keysList[i] as string;

                ver = MapEx.getString(localverVer, key); //实际上这个时间localverVer是空的
                if (ver == null || ver != MapEx.getString(serververVer, key))
                {
                    if (!key.Contains(PStr.b().a(basePath).a("/ui/panel").e()) &&
                        !key.Contains(PStr.b().a(basePath).a("/ui/cell").e()) &&
                        !key.Contains(PStr.b().a(basePath).a("/ui/other").e()))
                    {
                        MapEx.set(needUpgradeVerver, key, false);
                    }
                }
            }
            keysList.Clear();
            keysList = null;

            if (needUpgradeVerver.Count > 0)
            {
                if (progressCallback != null)
                {
                    Utl.doCallback(progressCallback, needUpgradeVerver.Count, 0);
                }

                keysList = MapEx.keys2List(needUpgradeVerver);
                count    = keysList.Count;
                key      = "";
                for (int i = 0; i < count; i++)
                {
                    key = keysList[i] as string;
                    getVerinfor(key, MapEx.getString(serververVer, key));
                }
                keysList.Clear();
                keysList = null;
            }
            else
            {
                loadPriorityVer();
                loadOtherResVer(true);
            }
        }
Example #2
0
        static void checkPriority()
        {
            localPriorityVer = new Hashtable();

            progress = 0;
            needUpgradeVerver.Clear();
            needUpgradePrioritis.Clear();
            string    ver      = null;
            ArrayList keysList = MapEx.keys2List(serverPriorityVer);
            string    key      = null;
            int       count    = keysList.Count;

            for (int i = 0; i < count; i++)
            {
                key = keysList[i] as string;
                ver = MapEx.getString(localPriorityVer, key);
                //实际上这个时间localverVer是空的,因此其实就是取得所有优先资源,但是因为了加了版本号,所以可以使用cdn,或者本地缓存什么的
                if (ver == null || ver != MapEx.getString(serverPriorityVer, key))
                {
                    MapEx.set(needUpgradeVerver, key, false);
                    needUpgradePrioritis.Enqueue(key);
                }
            }
            keysList.Clear();
            keysList = null;

            if (needUpgradePrioritis.Count > 0)
            {
                haveUpgrade = true;
                CLVerManager.self.haveUpgrade = true;
                if (progressCallback != null)
                {
                    Utl.doCallback(progressCallback, needUpgradeVerver.Count, 0);
                }
                getPriorityFiles(needUpgradePrioritis.Dequeue() as string);
            }
            else
            {
                //--同步总的版本管理文件到本地
                //MemoryStream ms = new MemoryStream();
                //B2OutputStream.writeMap(ms, localverVer);
                //string vpath = PStr.b().a(CLPathCfg.persistentDataPath).a("/").a(mVerverPath).e();
                //FileEx.CreateDirectory(Path.GetDirectoryName(vpath));
                //File.WriteAllBytes(vpath, ms.ToArray());

                loadOtherResVer(true);
            }
        }
Example #3
0
        void OnEnable()
        {
            try {
                if (!string.IsNullOrEmpty(spriteName))
                {
                    setMainTexture(spriteName);
                    MarkAsChanged();
                }

                Texture   tt      = null;
                string    _spName = "";
                ArrayList list    = MapEx.keys2List(subTextureNameMap);
                for (int i = 0; i < list.Count; i++)
                {
                    _spName = subTextureNameMap [list [i]] as string;
                    setTexture(list [i].ToString(), _spName);
                }
                list.Clear();
                list = null;
            } catch (System.Exception e) {
                Debug.LogError(e);
            }
        }