1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
 
using System.IO;
using UnityEngine.U2D;
 
 
public class UILoader
{
    public static GameObject LoadWindow(string name)
    {
        return ResManager.Instance.LoadAsset<GameObject>("UI", name);
    }
 
    public static GameObject LoadPrefab(string _name)
    {
        return ResManager.Instance.LoadAsset<GameObject>("UIComp", _name);
    }
 
    public static void UnLoadPrefab(string _assetName)
    {
        ResManager.Instance.UnloadAsset("UIComp", _assetName);
    }
 
    public static Sprite LoadSprite(string _iconKey)
    {
        var iconConfig = IconConfig.Get(_iconKey);
        if (iconConfig == null)
        {
            return null;
        }
 
        return LoadSprite(iconConfig.folder, iconConfig.sprite);
    }
 
    public static Sprite LoadSprite(string _folder, string _file)
    {
        return ResManager.Instance.LoadAsset<Sprite>("Sprite/" + _folder, _file);
    }
 
    public static void UnLoadSprite(string _iconKey)
    {
        var iconConfig = IconConfig.Get(_iconKey);
        if (iconConfig != null)
        {
            var bundleName = StringUtility.Contact("Sprite/", iconConfig.folder);
            ResManager.Instance.UnloadAsset(bundleName, iconConfig.sprite);
        }
    }
 
    public static Font LoadFont(string _fontName)
    {
        return ResManager.Instance.LoadAsset<Font>("Font", _fontName);
    }
 
    public static void UnLoadFont(string _fontName)
    {
        ResManager.Instance.UnloadAsset("Font", _fontName);
    }
}