예제 #1
0
    private void OnLoadAtlas(string tag, Action <SpriteAtlas> act)
    {
        string path = FilePathTools.getSpriteAtlasPath(tag);

        if (GameMainManager.instance.preloader.Contains(path))
        {
            AssetBundle ab = GameMainManager.instance.preloader.GetPreloaderAssetBundle(path);
            SpriteAtlas sa = ab.LoadAsset <SpriteAtlas>(System.IO.Path.GetFileNameWithoutExtension(path));
            act(sa);
            //同一图集只会请求一次,所以用完就卸载掉
            GameMainManager.instance.preloader.RemovePreloaderAssetBundle(this, path);
        }
        else
        {
            Debug.Log("开始加载[" + tag + "]图集");
            SpriteAtlas sa = AssetBundleLoadManager.Instance.Load <SpriteAtlas>(path);
            act(sa);
            Debug.Log("图集加载完毕:" + sa);
        }

        //canvasScaler.enabled = false;
        //canvas.enabled = false;

        //canvasScaler.enabled = true;
        //canvas.enabled = true;
    }
예제 #2
0
        private void OnLoadAtlas(string tag, Action <SpriteAtlas> act)
        {
            string path = FilePathTools.getSpriteAtlasPath(tag);

            Debug.Log("开始加载[" + tag + "]图集");
            SpriteAtlas sa = AssetsManager.Instance.LoadAsset <SpriteAtlas>(path);

            act(sa);
            Debug.Log("图集加载完毕:" + sa);

            //canvasScaler.enabled = false;
            //canvas.enabled = false;

            //canvasScaler.enabled = true;
            //canvas.enabled = true;
        }
예제 #3
0
 protected override void StartShowWindow(object[] data)
 {
     userData = GameMainManager.instance.model.userData;
     if (spriteAtlas != null && userData.islandId == islandID)
     {
         updateData(spriteAtlas);
     }
     else
     {
         islandID = userData.islandId;
         if (islandID > GameMainManager.instance.configManager.islandConfig.islandNames.Length)
         {
             islandID = islandID % (GameMainManager.instance.configManager.islandConfig.islandNames.Length + 1) + 1;
         }
         string name = "CityThumbnail_" + islandID.ToString();
         string path = FilePathTools.getSpriteAtlasPath(name);
         AssetBundleLoadManager.Instance.LoadAsset <SpriteAtlas>(path, (sa) => {
             spriteAtlas = sa;
             updateData(sa);
         });
     }
 }
예제 #4
0
    public void UpdateCityData(int islandID, BuildingData[] data)
    {
        Debug.Log("island is " + islandID);
        if (islandID > GameMainManager.instance.configManager.islandConfig.islandNames.Length)
        {
            islandID = islandID % (GameMainManager.instance.configManager.islandConfig.islandNames.Length + 1) + 1;
        }

        if (islandID == this.islandID)
        {
            UpdateAllSprite(spriteAtlas, data);
        }
        else
        {
            string path = FilePathTools.getSpriteAtlasPath("City_" + islandID.ToString());
            AssetBundleLoadManager.Instance.LoadAsset <SpriteAtlas>(path, (sa) => {
                this.islandID = islandID;
                spriteAtlas   = sa;

                UpdateAllSprite(sa, data);
            });
        }
    }