private void GenerateView()
    {
        picIdList.Clear();
        assetIdList.Clear();
        //List<Recommend> recommends = LogicController.GetRecommends();
        List <Recommend> recommends = GetTestData();

        for (int i = 0; i < recommends.Count; ++i)
        {
            RecommendItemView itemView = RecommendItemView.Create(table);
            itemView.RecommendId = recommends[i].recommendId;
            itemView.PictureId   = recommends[i].pictureId;
            PositionSerialize(recommends[i].position, out itemView.x, out itemView.y, out itemView.width, out itemView.height);
            UIEventListener.Get(itemView.gameObject).onClick = ItemClick;
            itemViewList.Add(itemView);

            Picture picture = LogicController.GetPicture(recommends[i].pictureId);
            if (picture == null)
            {
                picIdList.Add(recommends[i].pictureId);
            }
            else
            {
                Asset asset = LogicController.GetAsset(picture.assetId);
                if (asset == null)
                {
                    assetIdList.Add(picture.assetId);
                }
            }
        }
        tableComp.Reposition();
        if (picIdList.Count != 0)
        {
            GetPictureCommand cmd = new GetPictureCommand();
            cmd.Callback   = AfterGetPicture;
            cmd.PictureIds = picIdList;
            cmd.execute();
        }
        if (assetIdList.Count != 0)
        {
            GetAssetCommand cmd = new GetAssetCommand();
            cmd.Callback = AfterGetAsset;
            cmd.AssetIds = assetIdList;
            cmd.execute();
        }
        picIdList.Clear();
        assetIdList.Clear();
    }
Exemplo n.º 2
0
    public void ShowPicture()
    {
        if (IsPictureShowed())
        {
            return;
        }
        Debug.Log("ShowPicture call");
        Picture picture = LogicController.GetPicture(pictureId);

        if (picture == null)
        {
            return;
        }
        Asset asset = LogicController.GetAsset(picture.assetId);

        if (asset == null)
        {
            return;
        }
        AssetBundleManager.GetObject(AppSetting.getInstance().assetUrl + asset.name, asset.version,
                                     new string[] { picture.atlasName }, LoadCallback);
    }