示例#1
0
        void HorizontalArrowButtonClickHander(BaseScreenComponent sender, Vector2 position)
        {
            if (selectedRegion == -1 || !HasMultipleMaps)
            {
                return;
            }

            int newIndex = mapIndex;

            if (newIndex % 2 == 0)
            {
                newIndex += 1;          // Move right
            }
            else
            {
                newIndex -= 1;          // Move left
            }
            mapIndex = newIndex;
            SetupArrowButtons();
            regionTextureOverlayPanel.BackgroundTexture = DaggerfallUI.GetTextureFromImg(selectedRegionMapNames[mapIndex]);
            UpdateLocationCluster();
        }
示例#2
0
        void SetupButtons()
        {
            // Bottom row buttons
            if (!buyMode)
            {
                deleteButton = DaggerfallUI.AddButton(deleteOrBuyButtonRect, mainPanel);
                deleteButton.OnMouseClick += DeleteButton_OnMouseClick;
                deleteButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.SpellbookDelete);

                upButton = DaggerfallUI.AddButton(upButtonRect, mainPanel);
                upButton.OnMouseClick += SwapButton_OnMouseClick;
                upButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.SpellbookUp);

                sortButton = DaggerfallUI.AddButton(sortButtonRect, mainPanel);
                sortButton.OnMouseClick += SortButton_OnMouseClick;
                sortButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.SpellbookSort);

                downButton = DaggerfallUI.AddButton(downButtonRect, mainPanel);
                downButton.OnMouseClick += SwapButton_OnMouseClick;
                downButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.SpellbookDown);
            }
            else
            {
                buyButton = DaggerfallUI.AddButton(deleteOrBuyButtonRect, mainPanel);
                buyButton.OnMouseClick += BuyButton_OnMouseClick;
                buyButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.SpellbookBuy);
            }

            exitButton = DaggerfallUI.AddButton(exitButtonRect, mainPanel);
            exitButton.OnMouseClick += ExitButton_OnMouseClick;
            exitButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.SpellbookExit);

            // Scroller buttons
            upArrowButton = DaggerfallUI.AddButton(upArrowButtonRect, mainPanel);
            upArrowButton.OnMouseClick += UpArrowButton_OnMouseClick;

            downArrowButton = DaggerfallUI.AddButton(downArrowButtonRect, mainPanel);
            downArrowButton.OnMouseClick += DownArrowButton_OnMouseClick;
        }
示例#3
0
        private void SaveLoadEventHandler(BaseScreenComponent sender, Vector2 position)
        {
            if (mode == Modes.SaveGame)
            {
                // Must have a save name
                if (saveNameTextBox.Text.Length == 0)
                {
                    DaggerfallUI.MessageBox(HardStrings.youMustEnterASaveName);
                    return;
                }

                // Get save key and confirm if already exists
                int key = GameManager.Instance.SaveLoadManager.FindSaveFolderByNames(currentPlayerName, saveNameTextBox.Text);
                if (key != -1)
                {
                    DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                    messageBox.SetText(HardStrings.confirmOverwriteSave, "");
                    messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                    messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                    messageBox.OnButtonClick += ConfirmOverwrite_OnButtonClick;
                    uiManager.PushWindow(messageBox);
                }
                else
                {
                    SaveGame();
                }
            }
            else if (mode == Modes.LoadGame)
            {
                // Must have a save name
                if (saveNameTextBox.Text.Length == 0)
                {
                    DaggerfallUI.MessageBox(HardStrings.youMustSelectASaveName);
                    return;
                }

                LoadGame();
            }
        }
示例#4
0
        protected override void SetupActionButtons()
        {
            wagonButton = DaggerfallUI.AddButton(wagonButtonRect, actionButtonsPanel);
            wagonButton.OnMouseClick += WagonButton_OnMouseClick;

            infoButton = DaggerfallUI.AddButton(infoButtonRect, actionButtonsPanel);
            infoButton.OnMouseClick += InfoButton_OnMouseClick;

            selectButton = DaggerfallUI.AddButton(selectButtonRect, actionButtonsPanel);
            selectButton.OnMouseClick += SelectButton_OnMouseClick;

            if (windowMode == WindowModes.Buy)
            {
                stealButton = DaggerfallUI.AddButton(stealButtonRect, actionButtonsPanel);
                stealButton.OnMouseClick += StealButton_OnMouseClick;
            }
            modeActionButton = DaggerfallUI.AddButton(modeActionButtonRect, actionButtonsPanel);
            modeActionButton.OnMouseClick += ModeActionButton_OnMouseClick;

            clearButton = DaggerfallUI.AddButton(clearButtonRect, actionButtonsPanel);
            clearButton.OnMouseClick += ClearButton_OnMouseClick;
        }
示例#5
0
        protected virtual void DoFoodAndDrink()
        {
            CloseWindow();
            uint gameMinutes = DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.ToClassicDaggerfallTime();

            if ((gameMinutes - (GameManager.Instance.PlayerEntity.LastTimePlayerAteOrDrankAtTavern)) >= 240)
            {
                DaggerfallListPickerWindow foodAndDrinkPicker = new DaggerfallListPickerWindow(uiManager, this);
                foodAndDrinkPicker.OnItemPicked += FoodAndDrink_OnItemPicked;

                foreach (string menuItem in tavernMenu)
                {
                    foodAndDrinkPicker.ListBox.AddItem(menuItem);
                }

                uiManager.PushWindow(foodAndDrinkPicker);
            }
            else
            {
                DaggerfallUI.MessageBox(TextManager.Instance.GetLocalizedText("youAreNotHungry"));
            }
        }
示例#6
0
        private void FoodButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            CloseWindow();
            uint gameMinutes = DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.ToClassicDaggerfallTime();

            if ((gameMinutes - (GameManager.Instance.PlayerEntity.LastTimePlayerAteOrDrankAtTavern)) >= 240)
            {
                DaggerfallListPickerWindow foodAndDrinkPicker = new DaggerfallListPickerWindow(uiManager, this);
                foodAndDrinkPicker.OnItemPicked += FoodAndDrink_OnItemPicked;

                foreach (string menuItem in tavernMenu)
                {
                    foodAndDrinkPicker.ListBox.AddItem(menuItem);
                }

                uiManager.PushWindow(foodAndDrinkPicker);
            }
            else
            {
                DaggerfallUI.MessageBox(HardStrings.youAreNotHungry);
            }
        }
        protected override void Setup()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("CreateCharReflexSelect: Could not load native texture.");
            }

            // Setup native panel background
            NativePanel.BackgroundTexture = nativeTexture;

            // Setup info panel
            Panel infoPanel = new Panel();

            DaggerfallUI.Instance.SetDaggerfallPopupStyle(DaggerfallUI.PopupStyle.Parchment, infoPanel);
            NativePanel.Components.Add(infoPanel);
            infoPanel.HorizontalAlignment = HorizontalAlignment.Center;
            infoPanel.Position            = new Vector2(0, 15);

            // Setup info text
            MultiFormatTextLabel infoText = new MultiFormatTextLabel();

            infoPanel.Components.Add(infoText);
            infoText.SetText(DaggerfallUnity.Instance.TextProvider.GetRSCTokens(strPlayerReflexesDetermine));
            infoText.HorizontalAlignment = HorizontalAlignment.Center;
            infoText.VerticalAlignment   = VerticalAlignment.Middle;
            infoPanel.Size = infoText.Size;

            // Setup button picker
            reflexPicker = new ReflexPicker();
            NativePanel.Components.Add(reflexPicker);
            reflexPicker.Position = new Vector2(127, 148f);

            // Add "OK" button
            Button okButton = DaggerfallUI.AddButton(new Rect(263, 172, 39, 22), NativePanel);

            okButton.OnMouseClick += OkButton_OnMouseClick;
        }
示例#8
0
        void VerticalArrowButtonClickHander(BaseScreenComponent sender, Vector2 position)
        {
            if (selectedRegion == -1 || !HasVerticalMaps)
            {
                return;
            }

            int newIndex = mapIndex;

            if (newIndex > 1)
            {
                newIndex -= 2;          // Move up
            }
            else
            {
                newIndex += 2;          // Move down
            }
            mapIndex = newIndex;
            SetupArrowButtons();
            regionTextureOverlayPanel.BackgroundTexture = DaggerfallUI.GetTextureFromImg(selectedRegionMapNames[mapIndex]);
            UpdateLocationCluster();
        }
示例#9
0
 private static void CampPopUp_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton)
 {
     if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes)
     {
         sender.CloseWindow();
         if (GameManager.Instance.AreEnemiesNearby())
         {
             DaggerfallUI.MessageBox("There are enemies nearby.");
         }
         else
         {
             IUserInterfaceManager uiManager = DaggerfallUI.UIManager;
             ClimateCalories.camping = true;
             uiManager.PushWindow(new DaggerfallRestWindow(uiManager, true));
         }
     }
     else
     {
         sender.CloseWindow();
         PackOrLeaveCamp();
     }
 }
        void ForceTransformDuringFullMoon()
        {
            // Does not happen if Hircine's Ring equipped
            if (wearingHircineRing)
            {
                return;
            }

            // Player is forced into lycanthrope form every magic round for the whole duration of any full moon
            // In classic, player can switch back to humanoid form briefly (remainder of magic round) before being forced to shapechange again (next magic round)
            // Intentionally reproducing this handling here so player can shift back and forth to loot corpses, etc.
            // I'm not sure if this was intentional in classic or not, but it's not much fun to be shut out of the game for a
            // whole 24 hours every 15 days. I *think* this was intentional so lycanthrope players could at least struggle through.
            // Same goes for other weirdness like renting rooms or handing in quests. It's just not fun to shut out of game completely.
            // Ultimately the player has their own choice to do this or not. They can run free in the wilderness for 24 hours if they prefer.
            if (isFullMoon && !isTransformed)
            {
                string youDreamOfTheMoon = TextManager.Instance.GetText(generalTextDatabase, "youDreamOfTheMoon");
                DaggerfallUI.AddHUDText(youDreamOfTheMoon, 2);
                MorphSelf(true);
            }
        }
示例#11
0
        protected virtual void StartConcealment()
        {
            // Get peered entity gameobject
            DaggerfallEntityBehaviour entityBehaviour = GetPeeredEntityBehaviour(manager);

            if (!entityBehaviour)
            {
                return;
            }

            entityBehaviour.Entity.MagicalConcealmentFlags |= concealmentFlag;

            if (!string.IsNullOrEmpty(startConcealmentMessageKey))
            {
                // Output start of concealment message if the host manager is player (e.g. "You are invisible.")
                if (IsIncumbent && awakeAlert && entityBehaviour == GameManager.Instance.PlayerEntityBehaviour)
                {
                    DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, startConcealmentMessageKey), 1.5f);
                    awakeAlert = false;
                }
            }
        }
        private void BuyButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick);
            const int tradeMessageBaseId = 260;
            const int notEnoughGoldId    = 454;
            int       tradePrice         = GetTradePrice();
            int       msgOffset          = 0;

            if (!GameManager.Instance.PlayerEntity.Items.Contains(Items.ItemGroups.MiscItems, (int)Items.MiscItems.Spellbook))
            {
                DaggerfallUI.MessageBox(noSpellBook);
            }
            else if (GameManager.Instance.PlayerEntity.GetGoldAmount() < tradePrice)
            {
                DaggerfallUI.MessageBox(notEnoughGoldId);
            }
            else
            {
                if (presentedCost >> 1 <= tradePrice)
                {
                    if (presentedCost - (presentedCost >> 2) <= tradePrice)
                    {
                        msgOffset = 2;
                    }
                    else
                    {
                        msgOffset = 1;
                    }
                }

                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                TextFile.Token[]     tokens     = DaggerfallUnity.Instance.TextProvider.GetRandomTokens(tradeMessageBaseId + msgOffset);
                messageBox.SetTextTokens(tokens, this);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                messageBox.OnButtonClick += ConfirmTrade_OnButtonClick;
                uiManager.PushWindow(messageBox);
            }
        }
示例#13
0
        void SelectNextPath()
        {
            PlayerGPS playerGPS = GameManager.Instance.PlayerGPS;

            if (!playerGPS.HasCurrentLocation)
            {
                DFPosition currMapPixel = playerGPS.CurrentMapPixel;

                byte pathsDataPt     = GetPathsDataPoint(currMapPixel);
                byte playerDirection = GetDirection(GetNormalisedPlayerYaw());
                if (CountSetBits(pathsDataPt) == 2)
                {
                    playerDirection = (byte)(pathsDataPt & playerDirection);
                    if (playerDirection == 0)
                    {
                        byte fromDirection = GetDirection(GetNormalisedPlayerYaw(true));
                        playerDirection = (byte)(pathsDataPt ^ fromDirection);
                    }
#if UNITY_EDITOR
                    Debug.LogFormat("Heading {0}", GetDirectionStr(playerDirection));
#endif
                    byte roadDataPt = GetRoadsDataPoint(currMapPixel);
                    road = (roadDataPt & playerDirection) != 0;
                    BeginPathTravel(GetTargetPixel(playerDirection, currMapPixel), false);
                    return;
                }
                else
                {
                    DaggerfallUI.AddHUDText("You've arrived at a junction.");
                }
            }
            else
            {
                lastCrossed = GetDirection(GetNormalisedPlayerYaw(true));
            }
            // An intersection, location, or path end then end travel
            travelControlUI.CloseWindow();
        }
示例#14
0
        protected int GetMagnitude(DaggerfallEntityBehaviour caster = null)
        {
            if (caster == null)
            {
                Debug.LogWarningFormat("GetMagnitude() for {0} has no caster. Using caster level 1 for magnitude.", Properties.Key);
            }

            if (manager == null)
            {
                Debug.LogWarningFormat("GetMagnitude() for {0} has no parent manager.", Properties.Key);
            }

            int magnitude = 0;

            if (Properties.SupportMagnitude)
            {
                int casterLevel   = (caster) ? caster.Entity.Level : 1;
                int baseMagnitude = UnityEngine.Random.Range(settings.MagnitudeBaseMin, settings.MagnitudeBaseMax + 1);
                int plusMagnitude = UnityEngine.Random.Range(settings.MagnitudePlusMin, settings.MagnitudePlusMax + 1);
                int multiplier    = (int)Mathf.Floor(casterLevel / settings.MagnitudePerLevel);
                magnitude = baseMagnitude + plusMagnitude * multiplier;
            }

            int initialMagnitude = magnitude;

            if (ParentBundle.targetType != TargetTypes.CasterOnly)
            {
                magnitude = FormulaHelper.ModifyEffectAmount(this, manager.EntityBehaviour.Entity, magnitude);
            }

            // Output "Save versus spell made." when magnitude is fully reduced to 0 by saving throw
            if (initialMagnitude > 0 && magnitude == 0)
            {
                DaggerfallUI.AddHUDText(TextManager.Instance.GetLocalizedText("saveVersusSpellMade"));
            }

            return(magnitude);
        }
示例#15
0
        public Button AddButton(MessageBoxButtons messageBoxButton, bool defaultButton = false)
        {
            if (!IsSetup)
            {
                Setup();
            }

            // If this is to become default button, first unset any other default buttons
            // Only one button in collection can be default
            if (defaultButton)
            {
                foreach (Button b in buttons)
                {
                    b.DefaultButton = false;
                }
            }

            Texture2D background = DaggerfallUI.GetTextureFromCifRci(buttonsFilename, (int)messageBoxButton);
            Button    button     = DaggerfallUI.AddButton(Vector2.zero,
                                                          TextureReplacement.GetSize(background, buttonsFilename, (int)messageBoxButton), buttonPanel);

            button.BackgroundTexture       = background;
            button.BackgroundTextureLayout = BackgroundLayout.StretchToFill;
            button.Tag              = messageBoxButton;
            button.OnMouseClick    += ButtonClickHandler;
            button.DefaultButton    = defaultButton;
            button.Hotkey           = DaggerfallShortcut.GetBinding(ToShortcutButton(messageBoxButton));
            button.OnKeyboardEvent += ButtonKeyboardEvent;
            buttons.Add(button);

            // Once a button has been added the owner is expecting some kind of input from player
            // Don't allow a messagebox with buttons to be cancelled with escape
            AllowCancel = false;

            UpdatePanelSizes();

            return(button);
        }
示例#16
0
        protected override void Setup()
        {
            // Load all textures
            LoadTextures();

            // Create interface panel
            mainPanel.HorizontalAlignment = HorizontalAlignment.Center;
            mainPanel.VerticalAlignment   = VerticalAlignment.Middle;
            mainPanel.BackgroundTexture   = baseTexture;
            mainPanel.Position            = new Vector2(0, 50);
            mainPanel.Size = new Vector2(130, 51);

            // Repair button
            repairButton = DaggerfallUI.AddButton(repairButtonRect, mainPanel);
            repairButton.OnMouseClick    += RepairButton_OnMouseClick;
            repairButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MerchantRepair);
            repairButton.OnKeyboardEvent += RepairButton_OnKeyboardEvent;

            // Talk button
            talkButton = DaggerfallUI.AddButton(talkButtonRect, mainPanel);
            talkButton.OnMouseClick    += TalkButton_OnMouseClick;
            talkButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MerchantTalk);
            talkButton.OnKeyboardEvent += TalkButton_OnKeyboardEvent;

            // Sell button
            sellButton = DaggerfallUI.AddButton(sellButtonRect, mainPanel);
            sellButton.OnMouseClick    += SellButton_OnMouseClick;
            sellButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MerchantSell);
            sellButton.OnKeyboardEvent += SellButton_OnKeyboardEvent;

            // Exit button
            exitButton = DaggerfallUI.AddButton(exitButtonRect, mainPanel);
            exitButton.OnMouseClick    += ExitButton_OnMouseClick;
            exitButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MerchantExit);
            exitButton.OnKeyboardEvent += ExitButton_OnKeyboardEvent;

            NativePanel.Components.Add(mainPanel);
        }
        protected override void Setup()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallPlayerHistoryWindow: Could not load native texture.");
            }

            // Setup native panel background
            NativePanel.BackgroundTexture = nativeTexture;

            // Load default pixel font
            ChangeFont(DaggerfallFont.FontName.FONT0003);

            // Add buttons
            Button nextPageButton = DaggerfallUI.AddButton(new Rect(208, 188, 14, 8), NativePanel);

            nextPageButton.OnMouseClick += NextPageButton_OnMouseClick;
            nextPageButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.HistoryNextPage);

            Button previousPageButton = DaggerfallUI.AddButton(new Rect(181, 188, 14, 48), NativePanel);

            previousPageButton.OnMouseClick += PreviousPageButton_OnMouseClick;
            previousPageButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.HistoryPreviousPage);

            Button exitButton = DaggerfallUI.AddButton(new Rect(277, 187, 32, 10), NativePanel);

            exitButton.OnMouseClick    += ExitButton_OnMouseClick;
            exitButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.HistoryExit);
            exitButton.OnKeyboardEvent += ExitButton_OnKeyboardEvent;

            LayoutPage();
            DaggerfallUI.Instance.PlayOneShot(SoundClips.OpenBook);

            NativePanel.OnMouseScrollDown += NativePanel_OnMouseScrollDown;
            NativePanel.OnMouseScrollUp   += NativePanel_OnMouseScrollUp;
        }
        protected override void Setup()
        {
            // Load all textures
            LoadTextures();

            // Create interface panel
            mainPanel.HorizontalAlignment = HorizontalAlignment.Center;
            mainPanel.VerticalAlignment   = VerticalAlignment.Middle;
            mainPanel.BackgroundTexture   = baseTexture;
            mainPanel.Position            = new Vector2(0, 50);
            mainPanel.Size = new Vector2(130, 51);

            // Talk button
            talkButton = DaggerfallUI.AddButton(talkButtonRect, mainPanel);
            talkButton.OnMouseClick    += TalkButton_OnMouseClick;
            talkButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.WitchesTalk);
            talkButton.OnKeyboardEvent += TalkButton_OnKeyboardEvent;

            // Summon button
            summonButton = DaggerfallUI.AddButton(summonButtonRect, mainPanel);
            summonButton.OnMouseClick    += SummonButton_OnMouseClick;
            summonButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.WitchesDaedraSummon);
            summonButton.OnKeyboardEvent += SummonButton_OnKeyboardEvent;

            // Quest button
            questButton = DaggerfallUI.AddButton(questButtonRect, mainPanel);
            questButton.OnMouseClick    += QuestButton_OnMouseClick;
            questButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.WitchesQuest);
            questButton.OnKeyboardEvent += QuestButton_OnKeyboardEvent;

            // Exit button
            exitButton = DaggerfallUI.AddButton(exitButtonRect, mainPanel);
            exitButton.OnMouseClick    += ExitButton_OnMouseClick;
            exitButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.WitchesExit);
            exitButton.OnKeyboardEvent += ExitButton_OnKeyboardEvent;

            NativePanel.Components.Add(mainPanel);
        }
        void SetupButtons()
        {
            beginButton = DaggerfallUI.AddButton(beginButtonRect, NativePanel);
            beginButton.OnMouseClick += BeginButtonOnClickHandler;

            exitButton = DaggerfallUI.AddButton(exitButtonRect, NativePanel);
            exitButton.OnMouseClick += ExitButtonOnClickHandler;

            cautiousToggleButton = DaggerfallUI.AddButton(cautiousButtonRect, NativePanel);
            cautiousToggleButton.OnMouseClick      += SpeedButtonOnClickHandler;
            cautiousToggleButton.OnMouseScrollUp   += ToggleSpeedButtonOnScrollHandler;
            cautiousToggleButton.OnMouseScrollDown += ToggleSpeedButtonOnScrollHandler;

            recklessToggleButton = DaggerfallUI.AddButton(recklessButtonRect, NativePanel);
            recklessToggleButton.OnMouseClick      += SpeedButtonOnClickHandler;
            recklessToggleButton.OnMouseScrollUp   += ToggleSpeedButtonOnScrollHandler;
            recklessToggleButton.OnMouseScrollDown += ToggleSpeedButtonOnScrollHandler;

            footHorseToggleButton = DaggerfallUI.AddButton(footHorseButtonRect, NativePanel);
            footHorseToggleButton.OnMouseClick      += TransportModeButtonOnClickHandler;
            footHorseToggleButton.OnMouseScrollUp   += ToggleTransportModeButtonOnScrollHandler;
            footHorseToggleButton.OnMouseScrollDown += ToggleTransportModeButtonOnScrollHandler;

            shipToggleButton = DaggerfallUI.AddButton(shipButtonRect, NativePanel);
            shipToggleButton.OnMouseClick      += TransportModeButtonOnClickHandler;
            shipToggleButton.OnMouseScrollUp   += ToggleTransportModeButtonOnScrollHandler;
            shipToggleButton.OnMouseScrollDown += ToggleTransportModeButtonOnScrollHandler;

            innToggleButton = DaggerfallUI.AddButton(innsButtonRect, NativePanel);
            innToggleButton.OnMouseClick      += SleepModeButtonOnClickHandler;
            innToggleButton.OnMouseScrollUp   += ToggleSleepModeButtonOnScrollHandler;
            innToggleButton.OnMouseScrollDown += ToggleSleepModeButtonOnScrollHandler;

            campOutToggleButton = DaggerfallUI.AddButton(campoutButtonRect, NativePanel);
            campOutToggleButton.OnMouseClick      += SleepModeButtonOnClickHandler;
            campOutToggleButton.OnMouseScrollUp   += ToggleSleepModeButtonOnScrollHandler;
            campOutToggleButton.OnMouseScrollDown += ToggleSleepModeButtonOnScrollHandler;
        }
示例#20
0
        protected override void Setup()
        {
            base.Setup();

            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new System.Exception("DaggerfallTravelMap: Could not load native texture.");
            }

            greenCheckboxTexture = DaggerfallUI.GetTextureFromResources(greenCheckboxTextureFilename);

            ParentPanel.BackgroundColor = Color.clear;

            travelPanel = DaggerfallUI.AddPanel(nativePanelRect, NativePanel);
            travelPanel.BackgroundTexture = nativeTexture;

            availableGoldLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(148, 97), "0", NativePanel);
            availableGoldLabel.MaxCharacters = 12;

            tripCostLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(117, 107), "0", NativePanel);
            tripCostLabel.MaxCharacters = 18;

            travelTimeLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(129, 117), "0", NativePanel);
            travelTimeLabel.MaxCharacters = 16;

            speedToggleColorPanel = DaggerfallUI.AddPanel(new Rect(cautiousPanelPos, colorPanelSize), NativePanel);
            SetToggleLook(speedToggleColorPanel);

            sleepToggleColorPanel = DaggerfallUI.AddPanel(new Rect(innPanelPos, colorPanelSize), NativePanel);
            SetToggleLook(sleepToggleColorPanel);

            transportToggleColorPanel = DaggerfallUI.AddPanel(new Rect(footPos, colorPanelSize), NativePanel);
            SetToggleLook(transportToggleColorPanel);

            SetupButtons();
            Refresh();
        }
示例#21
0
        private void ServiceButton_OnMouseClick(BaseScreenComponent sender, Vector2 position)
        {
            CloseWindow();
            switch (service)
            {
            case GuildServices.MG_Identify:
                uiManager.PushWindow(new DaggerfallTradeWindow(uiManager, DaggerfallTradeWindow.WindowModes.Identify, this));
                break;

            case GuildServices.MG_Training:
            case GuildServices.FG_Training:
            case GuildServices.TG_Training:
            case GuildServices.DB_Training:
            case GuildServices.TAk_Training:
            case GuildServices.TAr_Training:
            case GuildServices.TDi_Training:
            case GuildServices.TJu_Training:
            case GuildServices.TKy_Training:
            case GuildServices.TMa_Training:
            case GuildServices.TSt_Training:
            case GuildServices.TZe_Training:
                TrainingService();
                break;

            case GuildServices.MG_Buy_Magic_Items:
                DaggerfallTradeWindow tradeWindow = new DaggerfallTradeWindow(uiManager, DaggerfallTradeWindow.WindowModes.Buy, this);
                tradeWindow.MerchantItems = GetMerchantItems();
                uiManager.PushWindow(tradeWindow);
                break;

            case GuildServices.MG_Buy_Spells:
            //uiManager.PushWindow(new DaggerfallBankingWindow(uiManager, this));
            //break;
            default:
                DaggerfallUI.MessageBox("Guild service not yet implemented.");
                break;
            }
        }
        void SetupButtons()
        {
            // Tab page buttons
            weaponsAndArmorButton = DaggerfallUI.AddButton(weaponsAndArmorRect, NativePanel);
            weaponsAndArmorButton.OnMouseClick += WeaponsAndArmor_OnMouseClick;
            magicItemsButton = DaggerfallUI.AddButton(magicItemsRect, NativePanel);
            magicItemsButton.OnMouseClick      += MagicItems_OnMouseClick;
            clothingAndMiscButton               = DaggerfallUI.AddButton(clothingAndMiscRect, NativePanel);
            clothingAndMiscButton.OnMouseClick += ClothingAndMisc_OnMouseClick;
            ingredientsButton = DaggerfallUI.AddButton(ingredientsRect, NativePanel);
            ingredientsButton.OnMouseClick += Ingredients_OnMouseClick;

            // Add powers & side-effects buttons
            Button powersButton = DaggerfallUI.AddButton(powersButtonRect, NativePanel);

            powersButton.OnMouseClick += PowersButton_OnMouseClick;
            Button sideeffectsButton = DaggerfallUI.AddButton(sideeffectsButtonRect, NativePanel);

            sideeffectsButton.OnMouseClick += SideeffectsButton_OnMouseClick;

            // Exit button
            exitButton = DaggerfallUI.AddButton(exitButtonRect, NativePanel);
            exitButton.OnMouseClick += ExitButton_OnMouseClick;

            Button enchantButton = DaggerfallUI.AddButton(enchantButtonRect, NativePanel);

            enchantButton.OnMouseClick += EnchantButton_OnMouseClick;

            // Selected item button
            selectedItemButton = DaggerfallUI.AddButton(selectedItemRect, NativePanel);
            selectedItemButton.SetMargins(Margins.All, 2);
            selectedItemButton.OnMouseClick += SelectedItemButton_OnMouseClick;
            // Selected item icon image panel
            selectedItemPanel = DaggerfallUI.AddPanel(selectedItemButton, AutoSizeModes.ScaleToFit);
            selectedItemPanel.HorizontalAlignment = HorizontalAlignment.Center;
            selectedItemPanel.VerticalAlignment   = VerticalAlignment.Middle;
            selectedItemPanel.MaxAutoScale        = 1f;
        }
        void ShowTradePopup()
        {
            const int tradeMessageBaseId = 260;
            const int notEnoughGoldId    = 454;
            int       msgOffset          = 0;
            int       tradePrice         = GetTradePrice();

            if (windowMode != WindowModes.Sell && PlayerEntity.GetGoldAmount() < tradePrice)
            {
                DaggerfallUI.MessageBox(notEnoughGoldId);
            }
            else
            {
                if (cost >> 1 <= tradePrice)
                {
                    if (cost - (cost >> 2) <= tradePrice)
                    {
                        msgOffset = 2;
                    }
                    else
                    {
                        msgOffset = 1;
                    }
                }
                if (windowMode == WindowModes.Sell)
                {
                    msgOffset += 3;
                }

                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                TextFile.Token[]     tokens     = DaggerfallUnity.Instance.TextProvider.GetRandomTokens(tradeMessageBaseId + msgOffset);
                messageBox.SetTextTokens(tokens, this);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                messageBox.OnButtonClick += ConfirmTrade_OnButtonClick;
                uiManager.PushWindow(messageBox);
            }
        }
        private void AddSectionDescriptionBox(string description)
        {
            const int margin = 1;
            const int textMargin = 1;

            Vector2 position = new Vector2(0 + textMargin + margin, 0 + textMargin);
            TextLabel textLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.Instance.Font4, position, description);
            textLabel.TextScale = 0.5f;
            textLabel.TextColor = sectionTitleColor;
            textLabel.ShadowColor = Color.clear;
            textLabel.WrapText = true;
            textLabel.WrapWords = true;
            textLabel.MaxWidth = columnWidth - (textMargin + margin) * 2;

            int height = textLabel.TextHeight + 2;
            Panel background = DaggerfallUI.AddPanel(new Rect(x + margin, y, columnWidth - margin * 2, height));
            background.BackgroundColor = sectionDescriptionBackgroundColor;
            background.Outline.Enabled = true;
            background.Outline.Color = sectionDescriptionOutlineColor;
            background.Outline.Thickness = 1;
            background.Components.Add(textLabel);
            AddAtNextPosition(height, background);
        }
示例#25
0
 private void QuestMachine_OnQuestStarted(Quest quest)
 {
     // If quest is from archaeologists and involves a dungeon place, give player a locator device
     if (quest.FactionId == ArchaeologistsGuild.FactionId)
     {
         QuestResource[] foundResources = quest.GetAllResources(typeof(Place));
         foreach (Place place in foundResources)
         {
             if (place.SiteDetails.siteType == SiteTypes.Dungeon)
             {
                 if (DaggerfallUnity.Settings.SmallerDungeons)
                 {
                     DaggerfallUI.MessageBox(SMALLDUNGEON_MSG);
                 }
                 else
                 {
                     GameManager.Instance.PlayerEntity.Items.AddItem(new LocatorItem(), ItemCollection.AddPosition.DontCare, true);
                 }
                 break;
             }
         }
     }
 }
示例#26
0
        static private void EatRation()
        {
            List <DaggerfallUnityItem> sacks = GameManager.Instance.PlayerEntity.Items.SearchItems(ItemGroups.UselessItems2, ClimateCalories.templateIndex_Rations);

            foreach (DaggerfallUnityItem sack in sacks)
            {
                if (sack.weightInKg > 0.1)
                {
                    sack.weightInKg -= 0.1f;
                    playerEntity.LastTimePlayerAteOrDrankAtTavern = DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.ToClassicDaggerfallTime() - 250;
                    if (!GameManager.IsGamePaused)
                    {
                        DaggerfallUI.AddHUDText("You eat some rations.");
                    }
                    if (sack.weightInKg <= 0.1)
                    {
                        GameManager.Instance.PlayerEntity.Items.RemoveItem(sack);
                        DaggerfallUI.MessageBox(string.Format("You empty your sack of rations."));
                    }
                    break;
                }
            }
        }
示例#27
0
        public override void OnPush()
        {
            base.OnPush();

            buildingDiscoveryData = GameManager.Instance.PlayerEnterExit.BuildingDiscoveryData;

            // Check guild advancement
            TextFile.Token[] updatedRank = guild.UpdateRank(playerEntity);
            if (updatedRank != null)
            {
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, uiManager.TopWindow);
                messageBox.SetTextTokens(updatedRank, guild);
                messageBox.ClickAnywhereToClose = true;
                uiManager.PushWindow(messageBox);
            }
            // Check for free healing (Temple members)
            if (guild.FreeHealing() && playerEntity.CurrentHealth < playerEntity.MaxHealth)
            {
                playerEntity.SetHealth(playerEntity.MaxHealth);
                DaggerfallUI.MessageBox(350);
            }
            // TODO: Check for magicka restoration (sorcerers)
        }
示例#28
0
            public EnchantmentPanel(EnchantmentSettings enchantment, Rect renderArea)
            {
                bool hasSecondaryLabel = !string.IsNullOrEmpty(enchantment.SecondaryDisplayName);

                Size = new Vector2(panelWidthWithoutScroller, hasSecondaryLabel ? panelHeightWithSecondary : panelHeightWithoutSecondary);

                primaryLabel   = DaggerfallUI.AddTextLabel(DaggerfallUI.SmallFont, Vector2.zero, enchantment.PrimaryDisplayName, this);
                secondaryLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.SmallFont, secondaryLabelPos, secondarySpacing + enchantment.SecondaryDisplayName, this);
                primaryLabel.RestrictedRenderAreaCoordinateType = secondaryLabel.RestrictedRenderAreaCoordinateType = TextLabel.RestrictedRenderArea_CoordinateType.DaggerfallNativeCoordinates;
                primaryLabel.RectRestrictedRenderArea           = secondaryLabel.RectRestrictedRenderArea = renderArea;
                primaryLabel.TextColor = secondaryLabel.TextColor = textColor;

                if (!hasSecondaryLabel)
                {
                    secondaryLabel.Enabled = false;
                }

                OnMouseEnter += EnchantmentPanel_OnMouseEnter;
                OnMouseLeave += EnchantmentPanel_OnMouseLeave;

                RenderArea  = renderArea;
                Enchantment = enchantment;
            }
示例#29
0
        void StartTitleMenu()
        {
            RaiseOnNewGameEvent();
            DaggerfallUI.Instance.PopToHUD();
            playerEnterExit.DisableAllParents();
            ResetWeaponManager();

            if (string.IsNullOrEmpty(PostStartMessage))
            {
                DaggerfallUI.PostMessage(DaggerfallUIMessages.dfuiInitGame);
            }
            else
            {
                DaggerfallUI.PostMessage(PostStartMessage);
            }

            lastStartMethod = StartMethods.TitleMenu;

            if (OnStartMenu != null)
            {
                OnStartMenu(this, null);
            }
        }
        protected override void Setup()
        {
            // Load all textures
            baseTexture = ImageReader.GetTexture(baseTextureName);

            // Create interface panel
            mainPanel.HorizontalAlignment = HorizontalAlignment.Center;
            mainPanel.VerticalAlignment   = VerticalAlignment.Middle;
            mainPanel.BackgroundTexture   = baseTexture;
            mainPanel.Position            = new Vector2(0, 50);
            mainPanel.Size = new Vector2(130, 44);

            // Room button
            roomButton = DaggerfallUI.AddButton(roomButtonRect, mainPanel);
            roomButton.OnMouseClick += RoomButton_OnMouseClick;
            roomButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TavernRoom);

            // Talk button
            talkButton = DaggerfallUI.AddButton(talkButtonRect, mainPanel);
            talkButton.OnMouseClick    += TalkButton_OnMouseClick;
            talkButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TavernTalk);
            talkButton.OnKeyboardEvent += TalkButton_OnKeyboardEvent;

            // Food button
            foodButton = DaggerfallUI.AddButton(foodButtonRect, mainPanel);
            foodButton.OnMouseClick    += FoodButton_OnMouseClick;
            foodButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TavernFood);
            foodButton.OnKeyboardEvent += FoodButton_OnKeyboardEvent;

            // Exit button
            exitButton = DaggerfallUI.AddButton(exitButtonRect, mainPanel);
            exitButton.OnMouseClick    += ExitButton_OnMouseClick;
            exitButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TavernExit);
            exitButton.OnKeyboardEvent += ExitButton_OnKeyboardEvent;

            NativePanel.Components.Add(mainPanel);
        }