Esempio n. 1
0
        public void SpellNameLabel_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            if (!GameManager.Instance.PlayerEntity.GetSpell(spellsListBox.SelectedIndex, out renamedSpellSettings))
            {
                return;
            }

            DaggerfallInputMessageBox renameSpellPrompt;

            renameSpellPrompt = new DaggerfallInputMessageBox(uiManager, this);
            renameSpellPrompt.SetTextBoxLabel(TextManager.Instance.GetText(textDatabase, "enterSpellName") + " ");
            renameSpellPrompt.TextBox.Text    = renamedSpellSettings.Name;
            renameSpellPrompt.OnGotUserInput += RenameSpellPromptHandler;
            uiManager.PushWindow(renameSpellPrompt);
        }
Esempio n. 2
0
        public void RenameSpellPromptHandler(DaggerfallInputMessageBox sender, string input)
        {
            // Must not be blank
            if (spellsListBox.SelectedIndex == -1 || string.IsNullOrEmpty(input))
            {
                return;
            }

            renamedSpellSettings.Name = input;
            GameManager.Instance.PlayerEntity.SetSpell(spellsListBox.SelectedIndex, renamedSpellSettings);
            RefreshSpellsList(true);
            UpdateSelection();
            // classic plays edit sound before you enter the new name
            DaggerfallUI.Instance.PlayOneShot(editSpellBook);
        }
        private void LoiterButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
            DaggerfallInputMessageBox mb = new DaggerfallInputMessageBox(uiManager, this);

            mb.SetTextBoxLabel(HardStrings.loiterHowManyHours);
            mb.TextPanelDistanceX    = 5;
            mb.TextPanelDistanceY    = 8;
            mb.TextBox.Text          = "0";
            mb.TextBox.Numeric       = true;
            mb.TextBox.MaxCharacters = 8;
            mb.TextBox.WidthOverride = 286;
            mb.OnGotUserInput       += LoiterPrompt_OnGotUserInput;
            mb.Show();
        }
 private void WhileButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     if (CanRest())
     {
         DaggerfallInputMessageBox mb = new DaggerfallInputMessageBox(uiManager, this);
         mb.SetTextBoxLabel(HardStrings.restHowManyHours);
         mb.TextPanelDistanceX    = 9;
         mb.TextPanelDistanceY    = 8;
         mb.TextBox.Text          = "0";
         mb.TextBox.Numeric       = true;
         mb.TextBox.MaxCharacters = 8;
         mb.TextBox.WidthOverride = 286;
         mb.OnGotUserInput       += TimedRestPrompt_OnGotUserInput;
         mb.Show();
     }
 }
Esempio n. 5
0
 void DoRestForAWhile(bool alreadyWarned)
 {
     if (CanRest(alreadyWarned))
     {
         DaggerfallInputMessageBox mb = new DaggerfallInputMessageBox(uiManager, this);
         mb.SetTextBoxLabel(TextManager.Instance.GetLocalizedText("restHowManyHours"));
         mb.TextPanelDistanceX    = 9;
         mb.TextPanelDistanceY    = 8;
         mb.TextBox.Text          = "0";
         mb.TextBox.Numeric       = true;
         mb.TextBox.MaxCharacters = 8;
         mb.TextBox.WidthOverride = 286;
         mb.OnGotUserInput       += TimedRestPrompt_OnGotUserInput;
         mb.Show();
     }
 }
        private void RenameSaveButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            // Must have a save selected
            if (savesList.SelectedIndex < 0)
            {
                return;
            }

            // Input save name
            DaggerfallInputMessageBox messageBox = new DaggerfallInputMessageBox(uiManager, this);

            messageBox.SetTextBoxLabel(TextManager.Instance.GetLocalizedText("enterSaveName") + ": ");
            messageBox.TextBox.Text    = saveNameTextBox.Text;
            messageBox.OnGotUserInput += RenameSaveButton_OnGotUserInput;
            uiManager.PushWindow(messageBox);
        }
        protected virtual void InputMessageBox_OnGotUserInput(DaggerfallInputMessageBox sender, string input)
        {
            daysToRent = 0;
            bool result = int.TryParse(input, out daysToRent);

            if (!result || daysToRent < 1)
            {
                return;
            }

            int daysAlreadyRented = 0;

            if (rentedRoom != null)
            {
                daysAlreadyRented = (int)((rentedRoom.expiryTime - DaggerfallUnity.Instance.WorldTime.Now.ToSeconds()) / DaggerfallDateTime.SecondsPerDay);
                if (daysAlreadyRented < 0)
                {
                    daysAlreadyRented = 0;
                }
            }

            if (daysToRent + daysAlreadyRented > 350)
            {
                DaggerfallUI.MessageBox(tooManyDaysFutureId);
            }
            else if (GameManager.Instance.GuildManager.GetGuild(FactionFile.GuildGroups.KnightlyOrder).FreeTavernRooms())
            {
                DaggerfallUI.MessageBox(TextManager.Instance.GetLocalizedText("roomFreeForKnightSuchAsYou"));
                RentRoom();
            }
            else
            {
                int cost = FormulaHelper.CalculateRoomCost(daysToRent);
                tradePrice = FormulaHelper.CalculateTradePrice(cost, buildingData.quality, false);

                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                TextFile.Token[]     tokens     = DaggerfallUnity.Instance.TextProvider.GetRandomTokens(offerPriceId);
                messageBox.SetTextTokens(tokens, this);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                messageBox.OnButtonClick += ConfirmRenting_OnButtonClick;
                uiManager.PushWindow(messageBox);
            }
        }
Esempio n. 8
0
        private void RoomButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            int mapId       = GameManager.Instance.PlayerGPS.CurrentLocation.MapTableData.MapId;
            int buildingKey = GameManager.Instance.PlayerEnterExit.BuildingDiscoveryData.buildingKey;

            rentedRoom = GameManager.Instance.PlayerEntity.GetRentedRoom(mapId, buildingKey);

            DaggerfallInputMessageBox inputMessageBox = new DaggerfallInputMessageBox(uiManager, this);

            inputMessageBox.SetTextTokens((rentedRoom == null) ? howManyDaysId : howManyAdditionalDaysId, this);
            inputMessageBox.TextPanelDistanceY = 0;
            inputMessageBox.InputDistanceX     = 24;
            //inputMessageBox.InputDistanceY = -4;
            inputMessageBox.TextBox.Numeric       = true;
            inputMessageBox.TextBox.MaxCharacters = 3;
            inputMessageBox.TextBox.Text          = "1";
            inputMessageBox.OnGotUserInput       += InputMessageBox_OnGotUserInput;
            inputMessageBox.Show();
        }
        //spell name shown above spell icons
        public void spellName_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            Debug.Log("SpellName label clicked");

            if (!ValidIndex)
            {
                return;
            }

            DaggerfallInputMessageBox renameSpellPrompt;

            renameSpellPrompt = new DaggerfallInputMessageBox(this.uiManager, this);
            renameSpellPrompt.SetTextBoxLabel(CHANGETEXT);
            renameSpellPrompt.TextBox.Text    = listBox.SelectedItem;
            renameSpellPrompt.OnGotUserInput += renameSpellPromptHandler;
            uiManager.PushWindow(renameSpellPrompt);

            Refresh = true;
        }
        private void RenameSaveButton_OnGotUserInput(DaggerfallInputMessageBox sender, string saveName)
        {
            if (string.IsNullOrEmpty(saveName))
            {
                return;
            }

            // Get save key
            int key = GameManager.Instance.SaveLoadManager.FindSaveFolderByNames(currentPlayerName, saveNameTextBox.Text);

            if (key == -1)
            {
                return;
            }

            // Rename save
            GameManager.Instance.SaveLoadManager.Rename(key, saveName);
            savesList.UpdateItem(savesList.SelectedIndex, saveName);
            SavesList_OnSelectItem();
        }
Esempio n. 11
0
        protected virtual void EnterNote(int index)
        {
            if (DisplayMode == JournalDisplay.Notebook)
            {
                selectedEntry = -index + currentMessageIndex;
                Debug.Log("Add at " + selectedEntry);

                TextFile.Token prompt = new TextFile.Token()
                {
                    text       = TextManager.Instance.GetLocalizedText("enterNote"),
                    formatting = TextFile.Formatting.Text,
                };
                DaggerfallInputMessageBox enterNote =
                    new DaggerfallInputMessageBox(uiManager, new TextFile.Token[] { prompt }, PlayerNotebook.MaxLineLenth, "", true, this);
                //enterNote.TextPanelDistanceY = 5;
                enterNote.TextBox.WidthOverride = 318;
                enterNote.OnGotUserInput       += EnterNote_OnGotUserInput;
                enterNote.OnCancel += EnterNote_OnCancel;
                enterNote.Show();
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Handles events from Find Location pop-up.
        /// </summary>
        void HandleLocationFindEvent(DaggerfallInputMessageBox inputMessageBox, string locationName)
        {
            ////locationSelected = false;

            //if (string.IsNullOrEmpty(locationName))
            //{
            //    TextFile.Token[] textTokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(13);
            //    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
            //    messageBox.SetTextTokens(textTokens);
            //    messageBox.ClickAnywhereToClose = true;
            //    uiManager.PushWindow(messageBox);
            //    return;
            //}
            //else if (!FindLocation(locationName, out locationInfo))
            //{
            //    TextFile.Token[] textTokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(13);
            //    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
            //    messageBox.SetTextTokens(textTokens);
            //    messageBox.ClickAnywhereToClose = true;
            //    uiManager.PushWindow(messageBox);
            //    return;
            //}
            //else
            //{
            //    //locationSelected = true;
            //    TextFile.Token[] textTokens = new TextFile.Token[2];
            //    int index = regionRecord.Region.MapIdLookup[locationInfo.MapId];
            //    textTokens[0].text = string.Format("Travel to  {0} : {1} ?", regionRecord.Region.Name, regionRecord.Region.MapNames[index]);
            //    textTokens[0].formatting = TextFile.Formatting.Text;
            //    textTokens[1].text = null;
            //    textTokens[1].formatting = TextFile.Formatting.NewLine;

            //    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);    // Temp solution
            //    messageBox.SetTextTokens(textTokens);
            //    messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
            //    messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
            //    messageBox.OnButtonClick += ConfirmTravelPopupButtonClick;
            //    uiManager.PushWindow(messageBox);
            //}
        }
        /// <summary>
        /// Handles events from Find Location pop-up.
        /// </summary>
        void HandleLocationFindEvent(DaggerfallInputMessageBox inputMessageBox, string locationName)
        {
            ////locationSelected = false;

            //if (string.IsNullOrEmpty(locationName))
            //{
            //    TextFile.Token[] textTokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(13);
            //    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
            //    messageBox.SetTextTokens(textTokens);
            //    messageBox.ClickAnywhereToClose = true;
            //    uiManager.PushWindow(messageBox);
            //    return;
            //}
            //else if (!FindLocation(locationName, out locationInfo))
            //{
            //    TextFile.Token[] textTokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(13);
            //    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
            //    messageBox.SetTextTokens(textTokens);
            //    messageBox.ClickAnywhereToClose = true;
            //    uiManager.PushWindow(messageBox);
            //    return;
            //}
            //else
            //{
            //    //locationSelected = true;
            //    TextFile.Token[] textTokens = new TextFile.Token[2];
            //    int index = regionRecord.Region.MapIdLookup[locationInfo.MapId];
            //    textTokens[0].text = string.Format("Travel to  {0} : {1} ?", regionRecord.Region.Name, regionRecord.Region.MapNames[index]);
            //    textTokens[0].formatting = TextFile.Formatting.Text;
            //    textTokens[1].text = null;
            //    textTokens[1].formatting = TextFile.Formatting.NewLine;

            //    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);    // Temp solution
            //    messageBox.SetTextTokens(textTokens);
            //    messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
            //    messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
            //    messageBox.OnButtonClick += ConfirmTravelPopupButtonClick;
            //    uiManager.PushWindow(messageBox);
            //}
        }
 void FindlocationButtonClickHandler(BaseScreenComponent sender, Vector2 position)
 {
     if (RegionSelected == false)           // Do nothing
         return;
     else                                // Open find location pop-up
     {
         StopRegionIdentify();
         DaggerfallInputMessageBox findPopUp = new DaggerfallInputMessageBox(uiManager, null, 31, HardStrings.findLocationPrompt, true, this);
         findPopUp.TextPanelDistance = 0;
         findPopUp.OnGotUserInput += HandleLocationFindEvent;
         findPopUp.Show();
     }
 }
Esempio n. 15
0
        protected void InvestButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
            if (currentService == Services.Sell)
            {
                int mercSkill    = player.Skills.GetLiveSkillValue(DFCareer.Skills.Mercantile);
                int playerIntell = player.Stats.LiveIntelligence;
                if (LimitedGoldShops.LimitedGoldShops.ShopBuildingData.TryGetValue(currentBuildingID, out sd))
                {
                    investedFlag = sd.InvestedIn;
                    shopAttitude = sd.ShopAttitude;
                }

                if (playerIntell >= 30 && mercSkill >= 40)
                {
                    DaggerfallInputMessageBox investMessageBox = new DaggerfallInputMessageBox(uiManager, this);
                    if (buildQual <= 3) // 01 - 03
                    {
                        if (shopAttitude == 0)
                        {
                            tokens = LGSTextTokenHolder.ShopTextTokensNice(10);
                        }
                        else
                        {
                            tokens = LGSTextTokenHolder.ShopTextTokensMean(13);
                        }
                    }
                    else if (buildQual <= 7) // 04 - 07
                    {
                        if (shopAttitude == 0)
                        {
                            tokens = LGSTextTokenHolder.ShopTextTokensNice(1);
                        }
                        else
                        {
                            tokens = LGSTextTokenHolder.ShopTextTokensMean(9);
                        }
                    }
                    else if (buildQual <= 17) // 08 - 17
                    {
                        if (shopAttitude == 0)
                        {
                            tokens = LGSTextTokenHolder.ShopTextTokensNice(14);
                        }
                        else
                        {
                            tokens = LGSTextTokenHolder.ShopTextTokensMean(17);
                        }
                    }
                    else                      // 18 - 20
                    {
                        if (shopAttitude == 0)
                        {
                            tokens = LGSTextTokenHolder.ShopTextTokensNice(18);
                        }
                        else
                        {
                            tokens = LGSTextTokenHolder.ShopTextTokensMean(21);
                        }
                    }

                    if (investedFlag)
                    {
                        if (buildQual <= 3) // 01 - 03
                        {
                            if (shopAttitude == 0)
                            {
                                tokens = LGSTextTokenHolder.ShopTextTokensNice(12);
                            }
                            else
                            {
                                tokens = LGSTextTokenHolder.ShopTextTokensMean(15);
                            }
                        }
                        else if (buildQual <= 7) // 04 - 07
                        {
                            if (shopAttitude == 0)
                            {
                                tokens = LGSTextTokenHolder.ShopTextTokensNice(2);
                            }
                            else
                            {
                                tokens = LGSTextTokenHolder.ShopTextTokensMean(11);
                            }
                        }
                        else if (buildQual <= 17) // 08 - 17
                        {
                            if (shopAttitude == 0)
                            {
                                tokens = LGSTextTokenHolder.ShopTextTokensNice(16);
                            }
                            else
                            {
                                tokens = LGSTextTokenHolder.ShopTextTokensMean(19);
                            }
                        }
                        else                      // 18 - 20
                        {
                            if (shopAttitude == 0)
                            {
                                tokens = LGSTextTokenHolder.ShopTextTokensNice(20);
                            }
                            else
                            {
                                tokens = LGSTextTokenHolder.ShopTextTokensMean(23);
                            }
                        }
                    }
                    investMessageBox.SetTextTokens(tokens);
                    investMessageBox.TextPanelDistanceY    = 0;
                    investMessageBox.InputDistanceX        = 24;
                    investMessageBox.InputDistanceY        = 2;
                    investMessageBox.TextBox.Numeric       = true;
                    investMessageBox.TextBox.MaxCharacters = 9;
                    investMessageBox.TextBox.Text          = "1";
                    investMessageBox.OnGotUserInput       += InvestMessageBox_OnGotUserInput;
                    investMessageBox.Show();
                }
                else if (shopAttitude == 1 && buildQual <= 7 && playerIntell < 30)
                {
                    DaggerfallInputMessageBox scamMessageBox = new DaggerfallInputMessageBox(uiManager, this);
                    tokens = LGSTextTokenHolder.ShopTextTokensMean(1);
                    scamMessageBox.InputDistanceY = 2;
                    if (investedFlag)
                    //if (test == 0)
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensMean(2);
                        scamMessageBox.InputDistanceY = 9;
                    }
                    scamMessageBox.SetTextTokens(tokens);
                    scamMessageBox.TextPanelDistanceY    = 0;
                    scamMessageBox.InputDistanceX        = 24;
                    scamMessageBox.TextBox.Numeric       = true;
                    scamMessageBox.TextBox.MaxCharacters = 9;
                    scamMessageBox.TextBox.Text          = "1";
                    scamMessageBox.OnGotUserInput       += ScamMessageBox_OnGotUserInput;
                    scamMessageBox.Show();
                }
                else if (playerIntell < 30)
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensNeutral(1);
                    DaggerfallUI.MessageBox(tokens);
                }
                else
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensNeutral(2);
                    DaggerfallUI.MessageBox(tokens);
                }
            }
            else
            {
                DaggerfallUI.MessageBox("We don't accept investment offers here, sorry.");
            }
        }
Esempio n. 16
0
        protected void InvestMessageBox_OnGotUserInput(DaggerfallInputMessageBox sender, string input)
        {
            int playerIntell = player.Stats.LiveIntelligence;

            if (LimitedGoldShops.LimitedGoldShops.ShopBuildingData.TryGetValue(currentBuildingID, out sd))
            {
                investedFlag = sd.InvestedIn;
                shopAttitude = sd.ShopAttitude;
            }

            bool result = int.TryParse(input, out investOffer);

            if (!result || investOffer < 500)
            {
                tokens = LGSTextTokenHolder.ShopTextTokensNeutral(5);
                DaggerfallUI.MessageBox(tokens);
                return;
            }

            DaggerfallMessageBox investConfimBox = new DaggerfallMessageBox(uiManager, this);

            if (buildQual <= 3) // 01 - 03
            {
                if (shopAttitude == 0)
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensNice(11, investOffer);
                }
                else
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensMean(14, investOffer);
                }
            }
            else if (buildQual <= 7) // 04 - 07
            {
                if (shopAttitude == 0)
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensNice(3, investOffer);
                }
                else
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensMean(10, investOffer);
                }
            }
            else if (buildQual <= 17) // 08 - 17
            {
                if (shopAttitude == 0)
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensNice(15, investOffer);
                }
                else
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensMean(18, investOffer);
                }
            }
            else                      // 18 - 20
            {
                if (shopAttitude == 0)
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensNice(19, investOffer);
                }
                else
                {
                    tokens = LGSTextTokenHolder.ShopTextTokensMean(22, investOffer);
                }
            }
            if (investedFlag)
            {
                if (buildQual <= 3) // 01 - 03
                {
                    if (shopAttitude == 0)
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensNice(13, investOffer);
                    }
                    else
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensMean(16, investOffer);
                    }
                }
                else if (buildQual <= 7) // 04 - 07
                {
                    if (shopAttitude == 0)
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensNice(9, investOffer);
                    }
                    else
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensMean(12, investOffer);
                    }
                }
                else if (buildQual <= 17) // 08 - 17
                {
                    if (shopAttitude == 0)
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensNice(17, investOffer);
                    }
                    else
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensMean(20, investOffer);
                    }
                }
                else                      // 18 - 20
                {
                    if (shopAttitude == 0)
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensNice(21, investOffer);
                    }
                    else
                    {
                        tokens = LGSTextTokenHolder.ShopTextTokensMean(24, investOffer);
                    }
                }
            }
            investConfimBox.SetTextTokens(tokens);
            investConfimBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
            investConfimBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
            investConfimBox.OnButtonClick += ConfirmInvestment_OnButtonClick;
            uiManager.PushWindow(investConfimBox);
        }
Esempio n. 17
0
 /// <summary>
 /// Handles the input return event for action type 12
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="userInput"></param>
 public void UserInputHandler(DaggerfallInputMessageBox sender, string userInput)
 {
     if (type12_answers == null || type12_answers.Length == 0)
     {
         DaggerfallUnity.LogMessage(string.Format(("No answers to check for: {0} {1}"), this.gameObject.name, this.Index));
         return;
     }
     userInput = userInput.ToLower();
     for (int i = 0; i < type12_answers.Length; i++)
     {
         if (userInput == type12_answers[i].ToLower())
         {
             ActivateNext();
             return;
         }
     }
     //Debug.Log("no matching answer found for: " + userInput);
 }
        private void TimedRestPrompt_OnGotUserInput(DaggerfallInputMessageBox sender, string input)
        {
            // Validate input
            int time = 0;
            bool result = int.TryParse(input, out time);
            if (!result)
                return;

            // Validate range
            if (time < 0)
            {
                time = 0;
            }
            else if (time > 99)
            {
                DaggerfallUI.MessageBox(cannotRestMoreThan99Hours);
                return;
            }

            hoursRemaining = time;
            waitTimer = Time.realtimeSinceStartup;
            currentRestMode = RestModes.TimedRest;
        }
 void FindlocationButtonClickHandler(BaseScreenComponent sender, Vector2 position)
 {
     if (selectedRegion == -1)           // Do nothing
     {
         return;
     }
     else                                // Open find location pop-up
     {
         DaggerfallInputMessageBox findPopUp = new DaggerfallInputMessageBox(uiManager, null, 31, HardStrings.findLocationPrompt, true, true, this);
         findPopUp.OnGotUserInput += HandleLocationFindEvent;
         findPopUp.Show();
     }
 }
Esempio n. 20
0
 /// <summary>
 /// 12
 /// Pop-up text that returns player input
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="thisAction"></param>
 public static void ShowTextWithInput(GameObject obj, DaggerfallAction thisAction)
 {
     int textID = thisAction.Index + TYPE_12_TEXT_INDEX;
     if (actionTypeTwelveLookup.ContainsKey(textID))
     {
         thisAction.type12_answers = actionTypeTwelveLookup[textID];
     }
     else
     {
         Debug.LogError(string.Format("Error: invalid key: {0} for action type 12, couldn't get answer(s)", textID));//todo - display error message
     }
     DaggerfallInputMessageBox inputBox = new DaggerfallInputMessageBox(DaggerfallWorkshop.Game.DaggerfallUI.UIManager, textID, 20, "\t> ", true, false, null);
     inputBox.ParentPanel.BackgroundColor = Color.clear;
     inputBox.OnGotUserInput += thisAction.UserInputHandler;
     inputBox.Show();
 }
 private void ReturnPlayerInputEvent(DaggerfallInputMessageBox sender, string userInput)
 {
     CloseWindow();
     if (OnGotUserInput != null)
         OnGotUserInput(sender, userInput);
 }
Esempio n. 22
0
 private void EnterName_OnGotUserInput(DaggerfallInputMessageBox sender, string input)
 {
     itemNameLabel.Text = input;
 }
 private void WhileButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     DaggerfallInputMessageBox mb = new DaggerfallInputMessageBox(uiManager, this);
     mb.SetTextBoxLabel(HardStrings.restHowManyHours);
     mb.TextPanelDistance = 0;
     mb.TextBox.Text = "0";
     mb.TextBox.Numeric = true;
     mb.OnGotUserInput += TimedRestPrompt_OnGotUserInput;
     mb.Show();
 }
        private void GoldButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            // Get text tokens
            TextFile.Token[] textTokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(goldToDropID);

            // Hack to set gold pieces in text token for now
            textTokens[0].text = textTokens[0].text.Replace("%gii", GameManager.Instance.PlayerEntity.GoldPieces.ToString());

            // Show message box
            DaggerfallInputMessageBox mb = new DaggerfallInputMessageBox(uiManager, this);
            mb.SetTextTokens(textTokens);
            mb.TextPanelDistance = 0;
            mb.TextBox.Numeric = true;
            mb.OnGotUserInput += DropGoldPopup_OnGotUserInput;
            mb.Show();
        }
        private void DropGoldPopup_OnGotUserInput(DaggerfallInputMessageBox sender, string input)
        {
            // Get player gold count
            int playerGold = GameManager.Instance.PlayerEntity.GoldPieces;

            // Determine how many gold pieces to drop
            int goldToDrop = 0;
            bool result = int.TryParse(input, out goldToDrop);
            if (!result || goldToDrop < 1 || goldToDrop > playerGold)
                return;

            // Create new item for gold pieces and add to other container
            DaggerfallUnityItem goldPieces = ItemBuilder.CreateGoldPieces(goldToDrop);
            remoteItems.AddItem(goldPieces, preferredOrder);

            // Remove gold count from player
            GameManager.Instance.PlayerEntity.GoldPieces -= goldToDrop;

            Refresh(false);
        }
        /// <summary>
        /// Handles events from Find Location pop-up.
        /// </summary>
        void HandleLocationFindEvent(DaggerfallInputMessageBox inputMessageBox, string locationName)
        {
            //locationSelected = false;

            if (string.IsNullOrEmpty(locationName) || !FindLocation(locationName))
            {
                TextFile.Token[] textTokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(13);
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                messageBox.SetTextTokens(textTokens);
                messageBox.ClickAnywhereToClose = true;
                uiManager.PushWindow(messageBox);
                return;
            }
            else //place flashing crosshair over location
            {
                locationSelected = true;
                findingLocation = true;
                CreateCrossHair(MapsFile.GetPixelFromPixelID(locationSummary.ID), locationSummary.RegionIndex);
                StartRegionIdentify();
            }
        }
Esempio n. 27
0
 protected virtual void EnterName_OnGotUserInput(DaggerfallInputMessageBox sender, string input)
 {
     spellNameLabel.Text = input;
 }