Beispiel #1
0
    public IEnumerator load()
    {
        ResourceLoadTaskGroup group = new ResourceLoadTaskGroup();

        foreach (TileCfg tileCfg in TileCfg.dataList)
        {
            ResourceLoadTask task = new ResourceLoadTask();
            task.path = tileCfg.resourcePath;
            task.name = tileCfg.resourceName;
            group.addTask(task);
        }
        yield return(ResourceLoader.LoadGroupAsync(group));

        for (int i = 0; i < TileCfg.dataList.Count; i++)
        {
            ResourceLoadTask t = group.getTaskList()[i];
            textures.Add(t.asset as Texture2D);
            Tileset tileset = new Tileset();
            tileset.init(t.asset as Texture2D, TileLength);
            tilesets.Add(TileCfg.dataList[i].id, tileset);
        }
        ResourceLoadTask taskMapTilePrefab = new ResourceLoadTask();

        taskMapTilePrefab.path = PrefabCfg.get(2).resourcePath;
        taskMapTilePrefab.name = PrefabCfg.get(2).resourceName;
        yield return(ResourceLoader.LoadAssetAsync(taskMapTilePrefab));

        mapTilePrefab = taskMapTilePrefab.asset as GameObject;
    }
Beispiel #2
0
    public IEnumerator init()
    {
        InitUnitsMemory();
        unitDrawer = new GameObjectPool(new UnitDrawerFactory());
        PrefabCfg        prefabcfg = PrefabCfg.get(1);
        ResourceLoadTask task      = new ResourceLoadTask();

        task.path = prefabcfg.resourcePath;
        task.name = prefabcfg.resourceName;
        yield return(ResourceLoader.LoadAssetAsync(task));

        if (task.asset == null)
        {
            Debug.LogError("load charactor drawer prefab erro");
        }

        characrerDrawerPrefab = task.asset as GameObject;
        foreach (UnitTypeCfg unitTypeCfg in UnitTypeCfg.dataList)
        {
        }
        yield return(0);
    }