コード例 #1
0
    static public void CreatUIRoot()
    {
        GameObject root = GameObject.Instantiate(AssetLoad.LoadUI("UIRoot")) as GameObject;

        GameObject.DontDestroyOnLoad(root);
        root.name = "UIRoot";
    }
コード例 #2
0
        private void LoadResource()
        {
            string temp       = this.GetType().Name;
            string prefabName = StringUtil.StringBuild("Win_", temp.Substring(0, temp.Length - 3));

            panel      = GameObject.Instantiate(AssetLoad.LoadUI(prefabName)) as GameObject;
            panel.name = temp;
        }
コード例 #3
0
    // Use this for initialization

    void Awake()
    {
        Instance = this;

        mLocalResRootPath = Application.persistentDataPath + "/AssetBundle/StandaloneWindow";
        mAssetsABDic      = new Dictionary <string, AssetsBundleData>();
        StartCoroutine(SetMD5AssetsList());
    }
コード例 #4
0
    public void onLoadCompleted(AssetLoad dl)
    {
        currLoadings -= 1;

        if (dl.asset.loadLevel == Asset.LOAD_LEVEL.LEVEL_ENTER_BEFORE)
        {
            loadingbar.loadingbar_currValue += 1;
            Common.DEBUG_MSG("loadingbar_currValue=" + loadingbar.loadingbar_currValue);
            for (int i = 0; i < before_loads.Count; i++)
            {
                if (before_loads[i] == dl)
                {
                    before_loads.RemoveAt(i);
                    break;
                }
            }

            if (before_loads.Count == 0)
            {
                Common.DEBUG_MSG("LoadAssetsPool::onLoadCompleted: ENTER_BEFORE!");
            }
        }
        else if (dl.asset.loadLevel == Asset.LOAD_LEVEL.LEVEL_ENTER_AFTER)
        {
            for (int i = 0; i < after_loads.Count; i++)
            {
                if (after_loads[i] == dl)
                {
                    after_loads.RemoveAt(i);
                    break;
                }
            }

            if (after_loads.Count == 0)
            {
                Common.DEBUG_MSG("LoadAssetsPool::onLoadCompleted: ENTER_AFTER!");
            }
        }
        else
        {
            for (int i = 0; i < loads.Count; i++)
            {
                if (loads[i] == dl)
                {
                    loads.RemoveAt(i);
                    break;
                }
            }

            if (loads.Count == 0)
            {
                Common.DEBUG_MSG("LoadAssetsPool::onLoadCompleted: NORMAL!");
            }
        }

        loadNext();
    }
コード例 #5
0
ファイル: ConfigLoader.cs プロジェクト: linyichie/Game
    static void LoadConfig(string fileName, Action <string> callback)
    {
        Count += 1;
        var addressableName = StringUtil.Contact("Txt/", fileName);

        AssetLoad.LoadAsync <TextAsset>(addressableName, asset => {
            var textAsset = asset.asset as TextAsset;
            callback?.Invoke(textAsset.text);
        });
    }
コード例 #6
0
    private void InitResManger()
    {
        AssetLoad l = null;

                #if UNITY_EDITOR
        l = new AssetLoadEditor();
                #else
        l = new AssetLoadRun();
                #endif
        ResourceManger.SetLoadObj(this, l);
        ResourceManger.InitCache();
    }
コード例 #7
0
    public bool stop(bool isAllUnLoadLevel)
    {
        // loader_.StopAllCoroutines();

        for (int i = 0; i < before_loads.Count; i++)
        {
            AssetLoad load = before_loads[i];
            if (isAllUnLoadLevel == false && load.asset.unloadLevel != Asset.UNLOAD_LEVEL.LEVEL_NORMAL)
            {
                continue;
            }

            if (load.loading == true)
            {
                load.stop();
                break;
            }
        }

        for (int i = 0; i < after_loads.Count; i++)
        {
            AssetLoad load = after_loads[i];
            if (isAllUnLoadLevel == false && load.asset.unloadLevel != Asset.UNLOAD_LEVEL.LEVEL_NORMAL)
            {
                continue;
            }

            if (load.loading == true)
            {
                load.stop();
                break;
            }
        }

        for (int i = 0; i < loads.Count; i++)
        {
            AssetLoad load = loads[i];
            if (isAllUnLoadLevel == false && load.asset.unloadLevel != Asset.UNLOAD_LEVEL.LEVEL_NORMAL)
            {
                continue;
            }

            if (load.loading == true)
            {
                load.stop();
                break;
            }
        }

        isLoading = false;
        return(true);
    }
コード例 #8
0
    public AssetLoad addLoad(Asset a)
    {
        //if(a.bundle != null || a.isLoaded == true)
        if ((!(System.Object.ReferenceEquals(a.bundle, null))) || a.isLoaded == true)
        {
            Common.DEBUG_MSG("LoadAssetsPool::addLoad:" + a.source + ", bundle != null(" +
                             a.bundle + ") or isLoaded(" + a.isLoaded + ")!");
            return(null);
        }

        if (findLoad(a.source) != null)
        {
            Common.DEBUG_MSG("LoadAssetsPool::addLoad: findLoad(" + a.source + ") = true!");
            return(null);
        }

        AssetLoad load = null;

        if (a.type == Asset.TYPE.SKYBOX)
        {
            load = new AssetLoadSkybox(loader_, this, a);
        }
        else if (a.type == Asset.TYPE.TERRAIN)
        {
            load = new AssetLoadTerrain(loader_, this, a);
        }
        else if (a.type == Asset.TYPE.TERRAIN_DETAIL_TEXTURE)
        {
            load = new AssetLoadTerrain(loader_, this, a);
        }
        else if (a.type == Asset.TYPE.TERRAIN_TREE)
        {
            load = new AssetLoadTerrain(loader_, this, a);
        }
        else if (a.type == Asset.TYPE.WORLD_OBJ)
        {
            load = new AssetLoad(loader_, this, a);
        }
        else
        {
            load = new AssetLoad(loader_, this, a);
        }

        add(load);
        return(load);
    }
コード例 #9
0
ファイル: WindowController.cs プロジェクト: linyichie/Game
 private void TryOpen(string windowName)
 {
     if (windows.ContainsKey(windowName))
     {
         var window = windows[windowName];
         if (window.state == WindowState.Closed)
         {
             window.Open();
         }
     }
     else
     {
         openingList.Add(windowName);
         var addressableName = StringUtil.Contact("Windows/", windowName);
         AssetLoad.LoadAsync <GameObject>(addressableName, asset => { OnLoadedWindow(windowName, asset.asset as GameObject); });
     }
 }
コード例 #10
0
ファイル: WindowController.cs プロジェクト: linyichie/Game
 private void OnLoadedWindow(string windowName, GameObject go)
 {
     if (openingList.Contains(windowName))
     {
         openingList.Remove(windowName);
         go.transform.SetParent(uiRoot);
         var window = go.GetComponent <Window>();
         var canvas = go.GetComponent <Canvas>();
         canvas.worldCamera = uiCamera;
         windows.Add(windowName, window);
         window.Open();
     }
     else
     {
         var addressableName = StringUtil.Contact("Windows/", windowName);
         AssetLoad.Release(addressableName, go);
     }
 }
コード例 #11
0
    public void add(AssetLoad load)
    {
        // Common.DEBUG_MSG("LoadAssetsPool::add: " + load.asset.source + ", loadlevel=" + load.asset.loadLevel + "!");
        switch (load.asset.loadLevel)
        {
        case Asset.LOAD_LEVEL.LEVEL_ENTER_BEFORE:
            before_loads.Add(load);
            loadingbar.loadingbar_maxValue += 1;
            break;

        case Asset.LOAD_LEVEL.LEVEL_ENTER_AFTER:
            after_loads.Add(load);
            break;

        case Asset.LOAD_LEVEL.LEVEL_SCRIPT_DYNAMIC:
            // after_loads.Add(load);
            break;

        default:
            loads.Add(load);
            break;
        }
        ;
    }
コード例 #12
0
	public void onLoadCompleted(AssetLoad dl)
	{
		currLoadings -= 1;

		if(dl.asset.loadLevel == Asset.LOAD_LEVEL.LEVEL_ENTER_BEFORE)
		{
			loadingbar.loadingbar_currValue += 1;
			Common.DEBUG_MSG("loadingbar_currValue=" + loadingbar.loadingbar_currValue);
			for(int i=0; i<before_loads.Count; i++)
			{
				if(before_loads[i] == dl)
				{
					before_loads.RemoveAt(i);
					break;
				}
			}
			
			if(before_loads.Count == 0)
			{
				Common.DEBUG_MSG("LoadAssetsPool::onLoadCompleted: ENTER_BEFORE!");
			}
		}
		else if(dl.asset.loadLevel == Asset.LOAD_LEVEL.LEVEL_ENTER_AFTER)
		{
			for(int i=0; i<after_loads.Count; i++)
			{
				if(after_loads[i] == dl)
				{
					after_loads.RemoveAt(i);
					break;
				}
			}
			
			if(after_loads.Count == 0)
			{
				Common.DEBUG_MSG("LoadAssetsPool::onLoadCompleted: ENTER_AFTER!");
			}
		}
		else
		{
			for(int i=0; i<loads.Count; i++)
			{
				if(loads[i] == dl)
				{
					loads.RemoveAt(i);
					break;
				}
			}
			
			if(loads.Count == 0)
			{
				Common.DEBUG_MSG("LoadAssetsPool::onLoadCompleted: NORMAL!");
			}
		}
		
		loadNext();
	}
コード例 #13
0
 public static void SetLoadObj(MonoBehaviour fac, AssetLoad load)
 {
     g_AssetLoad = load;
     g_asyncGo   = fac;
 }
コード例 #14
0
ファイル: AssetLoad.cs プロジェクト: Rinal/Niam-Niam
 public void Awake()
 {
     Instance = this;
 }
コード例 #15
0
    public static void CreateUIRoot()
    {
        GameObject go = Instantiate(AssetLoad.LoadUI("UIRoot"));

        go.name = "UIRoot";
    }
コード例 #16
0
	public AssetLoad addLoad(Asset a)
	{
		if(a.bundle != null || a.isLoaded == true)
		{
			Common.DEBUG_MSG("LoadAssetsPool::addLoad:" + a.source + ", bundle != null(" + 
				a.bundle + ") or isLoaded(" + a.isLoaded + ")!");
			return null;
		}
		
		if(findLoad(a.source) != null)
		{
			Common.DEBUG_MSG("LoadAssetsPool::addLoad: findLoad("+ a.source + ") = true!");
			return null;
		}
		
		AssetLoad load = null;
		
		if(a.type == Asset.TYPE.SKYBOX)
		{
			load = new AssetLoadSkybox(loader_, this, a);
		}
		else if(a.type == Asset.TYPE.TERRAIN)
		{
			load = new AssetLoadTerrain(loader_, this, a);
		}
		else if(a.type == Asset.TYPE.TERRAIN_DETAIL_TEXTURE)
		{
			load = new AssetLoadTerrain(loader_, this, a);
		}
		else if(a.type == Asset.TYPE.TERRAIN_TREE)
		{
			load = new AssetLoadTerrain(loader_, this, a);
		}
		else if(a.type == Asset.TYPE.WORLD_OBJ)
		{
			load = new AssetLoad(loader_, this, a);
		}
		else
		{
			load = new AssetLoad(loader_, this, a);
		}
		
		add(load);
		return load;
	}
コード例 #17
0
    public void erase(Asset.TYPE type, bool removeAllOther)
    {
        while (true)
        {
            for (int i = 0; i < before_loads.Count; i++)
            {
                AssetLoad load = before_loads[i];
                if ((load.asset.type == type) != removeAllOther)
                {
                    if (load.loading == true)
                    {
                        load.stop();
                    }

                    before_loads.RemoveAt(i);
                    break;
                }
            }

            break;
        }

        while (true)
        {
            for (int i = 0; i < after_loads.Count; i++)
            {
                AssetLoad load = after_loads[i];
                if ((load.asset.type == type) != removeAllOther)
                {
                    if (load.loading == true)
                    {
                        load.stop();
                    }

                    after_loads.RemoveAt(i);
                    break;
                }
            }

            break;
        }

        while (true)
        {
            for (int i = 0; i < loads.Count; i++)
            {
                AssetLoad load = loads[i];
                if ((load.asset.type == type) != removeAllOther)
                {
                    if (load.loading == true)
                    {
                        load.stop();
                    }

                    loads.RemoveAt(i);
                    break;
                }
            }

            break;
        }
    }
コード例 #18
0
    public void eraseByUNLoadLevel(Asset.UNLOAD_LEVEL level, bool removeAllOther)
    {
        while (true)
        {
            for (int i = 0; i < before_loads.Count; i++)
            {
                AssetLoad load = before_loads[i];
                if ((load.asset.unloadLevel == level) != removeAllOther)
                {
                    if (load.loading == true)
                    {
                        load.stop();
                    }

                    before_loads.RemoveAt(i);
                    break;
                }
            }

            break;
        }

        while (true)
        {
            for (int i = 0; i < after_loads.Count; i++)
            {
                AssetLoad load = after_loads[i];
                if ((load.asset.unloadLevel == level) != removeAllOther)
                {
                    if (load.loading == true)
                    {
                        load.stop();
                    }

                    after_loads.RemoveAt(i);
                    break;
                }
            }

            break;
        }

        while (true)
        {
            for (int i = 0; i < loads.Count; i++)
            {
                AssetLoad load = loads[i];
                if ((load.asset.unloadLevel == level) != removeAllOther)
                {
                    if (load.loading == true)
                    {
                        load.stop();
                    }

                    loads.RemoveAt(i);
                    break;
                }
            }

            break;
        }
    }
コード例 #19
0
	public void add(AssetLoad load)
	{
		// Common.DEBUG_MSG("LoadAssetsPool::add: " + load.asset.source + ", loadlevel=" + load.asset.loadLevel + "!");
		switch(load.asset.loadLevel)
		{
			case Asset.LOAD_LEVEL.LEVEL_ENTER_BEFORE:
				before_loads.Add(load);
				loadingbar.loadingbar_maxValue += 1;
				break;
			case Asset.LOAD_LEVEL.LEVEL_ENTER_AFTER:
				after_loads.Add(load);
				break;
			case Asset.LOAD_LEVEL.LEVEL_SCRIPT_DYNAMIC:
				// after_loads.Add(load);
				break;
			default:
				loads.Add(load);
				break;
		};
	}