protected override void Setup() { // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new Exception("CreateCharNameSelect: Could not load native texture."); } // Setup native panel background NativePanel.BackgroundTexture = nativeTexture; // Text edit box textBox.Position = new Vector2(80, 5); textBox.Size = new Vector2(214, 7); NativePanel.Components.Add(textBox); // Random name button randomNameButton = DaggerfallUI.AddButton(new Rect(279, 3, 36, 10), NativePanel); randomNameButton.Label.Text = "Random"; randomNameButton.Label.ShadowColor = Color.black; randomNameButton.BackgroundColor = new Color(0.5f, 0.5f, 0.5f, 0.75f); randomNameButton.OnMouseClick += RandomNameButton_OnMouseClick; // OK button okButton = DaggerfallUI.AddButton(new Rect(263, 172, 39, 22), NativePanel); okButton.OnMouseClick += OkButton_OnMouseClick; }
protected override void Setup() { base.Setup(); // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new Exception("CreateCharChooseClassGen: Could not load native texture."); } // Create panel for window classGenChoosePanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName); classGenChoosePanel.HorizontalAlignment = HorizontalAlignment.Center; classGenChoosePanel.VerticalAlignment = VerticalAlignment.Middle; classGenChoosePanel.BackgroundTexture = nativeTexture; classGenChoosePanel.BackgroundTextureLayout = BackgroundLayout.StretchToFill; NativePanel.Components.Add(classGenChoosePanel); // Create buttons chooseClass = DaggerfallUI.AddButton(chooseClassRect, classGenChoosePanel); chooseClass.OnMouseClick += ChooseClass_OnMouseClick; chooseGenerate = DaggerfallUI.AddButton(chooseQuestionsRect, classGenChoosePanel); chooseGenerate.OnMouseClick += ChooseGenerate_OnMouseClick; }
void LoadAssets() { compassTexture = DaggerfallUI.GetTextureFromImg(compassFilename); compassSize = TextureReplacement.GetSize(compassTexture, compassFilename, true); compassBoxTexture = DaggerfallUI.GetTextureFromImg(compassBoxFilename); compassBoxSize = TextureReplacement.GetSize(compassBoxTexture, compassBoxFilename, true); }
protected override void Setup() { // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new Exception("CreateCharRaceSelect: Could not load native texture."); } // Load picker colours racePickerBitmap = DaggerfallUI.GetImgBitmap(racePickerImgName); // Setup native panel background NativePanel.BackgroundTexture = nativeTexture; // Add "Please select your home province..." prompt promptLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(0, 16), TextManager.Instance.GetLocalizedText("pleaseSelectYourHomeProvince"), NativePanel); promptLabel.HorizontalAlignment = HorizontalAlignment.Center; promptLabel.TextColor = DaggerfallUI.DaggerfallDefaultTextColor; promptLabel.ShadowColor = DaggerfallUI.DaggerfallDefaultShadowColor; promptLabel.ShadowPosition = DaggerfallUI.DaggerfallDefaultShadowPos; // Handle clicks NativePanel.OnMouseClick += ClickHandler; }
protected override void Setup() { dfUnity = DaggerfallUnity.Instance; // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new Exception("DaggerfallBookReaderWindow: Could not load native texture."); } // Setup native panel background NativePanel.BackgroundTexture = nativeTexture; // Load default pixel font ChangeFont(4); // Add buttons Button nextPageButton = DaggerfallUI.AddButton(new Rect(208, 188, 14, 8), NativePanel); nextPageButton.OnMouseClick += NextPageButton_OnMouseClick; Button previousPageButton = DaggerfallUI.AddButton(new Rect(181, 188, 14, 48), NativePanel); previousPageButton.OnMouseClick += PreviousPageButton_OnMouseClick; Button exitButton = DaggerfallUI.AddButton(new Rect(277, 187, 32, 10), NativePanel); exitButton.OnMouseClick += ExitButton_OnMouseClick; LayoutPage(); DaggerfallUI.Instance.PlayOneShot(SoundClips.OpenBook); }
protected override void Setup() { // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new Exception("DaggerfallStartWindow: Could not load native texture."); } // Setup native panel background NativePanel.BackgroundTexture = nativeTexture; // Setup buttons loadGameButton = DaggerfallUI.AddButton(new Vector2(72, 45), new Vector2(147, 15), DaggerfallUIMessages.dfuiOpenLoadSavedGameWindow, NativePanel); loadGameButton.OnMouseClick += LoadGameButton_OnMouseClick; loadGameButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MainMenuLoad); loadGameButton.OnKeyboardEvent += LoadGameButton_OnKeyboardEvent; newGameButton = DaggerfallUI.AddButton(new Vector2(72, 99), new Vector2(147, 15), DaggerfallUIMessages.dfuiStartNewGame, NativePanel); newGameButton.OnMouseClick += NewGameButton_OnMouseClick; newGameButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MainMenuStart); newGameButton.OnKeyboardEvent += NewGameButton_OnKeyboardEvent; exitButton = DaggerfallUI.AddButton(new Vector2(125, 145), new Vector2(41, 15), DaggerfallUIMessages.dfuiExitGame, NativePanel); exitButton.OnMouseClick += ExitButton_OnMouseClick; exitButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MainMenuExit); exitButton.OnKeyboardEvent += ExitButton_OnKeyboardEvent; }
protected override void Setup() { if (IsSetup) { return; } // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new Exception("CreateCharAddBonusSkillsWindow: Could not load native texture."); } // Setup native panel background NativePanel.BackgroundTexture = nativeTexture; // Add skills rollout skillsRollout = new SkillsRollout(); skillsRollout.Position = new Vector2(0, 0); NativePanel.Components.Add(skillsRollout); // Add "OK" button Button okButton = DaggerfallUI.AddButton(new Rect(263, 172, 39, 22), NativePanel); okButton.OnMouseClick += OkButton_OnMouseClick; IsSetup = true; }
protected override void Setup() { dfUnity = DaggerfallUnity.Instance; // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new Exception("DaggerfallBookReaderWindow: Could not load native texture."); } // Setup native panel background NativePanel.BackgroundTexture = nativeTexture; // Load default pixel font ChangeFont(4); // Add buttons DaggerfallUI.AddButton(new Vector2(181, 188), new Vector2(14, 8), DaggerfallUIMessages.dfuiBookReaderPreviousPage, NativePanel); DaggerfallUI.AddButton(new Vector2(208, 188), new Vector2(14, 8), DaggerfallUIMessages.dfuiBookReaderNextPage, NativePanel); //CreateButton(new Vector2(277, 187), new Vector2(32, 10), WindowMessages.wmCloseWindow); // Test book dfUnity.TextProvider.OpenBook("BOK00043.TXT"); // The Real Barenziah //dfUnity.TextProvider.OpenBook("BOK00101.TXT"); // Kind Edward, Part 2 //dfUnity.TextProvider.OpenBook("BOK00008.TXT"); // The Pig Children LayoutPage(); }
protected override void Setup() { // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new Exception("DaggerfallCourtWindow: Could not load native texture."); } // Native court panel courtPanel.HorizontalAlignment = HorizontalAlignment.Center; courtPanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName); courtPanel.BackgroundTexture = nativeTexture; NativePanel.Components.Add(courtPanel); // Cancel any camera recoil RaiseOnCourtScreenEvent(); // Add days until freedom label daysUntilFreedomLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(156, 165), string.Empty, NativePanel); daysUntilFreedomLabel.TextColor = DaggerfallUI.DaggerfallPrisonDaysUntilFreedomColor; daysUntilFreedomLabel.ShadowColor = DaggerfallUI.DaggerfallPrisonDaysUntilFreedomShadowColor; daysUntilFreedomLabel.HorizontalAlignment = HorizontalAlignment.Center; playerEntity = GameManager.Instance.PlayerEntity; AllowCancel = false; }
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 LoadTextures() { // Load base texture baseTexture = DaggerfallUI.GetTextureFromImg(baseTextureName); if (!baseTexture) { throw new Exception(string.Format("DaggerfallInventoryWindow: Could not load {0}.", baseTextureName)); } }
//returns icon texture for corresponding index Texture2D GetSpellIcon(int iconIndex) { var x = iconIndex % 10; var y = iconIndex / 10; var rect = new Rect(x * 16, y * 16, 16, 16); var iconTexture = DaggerfallUI.GetTextureFromImg(System.IO.Path.Combine(DaggerfallUnity.Arena2Path, ICONIMAGENAME), rect, TextureFormat.ARGB32); return(iconTexture); }
//returns icon texture for corresponding index Texture2D GetElementTypeIcon(int iconIndex) { var x = 24; var y = iconIndex * 16; var rect = new Rect(x, y, 16, 16); var iconTexture = DaggerfallUI.GetTextureFromImg(System.IO.Path.Combine(DaggerfallUnity.Arena2Path, RANGEICONSIMAGENAME), rect, TextureFormat.ARGB32); return(iconTexture); }
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 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; }
void LoadAssets() { compassTexture = DaggerfallUI.GetTextureFromImg(compassFilename); compassSize = TextureReplacement.GetSize(compassTexture, compassFilename, true); compassBoxTexture = DaggerfallUI.GetTextureFromImg(compassBoxFilename); compassBoxSize = TextureReplacement.GetSize(compassBoxTexture, compassBoxFilename, true); defaultTrackingIcon = Resources.Load <Texture2D>(trackingIconFilename); defaultTrackingIcon.filterMode = (FilterMode)DaggerfallUnity.Settings.GUIFilterMode; }
// 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; }
void LoadTextures() { if (!buyMode) { baseTexture = DaggerfallUI.GetTextureFromImg(spellBookTextureFilename); } else { baseTexture = DaggerfallUI.GetTextureFromImg(spellBookBuyModeTextureFilename); } }
//returns icon texture for corresponding index //this is not working properly for some reason - the y pos. isn't being respected Texture2D GetSpellRangeIcon(int iconIndex) { var x = 0; var y = iconIndex * 16; var rect = new Rect(x, y, 24, 16); var iconTexture = DaggerfallUI.GetTextureFromImg(System.IO.Path.Combine(DaggerfallUnity.Arena2Path, RANGEICONSIMAGENAME), rect, TextureFormat.ARGB32); Debug.Log(string.Format("tw: {0} th: {1} x: {2} y: {3}", iconTexture.width, iconTexture.height, rect.x, rect.y)); return(iconTexture); }
void LoadClassicSpellTargetAndElementIcons() { // Clear existing collections spellTargetIcons.Clear(); spellElementIcons.Clear(); // Get source atlas Texture2D spellTargetAndElementIconAtlas = DaggerfallUI.GetTextureFromImg(spellTargetAndElementIconsFile, TextureFormat.ARGB32, false); if (spellTargetAndElementIconAtlas == null) { Debug.LogWarning("SpellIconCollection: Could not load spell target and element icons atlas texture. Arena2 path might not be set yet."); return; } // Derive dimension of each icon from atlas width const int columnCount = 5; int height = spellTargetAndElementIconAtlas.height / columnCount; int elementIconWidth = height; int targetIconWidth = height * 3 / 2; // Checks texture imported from mods if (spellTargetAndElementIconAtlas.format == TextureFormat.DXT5 && height % 4 != 0 && targetIconWidth % 4 != 0) { Debug.LogErrorFormat("{0} is compressed with a block-based format but icons are not multiple of 4.", spellIconsFile); return; } // Read target icons to their own atlas Rect targetIconRect = new Rect(0, 0, targetIconWidth, height); for (int i = 0; i < spellTargetIconsCount; i++) { Texture2D iconTexture = ImageReader.GetSubTexture(spellTargetAndElementIconAtlas, targetIconRect); spellTargetIcons.Add(iconTexture); targetIconRect.y = targetIconRect.y + height; } // Read element icons to their own atlas Rect elementIconRect = new Rect(targetIconWidth, 0, elementIconWidth, height); for (int i = 0; i < spellElementIconsCount; i++) { Texture2D iconTexture = ImageReader.GetSubTexture(spellTargetAndElementIconAtlas, elementIconRect); spellElementIcons.Add(iconTexture); elementIconRect.y = elementIconRect.y + height; } // Log success Debug.LogFormat("Loaded {0} spell target icons and {1} element icons.", spellTargetIcons.Count, spellElementIcons.Count); }
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; }
void Start() { indicatorTexure = DaggerfallUI.GetTextureFromImg(indicatorFilename); indicatorSize = new Vector2(indicatorTexure.width, indicatorTexure.height); // Register listner for start quest event so free locator device can be given for dungeons QuestMachine.OnQuestStarted += QuestMachine_OnQuestStarted; // Register listeners for loading game and exiting dungeons - so that state can be updated SaveLoadManager.OnLoad += SaveLoadManager_OnLoad; PlayerEnterExit.OnTransitionDungeonExterior += OnTransitionToDungeonExterior; enabled = false; }
void LoadAssets() { if (DaggerfallUnity.Settings.SwapHealthAndFatigueColors) { healthProgress.ProgressTexture = DaggerfallUI.GetTextureFromImg(fatigueBarFilename); fatigueProgress.ProgressTexture = DaggerfallUI.GetTextureFromImg(healthBarFilename); } else { healthProgress.ProgressTexture = DaggerfallUI.GetTextureFromImg(healthBarFilename); fatigueProgress.ProgressTexture = DaggerfallUI.GetTextureFromImg(fatigueBarFilename); } magickaProgress.ProgressTexture = DaggerfallUI.GetTextureFromImg(magickaBarFilename); }
/// <summary> /// Loads classic spell icons. /// </summary> void LoadClassicSpellIcons() { // Clear existing collection spellIcons.Clear(); // Get source atlas Texture2D spellIconAtlas = DaggerfallUI.GetTextureFromImg(spellIconsFile); if (spellIconAtlas == null) { Debug.LogWarning("SpellIconCollection: Could not load spell icons atlas texture. Arena2 path might not be set yet."); return; } // Derive dimension of each icon from atlas width const int rowCount = 20; int dim = spellIconAtlas.width / rowCount; // Checks texture imported from mods if (spellIconAtlas.format == TextureFormat.DXT5 && dim % 4 != 0) { Debug.LogErrorFormat("{0} is compressed with a block-based format but icons are not multiple of 4.", spellIconsFile); return; } // Read icons to their own texture (remembering Unity textures are flipped vertically) int srcX = 0, srcY = spellIconAtlas.height - dim; for (int i = 0; i < SpellIconCount; i++) { // Extract texture Texture2D iconTexture = new Texture2D(dim, dim, spellIconAtlas.format, false); Graphics.CopyTexture(spellIconAtlas, 0, 0, srcX, srcY, dim, dim, iconTexture, 0, 0, 0, 0); iconTexture.filterMode = DaggerfallUnity.Instance.MaterialReader.MainFilterMode; spellIcons.Add(iconTexture); // Step to next source icon position and wrap to next row srcX += dim; if (srcX >= spellIconAtlas.width) { srcX = 0; srcY -= dim; } } // Log success //Debug.LogFormat("Loaded {0} spell icons for UI with a dimension of {1}x{2} each.", spellIcons.Count, dim, dim); }
private void SwitchToPrisonScreen() { // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName2); if (!nativeTexture) { throw new Exception("DaggerfallCourtWindow: Could not load native texture."); } // Native court panel courtPanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName2); courtPanel.BackgroundTexture = nativeTexture; daysUntilFreedomLabel.Text = HardStrings.daysUntilFreedom; daysUntilFreedomLabel.Text = daysUntilFreedomLabel.Text.Replace("%d", daysInPrison.ToString()); }
protected virtual void SwitchToPrisonScreen() { // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName2); if (!nativeTexture) { throw new Exception("DaggerfallCourtWindow: Could not load native texture."); } // Native court panel courtPanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName2); courtPanel.BackgroundTexture = nativeTexture; daysUntilFreedomLabel.Text = TextManager.Instance.GetLocalizedText("daysUntilFreedom"); daysUntilFreedomLabel.Text = daysUntilFreedomLabel.Text.Replace("%d", daysInPrison.ToString()); }
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); }
protected override void Setup() { // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new Exception("DaggerfallLoadSavedGameWindow: Could not load native texture."); } // Setup native panel background NativePanel.BackgroundTexture = nativeTexture; // Always dim background //ParentPanel.BackgroundColor = ScreenDimColor; OpenSaveGames(); AddControls(); }
protected override void Setup() { // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new Exception("DaggerfallCourtWindow: Could not load native texture."); } // Native court panel courtPanel.HorizontalAlignment = HorizontalAlignment.Center; courtPanel.Size = TextureReplacement.GetSize(nativeTexture, nativeImgName); courtPanel.BackgroundTexture = nativeTexture; NativePanel.Components.Add(courtPanel); playerEntity = GameManager.Instance.PlayerEntity; state = 0; }