コード例 #1
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.GetSizeFromTexture(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);
        }
コード例 #2
0
        void SetCurrentFace()
        {
            currentFaceTexture = faceTextures[faceIndex];

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

                facePanel.BackgroundTexture = currentFaceTexture;
            }
        }
コード例 #3
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.GetSizeFromTexture(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);
        }
コード例 #4
0
        public Button AddButton(MessageBoxButtons messageBoxButton)
        {
            if (!IsSetup)
            {
                Setup();
            }

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

            button.BackgroundTexture       = background;
            button.BackgroundTextureLayout = BackgroundLayout.StretchToFill;
            button.Tag           = messageBoxButton;
            button.OnMouseClick += ButtonClickHandler;
            buttons.Add(button);

            UpdatePanelSizes();

            return(button);
        }
コード例 #5
0
        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.GetSizeFromTexture(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;
            rightButton.Position      = new Vector2(26, 0);
            rightButton.Size          = new Vector2(11, 9);
            rightButton.OnMouseClick += RightButton_OnMouseClick;

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