public Item GetAsItem(Item referenceItem) { if (CurrentItemID == -1) { return(referenceItem); } Item item = (referenceItem == null) ? new Item() : referenceItem; ushort num = Convert.ToUInt16(CurrentItemID); ItemKind itemKind = ItemInfo.GetItemKind(num); item.ItemId = num; if (itemKind.IsFlowerGene()) { item.Genes = saveGenes(); item.DaysWatered = int.Parse(FlowerController.DaysWatered.text); item.IsWateredGold = FlowerController.GoldCanWatered.isOn; item.IsWatered = FlowerController.Watered.isOn; bool[] visitorWatered = FlowerController.GetVisitorWatered(); for (int i = 0; i < visitorWatered.Length; i++) { item.SetIsWateredByVisitor(i, visitorWatered[i]); } item.SystemParam = 0; item.AdditionalParam = 0; } else { int value = int.Parse(SetController.FCount.text); int value2 = int.Parse(SetController.FUses.text); int value3 = int.Parse(SetController.FFlagZero.text); item.Count = Convert.ToUInt16(value); item.UseCount = Convert.ToUInt16(value2); item.SystemParam = Convert.ToByte(value3); } int value4 = int.Parse(SetController.FFlagOne.text); if (itemKind == ItemKind.Kind_MessageBottle) { item.AdditionalParam = Convert.ToByte(value4); } else if (!WrapController.WrapToggle.isOn) { item.SetWrapping(ItemWrapping.Nothing, ItemWrappingPaper.Yellow); } else { ItemWrapping wrap = (ItemWrapping)WrapController.ItemWrap; ItemWrappingPaper color = (ItemWrappingPaper)WrapController.ItemColor; bool isOn = WrapController.ShowItemToggle.isOn; bool flag = WrapController.Flag80; item.SetWrapping(wrap, color, isOn, flag); } return(item); }
private void ToggleEditorVisibility(ItemKind k, ushort id) { if (k.IsFlowerGene(id)) { CB_Recipe.Visible = false; FLP_Uses.Visible = FLP_Count.Visible = false; FLP_Flower.Visible = true; return; } switch (k) { case ItemKind.Kind_FossilUnknown: CB_Fossil.Visible = true; CB_Recipe.Visible = false; FLP_Uses.Visible = FLP_Count.Visible = false; FLP_Flower.Visible = false; break; case ItemKind.Kind_DIYRecipe: CB_Recipe.Visible = true; CB_Fossil.Visible = false; FLP_Uses.Visible = FLP_Count.Visible = false; FLP_Flower.Visible = false; break; case ItemKind.Kind_MessageBottle: CB_Recipe.Visible = true; CB_Fossil.Visible = false; FLP_Uses.Visible = true; FLP_Count.Visible = false; FLP_Flower.Visible = false; break; default: CB_Fossil.Visible = false; CB_Recipe.Visible = false; FLP_Uses.Visible = FLP_Count.Visible = true; FLP_Flower.Visible = false; break; } }
public void LoadItem(Item item) { if (stopSearch || item.ItemId == Item.NONE) { return; } CurrentItemID = item.ItemId; if (CurrentItemID == MESSAGEBOTTLEITEM) { CurrentFilter = ItemFilter.MsgBottle; } else if (CurrentItemID == RECIPEITEM) { CurrentFilter = ItemFilter.Recipes; } else if (CurrentItemID == FOSSILITEM) { CurrentFilter = ItemFilter.Fossils; } else { CurrentFilter = ItemFilter.Items; } List <ComboItem> list = FilterToItems(CurrentFilter); ComboItem comboItem = (CurrentFilter == ItemFilter.Items) ? list.Find((ComboItem x) => x.Value == item.ItemId) : list.Find((ComboItem x) => x.Value == item.Count); SearchField.text = comboItem.Text; CurrentItemID = item.ItemId; ItemKind itemKind = ItemInfo.GetItemKind(Convert.ToUInt16(CurrentItemID)); if (itemKind.IsFlowerGene()) { loadGenes(item.Genes); FlowerController.DaysWatered.text = item.DaysWatered.ToString(); FlowerController.GoldCanWatered.isOn = item.IsWateredGold; FlowerController.Watered.isOn = item.IsWatered; bool[] array = new bool[10]; for (int i = 0; i < 10; i++) { array[i] = item.GetIsWateredByVisitor(i); } FlowerController.SetVisitorWatered(array); } else { SetController.FCount.text = item.Count.ToString(); if (itemKind == ItemKind.Kind_Fence) { SetController.FUses.text = item.UseCount.ToString(); } SetController.CompileBodyFabricFromCount(); SetController.FUses.text = item.UseCount.ToString(); SetController.FFlagZero.text = item.SystemParam.ToString(); } if (itemKind == ItemKind.Kind_MessageBottle || CurrentItemID >= 60_000) { SetController.FFlagOne.text = item.AdditionalParam.ToString(); SetController.FFlagOne.gameObject.SetActive(true); } else { WrapController.WrapToggle.isOn = item.WrappingType != ItemWrapping.Nothing; WrapController.WrapType.value = (int)item.WrappingType; WrapController.WrapColor.value = (int)item.WrappingPaper; WrapController.ShowItemToggle.isOn = item.WrappingShowItem; WrapController.Flag80 = item.Wrapping80; } DropdownFilter.SetValueWithoutNotify((int)CurrentFilter); DropdownFilter.RefreshShownValue(); UpdateSprite(); }