Beispiel #1
0
 public static void LoadAtlasToSprites(string name, Action <Dictionary <string, SpriteRenderer> > finish_callback)
 {
     name = name.ToLower();
     TPAtlasLoader.LoadAtlas(name, delegate(GameObject go_prefab)
     {
         if (go_prefab == null)
         {
             if (finish_callback != null)
             {
                 finish_callback.Invoke(null);
             }
         }
         else
         {
             if (go_prefab == null)
             {
                 Debug.LogError("atlas prefab is null");
                 if (finish_callback != null)
                 {
                     finish_callback.Invoke(null);
                 }
                 return;
             }
             Dictionary <string, SpriteRenderer> dictionary = TPAtlasLoader.ExtractSprites(go_prefab);
             if (finish_callback != null)
             {
                 finish_callback.Invoke(dictionary);
             }
         }
     });
 }
Beispiel #2
0
 public static void LoadAtlas(string[] atlas_no_suffix_list, Action finish_callback, int index = 0)
 {
     if (atlas_no_suffix_list == null || atlas_no_suffix_list.Length == 0 || index >= atlas_no_suffix_list.Length)
     {
         if (finish_callback != null)
         {
             finish_callback.Invoke();
         }
         return;
     }
     if (TPAtlasLoader.IsInPool(atlas_no_suffix_list[index]) || string.IsNullOrEmpty(atlas_no_suffix_list[index]))
     {
         AssetManager.AssetOfTPManager.LoadAtlas(atlas_no_suffix_list, finish_callback, ++index);
     }
     else
     {
         TimerHeap.AddTimer(0u, 0, delegate
         {
             AssetManager.AssetOfTPManager.LoadAtlas(atlas_no_suffix_list[index], delegate(bool isSuccess)
             {
                 AssetManager.AssetOfTPManager.LoadAtlas(atlas_no_suffix_list, finish_callback, ++index);
             });
         });
     }
 }
Beispiel #3
0
    public static Dictionary <string, SpriteRenderer> LoadAtlasNow(string atlas_no_suffix)
    {
        string text = atlas_no_suffix + "_pb";

        text = text.ToLower();
        if (!FileSystem.HasKey(text))
        {
            return(null);
        }
        GameObject gameObject = AssetManager.LoadAssetNowWithPool(FileSystem.GetPath(text, string.Empty)) as GameObject;

        if (gameObject == null)
        {
            Debug.LogError("atlas prefab is null :" + text);
            return(null);
        }
        return(TPAtlasLoader.ExtractSprites(gameObject));
    }
Beispiel #4
0
 public static void LoadAtlas(string atlas_no_suffix, Action <bool> finish_callback)
 {
     TPAtlasLoader.LoadAtlasToSprites(atlas_no_suffix, delegate(Dictionary <string, SpriteRenderer> obj)
     {
         if (obj == null)
         {
             if (finish_callback != null)
             {
                 finish_callback.Invoke(false);
             }
         }
         else
         {
             AssetManager.AssetOfTPManager.AddToUiSprites(atlas_no_suffix, obj);
             if (finish_callback != null)
             {
                 finish_callback.Invoke(true);
             }
         }
     });
 }
Beispiel #5
0
        public static void LoadAtlasNow(string atlas_no_suffix)
        {
            Dictionary <string, SpriteRenderer> sprites = TPAtlasLoader.LoadAtlasNow(atlas_no_suffix);

            AssetManager.AssetOfTPManager.AddToUiSprites(atlas_no_suffix, sprites);
        }