public ActionResult Inventory() { InventoryWrapper wrapper = new InventoryWrapper(); wrapper.LoadProducts(); return(View(wrapper)); }
public void SaveInventory() { InventoryWrapper inventoryWrapper = new InventoryWrapper(); inventoryWrapper.slotInfoList = this.slotInfoList; jsonString = JsonUtility.ToJson(inventoryWrapper); PlayerPrefs.SetString("inventory", jsonString); }
private async Task Open(InventoryWrapper inventory, LootBox variety, int count) { StringBuilder text = new StringBuilder(); IUserMessage message = null; if (count > 1) { string m = string.Concat(Enumerable.Repeat(variety.Emote.ToString() + "\n", count)); message = await ReplyAsync(m); await Task.Delay(1000); } for (int i = 0; i < count; i++) { var box = variety.Open(Context.Bot, 0); if (count == 1) { message = await ReplyAsync(variety.Emote.ToString()); await Task.Delay(1000); StringBuilder animation = new StringBuilder(); foreach (var(rarity, emoji) in box) { animation.Append($"{rarity.LeftBracket}❔{rarity.RightBracket}"); } await message.ModifyAsync(m => m.Content = animation.ToString()); await Task.Delay(1000); animation.Clear(); } foreach (var(rarity, emoji) in box) { var trans = Transaction.FromLootbox(marketId: 0, buyer: inventory.UserId, variety.Name); inventory.Add(new Models.Emoji { Owner = Context.User.Id, Transactions = new List <TransactionInfo>() { Context.Bot.Clerk.Queue(trans).Receive() }, Unicode = emoji }, true); text.Append($"{rarity.LeftBracket}{emoji}{rarity.RightBracket}"); } text.AppendLine(); } inventory.Save(); await message.ModifyAsync(m => m.Content = text.ToString()); }
public void Add(InventoryWrapper item) { if (!_list.Contains(item)) { item.Product.Save<Inventory>(); _list.Add(item); _IDDic.Add(item.ID, item); _specificationKeyDic.Add(item.Specification.ID, item); _itemKeyDic.Add(item.Item.ID, item); } }
private void LoadSavedInventory() { jsonString = PlayerPrefs.GetString("inventory"); InventoryWrapper inventoryWrapper = JsonUtility.FromJson <InventoryWrapper>(jsonString); this.slotInfoList = inventoryWrapper.slotInfoList; for (int i = 0; i < capacity; i++) { GameObject slot = Instantiate <GameObject>(slotPrefab, InventoryPanel); Slot newSlot = slot.GetComponent <Slot>(); newSlot.SetUp(i); newSlot.database = database; newSlot.slotInfo = slotInfoList[i]; newSlot.UpdateUI(); } }
/// <summary> /// 기존의 Inventory 데이터를 수정하고자 할 생성자 /// </summary> /// <param name="viewModel"></param> /// <param name="inventoryWrapper">수정하고자할 inventory 래핑 클래스</param> public InventoryWrapperEditorViewModel(InventoryWrapperViewModel viewModel, InventoryWrapper inventoryWrapper) : base(inventoryWrapper) { if (inventoryWrapper == null) throw new ArgumentNullException(); _viewModel = viewModel; _target = inventoryWrapper; Specification = inventoryWrapper.Specification; Item = inventoryWrapper.Item; Warehouse = inventoryWrapper.Warehouse; ItemList = new ItemWrapper[] { Item }; SpecificationList = new SpecificationWrapper[] { Specification }; WarehouseList = FieldWrapperDirector.GetInstance().CreateCollection<Warehouse, Observable<Warehouse>>().Where(x => !x.IsDeleted); }
string ConvertToStringArray(vItemManager manager, List <vItem> items) { InventoryWrapper topKey = new InventoryWrapper(); topKey.wrapper.items = items; for (int areaIndex = 0; areaIndex < manager.inventory.equipAreas.Length; areaIndex++) { for (int slotIndex = 0; slotIndex < manager.inventory.equipAreas[areaIndex].equipSlots.Count; slotIndex++) { topKey.wrapper.placement.Add(new InventoryPlacement( areaIndex, slotIndex, manager.inventory.equipAreas[areaIndex].equipSlots[slotIndex].item )); } } return(JsonUtility.ToJson(topKey)); }
/// <summary> /// 수정 또는 새로 추가할 데이터를 데이터베이스와 ViewModel의 Items 속성에 각각 추가 및 적용한다. /// </summary> /// <returns></returns> public StockWrapper Update() { //추가 및 적용의 최소 조건들 if (Item == null) throw new Exception("리스트박스에서 품목을 선택하세요."); if (Specification == null) throw new Exception("리스트박스에서 규격을 선택하세요."); InventoryWrapperDirector iwd = InventoryWrapperDirector.GetInstance(); InventoryWrapper invenw = iwd.SearchAsSpecificationKey(Specification.ID); StockWrapper stockw = null; if (invenw != null) { //재고의 개수를 수정 invenw.Quantity = InventoryQuantity; } else { //새로운 재고를 등록 Inventory inven = new Inventory(); inven.ItemID = this.Item.ID; inven.SpecificationID = this.Specification.ID; inven.Quantity = this.InventoryQuantity; inven.WarehouseID = this.Warehouse != null ? this.Warehouse.ID : null; invenw = new InventoryWrapper(inven); CollectionViewModelObserverSubject.GetInstance().NotifyNewItemAdded(invenw); //순서의 주의 iwd.Add(invenw); //순서의 주의 } if (_target != null) //InOutStock 데이터의 수정 코드 { _target.Product = InOutStock; stockw = _target; } else //새로운 InOutStock 데이터의 추가 코드 { InOutStock.InventoryID = invenw.ID; stockw = new StockWrapper(InOutStock); _viewModel.Add(stockw); } stockw.Product.Save<InOutStock>(); return stockw; }
public bool Remove(InventoryWrapper item) { item.Product.Delete<Inventory>(); _IDDic.Remove(item.ID); _specificationKeyDic.Remove(item.Specification.ID); _itemKeyDic.Remove(item.Item.ID, item); return _list.Remove(item); }
public bool Contains(InventoryWrapper item) { #if DEBUG Debug.Assert(_list.Contains(item) == _IDDic.ContainsKey(item.ID)); #endif return _list.Contains(item); }
public InventoryWrapper Update() { if (Item == null) throw new Exception("리스트박스에서 품목을 선택하세요."); if (Specification == null) throw new Exception("리스트박스에서 규격을 선택하세요."); Inventory inven = Stock as Inventory; InventoryWrapper invenw = null; if (_target != null) //기존 데이터를 수정하고자 할 경우 { _target.Product = inven; invenw = _target; } else //새로운 데이터를 추가하고자 할 경우 { invenw = new InventoryWrapper(inven); _viewModel.Add(invenw); } invenw.Product.Save<Inventory>(); return invenw; }
public InventoryWrapper ConvertBackToWrapper(string serializedItems) { InventoryWrapper topKey = JsonUtility.FromJson <InventoryWrapper>(serializedItems); return(topKey); }
public PortingKitWrapper() { this.m_inv = new InventoryWrapper(new Inventory()); this.m_helper = new InventoryHelperWrapper(new InventoryHelperWrapper(new InventoryWrapper[] { this.m_inv })); this.m_bw = new MsBuildWrapper(this.m_inv.InnerObject); this.m_spoClientPath = ""; this.m_worker = new BackgroundWorker(); this.m_worker.DoWork += new DoWorkEventHandler(m_worker_DoWork); this.m_worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(m_worker_RunWorkerCompleted); this.m_worker.WorkerReportsProgress = true; this.m_SearchWorker = new BackgroundWorker(); this.m_SearchWorker.DoWork += new DoWorkEventHandler(m_SearchWorker_DoWork); this.m_SearchWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(m_SearchWorker_RunWorkerCompleted); this.m_SearchWorker.WorkerReportsProgress = true; }