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

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

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

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

            clearButton = DaggerfallUI.AddButton(clearButtonRect, actionButtonsPanel);
            clearButton.OnMouseClick += ClearButton_OnMouseClick;
        }
Пример #2
0
        protected override void Setup()
        {
            // What transport options does the player have?
            ItemCollection inventory = GameManager.Instance.PlayerEntity.Items;
            bool           hasHorse  = inventory.Contains(ItemGroups.Transportation, (int)Transportation.Horse);
            bool           hasCart   = inventory.Contains(ItemGroups.Transportation, (int)Transportation.Small_cart);
            bool           hasShip   = DaggerfallBankManager.OwnsShip;

            // 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(baseTexture.width, baseTexture.height);

            // Foot button
            footButton = DaggerfallUI.AddButton(footButtonRect, mainPanel);
            footButton.OnMouseClick += FootButton_OnMouseClick;

            // Horse button
            horseButton = DaggerfallUI.AddButton(horseButtonRect, mainPanel);
            if (hasHorse)
            {
                horseButton.OnMouseClick += HorseButton_OnMouseClick;
            }
            else
            {
                horseButton.BackgroundTexture = ImageReader.GetSubTexture(disabledTexture, horseDisabledRect);
            }
            // Cart button
            cartButton = DaggerfallUI.AddButton(cartButtonRect, mainPanel);
            if (hasCart)
            {
                cartButton.OnMouseClick += CartButton_OnMouseClick;
            }
            else
            {
                cartButton.BackgroundTexture = ImageReader.GetSubTexture(disabledTexture, cartDisabledRect);
            }
            // Ship button
            shipButton = DaggerfallUI.AddButton(shipButtonRect, mainPanel);
            if (hasShip)
            {
                shipButton.OnMouseClick += ShipButton_OnMouseClick;
            }
            else
            {
                shipButton.BackgroundTexture = ImageReader.GetSubTexture(disabledTexture, shipDisabledRect);
            }

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

            NativePanel.Components.Add(mainPanel);
        }
Пример #3
0
        void SetupItemsList(bool enhanced)
        {
            // List panel for scrolling behaviour
            Panel itemsListPanel = DaggerfallUI.AddPanel(itemListPanelRect, this);

            itemsListPanel.OnMouseScrollUp   += ItemsListPanel_OnMouseScrollUp;
            itemsListPanel.OnMouseScrollDown += ItemsListPanel_OnMouseScrollDown;

            // Setup buttons
            itemButtons     = new Button[listDisplayUnits];
            itemIconPanels  = new Panel[listDisplayUnits];
            itemAnimPanels  = new Panel[listDisplayUnits];
            itemStackLabels = new TextLabel[listDisplayUnits];
            itemMiscLabels  = new TextLabel[listDisplayUnits];
            Rect[] itemButtonRects = (enhanced) ? itemButtonRects16 : itemButtonRects4;

            for (int i = 0; i < listDisplayUnits; i++)
            {
                // Panel - for backing button in enhanced mode
                if (enhanced)
                {
                    Panel buttonPanel = DaggerfallUI.AddPanel(itemButtonRects[i], itemsListPanel);
                    buttonPanel.BackgroundTexture = itemListTextures[i];
                }
                // Buttons (also handle highlight colours)
                itemButtons[i] = DaggerfallUI.AddButton(itemButtonRects[i], itemsListPanel);
                itemButtons[i].SetMargins(Margins.All, itemButtonMarginSize);
                itemButtons[i].ToolTip            = toolTip;
                itemButtons[i].Tag                = i;
                itemButtons[i].OnMouseClick      += ItemButton_OnMouseClick;
                itemButtons[i].OnMouseEnter      += ItemButton_OnMouseEnter;
                itemButtons[i].OnMouseScrollUp   += ItemButton_OnMouseEnter;
                itemButtons[i].OnMouseScrollDown += ItemButton_OnMouseEnter;

                // Item foreground animation panel
                itemAnimPanels[i] = DaggerfallUI.AddPanel(itemButtonRects[i], itemsListPanel);
                itemAnimPanels[i].AnimationDelayInSeconds = foregroundAnimationDelay;

                // Icon image panel
                itemIconPanels[i] = DaggerfallUI.AddPanel(itemButtons[i], AutoSizeModes.ScaleToFit);
                itemIconPanels[i].HorizontalAlignment = HorizontalAlignment.Center;
                itemIconPanels[i].VerticalAlignment   = VerticalAlignment.Middle;
                itemIconPanels[i].MaxAutoScale        = 1f;

                // Stack labels
                itemStackLabels[i] = DaggerfallUI.AddTextLabel(DaggerfallUI.Instance.Font4, Vector2.zero, string.Empty, itemButtons[i]);
                itemStackLabels[i].HorizontalAlignment = HorizontalAlignment.Right;
                itemStackLabels[i].VerticalAlignment   = VerticalAlignment.Bottom;
                itemStackLabels[i].ShadowPosition      = Vector2.zero;
                itemStackLabels[i].TextScale           = textScale;
                itemStackLabels[i].TextColor           = DaggerfallUI.DaggerfallUnityDefaultToolTipTextColor;

                // Misc labels
                itemMiscLabels[i] = DaggerfallUI.AddTextLabel(DaggerfallUI.Instance.Font4, Vector2.zero, string.Empty, itemButtons[i]);
                itemMiscLabels[i].HorizontalAlignment = HorizontalAlignment.Left;
                itemMiscLabels[i].VerticalAlignment   = VerticalAlignment.Top;
                itemMiscLabels[i].TextScale           = textScale;
            }
        }
Пример #4
0
        void SetupAccessoryElements()
        {
            // Starting layout
            Vector2 col0Pos    = new Vector2(1, 11);
            Vector2 col1Pos    = new Vector2(24, 11);
            Vector2 buttonSize = new Vector2(21, 20);
            int     rowOffset  = 31;
            bool    col0       = true;

            // Follow same order as equip slots
            int minSlot = (int)EquipSlots.Amulet0;
            int maxSlot = (int)EquipSlots.Crystal1;

            for (int i = minSlot; i <= maxSlot; i++)
            {
                // Current button rect
                Rect rect;
                if (col0)
                {
                    rect = new Rect(col0Pos.x, col0Pos.y, buttonSize.x, buttonSize.y);
                }
                else
                {
                    rect = new Rect(col1Pos.x, col1Pos.y, buttonSize.x, buttonSize.y);
                }

                // Create item button
                Button button = DaggerfallUI.AddButton(rect, NativePanel);
                button.SetMargins(Margins.All, accessoryButtonMarginSize);
                button.ToolTip       = defaultToolTip;
                button.Tag           = i;
                button.OnMouseClick += AccessoryItemsButton_OnMouseClick;
                accessoryButtons[i]  = button;

                // Create icon panel
                Panel panel = new Panel();
                panel.AutoSize            = AutoSizeModes.ScaleToFit;
                panel.MaxAutoScale        = 1f;
                panel.HorizontalAlignment = HorizontalAlignment.Center;
                panel.VerticalAlignment   = VerticalAlignment.Middle;
                button.Components.Add(panel);
                accessoryIconPanels[i] = panel;

                // Move to next column, then drop down a row at end of second column
                if (col0)
                {
                    col0 = !col0;
                }
                else
                {
                    col0       = !col0;
                    col0Pos.y += rowOffset;
                    col1Pos.y += rowOffset;
                }
            }
        }
Пример #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
        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);
        }
        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);
        }
Пример #8
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);
        }
Пример #9
0
        // Initial button setup
        void SetupButtons()
        {
            // Exit button
            exitButton = DaggerfallUI.AddButton(new Rect(278, 175, 39, 22), NativePanel);
            exitButton.OnMouseClick += ExitButtonClickHandler;

            // Find button
            Texture2D findButtonTexture = DaggerfallUI.GetTextureFromImg(findAtButtonImgName, new Rect(0, 0, 45, 11));

            findButton = DaggerfallUI.AddButton(new Rect(3, 175, findButtonTexture.width, findButtonTexture.height), NativePanel);
            findButton.BackgroundTexture = findButtonTexture;
            findButton.Enabled           = false;
            findButton.OnMouseClick     += FindlocationButtonClickHandler;

            // I'm At button
            Texture2D atButtonTexture = DaggerfallUI.GetTextureFromImg(findAtButtonImgName, new Rect(0, 11, 45, 11));

            atButton = DaggerfallUI.AddButton(new Rect(3, 186, findButtonTexture.width, findButtonTexture.height), NativePanel);
            atButton.BackgroundTexture = atButtonTexture;
            atButton.OnMouseClick     += AtButtonClickHandler;

            // Dungeons filter button
            dungeonsFilterButton.Position = new Vector2(50, 175);
            dungeonsFilterButton.Size     = new Vector2(dungeonsFilterButtonSrcRect.width, dungeonsFilterButtonSrcRect.height);
            NativePanel.Components.Add(dungeonsFilterButton);

            // Temples filter button
            templesFilterButton.Position = new Vector2(50, 186);
            templesFilterButton.Size     = new Vector2(templesFilterButtonSrcRect.width, templesFilterButtonSrcRect.height);
            NativePanel.Components.Add(templesFilterButton);

            // Homes filter button
            homesFilterButton.Position = new Vector2(149, 175);
            homesFilterButton.Size     = new Vector2(homesFilterButtonSrcRect.width, homesFilterButtonSrcRect.height);
            NativePanel.Components.Add(homesFilterButton);

            // Towns filter button
            townsFilterButton.Position = new Vector2(149, 186);
            townsFilterButton.Size     = new Vector2(townsFilterButtonSrcRect.width, townsFilterButtonSrcRect.height);
            NativePanel.Components.Add(townsFilterButton);

            // Horizontal arrow button
            horizontalArrowButton.Position = new Vector2(231, 176);
            horizontalArrowButton.Size     = new Vector2(leftArrowTexture.width, leftArrowTexture.height);
            horizontalArrowButton.Enabled  = false;
            NativePanel.Components.Add(horizontalArrowButton);
            horizontalArrowButton.OnMouseClick += HorizontalArrowButtonClickHander;

            // Vertical arrow button
            verticalArrowButton.Position = new Vector2(254, 176);
            verticalArrowButton.Size     = new Vector2(upArrowTexture.width, upArrowTexture.height);
            verticalArrowButton.Enabled  = false;
            NativePanel.Components.Add(verticalArrowButton);
            verticalArrowButton.OnMouseClick += VerticalArrowButtonClickHander;
        }
Пример #10
0
        Button AddTipButton(Rect rect, string tipID, BaseScreenComponent.OnMouseClickHandler handler)
        {
            Button tipButton = DaggerfallUI.AddButton(rect, NativePanel);

            tipButton.OnMouseEnter += TipButton_OnMouseEnter;
            tipButton.OnMouseLeave += TipButton_OnMouseLeave;
            tipButton.OnMouseClick += handler;
            tipButton.Tag           = tipID;

            return(tipButton);
        }
Пример #11
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);
        }
Пример #12
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);
        }
        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);
        }
Пример #14
0
        private Button AddButton(Panel panel, string label, BaseScreenComponent.OnMouseClickHandler onMouseClickHandler)
        {
            Button button = DaggerfallUI.AddButton(new Vector2(panel.Size.x / 2, y), new Vector2(30, 8), panel);

            button.Label.Text      = label;
            button.OnMouseClick   += onMouseClickHandler;
            button.Outline.Enabled = true;
            button.BackgroundColor = new Color(0.0f, 0.5f, 0.0f, 0.4f);

            y += itemSpacing + 2;

            return(button);
        }
Пример #15
0
        void SetupTabPageButtons()
        {
            weaponsAndArmorButton = DaggerfallUI.AddButton(weaponsAndArmorRect, NativePanel);
            weaponsAndArmorButton.OnMouseClick += WeaponsAndArmor_OnMouseClick;

            magicItemsButton = DaggerfallUI.AddButton(magicItemsRect, NativePanel);
            magicItemsButton.OnMouseClick += MagicItems_OnMouseClick;

            clothingAndMiscButton = DaggerfallUI.AddButton(clothingAndMiscRect, NativePanel);
            clothingAndMiscButton.OnMouseClick += ClothingAndMisc_OnMouseClick;

            ingredientsButton = DaggerfallUI.AddButton(ingredientsRect, NativePanel);
            ingredientsButton.OnMouseClick += Ingredients_OnMouseClick;
        }
Пример #16
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;
        }
        protected override void Setup()
        {
            if (IsSetup)
            {
                return;
            }

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

            // Load question data
            biogFile = new BiogFile(Document);

            // Set background
            NativePanel.BackgroundTexture = nativeTexture;

            // Set question text
            questionLabels[0] = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont,
                                                          new Vector2(questionLeft, questionTop),
                                                          string.Empty,
                                                          NativePanel);
            questionLabels[1] = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont,
                                                          new Vector2(questionLeft, questionTop + questionLineSpace),
                                                          string.Empty,
                                                          NativePanel);
            // Setup buttons
            for (int i = 0; i < buttonCount; i++)
            {
                int left = i % 2 == 0 ? buttonsLeft : buttonsLeft + buttonWidth;

                answerButtons[i] = DaggerfallUI.AddButton(new Rect((float)left,
                                                                   (float)(buttonsTop + (i / 2) * buttonHeight),
                                                                   (float)buttonWidth,
                                                                   (float)buttonHeight), NativePanel);
                answerButtons[i].Tag           = i;
                answerButtons[i].OnMouseClick += AnswerButton_OnMouseClick;
                answerLabels[i] = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont,
                                                            new Vector2(21f, 5f),
                                                            string.Empty,
                                                            answerButtons[i]);
            }

            PopulateControls(biogFile.Questions[questionIndex]);

            IsSetup = true;
        }
Пример #18
0
        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
            NativePanel.Components.Add(paperDoll);
            paperDoll.Position      = new Vector2(49, 13);
            paperDoll.OnMouseMove  += PaperDoll_OnMouseMove;
            paperDoll.OnMouseClick += PaperDoll_OnMouseClick;
            paperDoll.ToolTip       = defaultToolTip;
            paperDoll.Refresh();

            // Setup UI
            SetupTabPageButtons();
            SetupActionButtons();
            SetupScrollBars();
            SetupScrollButtons();
            SetupLocalItemsElements();
            SetupRemoteItemsElements();
            SetupAccessoryElements();

            // Exit buttons
            Button exitButton = DaggerfallUI.AddButton(exitButtonRect, NativePanel);

            exitButton.OnMouseClick += ExitButton_OnMouseClick;

            // Setup local and remote target icon panels
            //localTargetIconPanel = DaggerfallUI.AddPanel(localTargetIconRect, NativePanel);
            remoteTargetIconPanel = DaggerfallUI.AddPanel(remoteTargetIconRect, NativePanel);

            // Set initial state
            SelectTabPage(TabPages.WeaponsAndArmor);
            SelectActionMode(ActionModes.Equip);
            SetLocalTarget(ItemTargets.Player);
            SetRemoteTarget(ItemTargets.Wagon);

            // Update item lists
            FilterLocalItems();
            FilterRemoteItems();
            UpdateLocalItemsDisplay();
            UpdateRemoteItemsDisplay();
            UpdateAccessoryItemsDisplay();
        }
Пример #19
0
        void SetupButtons()
        {
            // Recipes button
            recipesButton = DaggerfallUI.AddButton(recipesButtonRect, NativePanel);
            recipesButton.OnMouseClick += RecipesButton_OnMouseClick;

            // Mixing button
            mixButton = DaggerfallUI.AddButton(mixButtonRect, NativePanel);
            mixButton.OnMouseClick += MixButton_OnMouseClick;

            // Exit button
            exitButton = DaggerfallUI.AddButton(exitButtonRect, NativePanel);
            exitButton.OnMouseClick += ExitButton_OnMouseClick;
        }
Пример #20
0
        protected override void Setup()
        {
            //base.Setup();

            // Load all textures
            Texture2D tex;

            TextureReplacement.TryImportTexture(baseTextureName, true, out tex);
            Debug.Log("Texture is:" + tex.ToString());
            baseTexture = tex;

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

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

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

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

            // Drinks button
            drinksButton = DaggerfallUI.AddButton(drinksButtonRect, mainPanel);
            drinksButton.OnMouseClick += DrinksButton_OnMouseClick;
            //drinksButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TavernFood);
            drinksButton.OnKeyboardEvent += FoodButton_OnKeyboardEvent;

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

            NativePanel.Components.Add(mainPanel);
        }
        void Setup()
        {
            // Cut out red up/down arrows
            Texture2D arrowTexture = ImageReader.GetTexture(redArrowsTextureName);

            arrowUpTexture   = ImageReader.GetSubTexture(arrowTexture, upArrowRect, arrowsFullSize);
            arrowDownTexture = ImageReader.GetSubTexture(arrowTexture, downArrowRect, arrowsFullSize);

            // Drop down button
            dropDownToggleButton = DaggerfallUI.AddButton(new Rect(0, 0, 7, 7), this);
            dropDownToggleButton.BackgroundColor   = new Color(0.2f, 0.2f, 0.2f, 0.5f);//0.5f);
            dropDownToggleButton.OnMouseClick     += DropdownButton_OnMouseClick;
            dropDownToggleButton.Hotkey            = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.OptionsDropdown);
            dropDownToggleButton.BackgroundTexture = arrowUpTexture;

            // Dropdown options panel
            dropdownPanel                 = new Panel();
            dropdownPanel.Position        = new Vector2(0, dropDownToggleButton.Position.y + dropDownToggleButton.Size.y);
            dropdownPanel.Size            = new Vector2(50, 30);
            dropdownPanel.BackgroundColor = Color.black;
            dropdownPanel.Enabled         = false;
            dropdownPanel.Outline.Enabled = true;
            this.Components.Add(dropdownPanel);

            dropdownList                = new ListBox();
            dropdownList.Position       = new Vector2(2, 2);
            dropdownList.ShadowPosition = Vector2.zero;
            dropdownList.RowsDisplayed  = unitsDisplayed;
            SetBackground(dropdownList, Color.black, "pauseDropdownListBackgroundColor");
            dropdownList.OnSelectItem     += DropdownList_OnUseSelectedItem;
            dropdownList.SelectedTextColor = dropdownList.TextColor;
            dropdownList.OnScroll         += DropdownList_OnScroll;
            dropdownPanel.Components.Add(dropdownList);

            AddOptions();
            var height = dropdownList.HeightContent();

            dropdownList.Size  = new Vector2(maxTextWidth, height > 80 ? 80 : height);
            dropdownPanel.Size = new Vector2(dropdownList.Size.x + 6, dropdownList.Size.y + 3);

            dropdownScroller              = new VerticalScrollBar();
            dropdownScroller.Position     = new Vector2(maxTextWidth, 2);
            dropdownScroller.Size         = new Vector2(5, dropdownPanel.Size.y - 3);
            dropdownScroller.DisplayUnits = unitsDisplayed;
            dropdownScroller.TotalUnits   = dropdownList.Count;
            dropdownScroller.OnScroll    += SavesScroller_OnScroll;
            dropdownPanel.Components.Add(dropdownScroller);
        }
        protected override void Setup()
        {
            // Create interface panel
            mainPanel = DaggerfallUI.AddPanel(mainPanelRect);
            mainPanel.HorizontalAlignment = HorizontalAlignment.Center;
            mainPanel.VerticalAlignment   = VerticalAlignment.Top;
            mainPanel.BackgroundColor     = mainPanelBackgroundColor;

            // destination description
            destinationTextbox          = DaggerfallUI.AddTextBox(destinationRect, _destinationName, mainPanel);
            destinationTextbox.ReadOnly = true;
            // increase time compression button
            fasterButton = DaggerfallUI.AddButton(fasterButtonRect, mainPanel);
            fasterButton.OnMouseClick   += FasterButton_OnMouseClick;
            fasterButton.BackgroundColor = buttonBackgroundColor;
            fasterButton.Label.Text      = "+";
            //display time compression
            timeCompressionTextbox          = DaggerfallUI.AddTextBox(timeCompressionRect, TimeCompressionSetting + "x", mainPanel);
            timeCompressionTextbox.ReadOnly = true;

            // decrease time compression button
            slowerButton = DaggerfallUI.AddButton(slowerButtonRect, mainPanel);
            slowerButton.OnMouseClick   += SlowerButton_OnMouseClick;
            slowerButton.BackgroundColor = buttonBackgroundColor;
            slowerButton.Label.Text      = "-";

            // map button
            mapButton = DaggerfallUI.AddButton(mapButtonRect, mainPanel);
            mapButton.OnMouseClick += (_, __) => {
                uiManager.PushWindow(travelMap);
            };
            mapButton.BackgroundColor = buttonBackgroundColor;
            mapButton.Label.Text      = "Map";

            // interrupt travel button
            interruptButton = DaggerfallUI.AddButton(interruptButtonRect, mainPanel);
            interruptButton.OnMouseClick   += (_, __) => { CloseWindow(); };
            interruptButton.BackgroundColor = buttonBackgroundColor;
            interruptButton.Label.Text      = "Interrupt";

            // cancel travel button
            cancelButton = DaggerfallUI.AddButton(cancelButtonRect, mainPanel);
            cancelButton.OnMouseClick   += (_, __) => { CancelWindow(); };
            cancelButton.BackgroundColor = cancelButtonBackgroundColor;
            cancelButton.Label.Text      = "Cancel";

            NativePanel.Components.Add(mainPanel);
        }
Пример #23
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;
        }
        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
            DaggerfallUI.AddButton(new Vector2(72, 45), new Vector2(147, 15), DaggerfallUIMessages.dfuiOpenLoadSavedGameWindow, NativePanel);
            DaggerfallUI.AddButton(new Vector2(72, 99), new Vector2(147, 15), DaggerfallUIMessages.dfuiStartNewGame, NativePanel);
            DaggerfallUI.AddButton(new Vector2(125, 145), new Vector2(41, 15), DaggerfallUIMessages.dfuiExitGame, NativePanel);
        }
Пример #25
0
        void SetupScrollButtons()
        {
            localItemsUpButton = DaggerfallUI.AddButton(localItemsUpButtonRect, NativePanel);
            localItemsUpButton.BackgroundTexture = redUpArrow;
            localItemsUpButton.OnMouseClick     += LocalItemsUpButton_OnMouseClick;

            localItemsDownButton = DaggerfallUI.AddButton(localItemsDownButtonRect, NativePanel);
            localItemsDownButton.BackgroundTexture = redDownArrow;
            localItemsDownButton.OnMouseClick     += LocalItemsDownButton_OnMouseClick;

            remoteItemsUpButton = DaggerfallUI.AddButton(remoteItemsUpButtonRect, NativePanel);
            remoteItemsUpButton.BackgroundTexture = redUpArrow;
            remoteItemsUpButton.OnMouseClick     += RemoteItemsUpButton_OnMouseClick;

            remoteItemsDownButton = DaggerfallUI.AddButton(remoteItemsDownButtonRect, NativePanel);
            remoteItemsDownButton.BackgroundTexture = redDownArrow;
            remoteItemsDownButton.OnMouseClick     += RemoteItemsDownButton_OnMouseClick;
        }
Пример #26
0
        public FacePicker()
        {
            // Face display panel
            faceDisplayPanel.Position = new Vector2(247, 25);
            faceDisplayPanel.Size     = new Vector2(64, 40);
            this.Components.Add(faceDisplayPanel);

            // Face panel
            facePanel.HorizontalAlignment = HorizontalAlignment.Center;
            facePanel.VerticalAlignment   = VerticalAlignment.Middle;
            faceDisplayPanel.Components.Add(facePanel);

            // Previous/Next buttons
            prevFaceButton = DaggerfallUI.AddButton(new Rect(245, 69, 42, 9), this);
            prevFaceButton.OnMouseClick += PrevFaceButton_OnMouseClick;
            nextFaceButton = DaggerfallUI.AddButton(new Rect(287, 69, 26, 9), this);
            nextFaceButton.OnMouseClick += NextFaceButton_OnMouseClick;
        }
Пример #27
0
        void SetupButtons()
        {
            // Tab page buttons
            weaponsAndArmorButton = DaggerfallUI.AddButton(weaponsAndArmorRect, NativePanel);
            weaponsAndArmorButton.OnMouseClick += WeaponsAndArmor_OnMouseClick;
            magicItemsButton = DaggerfallUI.AddButton(magicItemsRect, NativePanel);
            magicItemsButton.OnMouseClick      += MagicItems_OnMouseClick;
            clothingAndMiscButton               = DaggerfallUI.AddButton(clothingAndMiscRect, NativePanel);
            clothingAndMiscButton.OnMouseClick += ClothingAndMisc_OnMouseClick;
            ingredientsButton = DaggerfallUI.AddButton(ingredientsRect, NativePanel);
            ingredientsButton.OnMouseClick += Ingredients_OnMouseClick;

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

            powersButton.OnMouseClick += PowersButton_OnMouseClick;
            Button sideEffectsButton = DaggerfallUI.AddButton(sideEffectsButtonRect, NativePanel);

            sideEffectsButton.OnMouseClick += SideEffectsButton_OnMouseClick;

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

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

            enchantButton.OnMouseClick += EnchantButton_OnMouseClick;

            // Selected item button
            selectedItemButton = DaggerfallUI.AddButton(selectedItemRect, NativePanel);
            selectedItemButton.SetMargins(Margins.All, 2);
            selectedItemButton.OnMouseClick += SelectedItemButton_OnMouseClick;

            // Selected item icon image panel
            selectedItemPanel = DaggerfallUI.AddPanel(selectedItemButton, AutoSizeModes.ScaleToFit);
            selectedItemPanel.HorizontalAlignment = HorizontalAlignment.Center;
            selectedItemPanel.VerticalAlignment   = VerticalAlignment.Middle;
            selectedItemPanel.MaxAutoScale        = 1f;

            // Rename item button
            Button nameItemButon = DaggerfallUI.AddButton(nameItemButtonRect, NativePanel);

            nameItemButon.OnMouseClick += NameItemButon_OnMouseClick;
        }
Пример #28
0
        void SetupButtons()
        {
            // Bottom row buttons
            deleteButton = DaggerfallUI.AddButton(deleteButtonRect, mainPanel);
            deleteButton.OnMouseClick += DeleteButton_OnMouseClick;

            //upButton = DaggerfallUI.AddButton(upButtonRect, mainPanel);
            //sortButton = DaggerfallUI.AddButton(sortButtonRect, mainPanel);
            //downButton = DaggerfallUI.AddButton(downButtonRect, mainPanel);

            exitButton = DaggerfallUI.AddButton(exitButtonRect, mainPanel);
            exitButton.OnMouseClick += ExitButton_OnMouseClick;

            // 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("CreateCharFaceSelect: Could not load native texture.");
            }

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

            // Add face picker
            NativePanel.Components.Add(facePicker);

            // OK button
            okButton = DaggerfallUI.AddButton(new Rect(263, 172, 39, 22), NativePanel);
            okButton.OnMouseClick += OkButton_OnMouseClick;
        }
Пример #30
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 = new Vector2(nativeTexture.width, nativeTexture.height);
            pickerPanel.HorizontalAlignment     = HorizontalAlignment.Center;
            pickerPanel.VerticalAlignment       = VerticalAlignment.Middle;
            pickerPanel.BackgroundTexture       = nativeTexture;
            pickerPanel.BackgroundTextureLayout = TextureLayout.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.OnScrollUp   += ScrollBar_OnScrollUp;
            scrollBar.OnScrollDown += ScrollBar_OnScrollDown;
            pickerPanel.Components.Add(scrollBar);
        }