void SetupRemoteItemsElements() { // List panel for scrolling behaviour Panel remoteItemsListPanel = DaggerfallUI.AddPanel(remoteItemsListPanelRect, NativePanel); remoteItemsListPanel.OnMouseScrollUp += RemoteItemsListPanel_OnMouseScrollUp; remoteItemsListPanel.OnMouseScrollDown += RemoteItemsListPanel_OnMouseScrollDown; // Setup buttons for (int i = 0; i < listDisplayUnits; i++) { // Button remoteItemsButtons[i] = DaggerfallUI.AddButton(itemsButtonRects[i], remoteItemsListPanel); remoteItemsButtons[i].SetMargins(Margins.All, itemButtonMarginSize); remoteItemsButtons[i].ToolTip = defaultToolTip; remoteItemsButtons[i].Tag = i; remoteItemsButtons[i].OnMouseClick += RemoteItemsButton_OnMouseClick; // Icon image panel remoteItemsIconPanels[i] = DaggerfallUI.AddPanel(remoteItemsButtons[i], AutoSizeModes.ScaleToFit); remoteItemsIconPanels[i].HorizontalAlignment = HorizontalAlignment.Center; remoteItemsIconPanels[i].VerticalAlignment = VerticalAlignment.Middle; remoteItemsIconPanels[i].MaxAutoScale = 1f; // Stack labels remoteItemsStackLabels[i] = DaggerfallUI.AddTextLabel(DaggerfallUI.Instance.Font4, Vector2.zero, string.Empty, remoteItemsButtons[i]); remoteItemsStackLabels[i].HorizontalAlignment = HorizontalAlignment.Right; remoteItemsStackLabels[i].VerticalAlignment = VerticalAlignment.Bottom; remoteItemsStackLabels[i].ShadowPosition = Vector2.zero; remoteItemsStackLabels[i].TextColor = DaggerfallUI.DaggerfallUnityDefaultToolTipTextColor; } }
private void SetupDisplayPanel() { displayPanel = DaggerfallUI.AddPanel(displayPanelRect, mainPanel); displayResolution = new Vector2(displayPanelRect.width * NativePanel.LocalScale.x, displayPanelRect.height * NativePanel.LocalScale.y); displayTexture = new Texture2D((int)displayResolution.x, (int)displayResolution.y, TextureFormat.ARGB32, false); // Create camera if (!goCameraBankPurchase) { goCameraBankPurchase = new GameObject("Camera"); camera = goCameraBankPurchase.AddComponent <Camera>(); camera.clearFlags = CameraClearFlags.SolidColor; camera.cullingMask = 1 << layer; camera.renderingPath = Camera.main.renderingPath; camera.nearClipPlane = 0.7f; camera.farClipPlane = 100.0f; goCameraBankPurchase.transform.SetParent(goBankPurchase.transform); } if (!goLight) { goLight = new GameObject("Light"); Light light = goLight.AddComponent <Light>(); light.type = LightType.Directional; light.transform.position = new Vector3(0, 50, -50); light.intensity = brightness; light.shadows = LightShadows.Hard; light.cullingMask = 1 << layer; goLight.transform.SetParent(goBankPurchase.transform); } RenderTexture renderTexture = new RenderTexture((int)displayResolution.x, (int)displayResolution.y, 16); camera.targetTexture = renderTexture; }
protected override void Setup() { // Load 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); destinationPanel = DaggerfallUI.AddPanel(destinationPanelRect, mainPanel); destinationLabel = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(1, 1), destinationPanel); destinationLabel.ShadowColor = DaggerfallUI.DaggerfallDefaultShadowColor; destinationLabel.HorizontalAlignment = HorizontalAlignment.Center; destinationLabel.Text = destinationName; // Yes button yesButton = DaggerfallUI.AddButton(yesButtonRect, mainPanel); yesButton.OnMouseClick += YesButton_OnMouseClick; // No button noButton = DaggerfallUI.AddButton(noButtonRect, mainPanel); noButton.OnMouseClick += NoButton_OnMouseClick; NativePanel.Components.Add(mainPanel); }
protected override void Setup() { // Save panel savePanel.HorizontalAlignment = HorizontalAlignment.Center; savePanel.VerticalAlignment = VerticalAlignment.Middle; savePanel.Size = new Vector2(300, 160); DaggerfallUI.Instance.SetDaggerfallPopupStyle(DaggerfallUI.PopupStyle.Parchment, savePanel); NativePanel.Components.Add(savePanel); // Title TextLabel titleLabel = new TextLabel(); titleLabel.HorizontalAlignment = HorizontalAlignment.Center; titleLabel.VerticalAlignment = VerticalAlignment.Top; titleLabel.Text = HardStrings.saveGame; titleLabel.Font = DaggerfallUI.TitleFont; savePanel.Components.Add(titleLabel); // Child panels int top = 16; saveListPanel = DaggerfallUI.AddPanel(new Rect(0, top, 110, savePanel.Size.y - top), savePanel); saveListPanel.HorizontalAlignment = HorizontalAlignment.Left; saveListPanel.BackgroundColor = panelBackgroundColor; detailsPanel = DaggerfallUI.AddPanel(new Rect(110, top, 180, savePanel.Size.y - top), savePanel); detailsPanel.HorizontalAlignment = HorizontalAlignment.Right; detailsPanel.BackgroundColor = panelBackgroundColor; // Outlines DaggerfallUI.AddOutline(new Rect(0, 0, saveListPanel.Size.x, saveListPanel.Size.y), outlineColor, saveListPanel); DaggerfallUI.AddOutline(new Rect(0, 0, detailsPanel.Size.x, detailsPanel.Size.y), outlineColor, detailsPanel); }
private void AddSectionDescriptionBox(string description) { const int margin = 1; const int textMargin = 1; Vector2 position = new Vector2(0 + textMargin + margin, 0 + textMargin); TextLabel textLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.Instance.Font4, position, description); textLabel.TextScale = 0.5f; textLabel.TextColor = sectionTitleColor; textLabel.ShadowColor = Color.clear; textLabel.WrapText = true; textLabel.WrapWords = true; textLabel.MaxWidth = columnWidth - (textMargin + margin) * 2; int height = textLabel.TextHeight + 2; Panel background = DaggerfallUI.AddPanel(new Rect(x + margin, y, columnWidth - margin * 2, height)); background.BackgroundColor = sectionDescriptionBackgroundColor; background.Outline.Enabled = true; background.Outline.Color = sectionDescriptionOutlineColor; background.Outline.Thickness = 1; background.Components.Add(textLabel); AddAtNextPosition(height, background); }
protected override void Setup() { // Load textures LoadTextures(); // Create interface panel mainPanel.HorizontalAlignment = HorizontalAlignment.Center; mainPanel.VerticalAlignment = VerticalAlignment.Middle; mainPanel.BackgroundTexture = baseTexture; mainPanel.Position = mainPanelRect.position; mainPanel.Size = mainPanelRect.size; destinationPanel = DaggerfallUI.AddPanel(destinationPanelRect, mainPanel); destinationLabel = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(1, 1), destinationPanel); destinationLabel.ShadowColor = DaggerfallUI.DaggerfallDefaultShadowColor; destinationLabel.HorizontalAlignment = HorizontalAlignment.Center; destinationLabel.Text = destinationName; // Yes button yesButton = DaggerfallUI.AddButton(yesButtonRect, mainPanel); yesButton.OnMouseClick += YesButton_OnMouseClick; yesButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.Yes); // No button noButton = DaggerfallUI.AddButton(noButtonRect, mainPanel); noButton.OnMouseClick += NoButton_OnMouseClick; noButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.No); NativePanel.Components.Add(mainPanel); }
void SetupCostAndGold() { costPanel = DaggerfallUI.AddPanel(costPanelRect, NativePanel); costPanel.BackgroundTexture = costPanelTexture; costLabel = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(28, 2), costPanel); goldLabel = DaggerfallUI.AddDefaultShadowedTextLabel(new Vector2(68, 2), costPanel); }
protected override void Setup() { LoadResources(); // Background panel mainPanel = DaggerfallUI.AddPanel(NativePanel, AutoSizeModes.None); mainPanel.Size = mainPanelSize; mainPanel.HorizontalAlignment = HorizontalAlignment.Center; mainPanel.VerticalAlignment = VerticalAlignment.Middle; mainPanel.BackgroundColor = Color.black; // Scroll panel scrollPanel = DaggerfallUI.AddPanel(NativePanel, AutoSizeModes.None); scrollPanel.Size = scrollPanelSize; scrollPanel.HorizontalAlignment = HorizontalAlignment.Center; scrollPanel.VerticalAlignment = VerticalAlignment.Bottom; // Scroll buttons scrollUpButton = DaggerfallUI.AddButton(scrollUpButtonRect, NativePanel); scrollDownButton = DaggerfallUI.AddButton(scrollDownButtonRect, NativePanel); // Set initial textures mainPanel.BackgroundTexture = GetBackgroundTexture(); scrollPanel.BackgroundTexture = GetScrollFrameTexture(); }
protected override void Setup() { base.Setup(); Texture2D texture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (texture == null) { Debug.LogError("failed to load texture: " + nativeImgName); CloseWindow(); } mainPanel = DaggerfallUI.AddPanel(NativePanel, AutoSizeModes.None); mainPanel.BackgroundTexture = texture; mainPanel.Size = new Vector2(320, 200); mainPanel.HorizontalAlignment = HorizontalAlignment.Center; mainPanel.VerticalAlignment = VerticalAlignment.Middle; dialogButton = new Button(); dialogButton.Position = new Vector2(32, 187); dialogButton.Size = new Vector2(68, 10); dialogButton.OnMouseClick += dialogButton_OnMouseClick; dialogButton.Name = "dialog_button"; mainPanel.Components.Add(dialogButton); upArrowButton = new Button(); upArrowButton.Position = new Vector2(181, 188); upArrowButton.Size = new Vector2(13, 7); upArrowButton.OnMouseClick += upArrowButton_OnMouseClick; upArrowButton.Name = "uparrow_button"; mainPanel.Components.Add(upArrowButton); downArrowButton = new Button(); downArrowButton.Position = new Vector2(209, 188); downArrowButton.Size = new Vector2(13, 7); downArrowButton.OnMouseClick += downArrowButton_OnMouseClick; downArrowButton.Name = "downarrow_button"; mainPanel.Components.Add(downArrowButton); exitButton = new Button(); exitButton.Position = new Vector2(278, 187); exitButton.Size = new Vector2(30, 9); exitButton.OnMouseClick += exitButton_OnMouseClick; exitButton.Name = "exit_button"; mainPanel.Components.Add(exitButton); questLogLabel = new MultiFormatTextLabel(); questLogLabel.Position = new Vector2(30, 32); questLogLabel.Size = new Vector2(238, 138); mainPanel.Components.Add(questLogLabel); questMessages = QuestMachine.Instance.GetAllQuestLogMessages(); SetText(); #if LAYOUT SetBackgroundColors(); #endif }
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; } }
/// <summary> /// Creates a new page. /// </summary> /// <param name="enabled">Start enabled?</param> private void AddPage(bool enabled) { Panel panel = DaggerfallUI.AddPanel(pageRect, mainPanel); panel.BackgroundColor = Color.clear; panel.Outline.Enabled = false; panel.Enabled = enabled; pages.Add(panel); }
void SetupMain() { // Main panel mainPanel = DaggerfallUI.AddPanel(mainPanelRect, NativePanel); mainPanel.BackgroundTexture = baseTexture; mainPanel.HorizontalAlignment = HorizontalAlignment.Center; mainPanel.VerticalAlignment = VerticalAlignment.Middle; if (buyMode) { mainPanel.BackgroundColor = Color.black; } // Spells list spellsListBox = new ListBox(); spellsListBox.Position = new Vector2(spellsListBoxRect.x, spellsListBoxRect.y); spellsListBox.Size = new Vector2(spellsListBoxRect.width, spellsListBoxRect.height); spellsListBox.RowsDisplayed = 16; spellsListBox.MaxCharacters = 22; spellsListBox.OnSelectItem += SpellsListBox_OnSelectItem; if (buyMode) { spellsListBox.OnMouseDoubleClick += SpellsListBox_OnMouseDoubleClick; } else { spellsListBox.OnUseSelectedItem += SpellsListBox_OnUseSelectedItem; } spellsListBox.OnMouseScrollDown += SpellsListBox_OnMouseScroll; spellsListBox.OnMouseScrollUp += SpellsListBox_OnMouseScroll; mainPanel.Components.Add(spellsListBox); // Spells list scroller spellsListScrollBar = new VerticalScrollBar(); spellsListScrollBar.HorizontalAlignment = HorizontalAlignment.None; spellsListScrollBar.VerticalAlignment = VerticalAlignment.None; spellsListScrollBar.Position = new Vector2(spellsListScrollBarRect.x, spellsListScrollBarRect.y); spellsListScrollBar.Size = new Vector2(spellsListScrollBarRect.width, spellsListScrollBarRect.height); spellsListScrollBar.TotalUnits = spellsListBox.Count; spellsListScrollBar.DisplayUnits = spellsListBox.RowsDisplayed; spellsListScrollBar.ScrollIndex = 0; spellsListScrollBar.OnScroll += SpellsListScrollBar_OnScroll; mainPanel.Components.Add(spellsListScrollBar); // Spell effect panels spellEffectPanels = new Panel[3]; spellEffectPanels[0] = DaggerfallUI.AddPanel(effect1PanelRect, mainPanel); spellEffectPanels[0].Name = "effect1Panel"; spellEffectPanels[0].OnMouseClick += SpellEffectPanelClick; spellEffectPanels[1] = DaggerfallUI.AddPanel(effect2PanelRect, mainPanel); spellEffectPanels[1].Name = "effect2Panel"; spellEffectPanels[1].OnMouseClick += SpellEffectPanelClick; spellEffectPanels[2] = DaggerfallUI.AddPanel(effect3PanelRect, mainPanel); spellEffectPanels[2].Name = "effect3Panel"; spellEffectPanels[2].OnMouseClick += SpellEffectPanelClick; // TODO: Prepare UI for spell buy mode }
protected override void Setup() { // Load all textures LoadTextures(); // Create interface panel mainPanel.HorizontalAlignment = HorizontalAlignment.Center; mainPanel.VerticalAlignment = VerticalAlignment.Top; mainPanel.Position = new Vector2(0, 0); mainPanel.BackgroundTexture = baseTexture; mainPanel.Size = baseSize; // Add primary skill spinner mainPanel.Components.Add(timeAccelSpinner); timeAccelSpinner.Position = timeAccelPos; timeAccelSpinner.OnDownButtonClicked += SlowerButton_OnMouseClick; timeAccelSpinner.OnUpButtonClicked += FasterButton_OnMouseClick; timeAccelSpinner.Value = TimeAcceleration; // Destination label destPanel = DaggerfallUI.AddPanel(destPanelRect, mainPanel); destPanel.Components.Add(destinationLabel); destinationLabel.HorizontalAlignment = HorizontalAlignment.Center; // Message label messageLabel = DaggerfallUI.AddTextLabel(null, new Vector2(0, 32), "", NativePanel); messageLabel.HorizontalAlignment = HorizontalAlignment.Center; // Map button mapButton = DaggerfallUI.AddButton(mapButtonRect, mainPanel); mapButton.OnMouseClick += (_, __) => { DaggerfallUI.PostMessage(DaggerfallUIMessages.dfuiOpenTravelMapWindow); }; mapButton.ToolTip = defaultToolTip; mapButton.ToolTipText = TipMap; mapButton.Hotkey = new HotkeySequence(KeyCode.M, HotkeySequence.KeyModifiers.None); mapButton.OnKeyboardEvent += (_, __) => { DaggerfallUI.PostMessage(DaggerfallUIMessages.dfuiOpenTravelMapWindow); }; // Camp (pause travel) button campButton = DaggerfallUI.AddButton(campButtonRect, mainPanel); campButton.OnMouseClick += (_, __) => { CloseWindow(); }; campButton.ToolTip = defaultToolTip; campButton.ToolTipText = TipCamp; campButton.Hotkey = new HotkeySequence(KeyCode.C, HotkeySequence.KeyModifiers.None); campButton.OnKeyboardEvent += (_, __) => { CloseWindow(); }; // Exit travel button exitButton = DaggerfallUI.AddButton(exitButtonRect, mainPanel); exitButton.OnMouseClick += (_, __) => { CancelWindow(); }; exitButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.TravelExit); exitButton.OnKeyboardEvent += (_, __) => { CancelWindow(); }; NativePanel.Components.Add(mainPanel); }
protected override void 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); }
void SetupIcons() { spellIconPanel = DaggerfallUI.AddPanel(spellIconPanelRect, mainPanel); spellIconPanel.BackgroundColor = Color.black; spellIconPanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill; spellTargetIconPanel = DaggerfallUI.AddPanel(spellTargetPanelRect, mainPanel); spellTargetIconPanel.BackgroundColor = Color.black; spellTargetIconPanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill; spellElementIconPanel = DaggerfallUI.AddPanel(spellElementIconPanelRect, mainPanel); spellElementIconPanel.BackgroundColor = Color.black; spellElementIconPanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill; }
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(); }
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); }
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; }
void SetupIcons() { spellIconPanel = DaggerfallUI.AddPanel(spellIconPanelRect, mainPanel); spellIconPanel.BackgroundColor = Color.black; spellIconPanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill; spellIconPanel.ToolTip = defaultToolTip; spellIconPanel.ToolTipText = TextManager.Instance.GetText(textDatabase, "selectIcon"); spellIconPanel.OnMouseClick += SpellIconPanel_OnMouseClick; spellTargetIconPanel = DaggerfallUI.AddPanel(spellTargetPanelRect, mainPanel); spellTargetIconPanel.BackgroundColor = Color.black; spellTargetIconPanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill; spellTargetIconPanel.ToolTip = defaultToolTip; spellElementIconPanel = DaggerfallUI.AddPanel(spellElementIconPanelRect, mainPanel); spellElementIconPanel.BackgroundColor = Color.black; spellElementIconPanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill; spellElementIconPanel.ToolTip = defaultToolTip; }
void SetupEffectDescriptionPanels() { // Create parent panel to house effect description Panel descriptionParentPanel = DaggerfallUI.AddPanel(new Rect(5, 19, 312, 69), NativePanel); descriptionParentPanel.HorizontalAlignment = HorizontalAlignment.Center; // Create description panel centred inside of parent descriptionPanel = DaggerfallUI.AddPanel(descriptionParentPanel, AutoSizeModes.None); descriptionPanel.Size = new Vector2(306, 69); descriptionPanel.HorizontalAlignment = HorizontalAlignment.Center; descriptionPanel.VerticalAlignment = VerticalAlignment.Middle; DaggerfallUI.Instance.SetDaggerfallPopupStyle(DaggerfallUI.PopupStyle.Parchment, descriptionPanel); // Create multiline label for description text descriptionLabel = new MultiFormatTextLabel(); descriptionLabel.HorizontalAlignment = HorizontalAlignment.Center; descriptionLabel.VerticalAlignment = VerticalAlignment.Middle; descriptionPanel.Components.Add(descriptionLabel); }
protected override void Setup() { // 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; healedButton = DaggerfallUI.AddButton(healedButtonRect, mainPanel); healedButton.OnMouseClick += HealedButton_OnMouseClick; loiterButton = DaggerfallUI.AddButton(loiterButtonRect, mainPanel); loiterButton.OnMouseClick += LoiterButton_OnMouseClick; // 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; }
protected override void Setup() { base.Setup(); RemoveOldButtons(); LoadTextures(); // Item tabs allButton = DaggerfallUI.AddButton(allRect, NativePanel); allButton.OnMouseClick += All_OnMouseClick; weaponsButton = DaggerfallUI.AddButton(weaponsRect, NativePanel); weaponsButton.OnMouseClick += Weapons_OnMouseClick; armorButton = DaggerfallUI.AddButton(armorRect, NativePanel); armorButton.OnMouseClick += Armor_OnMouseClick; clothingButton = DaggerfallUI.AddButton(clothingRect, NativePanel); clothingButton.OnMouseClick += Clothing_OnMouseClick; alchemyButton = DaggerfallUI.AddButton(alchemyRect, NativePanel); alchemyButton.OnMouseClick += Alchemy_OnMouseClick; miscButton = DaggerfallUI.AddButton(miscRect, NativePanel); miscButton.OnMouseClick += Misc_OnMouseClick; // Accessory buttons foreach (var button in accessoryButtons) { button.OnRightMouseClick += AccessoryItemsButton_OnMouseRightClick; } // Attack bonus indicators rHandAttackPanel = DaggerfallUI.AddPanel(rHandAttackRect, NativePanel); lHandAttackPanel = DaggerfallUI.AddPanel(lHandAttackRect, NativePanel); rHandAttackLabel = GetAttackInfoLabel(); lHandAttackLabel = GetAttackInfoLabel(); rHandAttackPanel.Components.Add(rHandAttackLabel); lHandAttackPanel.Components.Add(lHandAttackLabel); SetAttackInfo(rHandAttackLabel); SetAttackInfo(lHandAttackLabel, false); // Initialize FilterLocalItems(); SelectTab(All, false); }
void SetupLabels() { // Tip label tipLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, tipLabelPos, string.Empty, NativePanel); // Status labels maxSpellPointsLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(43, 149), string.Empty, NativePanel); moneyLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(39, 158), string.Empty, NativePanel); goldCostLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(59, 167), string.Empty, NativePanel); spellPointCostLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(70, 176), string.Empty, NativePanel); // Name label spellNameLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, nameLabelPos, string.Empty, NativePanel); spellNameLabel.ShadowPosition = Vector2.zero; // Effect1 Panel effect1NamePanel = DaggerfallUI.AddPanel(effect1NameRect, NativePanel); effect1NamePanel.HorizontalAlignment = HorizontalAlignment.Center; effect1NamePanel.OnMouseClick += Effect1NamePanel_OnMouseClick; effect1NameLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.LargeFont, Vector2.zero, string.Empty, effect1NamePanel); effect1NameLabel.HorizontalAlignment = HorizontalAlignment.Center; effect1NameLabel.ShadowPosition = Vector2.zero; // Effect2 Panel effect2NamePanel = DaggerfallUI.AddPanel(effect2NameRect, NativePanel); effect2NamePanel.HorizontalAlignment = HorizontalAlignment.Center; effect2NamePanel.OnMouseClick += Effect2NamePanel_OnMouseClick; effect2NameLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.LargeFont, Vector2.zero, string.Empty, effect2NamePanel); effect2NameLabel.HorizontalAlignment = HorizontalAlignment.Center; effect2NameLabel.ShadowPosition = Vector2.zero; // Effect3 Panel effect3NamePanel = DaggerfallUI.AddPanel(effect3NameRect, NativePanel); effect3NamePanel.HorizontalAlignment = HorizontalAlignment.Center; effect3NamePanel.OnMouseClick += Effect3NamePanel_OnMouseClick; effect3NameLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.LargeFont, Vector2.zero, string.Empty, effect3NamePanel); effect3NameLabel.HorizontalAlignment = HorizontalAlignment.Center; effect3NameLabel.ShadowPosition = Vector2.zero; }
protected virtual void SetupIcons() { spellIconPanel = DaggerfallUI.AddPanel(spellIconPanelRect, mainPanel); spellIconPanel.BackgroundColor = Color.black; spellIconPanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill; spellIconPanel.ToolTip = defaultToolTip; spellIconPanel.ToolTipText = TextManager.Instance.GetLocalizedText("selectIcon"); spellIconPanel.OnMouseClick += SpellIconPanel_OnMouseClick; // Add a hotkey to a panel? spellTargetIconPanel = DaggerfallUI.AddPanel(spellTargetPanelRect, mainPanel); spellTargetIconPanel.BackgroundColor = Color.black; spellTargetIconPanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill; spellTargetIconPanel.ToolTip = defaultToolTip; spellElementIconPanel = DaggerfallUI.AddPanel(spellElementIconPanelRect, mainPanel); spellElementIconPanel.BackgroundColor = Color.black; spellElementIconPanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill; spellElementIconPanel.ToolTip = defaultToolTip; }
void SetupItemListScrollers() { if (DaggerfallUnity.Settings.EnableEnhancedItemLists) { // Clean UI background with 2 panels, and initialise a standard enhanced inventory list. Panel panel1 = DaggerfallUI.AddPanel(new Rect(253, 179, 9, 5), NativePanel); panel1.BackgroundTexture = ImageReader.GetSubTexture(baseTexture, new Rect(253, 175, 9, 5), baseSize); Panel panel2 = DaggerfallUI.AddPanel(new Rect(312, 49, 1, 149), NativePanel); panel2.BackgroundColor = Color.black; itemsListScroller = new ItemListScroller(defaultToolTip); } else { itemsListScroller = new ItemListScroller(4, 1, itemListPanelRect, itemButtonRects, new TextLabel(), defaultToolTip); } itemsListScroller.Position = new Vector2(itemListScrollerRect.x, itemListScrollerRect.y); itemsListScroller.Size = new Vector2(itemListScrollerRect.width, itemListScrollerRect.height); NativePanel.Components.Add(itemsListScroller); itemsListScroller.OnItemClick += ItemListScroller_OnItemClick; }
protected override void Setup() { base.Setup(); nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new System.Exception("DaggerfallTravelMap: Could not load native texture."); } greenCheckboxTexture = DaggerfallUI.GetTextureFromResources(greenCheckboxTextureFilename); ParentPanel.BackgroundColor = Color.clear; travelPanel = DaggerfallUI.AddPanel(nativePanelRect, NativePanel); travelPanel.BackgroundTexture = nativeTexture; availableGoldLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(148, 97), "0", NativePanel); availableGoldLabel.MaxCharacters = 12; tripCostLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(117, 107), "0", NativePanel); tripCostLabel.MaxCharacters = 18; travelTimeLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(129, 117), "0", NativePanel); travelTimeLabel.MaxCharacters = 16; speedToggleColorPanel = DaggerfallUI.AddPanel(new Rect(cautiousPanelPos, colorPanelSize), NativePanel); SetToggleLook(speedToggleColorPanel); sleepToggleColorPanel = DaggerfallUI.AddPanel(new Rect(innPanelPos, colorPanelSize), NativePanel); SetToggleLook(sleepToggleColorPanel); transportToggleColorPanel = DaggerfallUI.AddPanel(new Rect(footPos, colorPanelSize), NativePanel); SetToggleLook(transportToggleColorPanel); SetupButtons(); Refresh(); }
void SetupItemsList(bool enhanced, TextLabel miscLabelTemplate) { // List panel for scrolling behaviour Panel itemsListPanel = DaggerfallUI.AddPanel(itemListPanelRect, this); itemsListPanel.OnMouseScrollUp += ItemsListPanel_OnMouseScrollUp; itemsListPanel.OnMouseScrollDown += ItemsListPanel_OnMouseScrollDown; itemsListPanel.OnMouseLeave += ItemsListPanel_OnMouseLeave; // Setup buttons itemButtons = new Button[listDisplayTotal]; itemIconPanels = new Panel[listDisplayTotal]; itemAnimPanels = new Panel[listDisplayTotal]; itemStackLabels = new TextLabel[listDisplayTotal]; itemMiscLabels = new TextLabel[listDisplayTotal]; // Setup column misc label offsetting. Vector2 offsetPosition = miscLabelTemplate.Position + new Vector2(0, miscLabelOffsetDist); int osi = miscLabelOffsetIdx; for (int i = 0; i < listDisplayTotal; 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, itemButtonMargin); itemButtons[i].ToolTip = toolTip; itemButtons[i].Tag = i; itemButtons[i].OnMouseClick += ItemButton_OnMouseClick; itemButtons[i].OnRightMouseClick += ItemButton_OnRightMouseClick; 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 Vector2 position = miscLabelTemplate.Position; if (miscLabelOffsetDist != 0 && i == osi) { position = offsetPosition; osi += listWidth; } itemMiscLabels[i] = DaggerfallUI.AddTextLabel(miscLabelTemplate.Font, position, string.Empty, itemButtons[i]); itemMiscLabels[i].HorizontalAlignment = miscLabelTemplate.HorizontalAlignment; itemMiscLabels[i].VerticalAlignment = miscLabelTemplate.VerticalAlignment; itemMiscLabels[i].TextScale = miscLabelTemplate.TextScale; } }
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; }
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); }
protected override void Setup() { // Load all the textures used by inventory system LoadTextures(); // Always dim background ParentPanel.BackgroundColor = ScreenDimColor; // Setup native panel background NativePanel.BackgroundTexture = baseTexture; // Character portrait SetupPaperdoll(); // Cost & gold display SetupCostAndGold(); // Setup action button panel. actionButtonsPanel = DaggerfallUI.AddPanel(actionButtonsPanelRect, NativePanel); // If not inventory mode, overlay mode button texture. if (actionButtonsTexture != null) { actionButtonsPanel.BackgroundTexture = actionButtonsTexture; } // Setup item info panel if configured if (DaggerfallUnity.Settings.EnableInventoryInfoPanel) { if (windowMode == WindowModes.Buy) { itemInfoPanel = DaggerfallUI.AddPanel(itemBuyInfoPanelRect, NativePanel); } else { itemInfoPanel = DaggerfallUI.AddPanel(itemInfoPanelRect, NativePanel); } SetupItemInfoPanel(); } // Setup UI SetupTargetIconPanels(); SetupTabPageButtons(); SetupActionButtons(); SetupAccessoryElements(); SetupItemListScrollers(); // Highlight purchasable items if (windowMode == WindowModes.Buy) { localItemListScroller.BackgroundAnimationHandler = BuyItemBackgroundAnimationHandler; remoteItemListScroller.BackgroundAnimationHandler = BuyItemBackgroundAnimationHandler; localItemListScroller.BackgroundAnimationDelay = coinsAnimationDelay; remoteItemListScroller.BackgroundAnimationDelay = coinsAnimationDelay; } // Setup special behaviour for remote items when repairing if (windowMode == WindowModes.Repair) { remoteItemListScroller.BackgroundColourHandler = RepairItemBackgroundColourHandler; remoteItemListScroller.LabelTextHandler = RepairItemLabelTextHandler; } // Exit buttons Button exitButton = DaggerfallUI.AddButton(exitButtonRect, NativePanel); exitButton.OnMouseClick += ExitButton_OnMouseClick; // Setup initial state SelectTabPage((windowMode == WindowModes.Identify) ? TabPages.MagicItems : TabPages.WeaponsAndArmor); SelectActionMode(ActionModes.Select); // Setup initial display FilterLocalItems(); localItemListScroller.Items = localItemsFiltered; FilterRemoteItems(); remoteItemListScroller.Items = remoteItemsFiltered; UpdateAccessoryItemsDisplay(); UpdateLocalTargetIcon(); UpdateRemoteTargetIcon(); // UpdateRepairTimes(false); UpdateCostAndGold(); SelectWagon(false); }