protected override void Setup()
        {
            base.Setup();

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

            // Create panel for window
            classGenChoosePanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName);
            classGenChoosePanel.HorizontalAlignment     = HorizontalAlignment.Center;
            classGenChoosePanel.VerticalAlignment       = VerticalAlignment.Middle;
            classGenChoosePanel.BackgroundTexture       = nativeTexture;
            classGenChoosePanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill;
            NativePanel.Components.Add(classGenChoosePanel);

            // Create buttons
            chooseClass = DaggerfallUI.AddButton(chooseClassRect, classGenChoosePanel);
            chooseClass.OnMouseClick    += ChooseClass_OnMouseClick;
            chooseGenerate               = DaggerfallUI.AddButton(chooseQuestionsRect, classGenChoosePanel);
            chooseGenerate.OnMouseClick += ChooseGenerate_OnMouseClick;
        }
Пример #2
0
 void LoadAssets()
 {
     compassTexture    = DaggerfallUI.GetTextureFromImg(compassFilename);
     compassSize       = TextureReplacement.GetSize(compassTexture, compassFilename, true);
     compassBoxTexture = DaggerfallUI.GetTextureFromImg(compassBoxFilename);
     compassBoxSize    = TextureReplacement.GetSize(compassBoxTexture, compassBoxFilename, true);
 }
Пример #3
0
        protected override void Setup()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallCourtWindow: Could not load native texture.");
            }

            // Native court panel
            courtPanel.HorizontalAlignment = HorizontalAlignment.Center;
            courtPanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName);
            courtPanel.BackgroundTexture = nativeTexture;
            NativePanel.Components.Add(courtPanel);

            // Cancel any camera recoil
            RaiseOnCourtScreenEvent();

            // Add days until freedom label
            daysUntilFreedomLabel                     = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(156, 165), string.Empty, NativePanel);
            daysUntilFreedomLabel.TextColor           = DaggerfallUI.DaggerfallPrisonDaysUntilFreedomColor;
            daysUntilFreedomLabel.ShadowColor         = DaggerfallUI.DaggerfallPrisonDaysUntilFreedomShadowColor;
            daysUntilFreedomLabel.HorizontalAlignment = HorizontalAlignment.Center;

            playerEntity = GameManager.Instance.PlayerEntity;
            AllowCancel  = false;
        }
Пример #4
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.BackgroundTexture = nativeTexture;
            NativePanel.Components.Add(optionsPanel);

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

            exitButton.OnMouseClick += ExitButton_OnMouseClick;

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

            continueButton.OnMouseClick += ContinueButton_OnMouseClick;

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

            //saveButton.BackgroundColor = DaggerfallUI.DaggerfallUnityNotImplementedColor;
            saveButton.OnMouseClick += SaveButton_OnMouseClick;

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

            //loadButton.BackgroundColor = DaggerfallUI.DaggerfallUnityNotImplementedColor;
            loadButton.OnMouseClick += LoadButton_OnMouseClick;

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

            controlsButton.OnMouseClick += ControlsButton_OnMouseClick;

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

            fullScreenButton.BackgroundColor = new Color(1, 0, 0, 0.5f);

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

            headBobbingButton.BackgroundColor = new Color(1, 0, 0, 0.5f);
        }
Пример #5
0
        protected override void Setup()
        {
            if (IsSetup)
            {
                return;
            }

            base.Setup();

            // Load native texture
            nativeTexture        = DaggerfallUI.GetTextureFromImg(nativeImgName);
            nativeOverlayTexture = DaggerfallUI.GetTextureFromImg(nativeImgOverlayName);
            if (!nativeTexture || !nativeOverlayTexture)
            {
                throw new Exception("CreateCharSpecialAdvantage: Could not load native texture.");
            }

            // Create panel for window
            advantagePanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName);
            advantagePanel.HorizontalAlignment     = HorizontalAlignment.Left;
            advantagePanel.VerticalAlignment       = VerticalAlignment.Top;
            advantagePanel.BackgroundTexture       = nativeTexture;
            advantagePanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill;
            NativePanel.Components.Add(advantagePanel);

            // Setup UI components
            font = DaggerfallUI.SmallFont;
            Panel buttonPanel = NativePanel;

            if (!isDisadvantages)  // Adding this overlay makes it appear as Special Advantages instead of Disadvantages
            {
                overlayPanel.Size = TextureReplacement.GetSize(nativeOverlayTexture, nativeImgOverlayName);
                overlayPanel.HorizontalAlignment     = HorizontalAlignment.Left;
                overlayPanel.VerticalAlignment       = VerticalAlignment.Top;
                overlayPanel.BackgroundTexture       = nativeOverlayTexture;
                overlayPanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill;
                advantagePanel.Components.Add(overlayPanel);
                buttonPanel = overlayPanel;
            }
            addAdvantageButton = DaggerfallUI.AddButton(addAdvantageButtonRect, buttonPanel);
            addAdvantageButton.OnMouseClick += AddAdvantageButton_OnMouseClick;
            addAdvantageButton.ClickSound    = DaggerfallUI.Instance.GetAudioClip(SoundClips.ButtonClick);
            exitButton = DaggerfallUI.AddButton(exitButtonRect, NativePanel);
            exitButton.OnMouseClick += ExitButton_OnMouseClick;
            exitButton.ClickSound    = DaggerfallUI.Instance.GetAudioClip(SoundClips.ButtonClick);
            for (int i = 0; i < maxLabels; i++)
            {
                advantageLabels[i] = DaggerfallUI.AddTextLabel(font, new Vector2(8, 35 + i * labelSpacing), string.Empty, NativePanel);
                advantageLabels[i].OnMouseClick += AdvantageLabel_OnMouseClick;
                advantageLabels[i].Tag           = -1;
            }
            UpdateLabels();
            InitializeAdjustmentDict();

            IsSetup = true;
        }
Пример #6
0
        void LoadAssets()
        {
            compassTexture    = DaggerfallUI.GetTextureFromImg(compassFilename);
            compassSize       = TextureReplacement.GetSize(compassTexture, compassFilename, true);
            compassBoxTexture = DaggerfallUI.GetTextureFromImg(compassBoxFilename);
            compassBoxSize    = TextureReplacement.GetSize(compassBoxTexture, compassBoxFilename, true);

            defaultTrackingIcon            = Resources.Load <Texture2D>(trackingIconFilename);
            defaultTrackingIcon.filterMode = (FilterMode)DaggerfallUnity.Settings.GUIFilterMode;
        }
Пример #7
0
        void LoadAssets()
        {
            if (TextureReplacement.CustomTextureExist(defaultCrosshairFilename))
            {
                CrosshairTexture = TextureReplacement.LoadCustomTexture(defaultCrosshairFilename);
            }
            else
            {
                CrosshairTexture = Resources.Load <Texture2D>(defaultCrosshairFilename);
            }

            crosshairSize = TextureReplacement.GetSize(CrosshairTexture, defaultCrosshairFilename, true);
        }
Пример #8
0
        protected override void Setup()
        {
            if (IsSetup)
            {
                return;
            }

            base.Setup();

            prevWindow = (CreateCharCustomClass)this.PreviousWindow;

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

            // Create panel for window
            repPanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName);
            repPanel.HorizontalAlignment     = HorizontalAlignment.Center;
            repPanel.VerticalAlignment       = VerticalAlignment.Middle;
            repPanel.BackgroundTexture       = nativeTexture;
            repPanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill;
            repPanel.OnMouseClick           += RepPanel_OnMouseClick;
            NativePanel.Components.Add(repPanel);

            // Setup UI components
            font       = DaggerfallUI.DefaultFont;
            exitButton = DaggerfallUI.AddButton(exitButtonRect, repPanel);
            exitButton.OnMouseClick += ExitButton_OnMouseClick;
            exitButton.ClickSound    = DaggerfallUI.Instance.GetAudioClip(SoundClips.ButtonClick);

            // Setup adjustable bars
            SetupRepBars(merchantsGreenPanel, merchantsRedPanel, new Vector2(3f, 75f), new Vector2(3f, 77f), prevWindow.MerchantsRep);
            SetupRepBars(peasantsGreenPanel, peasantsRedPanel, new Vector2(36f, 75f), new Vector2(36f, 77f), prevWindow.PeasantsRep);
            SetupRepBars(scholarsGreenPanel, scholarsRedPanel, new Vector2(69f, 75f), new Vector2(69f, 77f), prevWindow.ScholarsRep);
            SetupRepBars(nobilityGreenPanel, nobilityRedPanel, new Vector2(102f, 75f), new Vector2(102f, 77f), prevWindow.NobilityRep);
            SetupRepBars(underworldGreenPanel, underworldRedPanel, new Vector2(135f, 75f), new Vector2(135f, 77f), prevWindow.UnderworldRep);

            // Setup text labels
            merchantsPtsLabel  = DaggerfallUI.AddTextLabel(font, new Vector2(18f, 143f), prevWindow.MerchantsRep.ToString(), repPanel);
            peasantsPtsLabel   = DaggerfallUI.AddTextLabel(font, new Vector2(50f, 143f), prevWindow.PeasantsRep.ToString(), repPanel);
            scholarsPtsLabel   = DaggerfallUI.AddTextLabel(font, new Vector2(82f, 143f), prevWindow.ScholarsRep.ToString(), repPanel);
            nobilityPtsLabel   = DaggerfallUI.AddTextLabel(font, new Vector2(114f, 143f), prevWindow.NobilityRep.ToString(), repPanel);
            underworldPtsLabel = DaggerfallUI.AddTextLabel(font, new Vector2(146f, 143f), prevWindow.UnderworldRep.ToString(), repPanel);
            distributePtsLabel = DaggerfallUI.AddTextLabel(font, new Vector2(64f, 173f), pointsToDistribute.ToString(), repPanel);

            IsSetup = true;
        }
Пример #9
0
        private void SwitchToPrisonScreen()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName2);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallCourtWindow: Could not load native texture.");
            }

            // Native court panel
            courtPanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName2);
            courtPanel.BackgroundTexture = nativeTexture;

            daysUntilFreedomLabel.Text = HardStrings.daysUntilFreedom;
            daysUntilFreedomLabel.Text = daysUntilFreedomLabel.Text.Replace("%d", daysInPrison.ToString());
        }
Пример #10
0
        protected virtual void SwitchToPrisonScreen()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName2);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallCourtWindow: Could not load native texture.");
            }

            // Native court panel
            courtPanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName2);
            courtPanel.BackgroundTexture = nativeTexture;

            daysUntilFreedomLabel.Text = TextManager.Instance.GetLocalizedText("daysUntilFreedom");
            daysUntilFreedomLabel.Text = daysUntilFreedomLabel.Text.Replace("%d", daysInPrison.ToString());
        }
Пример #11
0
        void SetCurrentFace()
        {
            currentFaceTexture = faceTextures[faceIndex];

            if (currentFaceTexture != null)
            {
                if (raceGender == Genders.Male)
                {
                    facePanel.Size = TextureReplacement.GetSize(currentFaceTexture, raceTemplate.PaperDollHeadsMale, faceIndex);
                }
                else if (raceGender == Genders.Female)
                {
                    facePanel.Size = TextureReplacement.GetSize(currentFaceTexture, raceTemplate.PaperDollHeadsFemale, faceIndex);
                }

                facePanel.BackgroundTexture = currentFaceTexture;
            }
        }
Пример #12
0
        protected override void Setup()
        {
            // Load native texture
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallCourtWindow: Could not load native texture.");
            }

            // Native court panel
            courtPanel.HorizontalAlignment = HorizontalAlignment.Center;
            courtPanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName);
            courtPanel.BackgroundTexture = nativeTexture;
            NativePanel.Components.Add(courtPanel);

            playerEntity = GameManager.Instance.PlayerEntity;
            state        = 0;
        }
Пример #13
0
        protected override void Setup()
        {
            base.Setup();

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

            // Create panel for picker
            pickerPanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName);
            pickerPanel.HorizontalAlignment     = HorizontalAlignment.Center;
            pickerPanel.VerticalAlignment       = VerticalAlignment.Middle;
            pickerPanel.BackgroundTexture       = nativeTexture;
            pickerPanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill;
            NativePanel.Components.Add(pickerPanel);

            // Create list box
            listBox.Position           = new Vector2(26, 27);
            listBox.Size               = new Vector2(138, 72);
            listBox.OnUseSelectedItem += ListBox_OnUseSelectedItem;
            pickerPanel.Components.Add(listBox);

            // Add previous button
            Button previousButton = DaggerfallUI.AddButton(new Rect(179, 10, 9, 9), pickerPanel);

            previousButton.OnMouseClick += PreviousButton_OnMouseClick;

            // Add next button
            Button nextButton = DaggerfallUI.AddButton(new Rect(179, 108, 9, 9), pickerPanel);

            nextButton.OnMouseClick += NextButton_OnMouseClick;

            // Add scrollbar
            scrollBar           = new VerticalScrollBar();
            scrollBar.Position  = new Vector2(181, 23);
            scrollBar.Size      = new Vector2(5, 82);
            scrollBar.OnScroll += ScrollBar_OnScroll;
            pickerPanel.Components.Add(scrollBar);
        }
        public LeftRightSpinner()
        {
            DaggerfallUnity dfUnity = DaggerfallUnity.Instance;

            if (!dfUnity.IsReady)
            {
                return;
            }

            // Load IMG texture
            ImgFile imgFile = new ImgFile(Path.Combine(dfUnity.Arena2Path, nativeImgName), FileUsage.UseMemory, true);

            imgFile.LoadPalette(Path.Combine(dfUnity.Arena2Path, imgFile.PaletteName));
            nativeTexture            = TextureReader.CreateFromAPIImage(imgFile, 0, 0, 0);
            nativeTexture.filterMode = DaggerfallUI.Instance.GlobalFilterMode;

            // Setup spinner panel
            Size = TextureReplacement.GetSize(nativeTexture, nativeImgName);
            backgroundTexture = nativeTexture;

            // Add up/down buttons
            Components.Add(leftButton);
            Components.Add(rightButton);
            leftButton.Position       = new Vector2(0, 0);
            leftButton.Size           = new Vector2(11, 9);
            leftButton.OnMouseClick  += LeftButton_OnMouseClick;
            leftButton.OnMouseDown   += LeftButton_OnMouseDown;
            leftButton.OnMouseUp     += LeftRightButtons_OnMouseUp;
            rightButton.Position      = new Vector2(26, 0);
            rightButton.Size          = new Vector2(11, 9);
            rightButton.OnMouseClick += RightButton_OnMouseClick;
            rightButton.OnMouseDown  += RightButton_OnMouseDown;
            rightButton.OnMouseUp    += LeftRightButtons_OnMouseUp;

            // Add value label
            Components.Add(valueLabel);
            valueLabel.Position            = new Vector2(0, 2);
            valueLabel.Size                = new Vector2(15, 9);
            valueLabel.HorizontalAlignment = HorizontalAlignment.Center;
            valueLabel.ShadowColor         = DaggerfallUI.DaggerfallAlternateShadowColor1;
            SetValue(this.value);
        }
Пример #15
0
        public override void OnPop()
        {
            // Reset variables
            GameManager.Instance.PlayerEntity.Arrested = false;
            state             = 0;
            prisonUpdateTimer = 0f;
            GameManager.Instance.PlayerEntity.InPrison = false;
            repositionPlayer           = false;
            daysUntilFreedomLabel.Text = string.Empty;

            // Return native texture to court screen
            nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName);
            if (!nativeTexture)
            {
                throw new Exception("DaggerfallCourtWindow: Could not load native texture.");
            }
            courtPanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName);
            courtPanel.BackgroundTexture = nativeTexture;

            base.CancelWindow();
        }
Пример #16
0
        public Button AddButton(MessageBoxButtons messageBoxButton)
        {
            if (!IsSetup)
            {
                Setup();
            }

            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;
            buttons.Add(button);

            UpdatePanelSizes();

            return(button);
        }
        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);
        }
Пример #18
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.BackgroundTexture = nativeTexture;
            NativePanel.Components.Add(optionsPanel);

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

            exitButton.OnMouseClick += ExitButton_OnMouseClick;

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

            continueButton.OnMouseClick += ContinueButton_OnMouseClick;

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

            //saveButton.BackgroundColor = DaggerfallUI.DaggerfallUnityNotImplementedColor;
            saveButton.OnMouseClick += SaveButton_OnMouseClick;

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

            //loadButton.BackgroundColor = DaggerfallUI.DaggerfallUnityNotImplementedColor;
            loadButton.OnMouseClick += LoadButton_OnMouseClick;

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

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

            controlsButton.OnMouseClick += ControlsButton_OnMouseClick;

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

            fullScreenButton.BackgroundColor = new Color(1, 0, 0, 0.5f);

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

            headBobbingButton.OnMouseClick += HeadBobbingButton_OnMouseClick;
            headBobbingTick = DaggerfallUI.AddPanel(new Rect(64f, 3.2f, 3.7f, 3.2f), headBobbingButton);
            headBobbingTick.BackgroundColor = DaggerfallUI.DaggerfallUnityDefaultCheckboxToggleColor;
            headBobbingTick.Enabled         = DaggerfallUnity.Settings.HeadBobbing;
        }
Пример #19
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);
        }