private void OnNameEdit(UIMouseEvent evt, UIElement listeningElement) { if (!EditingName) { EditingName = true; NameEditor = new UIVirtualKeyboard("", PotionSlot.Item.Name, null, null, 0, false); NameEditor.RemoveAllChildren(); Background.Append(NameEditor); } else { NameEditor.Remove(); NameBeingEdited.SetText(""); EditingName = false; } }
public override void OnInitialize() { OldAverageColors.Add(new Color(1, 1, 1, 1)); Background.HAlign = 0.7f; Background.VAlign = 0.5f; Append(Background); IngredientSlot[0] = new CustomItemSlot(0, 0.9f) { IsValidItem = item => item.IsAir || !item.IsAir && PotionOverhaul.PotionIngredients.Contains(item.type), BackgroundTexture = backgroundTexture, EmptyTexture = iconTextureIngredient, HoverText = "Ingredient" }; IngredientSlot[0].HAlign = 0.275f; IngredientSlot[0].VAlign = 0.125f; Background.Append(IngredientSlot[0]); IngredientSlot[1] = new CustomItemSlot(0, 0.9f) { IsValidItem = item => item.IsAir || !item.IsAir && PotionOverhaul.PotionIngredients.Contains(item.type), BackgroundTexture = backgroundTexture, EmptyTexture = iconTextureIngredient, HoverText = "Ingredient" }; IngredientSlot[1].HAlign = 0.50f; IngredientSlot[1].VAlign = 0.075f; Background.Append(IngredientSlot[1]); IngredientSlot[2] = new CustomItemSlot(0, 0.9f) { IsValidItem = item => item.IsAir || !item.IsAir && PotionOverhaul.PotionIngredients.Contains(item.type), BackgroundTexture = backgroundTexture, EmptyTexture = iconTextureIngredient, HoverText = "Ingredient" }; IngredientSlot[2].HAlign = 0.725f; IngredientSlot[2].VAlign = 0.125f; Background.Append(IngredientSlot[2]); PotionSlot = new CustomItemSlot(0, 0.9f) { IsValidItem = item => item.IsAir, BackgroundTexture = backgroundTexture, EmptyTexture = iconTexturePotion, HoverText = "Potion" }; PotionSlot.HAlign = 0.50f; PotionSlot.VAlign = 0.85f; PotionSlot.OnClick += OnPotionSlot; Background.Append(PotionSlot); NameBeingEdited.HAlign = 0.50f; NameBeingEdited.VAlign = 0.925f; Background.Append(NameBeingEdited); BrewButton.HAlign = 0.50f; BrewButton.VAlign = 0.45f; BrewButton.OnClick += OnBrewButton; Background.Append(BrewButton); SaveButton.HAlign = 0.030f; SaveButton.VAlign = 0.970f; SaveButton.OnClick += OnSaveButton; Background.Append(SaveButton); NameEditButton.HAlign = 0.65f; NameEditButton.VAlign = 0.825f; NameEditButton.OnClick += OnNameEdit; NameEditor = new UIVirtualKeyboard("", PotionSlot.Item.Name, null, null, 0, false); NameEditor.HAlign = 1f; NameEditor.VAlign = 1f; NameEditor.RemoveAllChildren(); OldIngredients = IngredientSlot.Select(e => e.Item.type).ToArray(); }