public RewardRequest(UserInfo info, UserHistory history, UserReward reward, UserInventory inven) { this.info = info; this.history = history; this.reward = reward; inventory = inven; }
private UserCharData m_UserCharData; //유저 소유 캐릭터 데이터 // Start is called before the first frame upda te /// <summary> /// 셋팅 관련 /// </summary> public void Init() { FirstLoadScene first = GameObject.Find("FirstLoad").GetComponent <FirstLoadScene>(); UnityEvent Event = new UnityEvent(); Event.AddListener(first.UserInfoComplete); Event.Invoke(); if (JSON.JsonUtil.FileCheck("UserInfoData")) { //해당 데이터를 확인, //유저 데이터를 모두 셋팅 하면 호출할 이벤트 설정 var UserTable = EXCEL.ExcelLoad.Read("Excel/Table/UserTable"); m_UserData = new UserData(UserTable); } //인벤토리 셋팅 m_UserInventory = new UserInventory(); //내가 가진 캐릭터 if (JSON.JsonUtil.FileCheck("UserCharInfoData")) { m_UserCharData = new UserCharData(); CharInfoData[] Char = JSON.JsonUtil.LoadArrJson <CharInfoData>("UserCharInfoData"); for (int i = 0; i < Char.Length; i++) { string file = "Excel/Table/" + Char[i].CharIndex + "_Char_Table";//테이블 데이터 var CharTable = EXCEL.ExcelLoad.Read(file); m_UserCharData.Init(Char[i], CharTable); } } //유저의 캐릭터 데이터를 먼저 받아주고, 인벤토리를 받는다. }
// GET: TradeListings/Details/5 public async Task <IActionResult> Details(int?id, string source) { var model = new TradeListingsDetailViewModel(); if (id == null) { return(NotFound()); } var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var tradeListing = await _DataAccess.TradeDataAccess.GetTradeListing(id ?? 0); if (userId != tradeListing.ApplicationUserId) { model.IsUsers = false; } else { model.IsUsers = true; } if (tradeListing == null) { return(NotFound()); } var userInventory = await _DataAccess.UserInventoryDataAccess.GetUserInventoryByUserAsync(userId); if (userInventory == null) { userInventory = new UserInventory(); userInventory.ApplicationUserId = userId; userInventory = await _DataAccess.UserInventoryDataAccess.Upsert(userInventory); } model.Listing = tradeListing; model.Source = source; return(View(model)); }
// GET: TradeOffers/Create public async Task <IActionResult> Create(int?id) { var listing = await _DataAccess.TradeDataAccess.GetTradeListing(id ?? 0); var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); // will give the user's userId if (listing == null) { return(NotFound()); } else if (string.IsNullOrEmpty(userId) || listing.ApplicationUserId == userId) { return(Forbid()); } else { var model = new CreateTradeOfferViewModel(); var userInventory = await _DataAccess.UserInventoryDataAccess.GetUserInventoryByUserAsync(userId); if (userInventory == null) { userInventory = new UserInventory(); userInventory.ApplicationUserId = userId; userInventory = await _DataAccess.UserInventoryDataAccess.Upsert(userInventory); } model.CardMappings = await _DataAccess.CardDataAccess.GetCardMappingsForUserAsync(userInventory.Id); model.TradeOffer = new TradeOffer(); model.TradeOffer.TradeListingOne = listing; model.TradeOffer.TradeListingOneId = listing.Id; model.Listing = new TradeListing(); return(View(model)); } }
private void UpdateFields() { currentUser = serviceClient.GetUserByUsername(UsernameLabel.Text); UserMoney.Text = "€ " + currentUser.Money.ToString("0.00"); List <Inventory> shopProducts = serviceClient.GetInventory(); List <UserProducts> userProducts = serviceClient.GetUserProducts(currentUser.UserID); UserInventory.Items.Clear(); ShopInventory.Items.Clear(); UserInventory.BeginUpdate(); userProducts.ForEach(product => { UserInventory.Items.Add(product.Product.Name + ", Owned: " + product.Amount); }); UserInventory.EndUpdate(); ShopInventory.BeginUpdate(); shopProducts.ForEach(product => { ListViewItem item = new ListViewItem(); item.Text = "€ " + product.Product.Price.ToString("0.00") + " : " + product.Product.Name + ", Amount: " + product.Storage; item.Tag = product.Product.ProductID; ShopInventory.Items.Add(item); }); ShopInventory.EndUpdate(); }
// Start is called before the first frame update void Start() { instance = this; itemEntry = new InventoryEntry(0, /*null,*/ null); itensInventory.Clear(); inventoryDisplaySlots = InventoryDisplayHolder.GetComponentsInChildren <Image>(); }
public void BuyBlockPowder() { UserInventory newItem = new UserInventory(AWSManager.instance.userInfo.nickname, blockName); JsonAdapter.instance.CreateUserInventory(newItem, WebCallback); AWSManager.instance.userInfo.block_powder -= block_powder; JsonAdapter.instance.UpdateData(AWSManager.instance.userInfo, "userInfo", WebCallback); }
private UserInventory PopulateUserInventory(UserInventory inventory) { var decks = _context.Decks.Where(x => x.UserInventoryId == inventory.Id).ToList(); inventory.Decks = decks; var user = _context.Users.FirstOrDefault(x => x.Id == inventory.ApplicationUserId); inventory.Email = user.Email; return(inventory); }
public UserInventory GetUserInventory(string id) { UserInventory result = null; if (DbContext.UserInventory.Count() > 0) { result = DbContext.UserInventory.Find(id); } return(result); }
private void BuyEventDng_OK() { RestrictionInput.EndLoad(); GameWebAPI.ResponseWorldStageForceOpenMaster.ForceOpen questForceOpen = QuestData.GetQuestForceOpen(int.Parse(this.worldStageData.worldStageM.worldStageId)); UserInventory.CalculateNumber((MasterDataMng.AssetCategory)questForceOpen.assetCategoryId, questForceOpen.assetValue.ToString(), questForceOpen.assetNum); GUIPlayerStatus.RefreshParams_S(false); this.worldStageData.wdi.isOpen = 1; this.SetOpenStatus(); this.ExecuteTouch(true); }
protected void UpdateUserAssetsInventory(int playCount) { GameWebAPI.RespDataGA_GetGachaInfo.Detail detail = this.gashaInfo.details.GetDetail(playCount); int value = 0; if (int.TryParse(detail.GetPrice(), out value)) { UserInventory.CalculateNumber(this.gashaInfo.priceType.GetCostAssetsCategory(), this.gashaInfo.priceType.GetCostAssetsValue(), value); } }
public void SetReward(int island_num, int level, int boong, int heart, int block_powder, int skin_powder, string item) { island = island_num; star_index = level; this.boong = boong; this.heart = heart; this.block_powder = block_powder; this.skin_powder = skin_powder; if (boong != 0) { RewardItem reward = Instantiate(rewardItemPrefab); reward.transform.SetParent(transform, false); reward.SetRewardItem("Reward/boong", boong + " 붕"); rewardItems.Add(reward); } if (heart != 0) { RewardItem reward = Instantiate(rewardItemPrefab); reward.transform.SetParent(transform, false); reward.SetRewardItem("Reward/heart", heart + " 개"); rewardItems.Add(reward); } if (block_powder != 0) { RewardItem reward = Instantiate(rewardItemPrefab); reward.transform.SetParent(transform, false); reward.SetRewardItem("Reward/block_powder", block_powder + " 개"); rewardItems.Add(reward); } if (skin_powder != 0) { RewardItem reward = Instantiate(rewardItemPrefab); reward.transform.SetParent(transform, false); reward.SetRewardItem("Reward/skin_powder", skin_powder + " 개"); rewardItems.Add(reward); } if (item != "none") { Debug.Log("item"); userInventory = new UserInventory(AWSManager.instance.userInfo.nickname, item); RewardItem reward = Instantiate(rewardItemPrefab); reward.transform.SetParent(transform, false); reward.SetRewardItem("Reward/" + item, item);//Image path , reward object rewardItems.Add(reward); } else { Debug.Log("none"); userInventory = new UserInventory(AWSManager.instance.userInfo.nickname, "none"); } }
public void BuyPowderPrice() { UserInfo userInfo = AWSManager.instance.userInfo; UserHistory userHistory = AWSManager.instance.userHistory; UserInventory newItem = new UserInventory(userInfo.nickname, skinText.text); JsonAdapter.instance.CreateUserInventory(newItem, WebCallback); userInfo.skin_powder -= skin_powder; JsonAdapter.instance.UpdateData(userInfo, "userInfo", WebCallback); }
private int CalcAbleCount() { int result = 0; int numberExceptProtectedAssets = UserInventory.GetNumberExceptProtectedAssets(this.gashaInfo.priceType.GetCostAssetsCategory(), this.gashaInfo.priceType.GetCostAssetsValue()); GameWebAPI.RespDataGA_GetGachaInfo.Detail detail = this.gashaInfo.details.GetDetail(1); if (detail != null) { result = detail.GetOnceRemainingPlayCount(numberExceptProtectedAssets); } return(result); }
public async Task <UserInventory> Upsert(UserInventory userInventory) { try { if (userInventory.Id > 0) { var userInventoryData = _context.UserInventories.FirstOrDefault(x => x.Id == userInventory.Id); if (userInventoryData != null) { userInventoryData.ApplicationUser = userInventory.ApplicationUser; userInventoryData.Decks = userInventory.Decks; userInventoryData.AddressLine = userInventory.AddressLine; userInventoryData.City = userInventory.City; userInventoryData.State = userInventory.State; userInventoryData.Zip = userInventory.Zip; await _context.SaveChangesAsync(); if (userInventory != null) { return(PopulateUserInventory(userInventory)); } return(userInventory); } else { _context.UserInventories.Add(userInventory); await _context.SaveChangesAsync(); if (userInventory != null) { return(PopulateUserInventory(userInventory)); } return(userInventory); } } else { _context.UserInventories.Add(userInventory); await _context.SaveChangesAsync(); if (userInventory != null) { return(PopulateUserInventory(userInventory)); } return(userInventory); } } catch { return(null); } }
public void BuyBoongPrice() { UserInfo userInfo = AWSManager.instance.userInfo; UserHistory userHistory = AWSManager.instance.userHistory; UserInventory newItem = new UserInventory(userInfo.nickname, skinText.text); JsonAdapter.instance.CreateUserInventory(newItem, WebCallback); userInfo.boong -= boong; userHistory.boong_use += boong; JsonAdapter.instance.UpdateData(userInfo, "userInfo", WebCallback); JsonAdapter.instance.UpdateData(userHistory, "userHistory", WebCallback); }
public void Init(CurrencyData data) { currencyData = data; currencyIcon.sprite = data.icon; if (userInventory == null) { userInventory = GameManager.Instance.GetUserInventory(); } inventoryData = userInventory.currenciesDataList.Find(x => x.type == currencyData.type); currencyAmountText.text = inventoryData.amount.ToString(); fillAnimator.gameObject.SetActive(currencyData.hasFillAnimation); }
// GET: Card public async Task <IActionResult> Index() { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var userInventory = await _DataAccess.UserInventoryDataAccess.GetUserInventoryByUserAsync(userId); if (userInventory == null) { userInventory = new UserInventory(); userInventory.ApplicationUserId = userId; userInventory = await _DataAccess.UserInventoryDataAccess.Upsert(userInventory); } var CardMappings = await _DataAccess.CardDataAccess.GetCardMappingsForUserAsync(userInventory.Id); return(View(CardMappings)); }
//TODO - add card! public override void Init(BasePopupData data) { base.Init(data); userInventory = GameManager.Instance.GetUserInventory(); UserProductData inventoryData = userInventory.productDataList.Find(x => x.guid == ((AtractionPopupData)data).guid); AttractionsDataAsset attractionsDataAsset = GameManager.Instance.GetAttractionsData(); AttractionDataAssetItem assetDataItem = attractionsDataAsset.attractionsDataAsset.Find (a => a.gameEventType == attractionsDataAsset.currentEvent); RideData rideData = assetDataItem.rideData.Find(a => a.guid == ((AtractionPopupData)data).guid); if (rideData != null) { InitRidePopup(rideData, inventoryData); } }
public async Task <IActionResult> DecreaseCardCount(int?id, string source) { if (id == null) { return(NotFound()); } var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var userInventory = await _DataAccess.UserInventoryDataAccess.GetUserInventoryByUserAsync(userId); if (userInventory == null) { userInventory = new UserInventory(); userInventory.ApplicationUserId = userId; userInventory = await _DataAccess.UserInventoryDataAccess.Upsert(userInventory); } var CardMapping = await _DataAccess.CardDataAccess.GetSpecificCardMappingForUserAsync(userInventory.Id, id ?? 0); if (CardMapping != null) { CardMapping.Count--; if (CardMapping.Count < 0) { await _DataAccess.CardDataAccess.RemoveCardMappingForUser(userInventory.Id, id ?? 0); return(RedirectToAction("Index")); } else { await _DataAccess.CardDataAccess.UpsertCardMappingAsync(CardMapping); if (source == "index") { return(RedirectToAction("Index")); } else { var obj = new { id = id }; return(RedirectToAction("Details", obj)); } } } return(RedirectToAction("Index")); }
internal void NewInventory(UserInventory P) { Gold = P.Gold; if (P.Inventory != null) { Inventory = P.Inventory; } if (P.Equipment != null) { Equipment = P.Equipment; RefreshLibraries(); } // if (P.Storage != null) ; // Storage = P.Storage; }
public int GetUserInventoryNumber(int assetsCategory, string assetsValue) { global::Debug.Assert(assetsCategory != 0, "アセットカテゴリーIDが設定されていません"); int result; if (string.IsNullOrEmpty(assetsValue)) { result = UserInventory.GetNumber((MasterDataMng.AssetCategory)assetsCategory); } else if (this.countProtectedAssets) { result = UserInventory.GetNumber((MasterDataMng.AssetCategory)assetsCategory, assetsValue); } else { result = UserInventory.GetNumberExceptProtectedAssets((MasterDataMng.AssetCategory)assetsCategory, assetsValue); } return(result); }
public void SetUserInventoryNumber(MasterDataMng.AssetCategory assetsCategory, string assetsValue) { global::Debug.Assert(assetsCategory != MasterDataMng.AssetCategory.NONE, "アセットカテゴリーIDが設定されていません"); int num; if (string.IsNullOrEmpty(assetsValue)) { num = UserInventory.GetNumber(assetsCategory); } else if (this.countProtectedAssets) { num = UserInventory.GetNumber(assetsCategory, assetsValue); } else { num = UserInventory.GetNumberExceptProtectedAssets(assetsCategory, assetsValue); } this.SetNumber(num.ToString()); }
public async Task <IActionResult> Delete(int?id) { if (id == null) { return(NotFound()); } var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var userInventory = await _DataAccess.UserInventoryDataAccess.GetUserInventoryByUserAsync(userId); if (userInventory == null) { userInventory = new UserInventory(); userInventory.ApplicationUserId = userId; userInventory = await _DataAccess.UserInventoryDataAccess.Upsert(userInventory); } await _DataAccess.CardDataAccess.RemoveCardMappingForUser(userInventory.Id, id ?? 0); return(RedirectToAction("Index")); }
// GET: Card/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var userInventory = await _DataAccess.UserInventoryDataAccess.GetUserInventoryByUserAsync(userId); if (userInventory == null) { userInventory = new UserInventory(); userInventory.ApplicationUserId = userId; userInventory = await _DataAccess.UserInventoryDataAccess.Upsert(userInventory); } var CardMapping = await _DataAccess.CardDataAccess.GetSpecificCardMappingForUserAsync(userInventory.Id, id ?? 0); return(View(CardMapping)); }
public override void Init(BasicAtractionData data) { inventory = GameManager.Instance.GetUserInventory(); gameAsset = GameManager.Instance.GetGameData(); _recreationAreaData = (RecreationAreaData)data; guid = data.guid; _userProductData = inventory.GetUserProductData(guid); if (_userProductData == null || _userProductData.count == 0) { _recreationAreaData.state = ItemState.LOCKED; //TODO - remove hardcodation } else { _recreationAreaData.state = ItemState.IDLE; //TODO - remove hardcodation } InitUIElements(); CheckBuyBtnState(); }
public override void Init(BasicAtractionData data) { inventory = GameManager.Instance.GetUserInventory(); gameAsset = GameManager.Instance.GetGameData(); _foodAndBeverageData = (FoodAndBeverageData)data; guid = data.guid; _userProductData = inventory.GetUserProductData(guid); if (_userProductData == null || _userProductData.count == 0) { _foodAndBeverageData.state = ItemState.LOCKED; //TODO - remove hardcodation } else { _foodAndBeverageData.state = ItemState.IDLE; //TODO - remove hardcodation } InitUIElements(); CheckBuyBtnState(); fillAnimation.Init(fillImage, _foodAndBeverageData.fillTimeSeconds, OnAnimComplete); }
// GET: TradeListings/Edit/5 public async Task <IActionResult> Edit(int?id, string source) { if (id == null) { return(NotFound()); } var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); if (string.IsNullOrWhiteSpace(userId)) { return(Forbid()); } else { var tradeListing = await _DataAccess.TradeDataAccess.GetTradeListing(id ?? 0); if (userId != tradeListing.ApplicationUserId) { return(Forbid()); } if (tradeListing == null) { return(NotFound()); } var model = new CreateTradeListingViewModel(); var userInventory = await _DataAccess.UserInventoryDataAccess.GetUserInventoryByUserAsync(userId); if (userInventory == null) { userInventory = new UserInventory(); userInventory.ApplicationUserId = userId; userInventory = await _DataAccess.UserInventoryDataAccess.Upsert(userInventory); } model.CardMappings = await _DataAccess.CardDataAccess.GetCardMappingsForUserAsync(userInventory.Id); model.TradeListing = tradeListing; model.Source = source; return(View(model)); } }
public void AddShieldToInventory(Shield newShield) { Shield currentShield = UserInventory.OfType <Shield>().FirstOrDefault(w => w.Equipped == true); if (currentShield == null) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"you found a... "); Console.WriteLine(newShield); Console.WriteLine("Its now equiped."); Console.ForegroundColor = ConsoleColor.White; newShield.Equipped = true; BlockRating = newShield.BlockRating; UserInventory.Add(newShield); Armour = newShield.ArmourAmount; } else if (newShield.BlockRating > currentShield.BlockRating) { currentShield.Equipped = false; newShield.Equipped = true; Armour = newShield.ArmourAmount; BlockRating = newShield.BlockRating; UserInventory.Add(newShield); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"you found a... "); Console.WriteLine(newShield); Console.WriteLine("Its now equiped."); Console.ForegroundColor = ConsoleColor.White; } else { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You found a.."); Console.WriteLine(newShield); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("You current one is better.. you add it to inventory.."); UserInventory.Add(newShield); } Console.ReadKey(); }
public string ClassPrintInformation() { StringBuilder sb = new StringBuilder(); sb.AppendFormat("-------------------------------------\n"); sb.AppendFormat("| Player Stats |\n"); sb.AppendFormat("-------------------------------------\n"); sb.AppendFormat($"Name {Name}\n"); sb.AppendFormat($"Level {Level} \n"); sb.AppendFormat($"Health {Health}hp\n"); sb.AppendFormat($"Tnl {ExpBar - Experience}xp\n"); sb.AppendFormat($"Gold {Gold}\n"); sb.AppendFormat($"Race {CharRace} ({CharClass})\n\n"); sb.AppendFormat($"Stats\n"); sb.AppendFormat($"Dmg {DmgLowerBound} - {DmgUpperBound}\n"); sb.AppendFormat($"Armour {Armour}\n"); sb.AppendFormat($"Strength {Strength}\n"); sb.AppendFormat($"Intelligence {Intelligence}\n"); sb.AppendFormat($"Dexterity {Dexerity}\n"); sb.AppendFormat($"Charisma {Charisma}\n"); sb.AppendFormat($"MainQuest {MainQuest}\n"); sb.AppendFormat($"Equipment\n"); var currentWeapon = UserInventory.OfType <Weapon>().FirstOrDefault(w => w.Equipped == true); var currentShield = UserInventory.OfType <Shield>().FirstOrDefault(s => s.Equipped == true); if (currentWeapon != null) { sb.AppendFormat($"Weapon {currentWeapon.ItemQuality} {currentWeapon.TypeOfWeapon}\n"); sb.AppendFormat($"Dmg ({currentWeapon.DmgLowerBound} - {currentWeapon.DmgUpperBound}) dmg\n"); } if (currentShield != null) { sb.AppendFormat($"Shield {currentShield.ItemQuality} {currentShield.ShieldName} \n"); sb.AppendFormat($"Armour {currentShield.ArmourAmount} Rating: {currentShield.BlockRating} \n"); } sb.AppendFormat("-------------------------------------\n"); return(sb.ToString()); }