public override void Init()
    {
        base.Init();
        Instance = this;
        m_wwws   = UNList <UNWWW> .New();

        InitAssetsBundle();
    }
 public static void UnLoad(string name)
 {
     if (m_gameLoadType == ResLoadLocation.Resource)
     {
     }
     else
     {
         AssetsBundleManager.UnLoadBundle(name);
     }
 }
Exemple #3
0
 public static void UnLoadRes(List <string> resList)
 {
     if (ResourceManager.m_gameLoadType != ResLoadLocation.Resource)
     {
         for (int i = 0; i < resList.Count; i++)
         {
             AssetsBundleManager.UnLoadBundle(resList[i]);
         }
     }
 }
Exemple #4
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.A))
        {
            GameObject testTmp = (GameObject)ResourceManager.Load("GameObject");

            Instantiate(testTmp);
        }

        if (Input.GetKey(KeyCode.B))
        {
            GameObject testTmp = (GameObject)ResourceManager.Load("UItest");

            Instantiate(testTmp);
        }

        if (Input.GetKey(KeyCode.U))
        {
            UIManager.OpenUIWindow("MianMenu");
        }

        if (Input.GetKey(KeyCode.I))
        {
            UIManager.CloseUIWindow("MianMenu");
        }

        if (Input.GetKey(KeyCode.C))
        {
            AssetsBundleManager.UnLoadBundle("UItest");
        }



        if (Input.GetKey(KeyCode.D))
        {
            loadCount++;
            ResourceManager.LoadAsync("UItest", (LoadState state, object obj) =>
            {
                if (state.isDone)
                {
                    callbackCount++;
                    Debug.Log(state.progress);
                    GameObject go = (GameObject)obj;

                    Instantiate(go);

                    Debug.Log(loadCount + "  " + callbackCount);
                }
                else
                {
                    Debug.Log(state.progress);
                }
            });
        }
    }
Exemple #5
0
    public static void UnLoad(string name)
    {
        string path = ResourcesConfigManager.GetResourcePath(name);

        if (m_gameLoadType == ResLoadLocation.Resource)
        {
        }
        else
        {
            AssetsBundleManager.UnLoadBundle(path);
        }
    }
Exemple #6
0
    public static void LoadAsync(string name, LoadCallBack callBack)
    {
        string path = ResourcesConfigManager.GetResourcePath(name);

        if (m_gameLoadType == ResLoadLocation.Resource)
        {
            ResourceIOTool.ResourceLoadAsync(path, callBack);
        }
        else
        {
            AssetsBundleManager.LoadAsync(path, callBack);
        }
    }
Exemple #7
0
    public static object Load(string name)
    {
        string path = ResourcesConfigManager.GetResourcePath(name);

        if (m_gameLoadType == ResLoadLocation.Resource)
        {
            return(Resources.Load(path));
        }
        else
        {
            return(AssetsBundleManager.Load(path));
        }
    }
Exemple #8
0
    public static T Load <T>(string name) where T : UnityEngine.Object
    {
        string path = ResourcesConfigManager.GetResourcePath(name);

        if (m_gameLoadType == ResLoadLocation.Resource)
        {
            return(Resources.Load <T>(path.Replace("/", "\\")));
        }
        else
        {
            return(AssetsBundleManager.Load <T>(path));
        }
    }
    public static void LoadAsync(string name, LoadCallBack callBack)
    {
        if (name == null)
        {
            throw new Exception("ResourceManager LoadAsync -> name is null !");
        }
        string path = ResourcesConfigManager.GetResourcePath(name);

        if (m_gameLoadType == ResLoadLocation.Resource)
        {
            ResourceIOTool.ResourceLoadAsync(path, null, callBack);
        }
        else
        {
            AssetsBundleManager.LoadAsync(path, null, callBack);
        }
    }
    public static void UnLoad(string name)
    {
        if (name == null)
        {
            throw new Exception("ResourceManager UnLoad -> name is null !");
        }
        //Debug.Log("UnLoad ==>>" + name);
        string path = ResourcesConfigManager.GetResourcePath(name);

        if (m_gameLoadType == ResLoadLocation.Resource)
        {
        }
        else
        {
            AssetsBundleManager.UnLoadBundle(path);
        }
    }
    public static T Load <T>(string name) where T : UnityEngine.Object
    {
        if (name == null)
        {
            throw new Exception("ResourceManager Load<T> -> name is null !");
        }

        string path = ResourcesConfigManager.GetResourcePath(name);

        if (m_gameLoadType == ResLoadLocation.Resource)
        {
            return(Resources.Load <T>(path.Replace("/", "\\")));
        }
        else
        {
            return(AssetsBundleManager.Load <T>(path));
        }
    }
    public static object Load(string name)
    {
        if (name == null)
        {
            throw new Exception("ResourceManager Load -> name is null !");
        }

        string path = ResourcesConfigManager.GetResourcePath(name);

        if (m_gameLoadType == ResLoadLocation.Resource)
        {
            return(Resources.Load(path));
        }
        else
        {
            return(AssetsBundleManager.Load(path));
        }
    }
    public static void LoadAsync(string name, LoadCallBack callBack)
    {
        ResourcesConfig packData = ResourcesConfigManager.GetBundleConfig(name);

        if (packData == null)
        {
            return;
        }

        if (m_gameLoadType == ResLoadLocation.Resource)
        {
            ResourceIOTool.ResourceLoadAsync(packData.path, callBack);
        }
        else
        {
            AssetsBundleManager.LoadAsync(name, callBack);
        }
    }
    public static T Load <T>(string name) where T : UnityEngine.Object
    {
        ResourcesConfig packData = ResourcesConfigManager.GetBundleConfig(name);

        if (packData == null)
        {
            throw new Exception("Load Exception not find " + name);
        }

        if (m_gameLoadType == ResLoadLocation.Resource)
        {
            return(Resources.Load <T>(packData.path));
        }
        else
        {
            return(AssetsBundleManager.Load <T>(name));
        }
    }
Exemple #15
0
    public static object Load(string name)
    {
        ResourcesConfig packData = ResourcesConfigManager.GetBundleConfig(name);

        if (packData == null)
        {
            throw new Exception("Load Exception not find " + name);
        }

        if (m_gameLoadType == ResLoadType.Resource)
        {
            return(Resources.Load(packData.path));
        }
        else
        {
            return(AssetsBundleManager.Load(name));
        }
    }
Exemple #16
0
    public static void LoadAsync(string name, LoadCallBack callBack)
    {
        BundleConfig packData = BundleConfigManager.GetBundleConfig(name);

        if (packData == null)
        {
            return;
        }

        ResLoadType loadTypeTmp = GetLoadType(packData.loadType);

        if (loadTypeTmp == ResLoadType.Resource)
        {
            ResourceIOTool.ResourceLoadAsync(packData.path, callBack);
        }
        else
        {
            AssetsBundleManager.LoadAsync(name, callBack);
        }
    }
Exemple #17
0
    static void LoadResources()
    {
        if (!isLoading)
        {
            if (s_LoadList.Count == 0)
            {
                if (s_loadCallBack != null)
                {
                    try
                    {
                        s_loadCallBack(LoadState.CompleteState);
                    }
                    catch (Exception e)
                    {
                        Debug.LogError("Load Finsih CallBack Error : " + e.ToString());
                    }
                    s_loadCallBack = null;
                    s_loadCount    = 0;
                }
            }
            else
            {
                AssetsBundleManager.LoadBundleAsync(s_LoadList[0], LoadResourcesFinishCallBack);
                s_LoadList.RemoveAt(0);
                isLoading = true;

                s_loadStatus.isDone   = false;
                s_loadStatus.progress = (1 - (s_LoadList.Count / s_loadCount));

                try
                {
                    s_loadCallBack(s_loadStatus);
                }
                catch (Exception e)
                {
                    Debug.LogError("Load Finsih CallBack Error : " + e.ToString());
                }
            }
        }
    }