private static void SetFakeUser() { if (Instance.UserDao.Read() == null) { ShopApi.GenUser(); } }
private static void SetFakeProducts() { if (Instance.ProductDao.ReadAll().None()) { ShopApi.GenProducts(); } }
private static void SetFakeCart() { if (Instance.OrderDao.GetCart() == null) { ShopApi.GenCart(); } }
/// <summary> /// ショップ開く /// </summary> public static void Open(MultiBattleShop prefab) { //通信で商品リスト取得 BillingApi.CallListApi(() => { ShopApi.CallNowShopApi((tShops) => { //ローダー準備 var loader = new AssetListLoader(Masters.ShopDB .GetList() .Where(x => x.multiFlg > 0) .SelectMany(x1 => Masters.ShopItemDB.GetList().FindAll(x2 => x2.shopItemId == x1.shopItemId)) .Select(x => CommonIconUtility.GetItemInfo(x.itemType, x.itemId)) .Where(x => !x.IsCommonSprite()) .Select(x => new AssetLoader <Sprite>(x.GetSpritePath()))); //ロード中タッチブロック SharedUI.Instance.DisableTouch(); //リソースロード loader.Load(() => { //タッチブロック解除 SharedUI.Instance.EnableTouch(); //ショップダイアログ生成 var dialog = SharedUI.Instance.ShowPopup(prefab); dialog.loader = loader; dialog.Setup(tShops); }); }); }); }
private static void SetFakeCategories() { if (Instance.CategoryDao.ReadAll().None()) { ShopApi.GenCategoryList(4); } }
public async Task <ShopApi> LikeShop(UserApi user, string shopId) { try { if (user is null) { throw new ArgumentNullException(nameof(user)); } if (shopId is null) { throw new ArgumentNullException(nameof(shopId)); } var shopAoi = new ShopApi { Id = shopId }; var shopModel = _mapper.Map <ShopModel>(shopAoi); var userModel = _mapper.Map <UserModel>(user); shopModel = await _userRepository.LikeShop(userModel, shopModel).ConfigureAwait(false); var shopApi = _mapper.Map <ShopApi>(shopModel); _logger.LogInformation($"the user {user} disliked the shop {shopAoi}"); return(shopApi); } catch (Exception ex) { _logger.LogError(ex, $"Error while disliking the shop with id {shopId} by the user {user}"); return(null); } }
public ActionResult Shop([FromBody] ShopApi shopApi) { if (shopApi == null) { return(Json(new ResultsJson(new Message(CodeMessage.PostNull, "PostNull"), null))); } return(Json(Global.BUSS.BussResults(this, shopApi))); }
public BasketViewModel(IServerConnectionResolver serverConnectionResolver, IProductItemViewModelFactory productItemViewModelFactory) { _shopApi = new ShopApi(serverConnectionResolver.GetServerApiBaseAddress()); _productItemViewModelFactory = productItemViewModelFactory; ClearAllCommand = new RelayCommand((t) => true, ClearAll); LogOutCommand = new RelayCommand((t) => true, OnLogOut); ProductItemViewModels = new ObservableCollection <IProductItemViewModel>(); }
/// <summary> /// 決定ボタンクリック時 /// </summary> private void OnClickDecideButton() { if (!this.dialog.isClose) { if (this.product is ProductBilling) { var iap = (SceneChanger.currentScene as ShopScene).iap; //処理完了までタッチブロック SharedUI.Instance.DisableTouch(); //一次通貨による商品の購入を行う iap.Purchase( productId: Masters.BillingDB.FindById(this.product.master.id).productId, onSuccess: (userBillingData) => { //タッチブロック解除 SharedUI.Instance.EnableTouch(); this.CloseDialog(); this.onPurchaseCompleted?.Invoke(userBillingData, null, this.icon, this.product); }, onFailed: () => { //タッチブロック解除 SharedUI.Instance.EnableTouch(); }); } else if (SceneChanger.currentScene is Battle.MultiBattleScene) { //バトル中簡易ショップの場合の購入通信 MultiPlayApi.CallItemBuyApi( this.product.master.id, this.buyNum, (SceneChanger.currentScene as Battle.MultiBattleScene).logData, (userShop) => { this.CloseDialog(); this.onPurchaseCompleted?.Invoke(null, userShop, this.icon, this.product); }); } else { //ジェム・コインなどの二次通貨による商品の購入を行う ShopApi.CallBuyApi( this.product.master.id, this.buyNum, (userShop) => { CloseDialog(); this.onPurchaseCompleted?.Invoke(null, userShop, this.icon, this.product); }); } SoundManager.Instance.PlaySe(SeName.YES); } }
public ProductItemViewModel(string userToken, int id, string name, string description, int count, decimal price, IServerConnectionResolver serverConnectionResolver) { _shopApi = new ShopApi(serverConnectionResolver.GetServerApiBaseAddress()); Id = id; Name = name; Description = description; Price = price; _count = count; _userToken = userToken; AddItemCommand = new RelayCommand((t) => true, AddItem); RemoveItemCommand = new RelayCommand(CanRemoveItem, RemoveItem); }
public ShopifyReferenceGet( ShopApi shopApi, ProductApi productApi, ShopifyInventoryRepository locationRepository, ReferenceDataRepository referenceDataRepository, ShopifyJsonService shopifyJsonService) { _shopApi = shopApi; _productApi = productApi; _locationRepository = locationRepository; _referenceDataRepository = referenceDataRepository; _shopifyJsonService = shopifyJsonService; }
/// <summary> /// 商品購入通信 /// </summary> public static void CallItemBuyApi(uint shopId, uint buyNum, LogData logData, Action <UserShopData> onCompleted) { var request = new SharkWebRequest <ShopApi.BuyResponseData>("multiPlaying/itemBuy"); request.SetRequestHeader("AccessToken", UserData.Get().hash); var requestParameter = logData.ToRequestParameter(); requestParameter.Add("shopId", shopId); requestParameter.Add("buyNum", buyNum); request.SetRequestParameter(requestParameter); request.onSuccess = (response) => { ShopApi.OnSuccessBuyApi(response, onCompleted); }; request.Send(); }
public async Task <ShopApi> AddShop(ShopApi shop) { try { if (shop is null) { throw new ArgumentNullException(nameof(shop)); } var shopModel = _mapper.Map <ShopModel>(shop); shopModel = await _shopRepository.AddShop(shopModel); var outputShopModel = _mapper.Map <ShopApi>(shopModel); _logger.LogInformation($"The shop {shop} had been added"); return(outputShopModel); } catch (Exception ex) { _logger.LogError(ex, $"Error while adding the shop {shop}"); return(null); } }
public async Task <IActionResult> AddShop([FromBody] ShopApi shop) { var addedShop = await _shopService.AddShop(shop).ConfigureAwait(false); return(Ok(addedShop)); }
/// <summary> /// Start /// </summary> private void Start() { Queue <Action> queue = new Queue <Action>(); //通信で課金商品情報を取得 queue.Enqueue(() => BillingApi.CallListApi(queue.Dequeue())); //IAP初期化 queue.Enqueue(() => { this.iap.Initialize( onSuccess: () => { //次の処理へ queue.Dequeue().Invoke(); }, onFailed: () => { //TODO:初期化エラー。ダイアログ出してHOMEにでも戻すか。 queue.Dequeue().Invoke(); } ); }); //通信で商品情報を取得 queue.Enqueue(() => { ShopApi.CallNowShopApi((tShops) => { //ショップページ情報初期化 this.InitPageData(tShops); //次の処理へ queue.Dequeue().Invoke(); }); }); //リソースの読み込み queue.Enqueue(() => { // Coin id 修得 this.coinId = Masters.ShopItemDB.GetList() .Where(x => x.itemType == (uint)ItemType.Coin) .Select(x => x.id) .ToList(); // Gem id 修得 this.gemId = Masters.BillingDB.GetList() .Select(x => x.id) .ToList(); //ペンディング数通知バッジ int pendingProductsCount = this.iap.GetPengingProductsCount(); this.pendingCountBadge.SetActive(pendingProductsCount > 0); this.pendingCountText.text = pendingProductsCount.ToString(); //タブセットアップ this.mainTabGroup.Setup(); this.subTabGroup.Setup(); //おすすめ商品が無い場合 if (this.pageDataList[(int)PageType.Recommend].products.Length == 0) { //おすすめタブをグレーアウト var recommendTab = this.mainTabGroup.Find(x => (x as ShopMainTab).tabType == PageType.Recommend); recommendTab.SetGrayout(true); if (this.firstOpenPage == PageType.Recommend) { //初期ページとしておすすめは開けないのでコインに変更 this.firstOpenPage = PageType.Coin; } } //リソースロード this.Load(queue.Dequeue()); }); //リソースロード完了時 queue.Enqueue(() => { //ローディング表示消す SharedUI.Instance.HideSceneChangeAnimation(); //BGM再生 SoundManager.Instance.PlayBgm(BgmName.HOME); //タブ開く this.OpenMainTab(this.firstOpenPage); }); queue.Dequeue().Invoke(); }