public bool AddItem(StuffItem item) { int count = item.Count; int possible; if (!((IReadOnlyCollection <StuffItem>) this.itemList).CanAddItem(this.slotCounter.y, item, count, out possible)) { count = possible; } if (count <= 0) { return(false); } this.itemList.AddItem(new StuffItem(item), count); item.Count -= count; List <StuffItem> list = ((IEnumerable <StuffItem>) this.itemList.FindItems(item)).ToList <StuffItem>(); foreach (ItemNodeUI itemNodeUi in this.itemListUI) { list.Remove(itemNodeUi.Item); } foreach (StuffItem stuffItem in list) { this.ItemListAddNode(this.itemListUI.SearchNotUsedIndex, stuffItem); } this.ItemListNodeFilter(this.categoryUI.CategoryID, true); return(item.Count <= 0); }
private void Reverse() { foreach (ItemNodeUI itemNodeUi in this._shopRateViewer.itemListUI) { ShopViewer.ExtraPadding extraData = itemNodeUi.extraData as ShopViewer.ExtraPadding; ShopViewer.ItemListController source = extraData.source; StuffItem stuffItem = itemNodeUi.Item; if (source == this._shopViewer.controllers[0]) { this._shopViewer.controllers[0].AddItem(stuffItem, extraData); } else if (source == this._shopViewer.controllers[1]) { this._shopViewer.controllers[1].AddItem(stuffItem, extraData); } else { Debug.LogError((object)string.Format("ItemNode ExtraData not ShopViewer:{0}", (object)source)); } } this._shopRateViewer.controller.Clear(); foreach (ItemNodeUI itemNodeUi in this._shopSendViewer.itemListUI) { StuffItem stuffItem = itemNodeUi.Item; if (this._inventoryUI.itemList.AddItem(stuffItem)) { this._inventoryUI.ItemListAddNode(this._inventoryUI.itemListUI.SearchNotUsedIndex, stuffItem); this._inventoryUI.ItemListNodeFilter(this._inventoryUI.categoryUI.CategoryID, true); } } this._shopSendViewer.controller.Clear(); this._shopRateViewer.rateCounter.x = 0; this._shopRateViewer.rateCounter.y = 0; }
protected void RemoveItem(int _ID) { int index1 = -1; List <StuffItem> itemList = Singleton <Manager.Map> .Instance.Player.PlayerData.ItemList; for (int index2 = 0; index2 < itemList.Count; ++index2) { if (itemList[index2].CategoryID == this.ItemCategory && itemList[index2].ID == _ID) { index1 = index2; break; } } if (index1 != -1) { StuffItem stuffItem = itemList[index1]; Singleton <Manager.Map> .Instance.Player.PlayerData.ItemList.RemoveItem(new StuffItem(stuffItem.CategoryID, stuffItem.ID, 1)); } else { List <StuffItem> itemListInStorage = Singleton <Game> .Instance.Environment.ItemListInStorage; for (int index2 = 0; index2 < itemListInStorage.Count; ++index2) { if (itemListInStorage[index2].CategoryID == this.ItemCategory && itemListInStorage[index2].ID == _ID) { index1 = index2; break; } } StuffItem stuffItem1 = itemListInStorage[index1]; StuffItem stuffItem2 = new StuffItem(stuffItem1.CategoryID, stuffItem1.ID, 1); itemListInStorage.RemoveItem(stuffItem2); } ObservableExtensions.Subscribe <Unit>((IObservable <M0>)Observable.NextFrame((FrameCountType)0), (Action <M0>)(_ => this.ItemRemove())); }
public void AddItem(StuffItem item, ShopViewer.ExtraPadding padding) { if (this.mode == ShopViewer.ItemListController.Mode.Normal) { StuffItem stuffItem = (StuffItem)null; foreach (KeyValuePair <int, ItemNodeUI> keyValuePair in (IEnumerable <KeyValuePair <int, ItemNodeUI> >) this._itemListUI.optionTable) { if (keyValuePair.Value.extraData is ShopViewer.ExtraPadding extraData && extraData.item == padding.item) { stuffItem = keyValuePair.Value.Item; break; } } if (stuffItem != null) { stuffItem.Count += item.Count; } else { this.ItemListAddNode(item, padding); } } else { padding.item.Count += item.Count; } this._itemListUI.Refresh(); }
public void SetPlantItemForAll(StuffItem item, int count) { StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(item.CategoryID, item.ID); if (stuffItemInfo == null) { Debug.LogError((object)string.Format("Item not Find\n[{0}:{1}][{2}:{3}]", (object)"CategoryID", (object)item.CategoryID, (object)"ID", (object)item.ID), (Object)this); } else { int num = 0; for (int index = 0; index < this._plantList.Count; ++index) { if (this._plantList[index] == null) { if (num++ >= count) { break; } AIProject.SaveData.Environment.PlantInfo plantInfo = Singleton <Resources> .Instance.GameInfo.GetPlantInfo(stuffItemInfo.nameHash); this._plantIcons[index].info = plantInfo; this._plantList[index] = plantInfo; } } } }
public int AddItem(StuffItem item) { if (this.InventoryUI != null) { return(this.InventoryUI.AddItem(item)); } if (this.ItemList == null) { return(0); } int count = this.PossibleCount(item); if (count <= 0) { return(0); } this.ItemList.AddItem(new StuffItem(item), count); item.Count -= count; List <StuffItem> list = ((IEnumerable <StuffItem>) this.ItemList.FindItems(item)).ToList <StuffItem>(); foreach (ItemNodeUI itemNodeUi in this._itemListUI) { list.Remove(itemNodeUi.Item); } foreach (StuffItem stuffItem in list) { this.ItemListAddNode(stuffItem, new ExtraPadding(stuffItem, this)); } if (this.RefreshEvent != null) { this.RefreshEvent(); } return(count); }
private static bool IsFoodItem(StuffItem item) { if ((ItemCategory)item.CategoryID == ItemCategory.Food) { return(true); } if ((ItemCategory)item.CategoryID == ItemCategory.Plants) { switch ((PlantItem)item.ID) { case PlantItem.QuailShroom: return(true); case PlantItem.BitterMelon: return(true); case PlantItem.BehemothBitter: return(true); default: return(false); } } if ((ItemCategory)item.CategoryID == ItemCategory.Fruits) { switch ((FruitItem)item.ID) { case FruitItem.RedFruit: return(true); case FruitItem.Coconut: return(true); default: return(false); } } return(false); }
public static bool AddItemVars(this TextScenario self, StuffItem Item) { Dictionary <string, ValData> vars = self.Vars; string index1 = nameof(Item); StuffItemInfo stuffItemInfo = (StuffItemInfo)null; if (Item != null && Singleton <Resources> .IsInstance()) { stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(Item.CategoryID, Item.ID); } vars[index1] = new ValData((object)(stuffItemInfo?.Name ?? string.Empty)); Dictionary <string, ValData> dictionary = vars; string index2 = string.Format("{0}.Hash", (object)index1); int? nameHash = stuffItemInfo?.nameHash; ValData valData = new ValData((object)(!nameHash.HasValue ? -1 : nameHash.Value)); dictionary[index2] = valData; if (Item == null) { return(false); } vars[string.Format("{0}.{1}", (object)index1, (object)"CategoryID")] = new ValData((object)Item.CategoryID); vars[string.Format("{0}.{1}", (object)index1, (object)"ID")] = new ValData((object)Item.ID); vars[string.Format("{0}.{1}", (object)index1, (object)"Count")] = new ValData((object)Item.Count); return(true); }
private void PlantingForAll(int currentID, ItemNodeUI currentOption) { int emptySum = this._plantUI.GetEmptySum(); if (emptySum == 0) { return; } StuffItem item = currentOption.Item; StuffItem stuffItem = this._inventoryUI.itemList.Find((Predicate <StuffItem>)(x => x == item)); int count = 0; while (stuffItem.Count > 0) { --stuffItem.Count; if (++count >= emptySum) { break; } } if (stuffItem.Count <= 0) { this._inventoryUI.itemList.Remove(stuffItem); this._inventoryUI.itemListUI.RemoveItemNode(currentID); this._inventoryUI.itemListUI.ForceSetNonSelect(); } this._inventoryUI.itemListUI.Refresh(); this._plantUI.SetPlantItemForAll(item, count); this._plantUI.Refresh(); this._plantInfoUI.ItemCancelInteractable(((IReadOnlyCollection <StuffItem>) this._inventoryUI.itemList).CanAddItem(this._inventoryUI.slotCounter.y, item)); }
protected override void OnUpdate(PlayerActor actor, ref Actor.InputInfo info) { Singleton <Manager.Map> .Instance.CheckStoryProgress(); if (actor == null) { return; } Input instance = Singleton <Input> .Instance; PlayerActor playerActor = actor; if (instance.State == Input.ValidType.Action) { Transform transform = ((Component)playerActor.CameraControl).get_transform(); Vector2 moveAxis = instance.MoveAxis; Quaternion rotation = transform.get_rotation(); Vector3 vector3 = Quaternion.op_Multiply(Quaternion.Euler(0.0f, (float)((Quaternion) ref rotation).get_eulerAngles().y, 0.0f), Vector3.ClampMagnitude(new Vector3((float)moveAxis.x, 0.0f, (float)moveAxis.y), 1f)); info.move = vector3; info.lookPos = Vector3.op_Addition(((Component)actor).get_transform().get_position(), Vector3.op_Multiply(transform.get_forward(), 100f)); StuffItem equipedLampItem = playerActor.PlayerData.EquipedLampItem; if (Mathf.Approximately(((Vector2) ref moveAxis).get_sqrMagnitude(), 0.0f) && (equipedLampItem == null || !Singleton <Resources> .Instance.CommonDefine.ItemIDDefine.ContainsLightItem(equipedLampItem))) { this._elapsedTimeOnLeft += Time.get_deltaTime(); if ((double)this._elapsedTimeOnLeft <= (double)Singleton <Resources> .Instance.LocomotionProfile.TimeToLeftState) { return; } playerActor.Controller.ChangeState("Houchi"); } else { this._elapsedTimeOnLeft = 0.0f; } }
public static StuffItem GetStuff(int id) { StuffItem stuff = new StuffItem(); using (SqliteConnection c = new SqliteConnection(DataBase.dbConnectionString)) { using (SqliteCommand sqlCommand = c.CreateCommand()) { sqlCommand.CommandText = "SELECT id,name,category,date,author from stuff where id = " + id + ";"; sqlCommand.Connection.Open(); var result = sqlCommand.ExecuteReader(); if (result.Read()) { stuff = new StuffItem() { Id = result.GetInt32(0), Name = result.GetString(1), Category = result.GetString(2), Date = result.GetString(3), Author = result.GetString(4) }; } result.Close(); } } return(stuff); }
public static bool CanAddItem( this IReadOnlyCollection <StuffItem> self, int capacity, StuffItem item) { return(self.CanAddItem(capacity, item, item.Count)); }
public static bool CanAddItem( this IReadOnlyCollection <StuffItem> self, int capacity, StuffItem item, int count, out int possible) { int ItemSlotMax = Singleton <Resources> .Instance.DefinePack.MapDefines.ItemSlotMax; int num1 = ((IEnumerable <StuffItem>)self).FindItems(item).Sum <StuffItem>((Func <StuffItem, int>)(x => ItemSlotMax - x.Count)); int num2 = count - num1; if (num2 <= 0) { num2 = 0; } int num3 = num2 / ItemSlotMax + (num2 % ItemSlotMax <= 0 ? 0 : 1); int num4 = capacity - self.get_Count() - num3; possible = num1; if (num4 > 0) { possible += ItemSlotMax * num4; } if (num4 >= 0 && num2 > 0) { possible += ItemSlotMax - num2; } if (num4 >= 0) { return(true); } return(possible > 0 && possible >= count); }
public static bool RemoveItem(this List <StuffItem> self, StuffItem item, ref int count) { bool flag = false; foreach (StuffItem stuffItem in (IEnumerable <StuffItem>)((IEnumerable <StuffItem>)self.FindItems(item)).OrderBy <StuffItem, int>((Func <StuffItem, int>)(x => x.Count))) { int num = count - stuffItem.Count; if (num >= 0) { stuffItem.Count = 0; count = num; flag = true; } else { stuffItem.Count -= count; count = 0; break; } } if (flag) { self.RemoveAll((Predicate <StuffItem>)(x => x.Count <= 0)); } return(flag); }
public virtual void OnStart() { AgentActor agent = this.Agent; agent.EventKey = EventType.Drink; this._targetItem = agent.SelectDrinkItem(); ((Task)this).OnStart(); agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); agent.ElectNextPoint(); PoseKeyPair drinkStandId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.DrinkStandID; agent.ActionID = drinkStandId.postureID; agent.PoseID = drinkStandId.poseID; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[drinkStandId.postureID][drinkStandId.poseID]; ActorAnimInfo animInfo = agent.Animation.LoadActionState(drinkStandId.postureID, drinkStandId.poseID, info); agent.LoadActionFlag(drinkStandId.postureID, drinkStandId.poseID); agent.StopNavMeshAgent(); agent.ChangeStaticNavMeshAgentAvoidance(); agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, info.MainStateInfo.FadeOutTime, animInfo.layer); this._onEndActionDisposable = ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>)agent.AnimationAgent.OnEndActionAsObservable(), 1), (System.Action <M0>)(_ => agent.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer))); if (animInfo.hasAction) { this._onActionPlayDisposable = ObservableExtensions.Subscribe <Unit>((IObservable <M0>)agent.AnimationAgent.OnActionPlayAsObservable(), (System.Action <M0>)(_ => agent.Animation.PlayActionAnimation(animInfo.layer))); } this._onCompleteActionDisposable = ObservableExtensions.Subscribe <Unit>((IObservable <M0>)agent.AnimationAgent.OnCompleteActionAsObservable(), (System.Action <M0>)(_ => this.Complete())); if (!animInfo.isLoop) { return; } agent.SetCurrentSchedule(animInfo.isLoop, "その場で飲む", animInfo.loopMinTime, animInfo.loopMaxTime, animInfo.hasAction, false); }
private void CreateItem(int pointID, RecyclingData data) { if (data == null) { return; } data.CreateCounter = 0.0f; if (this.CheckCreateable(data)) { this.RemoveItem(pointID, data); StuffItem randomCreate = this.GetRandomCreate(); if (randomCreate != null) { if (this._recyclingUI.CraftPointID == pointID) { this.CreateEvent.OnNext(randomCreate); } else { data.CreatedItemList.AddItem(randomCreate); } } } if (data.CreateCountEnabled) { data.CreateCountEnabled = this.CheckCreateable(data); } if (this._recyclingUI.CraftPointID != pointID) { return; } ((ReactiveProperty <bool>) this.IsCreate).set_Value(data.CreateCountEnabled); }
public ItemNodeUI AddItemNode(int id, StuffItem item) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type ItemListUI.\u003CAddItemNode\u003Ec__AnonStorey2 nodeCAnonStorey2 = new ItemListUI.\u003CAddItemNode\u003Ec__AnonStorey2(); // ISSUE: reference to a compiler-generated field nodeCAnonStorey2.id = id; // ISSUE: reference to a compiler-generated field nodeCAnonStorey2.\u0024this = this; StuffItemInfo itemInfo = ItemNodeUI.GetItemInfo(item); if (itemInfo == null) { return((ItemNodeUI)null); } GameObject gameObject = itemInfo.isNone ? ItemListUI.SystemNode : this.OptionNode; // ISSUE: reference to a compiler-generated field nodeCAnonStorey2.opt = (ItemNodeUI)((GameObject)Object.Instantiate <GameObject>((M0)gameObject, this.itemParent)).GetComponent <ItemNodeUI>(); // ISSUE: reference to a compiler-generated field nodeCAnonStorey2.opt.Bind(item, itemInfo); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated method DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <PointerEventData>((IObservable <M0>)nodeCAnonStorey2.opt.onEnter, (Action <M0>) new Action <PointerEventData>(nodeCAnonStorey2.\u003C\u003Em__0)), (Component)this); // ISSUE: reference to a compiler-generated field // ISSUE: method pointer ((UnityEvent)nodeCAnonStorey2.opt.OnClick).AddListener(new UnityAction((object)nodeCAnonStorey2, __methodptr(\u003C\u003Em__1))); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field this._optionTable.Add(nodeCAnonStorey2.id, nodeCAnonStorey2.opt); // ISSUE: reference to a compiler-generated field return(nodeCAnonStorey2.opt); }
public static List <StuffItem> GetStuff() { List <StuffItem> listStuff = new List <StuffItem>(); using (SqliteConnection c = new SqliteConnection(DataBase.dbConnectionString)) { using (SqliteCommand sqlCommand = c.CreateCommand()) { sqlCommand.CommandText = "SELECT id,name,category,date,author from stuff;"; sqlCommand.Connection.Open(); var result = sqlCommand.ExecuteReader(); while (result.Read()) { StuffItem stuff = new StuffItem() { Id = result.GetInt32(0), Name = result.GetString(1), Category = result.GetString(2), Date = result.GetString(3), Author = result.GetString(4) }; listStuff.Add(stuff); } result.Close(); } } return(listStuff); }
private void EnterItem(int selectIndex, ItemNodeUI selectItem) { StuffItem stuffItem = selectItem.Item; stuffItem.Count -= this._itemInfoUI.Count; Action <StuffItem> onSubmit = this.OnSubmit; if (onSubmit != null) { onSubmit(new StuffItem(stuffItem.CategoryID, stuffItem.ID, this._itemInfoUI.Count)); } bool flag = stuffItem.Count <= 0; this._itemInfoUI.Refresh(stuffItem); List <StuffItem> stuffItemList = this.itemList(); if (flag) { stuffItemList.Remove(stuffItem); this.itemListUI.RemoveItemNode(selectIndex); this.itemListUI.ForceSetNonSelect(); this._itemInfoUI.Close(); } this._inventoryUI.Refresh(); }
private void ItemDecideProc( int count, int sel, ShopViewer.ItemListController sender, ShopViewer.ItemListController receiver) { ItemNodeUI node = sender.itemListUI.GetNode(sel); StuffItem stuffItem = new StuffItem(node.Item); stuffItem.Count = count; receiver.AddItem(stuffItem, new ShopViewer.ExtraPadding(node.Item, sender)); if (ShopUI.RemoveItem(count, sel, stuffItem, sender, this._inventoryUI)) { this.SetFocusLevel(sender.itemListUI.FocusLevel); } bool flag1 = Object.op_Equality((Object)this._inventoryUI.itemListUI, (Object)receiver.itemListUI); if (!flag1) { receiver.itemListUI.Refresh(); } bool flag2 = Object.op_Equality((Object)this._inventoryUI.itemListUI, (Object)sender.itemListUI); if (!flag2) { sender.itemListUI.Refresh(); } if (flag1 || flag2) { this._inventoryUI.Refresh(); } this._shopInfoPanelUI.Refresh(); this.SendCheck(); }
protected void OpenInventory(int cnt, List <StuffItem> itemList) { MapUIContainer.ReserveSystemMenuMode(SystemMenuUI.MenuMode.InventoryEnter); SystemMenuUI systemUI = MapUIContainer.SystemMenuUI; InventoryUIController inventoryUI = systemUI.InventoryEnterUI; inventoryUI.isConfirm = true; inventoryUI.CountViewerVisible(true); inventoryUI.itemList = (Func <List <StuffItem> >)(() => itemList); inventoryUI.SetItemFilter(InventoryBase.ToFilter(this.GetArgToSplitLastTable(cnt))); inventoryUI.OnSubmit = (Action <StuffItem>)(item => { this.Item = item; InventoryUIController inventoryUiController = inventoryUI; if (inventoryUiController == null) { return; } inventoryUiController.OnClose(); }); inventoryUI.OnClose = (Action)(() => { inventoryUI.OnSubmit = (Action <StuffItem>)null; inventoryUI.IsActiveControl = false; systemUI.IsActiveControl = false; Singleton <Input> .Instance.FocusLevel = 0; Singleton <Input> .Instance.ReserveState(Input.ValidType.UI); this.isClose = true; inventoryUI.OnClose = (Action)null; }); MapUIContainer.SetActiveSystemMenuUI(true); }
public void Bind(StuffItem item, StuffItemInfo info = null) { this._info = info ?? ItemNodeUI.GetItemInfo(item); this.isTrash = this._info.isTrash; this.isNone = this._info.isNone; if (this.isNone) { this.isTrash = false; if (Object.op_Inequality((Object)this._stackCountText, (Object)null)) { ((Behaviour)this._stackCountText).set_enabled(false); } } ((ReactiveProperty <string>) this._name).set_Value(this._info.Name); if (Object.op_Inequality((Object)this._iconImage, (Object)null)) { Resources.ItemIconTables.SetIcon(Resources.ItemIconTables.IconCategory.Item, this._info.IconID, this._iconImage, true); if (Object.op_Equality((Object)this._iconImage.get_sprite(), (Object)null)) { ((Behaviour)this._iconImage).set_enabled(false); } } this._rarelity.set_Value(this._info.Rarelity); IntReactiveProperty rate = this._rate; int?nullable = item is MerchantData.VendorItem vendorItem ? new int?(vendorItem.Rate) : new int?(); int num = !nullable.HasValue ? this._info.Rate : nullable.Value; ((ReactiveProperty <int>)rate).set_Value(num); this._rarelitySprite.set_Value(this._rarelities.GetElement <Sprite>((int)this._info.Grade)); this._item = item; ((ReactiveProperty <int>) this._stackCount).set_Value(this._item.Count); }
private void Send(int currentID, ItemNodeUI currentOption) { StuffItem item = currentOption.Item; StuffItem stuffItem = this._inventoryUI.itemList.Find((Predicate <StuffItem>)(x => x == item)); --stuffItem.Count; if (stuffItem.Count <= 0) { this._inventoryUI.itemList.Remove(stuffItem); this._inventoryUI.itemListUI.RemoveItemNode(currentID); this._inventoryUI.itemListUI.ForceSetNonSelect(); } this._inventoryUI.itemListUI.Refresh(); int currentIndex = this._chickenCoopListUI.currentIndex; while (this.currentChickens.Count <= currentIndex) { this.currentChickens.Add((AIProject.SaveData.Environment.ChickenInfo)null); } AIProject.SaveData.Environment.ChickenInfo info = new AIProject.SaveData.Environment.ChickenInfo(); info.name = "ニワトリ"; ValueTuple <AIProject.SaveData.AnimalData, PetChicken> chicken = this.CreateChicken(info); info.AnimalData = (AIProject.SaveData.AnimalData)chicken.Item1; if (Object.op_Inequality((Object)this._currentFarmPoint, (Object)null)) { this._currentFarmPoint.AddChicken(currentIndex, (PetChicken)chicken.Item2); } this.currentChickens[currentIndex] = info; this._chickenCoopListUI.Refresh(currentIndex); this._inventoryUI.Visible = false; }
protected override void OnAwake(PlayerActor player) { player.SetActiveOnEquipedItem(false); player.ChaControl.setAllLayerWeight(0.0f); this.isEnd = false; this.isWait = (Func <PlayerActor, bool>)null; this.isNextEnabled = false; if (this.disposable != null) { this.disposable.Clear(); } this.disposable = new CompositeDisposable(); if (Object.op_Equality((Object)(this.hasAnimal = player.Animal), (Object)null)) { this.isEnd = true; this.ToErrorEnd(player); } else { this.animalName = this.hasAnimal.Name; this.isCameraBlend = true; this.getPercent = 30f; if (this.hasAnimal is WildGround) { this.getPercent = (this.hasAnimal as WildGround).GetPercent; } this.getAnimalFlag = (double)Random.Range(0.0f, 100f) <= (double)this.getPercent; if (this.getAnimalFlag && Singleton <Resources> .IsInstance() && Singleton <Manager.Map> .IsInstance()) { List <StuffItem> itemList = Singleton <Manager.Map> .Instance.Player?.PlayerData?.ItemList; if (itemList != null) { this.getIteminfo = this.hasAnimal.ItemInfo; if (this.getIteminfo != null) { this.addItem = new StuffItem(this.getIteminfo.CategoryID, this.getIteminfo.ID, 1); itemList.AddItem(this.addItem); } } } if (Singleton <Manager.Map> .IsInstance()) { List <StuffItem> itemList = Singleton <Manager.Map> .Instance.Player?.PlayerData?.ItemList; if (itemList != null && this.hasAnimal is WildGround) { ItemIDKeyPair getItemId = (this.hasAnimal as WildGround).GetItemID; itemList.RemoveItem(new StuffItem(getItemId.categoryID, getItemId.itemID, 1)); } } MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None); if (this.hasAnimal.AnimalType == AnimalTypes.Cat || this.hasAnimal.AnimalType == AnimalTypes.Chicken) { this.Initialize(player); } else { this.ToErrorEnd(player); } } }
private void OnDeleteOKClick() { if (this._deleteRequestUI.IsActiveControl) { this._deleteRequestUI.DoClose(); } RecyclingInfoPanelUI infoPanelUi = this._recyclingUI.InfoPanelUI; if (Object.op_Equality((Object)infoPanelUi, (Object)null) || !infoPanelUi.IsNumberInput) { return; } ValueTuple <ItemListController, ItemListController, ItemNodeUI, int, ButtonType> itemInfo = infoPanelUi.GetItemInfo(); ItemNodeUI itemNodeUi = (ItemNodeUI)itemInfo.Item3; StuffItem source = !Object.op_Inequality((Object)itemNodeUi, (Object)null) ? (StuffItem)null : itemNodeUi.Item; if (Object.op_Equality((Object)itemNodeUi, (Object)null) || source == null) { return; } int sel = (int)itemInfo.Item4; StuffItem stuffItem = new StuffItem(source); stuffItem.Count = Mathf.Min(source.Count, infoPanelUi.InputNumber); bool flag = source.Count <= stuffItem.Count; this.ListController.RemoveItem(sel, stuffItem); if (!flag) { return; } this._itemListUI.ForceSetNonSelect(); infoPanelUi.DetachItem(); }
public bool CanGet() { PlayerActor player = Manager.Map.GetPlayer(); if (Object.op_Equality((Object)player, (Object)null)) { return(false); } PlayerData playerData = player.PlayerData; if (playerData == null) { return(false); } List <StuffItem> itemList = playerData.ItemList; if (itemList == null) { return(false); } StuffItem stuffItem = new StuffItem(this.ItemID.categoryID, this.ItemID.itemID, 1); int possible; return(StuffItemExtensions.CanAddItem((IReadOnlyCollection <StuffItem>)itemList, playerData.InventorySlotMax, stuffItem, out possible) && 0 < possible); }
protected void LoadEquipmentItem(StuffItem item, ChaControlDefine.ExtraAccessoryParts parts) { int id = item.CategoryID == -1 ? -1 : item.ID; this.ChaControl.ChangeExtraAccessory(parts, id); this.ChaControl.ShowExtraAccessory(parts, true); }
public Task UpdateAsync(StuffItem item) { return(Task.Run(() => { if (item.Id.HasValue) // update { var updateitem = GetItemById(item.Id.Value); if (updateitem == null) { return; } if (item.Name?.ToLower() != StuffItem.Undefined) { updateitem.Name = item.Name; } if (item.Description?.ToLower() != StuffItem.Undefined) { updateitem.Description = item.Description; } _stuffContext.StuffItems.Update(updateitem); } else //Add new { if (item.Name?.ToLower() == StuffItem.Undefined) { item.Name = null; } if (item.Description?.ToLower() == StuffItem.Undefined) { item.Description = null; } _stuffContext.StuffItems.Add(item); } _stuffContext.SaveChanges(); if (item.Id.HasValue && item.Tags != null && item.Tags.Count > 0) { var tags = GetTagsByStuff(item.Id); if (tags.Count > 0) { _tagContext.TagItems.RemoveRange(tags); _tagContext.SaveChanges(); } foreach (var tag in item.Tags) { tag.Id = 0; tag.StuffId = item.Id.Value; } _tagContext.TagItems.AddRange(item.Tags); _tagContext.SaveChanges(); } })); }
public FishFoodInfo( StuffItem _stuffItem, Sprite _icon, FishFoodInfo _fishFoodInfo, bool _isInfinity) { this.Initialize(_stuffItem, _icon, _fishFoodInfo, _isInfinity); }
public virtual void Refresh(StuffItem item) { StuffItemInfo itemInfo = this.GetItemInfo(item); this._itemName.set_text(itemInfo.Name); this._flavorText.set_text(itemInfo.Explanation); this.Refresh(item.Count); }