Esempio n. 1
0
        public override void Start()
        {
            base.Start();
            var targetGameItems = GetTargetGameItems();

            var startIndex = _loadParameters.Offset;
            var endIndex   = Mathf.Min(_loadParameters.Offset + _loadParameters.Limit, GameModel.Items.Count);

            var items = new List <MarketItemModel>();

            for (int i = startIndex; i < endIndex && i < targetGameItems.Count; i++)
            {
                var itemInfo = targetGameItems[i];

                var itemModel = new MarketItemModel
                {
                    Tittle     = itemInfo.Title,
                    ClassId    = itemInfo.ClassId,
                    AssetId    = itemInfo.AssetId,
                    IconSprite = itemInfo.Sprite
                };

                items.Add(itemModel);
            }

            CommandResult = new LoadMarketItemsCommandResult(items, targetGameItems.Count);
            Terminate();
        }
Esempio n. 2
0
        private void OnSuccessCallback(GetUserSellOffersRequest.Response response, GetUserSellOffersRequest.RequestParams request)
        {
            var answer     = response;
            var modelsList = new List <MarketItemModel>();

            foreach (var itemInfo in answer.Items)
            {
                var itemModel = new MarketItemModel
                {
                    SellOfferId = itemInfo.sellOfferId,
                    Tittle      = itemInfo.title,
                    ImageUrl    = itemInfo.imageUrl,
                    Created     = IntToDateTime(itemInfo.created),
                    Fee         = itemInfo.fee,
                    Price       = itemInfo.price,
                    Status      = SellOfferStatusTypeExtentions.GetSellOfferStatusType(itemInfo.status)
                };
                itemModel.Fee.Currency = itemModel.Price.Currency; // TODO: workaround. wait backend.

                modelsList.Add(itemModel);
            }

            CommandResult = new LoadMarketItemsCommandResult(modelsList, answer.total);
            Terminate(true);
        }
Esempio n. 3
0
        protected override void OnScheduledUpdate()
        {
            base.OnScheduledUpdate();
            var items = CreateItems();

            items = ApplySearchFilter(items);
            var totalItems = kTotalItemsPerFilter * (_loadParameters.Categories.Count + 1);

            CommandResult = new LoadMarketItemsCommandResult(items, totalItems);
            Terminate(true);
        }
        private void OnSuccessCallback(GetUserInventoryRequest.Response response, GetUserInventoryRequest.RequestParams request)
        {
            var items = new List <MarketItemModel>();

            for (int i = 0; i < response.Items.Count; i++)
            {
                var itemInfo  = response.Items[i];
                var itemModel = new MarketItemModel
                {
                    Tittle   = itemInfo.title,
                    ClassId  = itemInfo.classId,
                    AssetId  = itemInfo.assetId,
                    ImageUrl = itemInfo.imageUrl
                };
                items.Add(itemModel);
            }

            CommandResult = new LoadMarketItemsCommandResult(items, response.total);
            Terminate(true);
        }
        private void OnSuccessCallback(GetGameClassSellOffersRequest.Response response, GetGameClassSellOffersRequest.RequestParams request)
        {
            var items = new List <MarketItemModel>();

            foreach (var itemInfo in response.Items)
            {
                var itemModel = new MarketItemModel
                {
                    ClassId     = _loadParameters.ClassId,
                    SellOfferId = itemInfo.sellOfferId,
                    Tittle      = itemInfo.title,
                    ImageUrl    = itemInfo.imageUrl,
                    Created     = IntToDateTime(itemInfo.created),
                    Fee         = itemInfo.fee,
                    Price       = itemInfo.price
                };
                itemModel.Fee.Currency = itemModel.Price.Currency;               // TODO: workaround. wait backend.
                items.Add(itemModel);
            }

            CommandResult = new LoadMarketItemsCommandResult(items, response.total);
            Terminate(true);
        }
Esempio n. 6
0
        private void OnSuccessLoadItemsCallback(GetGameAggregatedClassesRequest.Response response, GetGameAggregatedClassesRequest.RequestParams request)
        {
            var items = new List <MarketItemModel>();

            foreach (var itemInfo in response.Items)
            {
                var itemModel = new MarketItemModel
                {
                    SellOfferId = itemInfo.cheapestOfferId,
                    Tittle      = itemInfo.title,
                    ImageUrl    = itemInfo.imageUrl,
                    Updated     = IntToDateTime(itemInfo.lastUpdate),
                    Price       = itemInfo.cheapestPrice,
                    OffersCount = itemInfo.offersCount,
                    ClassId     = itemInfo.classId,
                    Description = itemInfo.description
                };

                items.Add(itemModel);
            }

            CommandResult = new LoadMarketItemsCommandResult(items, response.total);
            Terminate(true);
        }