Beispiel #1
0
        protected override void Setup()
        {
            AllowCancel = false;
            LoadResources();

            // Add exit button
            Button exitButton = new Button();

            exitButton.Size = new Vector2(20, 9);
            exitButton.HorizontalAlignment = HorizontalAlignment.Center;
            exitButton.VerticalAlignment   = VerticalAlignment.Bottom;
            exitButton.BackgroundColor     = new Color(0.2f, 0.2f, 0.2f, 0.6f);
            exitButton.Outline.Enabled     = true;
            exitButton.Label.Text          = GetText("exit");
            exitButton.OnMouseClick       += ExitButton_OnMouseClick;
            exitButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.GameSetupExit);
            NativePanel.Components.Add(exitButton);

            // If actually validated and we just want to see settings then move direct to settings page
            if (DaggerfallUnity.Instance.IsPathValidated && (DaggerfallUnity.Settings.ShowOptionsAtStart || Input.anyKey))
            {
                currentStage = SetupStages.Options - 1;
            }

            moveNextStage = true;

            // Apply joystick settings to input manager to keep consistency between the setup wizard and the game
            InputManager.Instance.JoystickCursorSensitivity = DaggerfallUnity.Settings.JoystickCursorSensitivity;
            InputManager.Instance.JoystickDeadzone          = DaggerfallUnity.Settings.JoystickDeadzone;

            // Override cursor
            SetCursor();
        }
Beispiel #2
0
        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);

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

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

            NativePanel.Components.Add(mainPanel);
        }
Beispiel #3
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);

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

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

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

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

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

            // Setup buttons
            loadGameButton = DaggerfallUI.AddButton(new Vector2(72, 45), new Vector2(147, 15), DaggerfallUIMessages.dfuiOpenLoadSavedGameWindow, NativePanel);
            loadGameButton.OnMouseClick    += LoadGameButton_OnMouseClick;
            loadGameButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MainMenuLoad);
            loadGameButton.OnKeyboardEvent += LoadGameButton_OnKeyboardEvent;

            newGameButton = DaggerfallUI.AddButton(new Vector2(72, 99), new Vector2(147, 15), DaggerfallUIMessages.dfuiStartNewGame, NativePanel);
            newGameButton.OnMouseClick    += NewGameButton_OnMouseClick;
            newGameButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MainMenuStart);
            newGameButton.OnKeyboardEvent += NewGameButton_OnKeyboardEvent;

            exitButton = DaggerfallUI.AddButton(new Vector2(125, 145), new Vector2(41, 15), DaggerfallUIMessages.dfuiExitGame, NativePanel);
            exitButton.OnMouseClick    += ExitButton_OnMouseClick;
            exitButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MainMenuExit);
            exitButton.OnKeyboardEvent += ExitButton_OnKeyboardEvent;
        }
Beispiel #5
0
        protected override void Setup()
        {
            AllowCancel = false;
            LoadResources();

            // Add exit button
            Button exitButton = new Button();

            exitButton.Size = new Vector2(20, 9);
            exitButton.HorizontalAlignment = HorizontalAlignment.Center;
            exitButton.VerticalAlignment   = VerticalAlignment.Bottom;
            exitButton.BackgroundColor     = new Color(0.2f, 0.2f, 0.2f, 0.6f);
            exitButton.Outline.Enabled     = true;
            exitButton.Label.Text          = GetText("exit");
            exitButton.OnMouseClick       += ExitButton_OnMouseClick;
            exitButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.GameSetupExit);
            NativePanel.Components.Add(exitButton);

            // If actually validated and we just want to see settings then move direct to settings page
            if (DaggerfallUnity.Instance.IsPathValidated && (DaggerfallUnity.Settings.ShowOptionsAtStart || Input.anyKey))
            {
                currentStage = SetupStages.Options - 1;
            }

            moveNextStage = true;

            // Override cursor
            Texture2D tex;

            if (TextureReplacement.TryImportTexture("Cursor", true, out tex))
            {
                Cursor.SetCursor(tex, Vector2.zero, CursorMode.Auto);
                Debug.Log("Cursor texture overridden by mods.");
            }
        }
        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);

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

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

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

            NativePanel.Components.Add(mainPanel);
        }
Beispiel #7
0
        /// <summary>
        /// Setup Advanced Settings Panel
        /// </summary>
        protected override void Setup()
        {
            AllowCancel = false;
            ParentPanel.BackgroundColor = Color.clear;

            gameObject      = new GameObject();
            gameObject.name = "DaggerfallAdvancedSettingsWindow";
            gameObject.AddComponent <AudioSource>();
            dfAudioSource = gameObject.AddComponent <DaggerfallAudioSource>();

            // Pages selection top bar
            bar.Outline.Enabled     = true;
            bar.BackgroundColor     = backgroundColor;
            bar.HorizontalAlignment = HorizontalAlignment.Center;
            bar.Position            = new Vector2(0, topY);
            bar.Size = topBarSize;
            NativePanel.Components.Add(bar);

            // Setup pages
            LoadSettings();

            // Add Close button
            Button closeButton = new Button();

            closeButton.Size = new Vector2(25, 9);
            closeButton.HorizontalAlignment = HorizontalAlignment.Center;
            closeButton.VerticalAlignment   = VerticalAlignment.Bottom;
            closeButton.BackgroundColor     = closeButtonColor;
            closeButton.Outline.Enabled     = true;
            closeButton.Label.Text          = closeButtonText;
            closeButton.OnMouseClick       += CloseButton_OnMouseClick;
            closeButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.GameSetupClose);
            NativePanel.Components.Add(closeButton);
        }
        protected override void Setup()
        {
            // Load textures
            LoadTextures();

            // Create interface panel
            mainPanel.HorizontalAlignment = HorizontalAlignment.Center;
            mainPanel.VerticalAlignment   = VerticalAlignment.Middle;
            mainPanel.BackgroundTexture   = baseTexture;
            mainPanel.Position            = mainPanelRect.position;
            mainPanel.Size = mainPanelRect.size;

            destinationPanel                     = DaggerfallUI.AddPanel(destinationPanelRect, mainPanel);
            destinationLabel                     = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(1, 1), destinationPanel);
            destinationLabel.ShadowColor         = DaggerfallUI.DaggerfallDefaultShadowColor;
            destinationLabel.HorizontalAlignment = HorizontalAlignment.Center;
            destinationLabel.Text                = destinationName;

            // Yes button
            yesButton = DaggerfallUI.AddButton(yesButtonRect, mainPanel);
            yesButton.OnMouseClick += YesButton_OnMouseClick;
            yesButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.Yes);

            // No button
            noButton = DaggerfallUI.AddButton(noButtonRect, mainPanel);
            noButton.OnMouseClick += NoButton_OnMouseClick;
            noButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.No);

            NativePanel.Components.Add(mainPanel);
        }
Beispiel #9
0
        protected override void Setup()
        {
            // Load all textures
            LoadTextures();

            // Create interface panel
            mainPanel.HorizontalAlignment = HorizontalAlignment.Center;
            mainPanel.VerticalAlignment   = VerticalAlignment.Top;
            mainPanel.Position            = new Vector2(0, 0);
            mainPanel.BackgroundTexture   = baseTexture;
            mainPanel.Size = baseSize;

            // Add primary skill spinner
            mainPanel.Components.Add(timeAccelSpinner);
            timeAccelSpinner.Position             = timeAccelPos;
            timeAccelSpinner.OnDownButtonClicked += SlowerButton_OnMouseClick;
            timeAccelSpinner.OnUpButtonClicked   += FasterButton_OnMouseClick;
            timeAccelSpinner.Value = TimeAcceleration;

            // Destination label
            destPanel = DaggerfallUI.AddPanel(destPanelRect, mainPanel);
            destPanel.Components.Add(destinationLabel);
            destinationLabel.HorizontalAlignment = HorizontalAlignment.Center;

            // Message label
            messageLabel = DaggerfallUI.AddTextLabel(null, new Vector2(0, 32), "", NativePanel);
            messageLabel.HorizontalAlignment = HorizontalAlignment.Center;

            // Map button
            mapButton = DaggerfallUI.AddButton(mapButtonRect, mainPanel);
            mapButton.OnMouseClick += (_, __) => {
                DaggerfallUI.PostMessage(DaggerfallUIMessages.dfuiOpenTravelMapWindow);
            };
            mapButton.ToolTip          = defaultToolTip;
            mapButton.ToolTipText      = TipMap;
            mapButton.Hotkey           = new HotkeySequence(KeyCode.M, HotkeySequence.KeyModifiers.None);
            mapButton.OnKeyboardEvent += (_, __) => {
                DaggerfallUI.PostMessage(DaggerfallUIMessages.dfuiOpenTravelMapWindow);
            };

            // Camp (pause travel) button
            campButton = DaggerfallUI.AddButton(campButtonRect, mainPanel);
            campButton.OnMouseClick    += (_, __) => { CloseWindow(); };
            campButton.ToolTip          = defaultToolTip;
            campButton.ToolTipText      = TipCamp;
            campButton.Hotkey           = new HotkeySequence(KeyCode.C, HotkeySequence.KeyModifiers.None);
            campButton.OnKeyboardEvent += (_, __) => { CloseWindow(); };

            // Exit travel button
            exitButton = DaggerfallUI.AddButton(exitButtonRect, mainPanel);
            exitButton.OnMouseClick    += (_, __) => { CancelWindow(); };
            exitButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TravelExit);
            exitButton.OnKeyboardEvent += (_, __) => { CancelWindow(); };

            NativePanel.Components.Add(mainPanel);
        }
        protected override void SetupActionButtons()
        {
            // Can happen using Identify spell https://forums.dfworkshop.net/viewtopic.php?f=24&t=1756
            if (!GameManager.Instance.PlayerEnterExit.IsPlayerInsideDungeon)
            {
                wagonButton = DaggerfallUI.AddButton(wagonButtonRect, actionButtonsPanel);
                wagonButton.OnMouseClick += WagonButton_OnMouseClick;
                wagonButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TradeWagon);
            }

            infoButton = DaggerfallUI.AddButton(infoButtonRect, actionButtonsPanel);
            infoButton.OnMouseClick += InfoButton_OnMouseClick;
            infoButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TradeInfo);

            selectButton = DaggerfallUI.AddButton(selectButtonRect, actionButtonsPanel);
            selectButton.OnMouseClick += SelectButton_OnMouseClick;
            selectButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TradeSelect);

            if (WindowMode == WindowModes.Buy)
            {
                stealButton = DaggerfallUI.AddButton(stealButtonRect, actionButtonsPanel);
                stealButton.OnMouseClick    += StealButton_OnMouseClick;
                stealButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TradeSteal);
                stealButton.OnKeyboardEvent += StealButton_OnKeyboardEvent;
            }
            modeActionButton = DaggerfallUI.AddButton(modeActionButtonRect, actionButtonsPanel);
            modeActionButton.OnMouseClick += ModeActionButton_OnMouseClick;
            switch (WindowMode)
            {
            case WindowModes.Buy:
                modeActionButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TradeBuy);
                break;

            case WindowModes.Identify:
                modeActionButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TradeIdentify);
                break;

            case WindowModes.Inventory:
                // Shouldn't happen
                break;

            case WindowModes.Repair:
                modeActionButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TradeRepair);
                break;

            case WindowModes.Sell:
            case WindowModes.SellMagic:
                modeActionButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TradeSell);
                break;
            }
            modeActionButton.OnKeyboardEvent += ModeActionButton_OnKeyboardEvent;

            clearButton = DaggerfallUI.AddButton(clearButtonRect, actionButtonsPanel);
            clearButton.OnMouseClick += ClearButton_OnMouseClick;
            clearButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TradeClear);
        }
        protected override void Setup()
        {
            AllowCancel = false;
            LoadResources();

            // Add exit button
            Button exitButton = new Button();

            exitButton.Size = new Vector2(20, 9);
            exitButton.HorizontalAlignment = HorizontalAlignment.Center;
            exitButton.VerticalAlignment   = VerticalAlignment.Bottom;
            exitButton.BackgroundColor     = new Color(0.2f, 0.2f, 0.2f, 0.6f);
            exitButton.Outline.Enabled     = true;
            exitButton.Label.Text          = GetText("exit");
            exitButton.OnMouseClick       += ExitButton_OnMouseClick;
            exitButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.GameSetupExit);
            NativePanel.Components.Add(exitButton);

            // If actually validated and we just want to see settings then move direct to settings page
            if (DaggerfallUnity.Instance.IsPathValidated && (DaggerfallUnity.Settings.ShowOptionsAtStart || Input.anyKey))
            {
                currentStage = SetupStages.Options - 1;
            }

            moveNextStage = true;

            int cursorWidth  = 32;
            int cursorHeight = 32;

            // Apply joystick settings to input manager to keep consistency between the setup wizard and the game
            InputManager.Instance.JoystickCursorSensitivity = DaggerfallUnity.Settings.JoystickCursorSensitivity;
            InputManager.Instance.JoystickDeadzone          = DaggerfallUnity.Settings.JoystickDeadzone;

            // Override cursor
            Texture2D tex;

            if (TextureReplacement.TryImportTexture("Cursor", true, out tex))
            {
                CursorMode cursorMode = CursorMode.Auto;
                cursorWidth  = tex.width;
                cursorHeight = tex.height;

                // Cases when true cursor size cannot be achieved using hardware accelerated cursor
                if (SystemInfo.operatingSystemFamily == OperatingSystemFamily.Windows && (cursorWidth > 32 || cursorHeight > 32))
                {
                    cursorMode = CursorMode.ForceSoftware;
                }

                Cursor.SetCursor(tex, Vector2.zero, cursorMode);
                Debug.Log("Cursor texture overridden by mods.");
            }

            DaggerfallUnity.Settings.CursorWidth  = cursorWidth;
            DaggerfallUnity.Settings.CursorHeight = cursorHeight;
        }
Beispiel #12
0
        protected override void Setup()
        {
            // Disable default canceling behavior so exiting can be handled by the Update function instead
            AllowCancel = false;

            // Load all the textures used by rest interface
            LoadTextures();

            // Hide world while resting
            ParentPanel.BackgroundColor = Color.black;

            // Create interface panel
            mainPanel.HorizontalAlignment = HorizontalAlignment.Center;
            mainPanel.BackgroundTexture   = baseTexture;
            mainPanel.Position            = new Vector2(0, 50);
            mainPanel.Size = new Vector2(ImageReader.GetImageData("REST00I0.IMG", 0, 0, false, false).width, ImageReader.GetImageData("REST00I0.IMG", 0, 0, false, false).height);

            NativePanel.Components.Add(mainPanel);

            // Create buttons
            whileButton = DaggerfallUI.AddButton(whileButtonRect, mainPanel);
            whileButton.OnMouseClick  += WhileButton_OnMouseClick;
            whileButton.Hotkey         = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.RestForAWhile);
            healedButton               = DaggerfallUI.AddButton(healedButtonRect, mainPanel);
            healedButton.OnMouseClick += HealedButton_OnMouseClick;
            healedButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.RestUntilHealed);
            loiterButton               = DaggerfallUI.AddButton(loiterButtonRect, mainPanel);
            loiterButton.OnMouseClick += LoiterButton_OnMouseClick;
            loiterButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.RestLoiter);

            // Setup counter panel
            counterPanel.Position            = new Vector2(counterPanelRect.x, counterPanelRect.y);
            counterPanel.Size                = new Vector2(counterPanelRect.width, counterPanelRect.height);
            counterPanel.HorizontalAlignment = HorizontalAlignment.Center;
            counterPanel.Enabled             = false;
            NativePanel.Components.Add(counterPanel);

            // Setup counter text
            Panel counterTextPanel = DaggerfallUI.AddPanel(counterTextPanelRect, counterPanel);

            counterLabel.Position            = new Vector2(0, 2);
            counterLabel.HorizontalAlignment = HorizontalAlignment.Center;
            counterTextPanel.Components.Add(counterLabel);

            // Stop button
            stopButton = DaggerfallUI.AddButton(stopButtonRect, counterPanel);
            stopButton.OnMouseClick    += StopButton_OnMouseClick;
            stopButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.RestStop);
            stopButton.OnKeyboardEvent += StopButton_OnKeyboardEvent;


            // Store toggle closed binding for this window
            toggleClosedBinding = InputManager.Instance.GetBinding(InputManager.Actions.Rest);
        }
        Button AddTipButton(Rect rect, string tipID, BaseScreenComponent.OnMouseClickHandler handler, DaggerfallShortcut.Buttons button)
        {
            Button tipButton = DaggerfallUI.AddButton(rect, NativePanel);

            tipButton.OnMouseEnter += TipButton_OnMouseEnter;
            tipButton.OnMouseLeave += TipButton_OnMouseLeave;
            tipButton.OnMouseClick += handler;
            tipButton.Hotkey        = DaggerfallShortcut.GetBinding(button);
            tipButton.Tag           = tipID;

            return(tipButton);
        }
Beispiel #14
0
        protected override void Setup()
        {
            // Ascertain guild membership status, exempt Thieves Guild and Dark Brotherhood since should never find em until a member
            bool member = guildManager.GetGuild(guildGroup).IsMember();

            if (guildGroup == FactionFile.GuildGroups.DarkBrotherHood || guildGroup == FactionFile.GuildGroups.GeneralPopulace)
            {
                member = true;
            }

            // Load all textures
            LoadTextures(member);

            // 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);

            // Join Guild button
            if (!member)
            {
                joinButton = DaggerfallUI.AddButton(joinButtonRect, mainPanel);
                joinButton.OnMouseClick += JoinButton_OnMouseClick;
                joinButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.GuildsJoin);
            }

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

            // Service button
            serviceLabel.Position            = new Vector2(0, 1);
            serviceLabel.ShadowPosition      = Vector2.zero;
            serviceLabel.HorizontalAlignment = HorizontalAlignment.Center;
            serviceLabel.Text = Services.GetServiceLabelText(service);
            serviceButton     = DaggerfallUI.AddButton(serviceButtonRect, mainPanel);
            serviceButton.Components.Add(serviceLabel);
            serviceButton.OnMouseClick    += ServiceButton_OnMouseClick;
            serviceButton.Hotkey           = DaggerfallShortcut.GetBinding(Services.GetServiceShortcutButton(service));
            serviceButton.OnKeyboardEvent += ServiceButton_OnKeyboardEvent;

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

            NativePanel.Components.Add(mainPanel);
        }
Beispiel #15
0
        void SetupButtons()
        {
            beginButton = DaggerfallUI.AddButton(beginButtonRect, NativePanel);
            beginButton.OnMouseClick += BeginButtonOnClickHandler;
            beginButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TravelBegin);

            exitButton = DaggerfallUI.AddButton(exitButtonRect, NativePanel);
            exitButton.OnMouseClick    += ExitButtonOnClickHandler;
            exitButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TravelExit);
            exitButton.OnKeyboardEvent += ExitButton_OnKeyboardEvent;

            cautiousToggleButton = DaggerfallUI.AddButton(cautiousButtonRect, NativePanel);
            cautiousToggleButton.OnMouseClick      += SpeedButtonOnClickHandler;
            cautiousToggleButton.Hotkey             = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TravelSpeedToggle);
            cautiousToggleButton.OnKeyboardEvent   += SpeedButton_OnKeyboardEvent;
            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.Hotkey             = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TravelTransportModeToggle);
            footHorseToggleButton.OnKeyboardEvent   += TransportModeButtonOnKeyboardHandler;
            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.Hotkey             = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TravelInnCampOutToggle);
            innToggleButton.OnKeyboardEvent   += SleepModeButtonOnKeyboardandler;
            innToggleButton.OnMouseScrollUp   += ToggleSleepModeButtonOnScrollHandler;
            innToggleButton.OnMouseScrollDown += ToggleSleepModeButtonOnScrollHandler;

            campOutToggleButton = DaggerfallUI.AddButton(campoutButtonRect, NativePanel);
            campOutToggleButton.OnMouseClick      += SleepModeButtonOnClickHandler;
            campOutToggleButton.OnMouseScrollUp   += ToggleSleepModeButtonOnScrollHandler;
            campOutToggleButton.OnMouseScrollDown += ToggleSleepModeButtonOnScrollHandler;
        }
Beispiel #16
0
        protected void RemoveOldButtons()
        {
            var components = NativePanel.Components;

            // Remove tab buttons
            var tabShortcuts = new List <DaggerfallShortcut.Buttons>()
            {
                DaggerfallShortcut.Buttons.InventoryWeapons,
                DaggerfallShortcut.Buttons.InventoryMagic,
                DaggerfallShortcut.Buttons.InventoryClothing,
                DaggerfallShortcut.Buttons.InventoryIngredients
            };

            var componentsToRemove = new List <BaseScreenComponent>();

            for (int i = 0; i < components.Count; i++)
            {
                if (components[i] is Button)
                {
                    Button button = components[i] as Button;
                    foreach (var binding in tabShortcuts)
                    {
                        if (button.Hotkey.Equals(DaggerfallShortcut.GetBinding(binding)))
                        {
                            componentsToRemove.Add(button);
                        }
                    }
                }
            }

            // Remove action buttons (info and select)
            var offset = GameManager.Instance.PlayerEnterExit.IsPlayerInsideDungeon ? -1 : 0;
            // This should get actionButtonsPanel's children (beware: this could easily break if someone modifies the component load order)
            var childComponents         = (components[3] as Panel).Components;
            var childComponentsToRemove = new List <BaseScreenComponent>
            {
                childComponents[2 + offset], // Info
                childComponents[3 + offset]  // Select
            };

            foreach (var c in childComponentsToRemove)
            {
                childComponents.Remove(c);
            }
        }
        public override void Update()
        {
            base.Update();

            if (lastChunk && !answerGiven)
            {
                HotkeySequence.KeyModifiers keyModifiers = HotkeySequence.GetKeyboardKeyModifiers();
                if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.Yes).IsUpWith(keyModifiers))
                {
                    HandleAnswer(QuestMachine.QuestMessages.AcceptQuest);
                    QuestMachine.Instance.StartQuest(daedraQuest);
                }
                else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.No).IsUpWith(keyModifiers))
                {
                    HandleAnswer(QuestMachine.QuestMessages.RefuseQuest);
                    GameObjectHelper.CreateFoeSpawner(true, DaggerfallQuestPopupWindow.daedricFoes[UnityEngine.Random.Range(0, 5)], UnityEngine.Random.Range(3, 6), 8, 64);
                }
            }
        }
        public override void Update()
        {
            base.Update();
            Cursor.visible = true;

            HotkeySequence.KeyModifiers keyModifiers = HotkeySequence.GetKeyboardKeyModifiers();
            // Shortcuts for options
            if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MainMenuLoad).IsUpWith(keyModifiers))
            {
                LoadGame();
            }
            else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MainMenuStart).IsUpWith(keyModifiers))
            {
                StartNewGame();
            }
            else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MainMenuExit).IsUpWith(keyModifiers))
            {
                ExitGame();
            }
        }
Beispiel #19
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);
            exitButton.OnKeyboardEvent += ExitButton_OnKeyboardEvent;

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

            downArrowButton = DaggerfallUI.AddButton(downArrowButtonRect, mainPanel);
            downArrowButton.OnMouseClick += DownArrowButton_OnMouseClick;
        }
        protected override void Setup()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallBookReaderWindow: Could not load native texture.");
            }

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

            // Setup panel to contain text labels
            pagePanel.Position = pagePanelPosition;
            pagePanel.Size     = pagePanelSize;
            pagePanel.RectRestrictedRenderArea = new Rect(pagePanel.Position, pagePanel.Size);
            NativePanel.Components.Add(pagePanel);

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

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

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

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

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

            exitButton.OnMouseClick += ExitButton_OnMouseClick;

            NativePanel.OnMouseScrollDown += Panel_OnMouseScrollDown;
            NativePanel.OnMouseScrollUp   += Panel_OnMouseScrollUp;

            LayoutBook();
            DaggerfallUI.Instance.PlayOneShot(openBook);
        }
        public override void Update()
        {
            base.Update();

            HotkeySequence.KeyModifiers keyModifiers = HotkeySequence.GetKeyboardKeyModifiers();
            if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.BookPageRight).IsDownWith(keyModifiers))
            {
                ScrollBook(-scrollAmount);
            }
            else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.BookPageLeft).IsDownWith(keyModifiers))
            {
                ScrollBook(scrollAmount);
            }
            else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.BookLineUp).IsDownWith(keyModifiers))
            {
                ScrollBook(1);
            }
            else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.BookLineDown).IsDownWith(keyModifiers))
            {
                ScrollBook(-1);
            }
        }
        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);
        }
Beispiel #23
0
        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(4);

            // 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;
        }
Beispiel #24
0
        protected override void Setup()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallOptionsWindow: Could not load native texture.");
            }

            // Always dim background
            ParentPanel.BackgroundColor = ScreenDimColor;

            // Native options panel
            optionsPanel.HorizontalAlignment = HorizontalAlignment.Center;
            optionsPanel.Position            = new Vector2(0, 40);
            optionsPanel.Size              = TextureReplacement.GetSize(nativeTexture, nativeImgName);
            optionsPanel.BackgroundColor   = Color.black;
            optionsPanel.BackgroundTexture = nativeTexture;
            NativePanel.Components.Add(optionsPanel);

            // Exit game
            Button exitButton = DaggerfallUI.AddButton(new Rect(101, 4, 45, 16), optionsPanel);

            exitButton.OnMouseClick += ExitButton_OnMouseClick;
            exitButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.OptionsExit);

            // Continue
            Button continueButton = DaggerfallUI.AddButton(new Rect(76, 60, 70, 17), optionsPanel);

            continueButton.OnMouseClick += ContinueButton_OnMouseClick;
            continueButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.OptionsContinue);

            // Save game
            Button saveButton = DaggerfallUI.AddButton(new Rect(4, 4, 45, 16), optionsPanel);

            //saveButton.BackgroundColor = DaggerfallUI.DaggerfallUnityNotImplementedColor;
            saveButton.OnMouseClick += SaveButton_OnMouseClick;
            saveButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.OptionsSave);

            // Load game
            Button loadButton = DaggerfallUI.AddButton(new Rect(52, 4, 46, 16), optionsPanel);

            //loadButton.BackgroundColor = DaggerfallUI.DaggerfallUnityNotImplementedColor;
            loadButton.OnMouseClick += LoadButton_OnMouseClick;
            loadButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.OptionsLoad);

            // Sound Bar
            Button soundPanel = DaggerfallUI.AddButton(new Rect(6.15f, 23.20f, barMaxLength, 5.5f), optionsPanel);

            soundPanel.OnMouseClick += SoundBar_OnMouseClick;
            soundBar = DaggerfallUI.AddPanel(new Rect(0f, 1f, DaggerfallUnity.Settings.SoundVolume * barMaxLength, 3.5f), soundPanel);
            soundBar.BackgroundColor = DaggerfallUI.DaggerfallUnityDefaultCheckboxToggleColor;

            // Music Bar
            Button musicPanel = DaggerfallUI.AddButton(new Rect(6.15f, 30.85f, barMaxLength, 5.5f), optionsPanel);

            musicPanel.OnMouseClick += MusicBar_OnMouseClick;
            musicBar = DaggerfallUI.AddPanel(new Rect(0f, 1f, DaggerfallUnity.Settings.MusicVolume * barMaxLength, 3.5f), musicPanel);
            musicBar.BackgroundColor = DaggerfallUI.DaggerfallUnityDefaultCheckboxToggleColor;

            // Detail level
            Button detailButton = DaggerfallUI.AddButton(new Rect(6.15f, 39f, barMaxLength, 5.5f), optionsPanel);

            detailButton.OnMouseClick += DetailButton_OnMouseClick;
            detailBar = DaggerfallUI.AddPanel(new Rect(0f, 1f, GetDetailBarWidth(QualitySettings.GetQualityLevel()), 3.5f), detailButton);
            detailBar.BackgroundColor = DaggerfallUI.DaggerfallUnityDefaultCheckboxToggleColor;

            // Controls
            Button controlsButton = DaggerfallUI.AddButton(new Rect(5, 60, 70, 17), optionsPanel);

            controlsButton.OnMouseClick += ControlsButton_OnMouseClick;
            controlsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.OptionsControls);

            // Full screen
            Button fullScreenButton = DaggerfallUI.AddButton(new Rect(5, 47, 70, 8), optionsPanel);

            fullScreenButton.OnMouseClick += FullScreenButton_OnMouseClick;
            fullScreenButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.OptionsFullScreen);
            fullScreenTick = DaggerfallUI.AddPanel(new Rect(64f, 3.2f, 3.7f, 3.2f), fullScreenButton);
            fullScreenTick.BackgroundColor = DaggerfallUI.DaggerfallUnityDefaultCheckboxToggleColor;
            fullScreenTick.Enabled         = DaggerfallUnity.Settings.LargeHUD;

            // Head bobbing
            Button headBobbingButton = DaggerfallUI.AddButton(new Rect(76, 47, 70, 8), optionsPanel);

            headBobbingButton.OnMouseClick += HeadBobbingButton_OnMouseClick;
            headBobbingButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.OptionsHeadBobbing);
            headBobbingTick = DaggerfallUI.AddPanel(new Rect(64f, 3.2f, 3.7f, 3.2f), headBobbingButton);
            headBobbingTick.BackgroundColor = DaggerfallUI.DaggerfallUnityDefaultCheckboxToggleColor;
            headBobbingTick.Enabled         = DaggerfallUnity.Settings.HeadBobbing;

            // Set version text
            versionTextLabel                     = new TextLabel();
            versionTextLabel.Text                = string.Format("{0} {1} {2}", VersionInfo.DaggerfallUnityProductName, VersionInfo.DaggerfallUnityStatus, VersionInfo.DaggerfallUnityVersion);
            versionTextLabel.TextColor           = versionTextColor;
            versionTextLabel.ShadowColor         = versionShadowColor;
            versionTextLabel.ShadowPosition      = Vector2.one;
            versionTextLabel.HorizontalAlignment = HorizontalAlignment.Right;
            ParentPanel.Components.Add(versionTextLabel);
        }
        public override void Update()
        {
            // Update HUD visibility
            popupText.Enabled           = ShowPopupText;
            midScreenTextLabel.Enabled  = ShowMidScreenText;
            crosshair.Enabled           = ShowCrosshair;
            vitals.Enabled              = ShowVitals;
            compass.Enabled             = ShowCompass;
            interactionModeIcon.Enabled = ShowInteractionModeIcon;
            placeMarker.Enabled         = ShowLocalQuestPlaces;
            escortingFaces.EnableBorder = ShowEscortingFaces;
            questDebugger.Enabled       = !(questDebugger.State == HUDQuestDebugger.DisplayState.Nothing);
            activeSpells.Enabled        = ShowActiveSpells;

            // Large HUD will force certain other HUD elements off as they conflict in space or utility
            bool largeHUDEnabled = false;//DaggerfallUnity.Settings.LargeHUD;

            if (largeHUDEnabled)
            {
                largeHUD.Enabled            = true;
                vitals.Enabled              = false;
                compass.Enabled             = false;
                interactionModeIcon.Enabled = false;
            }
            else
            {
                largeHUD.Enabled = false;
            }

            // Scale HUD elements
            largeHUD.Scale            = NativePanel.LocalScale * DaggerfallUnity.Settings.LargeHUDScale;
            compass.Scale             = NativePanel.LocalScale;
            vitals.Scale              = NativePanel.LocalScale;
            crosshair.CrosshairScale  = CrosshairScale;
            interactionModeIcon.Scale = NativePanel.LocalScale;

            // Align compass to screen panel
            Rect  screenRect = ParentPanel.Rectangle;
            float compassX   = screenRect.width - (compass.Size.x);
            float compassY   = screenRect.height - (compass.Size.y);

            compass.Position = new Vector2(compassX, compassY);

            // Update midscreen text timer and remove once complete
            if (midScreenTextTimer != -1)
            {
                midScreenTextTimer += Time.deltaTime;
                if (midScreenTextTimer > midScreenTextDelay)
                {
                    midScreenTextTimer      = -1;
                    midScreenTextLabel.Text = string.Empty;
                }
            }

            // Update arrow count if player holding an unsheathed bow
            // TODO: Find a spot for arrow counter when large HUD enabled (remembering player could be in 320x200 retro mode)
            arrowCountTextLabel.Enabled = false;
            if (!largeHUDEnabled && ShowArrowCount && !GameManager.Instance.WeaponManager.Sheathed)
            {
                EquipSlots          slot = DaggerfallUnity.Settings.BowLeftHandWithSwitching ? EquipSlots.LeftHand : EquipSlots.RightHand;
                DaggerfallUnityItem held = GameManager.Instance.PlayerEntity.ItemEquipTable.GetItem(slot);
                if (held != null && held.ItemGroup == ItemGroups.Weapons &&
                    (held.TemplateIndex == (int)Weapons.Long_Bow || held.TemplateIndex == (int)Weapons.Short_Bow))
                {
                    // Arrow count label position is offset to left of compass and centred relative to compass height
                    // This is done every frame to handle adaptive resolutions
                    Vector2 arrowLabelPos = compass.Position;
                    arrowLabelPos.x -= arrowCountTextLabel.TextWidth;
                    arrowLabelPos.y += compass.Size.y / 2 - arrowCountTextLabel.TextHeight / 2;

                    DaggerfallUnityItem arrows = GameManager.Instance.PlayerEntity.Items.GetItem(ItemGroups.Weapons, (int)Weapons.Arrow);
                    arrowCountTextLabel.Text      = (arrows != null) ? arrows.stackCount.ToString() : "0";
                    arrowCountTextLabel.TextScale = NativePanel.LocalScale.x;
                    arrowCountTextLabel.Position  = arrowLabelPos;
                    arrowCountTextLabel.Enabled   = true;
                }
            }

            HotkeySequence.KeyModifiers keyModifiers = HotkeySequence.GetKeyboardKeyModifiers();
            // Cycle quest debugger state
            if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.DebuggerToggle).IsDownWith(keyModifiers))
            {
                questDebugger.NextState();
            }

            if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.Pause).IsUpWith(keyModifiers))
            {
                DaggerfallUI.PostMessage(DaggerfallUIMessages.dfuiOpenPauseOptionsDialog);
            }

            // Toggle HUD rendering
            if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.HUDToggle).IsDownWith(keyModifiers))
            {
                renderHUD = !renderHUD;
            }

            // Toggle Retro Renderer Postprocessing
            if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.ToggleRetroPP).IsDownWith(keyModifiers))
            {
                RetroRenderer.enablePostprocessing = !RetroRenderer.enablePostprocessing;
            }

            flickerController.NextCycle();

            // Don't display persistent HUD elements during initial startup
            // Prevents HUD elements being shown briefly at wrong size/scale at game start
            if (!startupComplete && !GameManager.Instance.IsPlayingGame())
            {
                largeHUD.Enabled  = false;
                vitals.Enabled    = false;
                crosshair.Enabled = false;
                compass.Enabled   = false;
            }
            else
            {
                startupComplete = true;
            }

            base.Update();
        }
Beispiel #26
0
    protected override void Setup()
    {
        ParentPanel.BackgroundColor = Color.clear;

        ModListPanel.Outline.Enabled     = true;
        ModListPanel.BackgroundColor     = backgroundColor;
        ModListPanel.HorizontalAlignment = HorizontalAlignment.Left;
        ModListPanel.VerticalAlignment   = VerticalAlignment.Middle;
        ModListPanel.Size = new Vector2(120, 175);
        NativePanel.Components.Add(ModListPanel);

        modsFound.HorizontalAlignment = HorizontalAlignment.Center;
        modsFound.Position            = new Vector2(10, 20);
        modsFound.Text = string.Format("{0}: ", ModManager.GetText("modsFound"));
        ModListPanel.Components.Add(modsFound);

        modList.BackgroundColor        = new Color(0.1f, 0.1f, 0.1f, 0.5f);
        modList.Size                   = new Vector2(110, 115);
        modList.HorizontalAlignment    = HorizontalAlignment.Center;
        modList.VerticalAlignment      = VerticalAlignment.Middle;
        modList.TextColor              = unselectedTextColor;
        modList.SelectedTextColor      = textColor;
        modList.ShadowPosition         = Vector2.zero;
        modList.RowsDisplayed          = 14;
        modList.RowAlignment           = HorizontalAlignment.Left;
        modList.LeftMargin            += 4;
        modList.SelectedShadowPosition = DaggerfallUI.DaggerfallDefaultShadowPos;
        modList.SelectedShadowColor    = Color.black;
        modList.OnScroll              += ModList_OnScroll;
        ModListPanel.Components.Add(modList);

        modListScrollBar.Size = new Vector2(5, 115);
        modListScrollBar.HorizontalAlignment = HorizontalAlignment.Right;
        modListScrollBar.VerticalAlignment   = VerticalAlignment.Middle;
        modListScrollBar.Position            = new Vector2(100, 12);
        modListScrollBar.BackgroundColor     = Color.grey;
        modListScrollBar.DisplayUnits        = 14;
        modListScrollBar.TotalUnits          = modList.Count;
        modListScrollBar.OnScroll           += ModListScrollBar_OnScroll;
        ModListPanel.Components.Add(modListScrollBar);
        modList.ScrollToSelected();

        backButton.Size                 = new Vector2(45, 12);
        backButton.Label.Text           = string.Format("< {0}", ModManager.GetText("backToOptions"));
        backButton.Label.ShadowPosition = Vector2.zero;
        backButton.Label.TextColor      = Color.gray;
        backButton.ToolTip              = defaultToolTip;
        backButton.ToolTipText          = ModManager.GetText("backToOptionsInfo");
        backButton.VerticalAlignment    = VerticalAlignment.Top;
        backButton.HorizontalAlignment  = HorizontalAlignment.Left;
        backButton.OnMouseClick        += BackButton_OnMouseClick;
        backButton.Hotkey               = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.GameSetupBackToOptions);
        ModListPanel.Components.Add(backButton);

        increaseLoadOrderButton.Size            = new Vector2(40, 12);
        increaseLoadOrderButton.Position        = new Vector2(62, 150);
        increaseLoadOrderButton.Outline.Enabled = true;
        increaseLoadOrderButton.BackgroundColor = textColor;
        increaseLoadOrderButton.Label.Text      = ModManager.GetText("increase");
        increaseLoadOrderButton.OnMouseClick   += IncreaseLoadOrderButton_OnMouseClick;
        ModListPanel.Components.Add(increaseLoadOrderButton);

        decreaseLoadOrderButton.Size            = new Vector2(40, 12);
        decreaseLoadOrderButton.Position        = new Vector2(21, 150);
        decreaseLoadOrderButton.Outline.Enabled = true;
        decreaseLoadOrderButton.BackgroundColor = textColor;
        decreaseLoadOrderButton.Label.Text      = ModManager.GetText("lower");
        decreaseLoadOrderButton.OnMouseClick   += DecreaseLoadOrderButton_OnMouseClick;
        ModListPanel.Components.Add(decreaseLoadOrderButton);

        enableAllButton.Size              = new Vector2(40, 12);
        enableAllButton.Position          = new Vector2(21, 163);
        enableAllButton.Outline.Enabled   = true;
        enableAllButton.BackgroundColor   = textColor;
        enableAllButton.VerticalAlignment = VerticalAlignment.Bottom;
        enableAllButton.Label.Text        = ModManager.GetText("enableAll");
        enableAllButton.ToolTipText       = ModManager.GetText("enableAllInfo");
        enableAllButton.OnMouseClick     += EnableAllButton_OnMouseClick;
        ModListPanel.Components.Add(enableAllButton);

        disableAllButton.Size              = new Vector2(40, 12);
        disableAllButton.Position          = new Vector2(62, 163);
        disableAllButton.Outline.Enabled   = true;
        disableAllButton.BackgroundColor   = textColor;
        disableAllButton.VerticalAlignment = VerticalAlignment.Bottom;
        disableAllButton.Label.Text        = ModManager.GetText("disableAll");
        disableAllButton.ToolTipText       = ModManager.GetText("disableAllInfo");
        disableAllButton.OnMouseClick     += DisableAllButton_OnMouseClick;
        ModListPanel.Components.Add(disableAllButton);

        //Add main mod panel
        ModPanel.Outline.Enabled     = true;
        ModPanel.BackgroundColor     = backgroundColor;
        ModPanel.HorizontalAlignment = HorizontalAlignment.Right;
        ModPanel.VerticalAlignment   = VerticalAlignment.Middle;
        ModPanel.Size = new Vector2(200, 175);
        NativePanel.Components.Add(ModPanel);

        modEnabledCheckBox.Label.Text      = ModManager.GetText("enabled");
        modEnabledCheckBox.Label.TextColor = selectedTextColor;
        modEnabledCheckBox.CheckBoxColor   = selectedTextColor;
        modEnabledCheckBox.ToolTip         = defaultToolTip;
        modEnabledCheckBox.ToolTipText     = ModManager.GetText("enabledInfo");
        modEnabledCheckBox.IsChecked       = true;
        modEnabledCheckBox.Position        = new Vector2(1, 25);
        modEnabledCheckBox.OnToggleState  += ModEnabledCheckBox_OnToggleState;
        ModPanel.Components.Add(modEnabledCheckBox);

        modLoadPriorityLabel.Position = new Vector2(60, 25);
        ModPanel.Components.Add(modLoadPriorityLabel);

        modTitleLabel.Position            = new Vector2(0, 5);
        modTitleLabel.HorizontalAlignment = HorizontalAlignment.Center;
        modTitleLabel.MaxCharacters       = 40;
        ModPanel.Components.Add(modTitleLabel);

        modVersionLabel.Position      = new Vector2(5, 40);
        modVersionLabel.MaxCharacters = 40;
        ModPanel.Components.Add(modVersionLabel);

        modAuthorLabel.Position      = new Vector2(5, 50);
        modAuthorLabel.MaxCharacters = 40;
        ModPanel.Components.Add(modAuthorLabel);

        modAuthorContactLabel.Position      = new Vector2(5, 60);
        modAuthorContactLabel.MaxCharacters = 40;
        ModPanel.Components.Add(modAuthorContactLabel);

        modDFTFUVersionLabel.Position      = new Vector2(5, 70);
        modDFTFUVersionLabel.MaxCharacters = 40;
        ModPanel.Components.Add(modDFTFUVersionLabel);

        showModDescriptionButton.Position            = new Vector2(5, 95);
        showModDescriptionButton.Size                = new Vector2(75, 12);
        showModDescriptionButton.HorizontalAlignment = HorizontalAlignment.Center;
        showModDescriptionButton.Label.Text          = ModManager.GetText("modDescription");
        showModDescriptionButton.BackgroundColor     = textColor;
        showModDescriptionButton.Outline.Enabled     = true;
        showModDescriptionButton.OnMouseClick       += ShowModDescriptionPopUp_OnMouseClick;
        ModPanel.Components.Add(showModDescriptionButton);

        refreshButton.Size                = new Vector2(50, 12);
        refreshButton.Position            = new Vector2(5, 139);
        refreshButton.Outline.Enabled     = true;
        refreshButton.BackgroundColor     = textColor;
        refreshButton.HorizontalAlignment = HorizontalAlignment.Center;
        refreshButton.Label.Text          = ModManager.GetText("refresh");
        refreshButton.Label.ToolTipText   = ModManager.GetText("RrefreshInfo");
        refreshButton.OnMouseClick       += RefreshButton_OnMouseClick;
        refreshButton.Hotkey              = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.GameSetupRefresh);
        ModPanel.Components.Add(refreshButton);

        saveAndCloseButton.Size                = new Vector2(70, 12);
        saveAndCloseButton.Outline.Enabled     = true;
        saveAndCloseButton.BackgroundColor     = textColor;
        saveAndCloseButton.VerticalAlignment   = VerticalAlignment.Bottom;
        saveAndCloseButton.HorizontalAlignment = HorizontalAlignment.Center;
        saveAndCloseButton.Label.Text          = ModManager.GetText("saveClose");
        saveAndCloseButton.Label.ToolTipText   = ModManager.GetText("saveCloseInfo");
        saveAndCloseButton.OnMouseClick       += SaveAndCloseButton_OnMouseClick;
        saveAndCloseButton.Hotkey              = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.GameSetupSaveAndClose);
        ModPanel.Components.Add(saveAndCloseButton);

        extractFilesButton.Size                = new Vector2(60, 12);
        extractFilesButton.Position            = new Vector2(5, 117);
        extractFilesButton.Outline.Enabled     = true;
        extractFilesButton.BackgroundColor     = textColor;
        extractFilesButton.HorizontalAlignment = HorizontalAlignment.Center;
        extractFilesButton.Label.Text          = ModManager.GetText("extractText");
        extractFilesButton.Label.ToolTipText   = ModManager.GetText("extractTextInfo");
        extractFilesButton.OnMouseClick       += ExtractFilesButton_OnMouseClick;
        ModPanel.Components.Add(extractFilesButton);

        modSettingsButton.Size                = new Vector2(60, 12);
        modSettingsButton.Position            = new Vector2(5, 103);
        modSettingsButton.Outline.Enabled     = true;
        modSettingsButton.BackgroundColor     = textColor;
        modSettingsButton.HorizontalAlignment = HorizontalAlignment.Center;
        modSettingsButton.Label.Text          = ModManager.GetText("settings");
        modSettingsButton.Label.ToolTipText   = ModManager.GetText("settingsInfo");
        modSettingsButton.OnMouseClick       += ModSettingsButton_OnMouseClick;
        modSettingsButton.Enabled             = false;
        ModPanel.Components.Add(modSettingsButton);

        GetLoadedMods();
        UpdateModPanel();
    }
Beispiel #27
0
        protected override void Setup()
        {
            base.Setup();

            // Always dim background
            ParentPanel.BackgroundColor = ScreenDimColor;

            Texture2D texture = DaggerfallUI.GetTextureFromImg(nativeImgName);

            if (texture == null)
            {
                Debug.LogError("failed to load texture: " + nativeImgName);
                CloseWindow();
            }
            if (defaultToolTip != null)
            {
                defaultToolTip.ToolTipDelay = 1;
            }

            mainPanel = DaggerfallUI.AddPanel(NativePanel, AutoSizeModes.None);
            mainPanel.BackgroundTexture = texture;
            mainPanel.Size = new Vector2(320, 200);
            mainPanel.HorizontalAlignment = HorizontalAlignment.Center;
            mainPanel.VerticalAlignment   = VerticalAlignment.Middle;
            mainPanel.OnMouseScrollDown  += MainPanel_OnMouseScrollDown;
            mainPanel.OnMouseScrollUp    += MainPanel_OnMouseScrollUp;

            dialogButton               = new Button();
            dialogButton.Position      = new Vector2(32, 187);
            dialogButton.Size          = new Vector2(68, 10);
            dialogButton.OnMouseClick += DialogButton_OnMouseClick;
            dialogButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.JournalNextCategory);
            dialogButton.Name          = "dialog_button";
            dialogButton.ToolTip       = defaultToolTip;
            dialogButton.ToolTipText   = TextManager.Instance.GetLocalizedText("dialogButtonInfo");
            mainPanel.Components.Add(dialogButton);

            upArrowButton               = new Button();
            upArrowButton.Position      = new Vector2(181, 188);
            upArrowButton.Size          = new Vector2(13, 7);
            upArrowButton.OnMouseClick += UpArrowButton_OnMouseClick;
            upArrowButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.JournalPreviousPage);
            upArrowButton.Name          = "uparrow_button";
            mainPanel.Components.Add(upArrowButton);

            downArrowButton               = new Button();
            downArrowButton.Position      = new Vector2(209, 188);
            downArrowButton.Size          = new Vector2(13, 7);
            downArrowButton.OnMouseClick += DownArrowButton_OnMouseClick;
            downArrowButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.JournalNextPage);
            downArrowButton.Name          = "downarrow_button";
            mainPanel.Components.Add(downArrowButton);

            exitButton                  = new Button();
            exitButton.Position         = new Vector2(278, 187);
            exitButton.Size             = new Vector2(30, 9);
            exitButton.OnMouseClick    += ExitButton_OnMouseClick;
            exitButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.JournalExit);
            exitButton.OnKeyboardEvent += ExitButton_OnKeyboardEvent;
            exitButton.Name             = "exit_button";
            mainPanel.Components.Add(exitButton);

            questLogLabel                    = new MultiFormatTextLabel();
            questLogLabel.Position           = new Vector2(30, 38);
            questLogLabel.Size               = new Vector2(238, 138);
            questLogLabel.HighlightColor     = Color.white;
            questLogLabel.OnMouseClick      += QuestLogLabel_OnMouseClick;
            questLogLabel.OnRightMouseClick += QuestLogLabel_OnRightMouseClick;
            mainPanel.Components.Add(questLogLabel);

            Panel titlePanel = new Panel {
                Position = new Vector2(30, 22),
                Size     = new Vector2(238, 16),
            };

            titleLabel = new TextLabel {
                HorizontalAlignment = HorizontalAlignment.Center,
                Font        = DaggerfallUI.LargeFont,
                ShadowColor = new Color(0f, 0.2f, 0.5f),
                ToolTip     = defaultToolTip,
                ToolTipText = TextManager.Instance.GetLocalizedText("activeQuestsInfo"),
            };
            titlePanel.Components.Add(titleLabel);
            mainPanel.Components.Add(titlePanel);
            titlePanel.OnMouseClick += TitlePanel_OnMouseClick;

            questMessages = QuestMachine.Instance.GetAllQuestLogMessages();

            // Store toggle closed bindings for this window
            toggleClosedBinding1 = InputManager.Instance.GetBinding(InputManager.Actions.LogBook);
            toggleClosedBinding2 = InputManager.Instance.GetBinding(InputManager.Actions.NoteBook);

#if LAYOUT
            SetBackgroundColors();
#endif
        }
        protected override void Setup()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallCharacterSheetWindow: Could not load native texture.");
            }

            // Always dim background
            ParentPanel.BackgroundColor = ScreenDimColor;

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

            // Character portrait
            NativePanel.Components.Add(characterPortrait);
            characterPortrait.Position = new Vector2(200, 8);

            // Setup labels
            nameLabel        = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(41, 4), NativePanel);
            raceLabel        = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(41, 14), NativePanel);
            classLabel       = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(46, 24), NativePanel);
            levelLabel       = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(45, 34), NativePanel);
            goldLabel        = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(39, 44), NativePanel);
            fatigueLabel     = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(57, 54), NativePanel);
            healthLabel      = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(52, 64), NativePanel);
            encumbranceLabel = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(90, 74), NativePanel);

            // Setup stat labels
            Vector2 panelPos = new Vector2(141, 17);

            for (int i = 0; i < DaggerfallStats.Count; i++)
            {
                statPanels[i] = DaggerfallUI.AddPanel(new Rect(panelPos.x, panelPos.y, 28, 6), NativePanel);
                statLabels[i] = DaggerfallUI.AddDefaultShadowedTextLabel(Vector2.zero, statPanels[i]);
                statLabels[i].HorizontalAlignment = HorizontalAlignment.Center;
                panelPos.y += 24f;
            }

            // Name button
            Button nameButton = DaggerfallUI.AddButton(new Rect(4, 3, 132, 8), NativePanel);

            nameButton.OnMouseClick += NameButton_OnMouseClick;
            nameButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetName);

            // Level button
            Button levelButton = DaggerfallUI.AddButton(new Rect(4, 33, 132, 8), NativePanel);

            levelButton.OnMouseClick += LevelButton_OnMouseClick;
            levelButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetLevel);

            // Gold button
            Button goldButton = DaggerfallUI.AddButton(new Rect(4, 43, 132, 8), NativePanel);

            goldButton.OnMouseClick += GoldButton_OnMouseClick;
            goldButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetGold);

            // Health button
            Button healthButton = DaggerfallUI.AddButton(new Rect(4, 63, 128, 8), NativePanel);

            healthButton.OnMouseClick += HealthButton_OnMouseClick;
            healthButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetHealth);

            // Affiliations button
            Button affiliationsButton = DaggerfallUI.AddButton(new Rect(3, 84, 130, 8), NativePanel);

            affiliationsButton.OnMouseClick += AffiliationsButton_OnMouseClick;
            affiliationsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetAffiliations);

            // Primary skills button
            Button primarySkillsButton = DaggerfallUI.AddButton(new Rect(11, 106, 115, 8), NativePanel);

            primarySkillsButton.OnMouseClick += PrimarySkillsButton_OnMouseClick;
            primarySkillsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetPrimarySkills);

            // Major skills button
            Button majorSkillsButton = DaggerfallUI.AddButton(new Rect(11, 116, 115, 8), NativePanel);

            majorSkillsButton.OnMouseClick += MajorSkillsButton_OnMouseClick;
            majorSkillsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetMajorSkills);

            // Minor skills button
            Button minorSkillsButton = DaggerfallUI.AddButton(new Rect(11, 126, 115, 8), NativePanel);

            minorSkillsButton.OnMouseClick += MinorSkillsButton_OnMouseClick;
            minorSkillsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetMinorSkills);

            // Miscellaneous skills button
            Button miscSkillsButton = DaggerfallUI.AddButton(new Rect(11, 136, 115, 8), NativePanel);

            miscSkillsButton.OnMouseClick += MiscSkillsButton_OnMouseClick;
            miscSkillsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetMiscSkills);

            // Inventory button
            Button inventoryButton = DaggerfallUI.AddButton(new Rect(3, 151, 65, 12), NativePanel);

            inventoryButton.OnMouseClick    += InventoryButton_OnMouseClick;
            inventoryButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetInventory);
            inventoryButton.OnKeyboardEvent += InventoryButton_OnKeyboardEvent;

            // Spellbook button
            Button spellBookButton = DaggerfallUI.AddButton(new Rect(69, 151, 65, 12), NativePanel);

            spellBookButton.OnMouseClick    += SpellBookButton_OnMouseClick;
            spellBookButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetSpellbook);
            spellBookButton.OnKeyboardEvent += SpellBookButton_OnKeyboardEvent;

            // Logbook button
            Button logBookButton = DaggerfallUI.AddButton(new Rect(3, 165, 65, 12), NativePanel);

            logBookButton.OnMouseClick    += LogBookButton_OnMouseClick;
            logBookButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetLogbook);
            logBookButton.OnKeyboardEvent += LogBookButton_OnKeyboardEvent;

            // History button
            Button historyButton = DaggerfallUI.AddButton(new Rect(69, 165, 65, 12), NativePanel);

            historyButton.OnMouseClick    += HistoryButton_OnMouseClick;
            historyButton.Hotkey           = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.CharacterSheetHistory);
            historyButton.OnKeyboardEvent += HistoryButton_OnKeyboardEvent;

            // Exit button
            Button exitButton = DaggerfallUI.AddButton(new Rect(50, 179, 39, 19), NativePanel);

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

            // Attribute popup text
            Vector2 pos = new Vector2(141, 6);

            for (int i = 0; i < DaggerfallStats.Count; i++)
            {
                Rect rect = new Rect(pos.x, pos.y, 28, 20);
                AddAttributePopupButton((DFCareer.Stats)i, rect);
                pos.y += 24f;
            }

            statsRollout = new StatsRollout(true);
            statsRollout.OnStatChanged += StatsRollout_OnStatChanged;

            // Update player paper doll for first time
            UpdatePlayerValues();
            characterPortrait.Refresh();

            // Store toggle closed binding for this window
            toggleClosedBinding = InputManager.Instance.GetBinding(InputManager.Actions.CharacterSheet);
        }
Beispiel #29
0
        void ShowOptionsPanel()
        {
            // Disable previous stage
            resolutionPanel.Enabled = false;

            // Create backdrop
            if (!backdropCreated)
            {
                CreateBackdrop();
            }

            // Add options panel
            optionsPanel.Outline.Enabled     = true;
            optionsPanel.BackgroundColor     = backgroundColor;
            optionsPanel.HorizontalAlignment = HorizontalAlignment.Center;
            //optionsPanel.VerticalAlignment = VerticalAlignment.Middle;
            optionsPanel.Position = new Vector2(0, 8);
            optionsPanel.Size     = new Vector2(318, 165);
            NativePanel.Components.Add(optionsPanel);

            // Add title text
            TextLabel titleLabel = new TextLabel(DaggerfallUI.Instance.Font2);

            titleLabel.Text                = "Daggerfall Unity";
            titleLabel.Position            = new Vector2(0, 15);
            titleLabel.TextScale           = 1.4f;
            titleLabel.HorizontalAlignment = HorizontalAlignment.Center;
            optionsPanel.Components.Add(titleLabel);

            // Add version text
            TextLabel versionLabel = new TextLabel(DaggerfallUI.DefaultFont);

            versionLabel.Text                = string.Format("{0} v{1}", char.ToUpper(VersionInfo.DaggerfallUnityStatus[0]) + VersionInfo.DaggerfallUnityStatus.Substring(1), VersionInfo.DaggerfallUnityVersion);
            versionLabel.Position            = new Vector2(0, 40);
            versionLabel.TextScale           = 1.0f;
            versionLabel.HorizontalAlignment = HorizontalAlignment.Center;
            versionLabel.ShadowPosition      = Vector2.zero;
            versionLabel.TextColor           = secondaryTextColor;
            optionsPanel.Components.Add(versionLabel);

            // Add settings path text
            TextLabel settingsPathLabel = new TextLabel();

            settingsPathLabel.Text                = DaggerfallUnity.Settings.PersistentDataPath;
            settingsPathLabel.Position            = new Vector2(0, 170);
            settingsPathLabel.HorizontalAlignment = HorizontalAlignment.Center;
            settingsPathLabel.ShadowPosition      = Vector2.zero;
            settingsPathLabel.TextColor           = secondaryTextColor;
            settingsPathLabel.BackgroundColor     = backgroundColor;
            optionsPanel.Components.Add(settingsPathLabel);

            // Setup options checkboxes
            float x = 8;

            optionPos            = 60;
            alwayShowOptions     = AddOption(x, "alwayShowOptions", DaggerfallUnity.Settings.ShowOptionsAtStart);
            vsync                = AddOption(x, "vsync", DaggerfallUnity.Settings.VSync);
            swapHealthAndFatigue = AddOption(x, "swapHealthAndFatigue", DaggerfallUnity.Settings.SwapHealthAndFatigueColors);
            invertMouseVertical  = AddOption(x, "invertMouseVertical", DaggerfallUnity.Settings.InvertMouseVertical);
            mouseSmoothing       = AddOption(x, "mouseSmoothing", DaggerfallUnity.Settings.MouseLookSmoothing);

            x               = 165;
            optionPos       = 60;
            leftHandWeapons = AddOption(x, "leftHandWeapons", GetLeftHandWeapons());
            playerNudity    = AddOption(x, "playerNudity", DaggerfallUnity.Settings.PlayerNudity);
            clickToAttack   = AddOption(x, "clickToAttack", DaggerfallUnity.Settings.ClickToAttack);

            // Setup mods checkboxes
            // TODO: Might rework this, but could still be useful for certain core mods later
            sdfFontRendering = AddOption(x, "sdfFontRendering", DaggerfallUnity.Settings.SDFFontRendering);
            sdfFontRendering.OnToggleState += SDFFontRendering_OnToggleState;
            //bool exampleModCheckbox = AddOption(x, "Example", "Example built-in mod", DaggerfallUnity.Settings.ExampleModOption);

            enableController = AddOption(x, "enableController", DaggerfallUnity.Settings.EnableController);
            enableController.OnToggleState += EnableController_OnToggleState;

            // Add mod note
            TextLabel modNoteLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(0, 125), GetText("modNote"), optionsPanel);

            modNoteLabel.HorizontalAlignment = HorizontalAlignment.Center;
            modNoteLabel.ShadowPosition      = Vector2.zero;

            // Confirm button
            Button optionsConfirmButton = new Button();

            optionsConfirmButton.Position            = new Vector2(0, optionsPanel.InteriorHeight - 15);
            optionsConfirmButton.Size                = new Vector2(40, 12);
            optionsConfirmButton.Outline.Enabled     = true;
            optionsConfirmButton.Label.Text          = GetText("play");
            optionsConfirmButton.BackgroundColor     = new Color(0.0f, 0.5f, 0.0f, 0.4f);
            optionsConfirmButton.HorizontalAlignment = HorizontalAlignment.Center;
            optionsConfirmButton.OnMouseClick       += OptionsConfirmButton_OnMouseClick;
            optionsConfirmButton.Hotkey              = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.GameSetupPlay);
            optionsPanel.Components.Add(optionsConfirmButton);

            // Restart button
            Button restartButton = new Button();

            restartButton.Size                      = new Vector2(45, 12);
            restartButton.Label.Text                = string.Format("< {0}", GetText("restart"));
            restartButton.Label.ShadowPosition      = DaggerfallUI.DaggerfallDefaultShadowPos;
            restartButton.Label.TextColor           = DaggerfallUI.DaggerfallDefaultTextColor;
            restartButton.Label.HorizontalAlignment = HorizontalAlignment.Left;
            restartButton.ToolTip                   = defaultToolTip;
            restartButton.ToolTipText               = GetText("restartInfo");
            restartButton.VerticalAlignment         = VerticalAlignment.Top;
            restartButton.HorizontalAlignment       = HorizontalAlignment.Left;
            restartButton.OnMouseClick             += RestartButton_OnMouseClick;
            restartButton.Hotkey                    = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.GameSetupRestart);
            optionsPanel.Components.Add(restartButton);

            if (DaggerfallUnity.Settings.LypyL_ModSystem)
            {
                Button ShowModsButton = new Button();
                ShowModsButton.Label.Text      = GetText("mods");
                ShowModsButton.Position        = new Vector2(3, optionsConfirmButton.Position.y);
                ShowModsButton.Size            = optionsConfirmButton.Size;
                ShowModsButton.BackgroundColor = optionsConfirmButton.BackgroundColor;
                ShowModsButton.Label.TextColor = optionsConfirmButton.Label.TextColor;
                ShowModsButton.Outline.Enabled = true;
                optionsPanel.Components.Add(ShowModsButton);
                ShowModsButton.OnMouseClick += ModsButton_OnOnMouseBlick;
                ShowModsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.GameSetupMods);
            }

            // Advanced Settings
            Button AdvancedSettingsButton = new Button();

            AdvancedSettingsButton.Label.Text      = GetText("advanced");
            AdvancedSettingsButton.Size            = new Vector2(45, 12);
            AdvancedSettingsButton.Position        = new Vector2(optionsPanel.InteriorWidth - AdvancedSettingsButton.Size.x - 3, optionsConfirmButton.Position.y);
            AdvancedSettingsButton.BackgroundColor = optionsConfirmButton.BackgroundColor;
            AdvancedSettingsButton.Label.TextColor = optionsConfirmButton.Label.TextColor;
            AdvancedSettingsButton.Outline.Enabled = true;
            optionsPanel.Components.Add(AdvancedSettingsButton);
            AdvancedSettingsButton.OnMouseClick += AdvancedSettingsButton_OnOnMouseBlick;
            AdvancedSettingsButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.GameSetupAdvancedSettings);
        }
        protected override void Setup()
        {
            // Load all the textures used by inventory system
            LoadTextures();

            // Always dim background
            ParentPanel.BackgroundColor = ScreenDimColor;

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

            // Character portrait
            SetupPaperdoll();

            // Cost & gold display
            SetupCostAndGold();

            // Setup action button panel.
            actionButtonsPanel = DaggerfallUI.AddPanel(actionButtonsPanelRect, NativePanel);
            // If not inventory mode, overlay mode button texture.
            if (actionButtonsTexture != null)
            {
                actionButtonsPanel.BackgroundTexture = actionButtonsTexture;
            }

            // Setup item info panel if configured
            if (DaggerfallUnity.Settings.EnableInventoryInfoPanel)
            {
                if (WindowMode == WindowModes.Buy)
                {
                    itemInfoPanel = DaggerfallUI.AddPanel(itemBuyInfoPanelRect, NativePanel);
                }
                else
                {
                    itemInfoPanel = DaggerfallUI.AddPanel(itemInfoPanelRect, NativePanel);
                }
                SetupItemInfoPanel();
            }

            // Setup UI
            SetupTargetIconPanels();
            SetupTabPageButtons();
            SetupActionButtons();
            SetupAccessoryElements();
            SetupItemListScrollers();

            // Highlight purchasable items
            if (WindowMode == WindowModes.Buy)
            {
                localItemListScroller.BackgroundAnimationHandler  = BuyItemBackgroundAnimationHandler;
                remoteItemListScroller.BackgroundAnimationHandler = BuyItemBackgroundAnimationHandler;
                localItemListScroller.BackgroundAnimationDelay    = coinsAnimationDelay;
                remoteItemListScroller.BackgroundAnimationDelay   = coinsAnimationDelay;
            }
            // Setup special behaviour for remote items when repairing
            if (WindowMode == WindowModes.Repair)
            {
                remoteItemListScroller.BackgroundColourHandler = RepairItemBackgroundColourHandler;
                remoteItemListScroller.LabelTextHandler        = RepairItemLabelTextHandler;
            }
            // Exit buttons
            Button exitButton = DaggerfallUI.AddButton(exitButtonRect, NativePanel);

            exitButton.OnMouseClick += ExitButton_OnMouseClick;
            exitButton.Hotkey        = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TradeExit);

            // Setup initial state
            SelectTabPage((WindowMode == WindowModes.Identify) ? TabPages.MagicItems : TabPages.WeaponsAndArmor);
            SelectActionMode(ActionModes.Select);

            // Setup initial display
            FilterLocalItems();
            localItemListScroller.Items = localItemsFiltered;
            FilterRemoteItems();
            remoteItemListScroller.Items = remoteItemsFiltered;
            UpdateAccessoryItemsDisplay();
            UpdateLocalTargetIcon();
            UpdateRemoteTargetIcon();
            // UpdateRepairTimes(false);
            UpdateCostAndGold();
            SelectWagon(false);
        }