Ejemplo n.º 1
0
        private FloorModel MapFloor(FloorEntity floorEntity)
        {
            List <FloorItemBanner>  bannerList  = FloorHelper.GetFloorItem <FloorItemBanner>(floorEntity).OrderBy(x => x.Priority).ToList();
            List <FloorItemProduct> productList = FloorHelper.GetFloorItem <FloorItemProduct>(floorEntity).OrderBy(x => x.Priority).ToList();

            FloorModel model = new FloorModel();

            //楼层基本信息
            model.Name = floorEntity.FloorName;
            //banner
            var banner = bannerList.FirstOrDefault();

            if (banner != null)
            {
                model.Banner.BannerResourceUrl = banner.ImageSrc;
                model.Banner.BannerTitle       = banner.BannerText;
                model.Banner.BannerLink        = banner.LinkUrl;
                //从BannerLink中提取相关信息(比如ProductSysNo等)
                BannerHelper.FillPromoInfo(model.Banner);
            }

            //推荐商品列表
            ImageSize imageSize = ImageUrlHelper.GetImageSize(ImageType.Small);

            for (int i = 0; i < 3 && i < productList.Count; i++)
            {
                var item           = productList[i];
                var floorItemModel = MapFloorItem(item, imageSize);

                model.ItemList.Add(floorItemModel);
            }

            return(model);
        }
Ejemplo n.º 2
0
    private void Awake()
    {
        if (Instance != null)
        {
            Debug.LogError("Another singleton instance exists! this should not happen");
            Destroy(Instance);
        }

        Instance = this;
    }