Ejemplo n.º 1
0
        private void TimedRestPrompt_OnGotUserInput(DaggerfallInputMessageBox sender, string input)
        {
            const int cannotRestMoreThan99HoursTextId = 26;

            // 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(cannotRestMoreThan99HoursTextId);
                return;
            }

            hoursRemaining  = time;
            waitTimer       = Time.realtimeSinceStartup;
            currentRestMode = RestModes.TimedRest;
            MoveToBed();
        }
Ejemplo n.º 2
0
        private void LoiterPrompt_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 > DaggerfallUnity.Settings.LoiterLimitInHours)
            {
                DaggerfallUI.MessageBox(new string[] {
                    TextManager.Instance.GetLocalizedText("cannotLoiterMoreThanXHours1"),
                    string.Format(TextManager.Instance.GetLocalizedText("cannotLoiterMoreThanXHours2"), DaggerfallUnity.Settings.LoiterLimitInHours)
                });
                return;
            }

            hoursRemaining  = time;
            waitTimer       = Time.realtimeSinceStartup;
            currentRestMode = RestModes.Loiter;
        }
Ejemplo n.º 3
0
        private void LoiterPrompt_OnGotUserInput(DaggerfallInputMessageBox sender, string input)
        {
            const int cannotLoiterMoreThan3HoursTextId = 27;

            // 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 > DaggerfallUnity.Settings.LoiterLimitInHours)
            {
                DaggerfallUI.MessageBox(cannotLoiterMoreThan3HoursTextId);
                return;
            }

            hoursRemaining  = time;
            waitTimer       = Time.realtimeSinceStartup;
            currentRestMode = RestModes.Loiter;
        }
        void EndRest()
        {
            const int youWakeUpTextId         = 353;
            const int youAreHealedTextId      = 350;
            const int finishedLoiteringTextId = 349;

            if (currentRestMode == RestModes.TimedRest)
            {
                DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youWakeUpTextId);
                mb.OnClose     += RestFinishedPopup_OnClose;
                currentRestMode = RestModes.Selection;
            }
            else if (currentRestMode == RestModes.FullRest)
            {
                DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youAreHealedTextId);
                mb.OnClose     += RestFinishedPopup_OnClose;
                currentRestMode = RestModes.Selection;
            }
            else if (currentRestMode == RestModes.Loiter)
            {
                DaggerfallMessageBox mb = DaggerfallUI.MessageBox(finishedLoiteringTextId);
                mb.OnClose     += RestFinishedPopup_OnClose;
                currentRestMode = RestModes.Selection;
            }
        }
        public override void OnPush()
        {
            base.OnPush();

            toggleClosedBinding = InputManager.Instance.GetBinding(InputManager.Actions.Rest);

            // Reset counters
            minutesOfHour          = 0;
            hoursRemaining         = 0;
            totalHours             = 0;
            waitTimer              = 0;
            enemyBrokeRest         = false;
            preventedRestMessage   = null;
            abortRestForEnemySpawn = false;
            currentRestMode        = RestModes.Selection;

            // Get references
            playerEntity = GameManager.Instance.PlayerEntity;
            hud          = DaggerfallUI.Instance.DaggerfallHUD;

            GameManager.OnEncounter += GameManager_OnEncounter;

            // Raise player resting flag when UI opens
            // This is used for random enemy spawning and influences CastWhenHeld durability loss
            playerEntity.IsResting = true;
        }
Ejemplo n.º 6
0
        void EndRest()
        {
            const int youWakeUpTextId         = 353;
            const int enemiesNearby           = 354;
            const int youAreHealedTextId      = 350;
            const int finishedLoiteringTextId = 349;

            endedRest = true;

            if (enemyBrokeRest)
            {
                DaggerfallMessageBox mb = DaggerfallUI.MessageBox(enemiesNearby);
                mb.OnClose += RestFinishedPopup_OnClose;
            }
            else if (preventedRestMessage != null)
            {
                if (preventedRestMessage != "")
                {
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(preventedRestMessage);
                    mb.OnClose += RestFinishedPopup_OnClose;
                }
                else
                {
                    const int            cannotRestNow = 355;
                    DaggerfallMessageBox mb            = DaggerfallUI.MessageBox(cannotRestNow);
                    mb.OnClose += RestFinishedPopup_OnClose;
                }
            }
            else
            {
                if (remainingHoursRented == 0)
                {
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(TextManager.Instance.GetLocalizedText("expiredRentedRoom"));
                    mb.OnClose     += RestFinishedPopup_OnClose;
                    currentRestMode = RestModes.Selection;
                    playerEntity.RemoveExpiredRentedRooms();
                }
                else if (currentRestMode == RestModes.TimedRest)
                {
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youWakeUpTextId);
                    mb.OnClose     += RestFinishedPopup_OnClose;
                    currentRestMode = RestModes.Selection;
                }
                else if (currentRestMode == RestModes.FullRest)
                {
                    int message             = IsPlayerFullyHealed() ? youAreHealedTextId : youWakeUpTextId;
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(message);
                    mb.OnClose     += RestFinishedPopup_OnClose;
                    currentRestMode = RestModes.Selection;
                }
                else if (currentRestMode == RestModes.Loiter)
                {
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(finishedLoiteringTextId);
                    mb.OnClose     += RestFinishedPopup_OnClose;
                    currentRestMode = RestModes.Selection;
                }
            }
        }
Ejemplo n.º 7
0
 void DoRestUntilHealed(bool alreadyWarned)
 {
     if (CanRest(alreadyWarned))
     {
         waitTimer       = Time.realtimeSinceStartup;
         currentRestMode = RestModes.FullRest;
         MoveToBed();
     }
 }
 private void HealedButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     if (CanRest())
     {
         waitTimer       = Time.realtimeSinceStartup;
         currentRestMode = RestModes.FullRest;
         MoveToBed();
     }
 }
        void EndRest()
        {
            const int youWakeUpTextId         = 353;
            const int enemiesNearby           = 354;
            const int youAreHealedTextId      = 350;
            const int finishedLoiteringTextId = 349;

            if (enemyBrokeRest)
            {
                DaggerfallMessageBox mb = DaggerfallUI.MessageBox(enemiesNearby);
                mb.OnClose += RestFinishedPopup_OnClose;
            }
            else
            {
                if (remainingHoursRented == 0)
                {
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(HardStrings.expiredRentedRoom);
                    mb.OnClose     += RestFinishedPopup_OnClose;
                    currentRestMode = RestModes.Selection;
                    playerEntity.RemoveExpiredRentedRooms();
                }
                else if (currentRestMode == RestModes.TimedRest)
                {
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youWakeUpTextId);
                    mb.OnClose     += RestFinishedPopup_OnClose;
                    currentRestMode = RestModes.Selection;
                }
                else if (currentRestMode == RestModes.FullRest)
                {
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youAreHealedTextId);
                    mb.OnClose     += RestFinishedPopup_OnClose;
                    currentRestMode = RestModes.Selection;
                }
                else if (currentRestMode == RestModes.Loiter)
                {
                    DaggerfallMessageBox mb = DaggerfallUI.MessageBox(finishedLoiteringTextId);
                    mb.OnClose     += RestFinishedPopup_OnClose;
                    currentRestMode = RestModes.Selection;
                }
            }

            GameManager.Instance.PlayerEntity.IsResting = false;
        }
 void EndRest()
 {
     if (currentRestMode == RestModes.TimedRest)
     {
         DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youWakeUp);
         mb.OnClose     += RestFinishedPopup_OnClose;
         currentRestMode = RestModes.Selection;
     }
     else if (currentRestMode == RestModes.FullRest)
     {
         DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youAreHealed);
         mb.OnClose     += RestFinishedPopup_OnClose;
         currentRestMode = RestModes.Selection;
     }
     else if (currentRestMode == RestModes.Loiter)
     {
         DaggerfallMessageBox mb = DaggerfallUI.MessageBox(finishedLoitering);
         mb.OnClose     += RestFinishedPopup_OnClose;
         currentRestMode = RestModes.Selection;
     }
 }
        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;
        }
 private void HealedButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
 {
     waitTimer = Time.realtimeSinceStartup;
     currentRestMode = RestModes.FullRest;
 }
 void EndRest()
 {
     if (currentRestMode == RestModes.TimedRest)
     {
         DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youWakeUp);
         mb.OnClose += RestFinishedPopup_OnClose;
         currentRestMode = RestModes.Selection;
     }
     else if (currentRestMode == RestModes.FullRest)
     {
         DaggerfallMessageBox mb = DaggerfallUI.MessageBox(youAreHealed);
         mb.OnClose += RestFinishedPopup_OnClose;
         currentRestMode = RestModes.Selection;
     }
     else if (currentRestMode == RestModes.Loiter)
     {
         DaggerfallMessageBox mb = DaggerfallUI.MessageBox(finishedLoitering);
         mb.OnClose += RestFinishedPopup_OnClose;
         currentRestMode = RestModes.Selection;
     }
 }