Example #1
0
 public static void Preload()
 {
     LoginLoadingRes.Instance.total_res_count += ResourceRegulation.whitelist2spine.get_Count();
     LoginLoadingRes.Instance.total_res_count += ResourceRegulation.whitelist2uiatlas.get_Count();
     LoginLoadingRes.Instance.total_res_count += ResourceRegulation.temp_uilist.get_Count();
     for (int i = 0; i < ResourceRegulation.whitelist2spine.get_Count(); i++)
     {
         FXSpineManager.Instance.PreloadAsset(ResourceRegulation.whitelist2spine.get_Item(i), delegate
         {
             LoginLoadingRes.Instance.PreloadResourceFinish();
         });
     }
     for (int j = 0; j < ResourceRegulation.whitelist2uiatlas.get_Count(); j++)
     {
         string atlas_no_suffix = ConstTP.suffix_atlas_To_src(ResourceRegulation.whitelist2uiatlas.get_Item(j));
         AssetManager.AssetOfTPManager.LoadAtlas(atlas_no_suffix, delegate(bool isSuccess)
         {
             LoginLoadingRes.Instance.PreloadResourceFinish();
         });
     }
     for (int k = 0; k < ResourceRegulation.temp_uilist.get_Count(); k++)
     {
         AssetManager.LoadAssetWithPool(ResourceRegulation.temp_uilist.get_Item(k), delegate(bool isSuccess)
         {
             LoginLoadingRes.Instance.PreloadResourceFinish();
         });
     }
     ResourceRegulation.Uninit();
 }
Example #2
0
    private static void ReleaseAssetWithAB(string path)
    {
        if (!ResourceRegulation.is_inwhite_common(path))
        {
            if (AssetManagerBase.mapAssets.ContainsKey(path))
            {
                AssetManagerBase.mapAssets.Remove(path);
            }
            if (AssetManagerBase.mapAssetsRef.ContainsKey(path))
            {
                AssetManagerBase.mapAssetsRef.Remove(path);
            }
        }
        if (!AssetManagerBase.mapAssetsToAssetBundleRef.ContainsKey(path))
        {
            return;
        }
        int num = AssetManagerBase.mapAssetsToAssetBundleRef.get_Item(path);

        AssetManagerBase.mapAssetsToAssetBundleRef.Remove(path);
        for (int i = 0; i < num; i++)
        {
            AssetLoader.UnloadAsset(path, null);
        }
    }
Example #3
0
 private static void ReleaseAsset(string path)
 {
     if (!ResourceRegulation.is_inwhite_common(path))
     {
         AssetManagerBase.mapAssets.Remove(path);
         AssetManagerBase.mapAssetsRef.set_Item(path, 0);
     }
 }
Example #4
0
 private static void InitReference(string src_with_suffix_atlas)
 {
     if (ResourceRegulation.is_inwhite_uiatlas(src_with_suffix_atlas))
     {
         return;
     }
     if (!AssetManager.AssetOfTPManager.m_reference_atlas.ContainsKey(src_with_suffix_atlas))
     {
         AssetManager.AssetOfTPManager.m_reference_atlas.set_Item(src_with_suffix_atlas, 0);
     }
 }
Example #5
0
 private static void MinusReferenceCount(string src_with_suffix_atlas)
 {
     src_with_suffix_atlas = src_with_suffix_atlas.ToLower();
     if (ResourceRegulation.is_inwhite_uiatlas(src_with_suffix_atlas))
     {
         return;
     }
     if (AssetManager.AssetOfTPManager.m_reference_atlas.ContainsKey(src_with_suffix_atlas))
     {
         AssetManager.AssetOfTPManager.m_reference_atlas.set_Item(src_with_suffix_atlas, AssetManager.AssetOfTPManager.m_reference_atlas.get_Item(src_with_suffix_atlas) - 1);
     }
     else
     {
         AssetManager.AssetOfTPManager.m_reference_atlas.set_Item(src_with_suffix_atlas, 0);
     }
 }
Example #6
0
        public static void Clear()
        {
            Dictionary <string, Object> dictionary = new Dictionary <string, Object>();

            using (Dictionary <string, Object> .Enumerator enumerator = AssetManager.AssetOfSpineManager.mapAssets.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <string, Object> current = enumerator.get_Current();
                    if (ResourceRegulation.is_inwhite_spine(current.get_Key()))
                    {
                        dictionary.set_Item(current.get_Key(), current.get_Value());
                    }
                }
            }
            AssetManager.AssetOfSpineManager.mapAssets.Clear();
            AssetManager.AssetOfSpineManager.mapAssets = dictionary;
        }
Example #7
0
 public static void ReleaseNoRef()
 {
     AssetManager.AssetOfTPManager.delete_list.Clear();
     using (Dictionary <string, int> .Enumerator enumerator = AssetManager.AssetOfTPManager.m_reference_atlas.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             KeyValuePair <string, int> current = enumerator.get_Current();
             if (current.get_Value() <= 0)
             {
                 if (!ResourceRegulation.is_inwhite_uiatlas(current.get_Key()))
                 {
                     AssetManager.AssetOfTPManager.delete_list.Add(current.get_Key());
                 }
             }
         }
     }
     for (int i = 0; i < AssetManager.AssetOfTPManager.delete_list.get_Count(); i++)
     {
         string text = AssetManager.AssetOfTPManager.delete_list.get_Item(i);
         AssetManager.AssetOfTPManager.ReleaseAtlas(text.Substring(0, text.get_Length() - "_atlas".get_Length()));
     }
 }
Example #8
0
    public static void Init()
    {
        if (ResourceRegulation.IsInit)
        {
            return;
        }
        ResourceRegulation.IsInit = true;
        List <ReleaseResWhiteLists> dataList = DataReader <ReleaseResWhiteLists> .DataList;

        for (int i = 0; i < dataList.get_Count(); i++)
        {
            int id = dataList.get_Item(i).id;
            if (id >= 0 && id <= 1000)
            {
                string name = dataList.get_Item(i).name;
                if (!string.IsNullOrEmpty(name))
                {
                    ResourceRegulation.whitelist2uiatlas.Add(name.ToLower());
                }
            }
            else if (id >= 1001 && id <= 2000)
            {
                string name2 = dataList.get_Item(i).name;
                if (!string.IsNullOrEmpty(name2))
                {
                    int     key     = int.Parse(GameDataUtils.SplitString4Dot0(name2));
                    FXSpine fXSpine = DataReader <FXSpine> .Get(key);

                    if (fXSpine != null)
                    {
                        ResourceRegulation.whitelist2spine.Add("UGUI/PrefabSpine2d/" + fXSpine.name);
                    }
                }
            }
            else if (id >= 2001 && id <= 3000)
            {
                string name3 = dataList.get_Item(i).name;
                if (!string.IsNullOrEmpty(name3))
                {
                    int key2 = int.Parse(GameDataUtils.SplitString4Dot0(name3));
                    Fx  fx   = DataReader <Fx> .Get(key2);

                    if (fx != null && string.IsNullOrEmpty(fx.path))
                    {
                        ResourceRegulation.whitelist2common.Add(fx.path);
                    }
                }
            }
            else if (id >= 3001 && id <= 4000)
            {
                string name4 = dataList.get_Item(i).name;
                if (!string.IsNullOrEmpty(name4))
                {
                    ResourceRegulation.whitelist2common.Add(FileSystem.GetPath(name4, string.Empty));
                }
            }
            else if (id >= 4001 && id < 5000)
            {
                string name5 = dataList.get_Item(i).name;
                if (!string.IsNullOrEmpty(name5))
                {
                    int         key3        = int.Parse(GameDataUtils.SplitString4Dot0(name5));
                    UINameTable uINameTable = DataReader <UINameTable> .Get(key3);

                    if (uINameTable != null)
                    {
                        string path = FileSystem.GetPath(uINameTable.name, string.Empty);
                        ResourceRegulation.whitelist2common.Add(path);
                        ResourceRegulation.temp_uilist.Add(path);
                    }
                }
            }
        }
        ResourceRegulation.Preload();
    }
 private void StartLoadResource()
 {
     UIManagerControl.Instance.OpenUI_Async("LoginUI", null, null);
     ResourceRegulation.Init();
 }