public CreateItem() { // Setup item picker for effect selection UserInterface.UserInterfaceManager uiManager = DaggerfallUI.Instance.UserInterfaceManager; itemPicker = new DaggerfallListPickerWindow(uiManager); itemPicker.OnItemPicked += ItemPicker_OnItemPicked; itemPicker.AllowCancel = false; foreach (CreateItemSelection item in Enum.GetValues(typeof(CreateItemSelection))) { itemPicker.ListBox.AddItem(TextManager.Instance.GetText(textDatabase, item.ToString())); } }
public CreateItem() { // Setup item picker for effect selection UserInterface.UserInterfaceManager uiManager = DaggerfallUI.Instance.UserInterfaceManager; itemPicker = new DaggerfallListPickerWindow(uiManager); itemPicker.OnItemPicked += ItemPicker_OnItemPicked; itemPicker.AllowCancel = false; foreach (CreateItemSelection item in Enum.GetValues(typeof(CreateItemSelection))) { itemPicker.ListBox.AddItem(TextManager.Instance.GetLocalizedText(item.ToString())); } itemPicker.ListBox.SelectIndex(lastSelectedIndex); itemPicker.ListBox.ScrollToSelected(); }
private void ItemPicker_OnItemPicked(int index, string itemString) { //Add selected item to inventory with time limit DaggerfallUnityItem item = CreateTempItem((CreateItemSelection)index); if (item != null) { GameManager.Instance.PlayerEntity.Items.AddItem(item); } // Close picker and unsubscribe event UserInterface.UserInterfaceManager uiManager = DaggerfallUI.Instance.UserInterfaceManager; itemPicker.OnItemPicked -= ItemPicker_OnItemPicked; itemPicker.CloseWindow(); // End effect now - conjured item reports own lifetime End(); }
void PromptPlayer() { // Get peered entity gameobject DaggerfallEntityBehaviour entityBehaviour = GetPeeredEntityBehaviour(manager); if (!entityBehaviour) { return; } // Target must be player - no effect on other entities if (entityBehaviour != GameManager.Instance.PlayerEntityBehaviour) { return; } // Prompt for item selection UserInterface.UserInterfaceManager uiManager = DaggerfallUI.Instance.UserInterfaceManager; itemPicker.PreviousWindow = uiManager.TopWindow; uiManager.PushWindow(itemPicker); }