protected override void Setup() { // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new Exception("CreateCharReflexSelect: Could not load native texture."); } // Setup native panel background NativePanel.BackgroundTexture = nativeTexture; // Setup info panel Panel infoPanel = new Panel(); DaggerfallUI.Instance.SetDaggerfallPopupStyle(DaggerfallUI.PopupStyle.Parchment, infoPanel); NativePanel.Components.Add(infoPanel); infoPanel.HorizontalAlignment = HorizontalAlignment.Center; infoPanel.Position = new Vector2(0, 15); // Setup info text MultiFormatTextLabel infoText = new MultiFormatTextLabel(); infoPanel.Components.Add(infoText); infoText.SetText(DaggerfallUnity.Instance.TextProvider.GetRSCTokens(strPlayerReflexesDetermine)); infoText.HorizontalAlignment = HorizontalAlignment.Center; infoText.VerticalAlignment = VerticalAlignment.Middle; infoPanel.Size = infoText.Size; // Setup button picker reflexPicker = new ReflexPicker(); NativePanel.Components.Add(reflexPicker); reflexPicker.Position = new Vector2(127, 148f); // Add "OK" button Button okButton = DaggerfallUI.AddButton(new Rect(263, 172, 39, 22), NativePanel); okButton.OnMouseClick += OkButton_OnMouseClick; }
protected override void Setup() { // Load native texture nativeTexture = DaggerfallUI.GetTextureFromImg(nativeImgName); if (!nativeTexture) { throw new Exception("CreateCharReflexSelect: Could not load native texture."); } // Setup native panel background NativePanel.BackgroundTexture = nativeTexture; // Setup info panel Panel infoPanel = new Panel(); DaggerfallUI.Instance.SetDaggerfallPopupStyle(DaggerfallUI.PopupStyle.Parchment, infoPanel); NativePanel.Components.Add(infoPanel); infoPanel.HorizontalAlignment = HorizontalAlignment.Center; infoPanel.Position = new Vector2(0, 15); // Setup info text MultiFormatTextLabel infoText = new MultiFormatTextLabel(); infoPanel.Components.Add(infoText); infoText.SetText(DaggerfallUnity.Instance.TextProvider.GetRSCTokens(strPlayerReflexesDetermine)); infoText.HorizontalAlignment = HorizontalAlignment.Center; infoText.VerticalAlignment = VerticalAlignment.Middle; // Setup panel size int minimum = 44; float width = (infoText.Size.x + infoPanel.LeftMargin + infoPanel.RightMargin); float height = (infoText.Size.y + infoPanel.TopMargin + infoPanel.BottomMargin); if (width > minimum) { width = (float)Math.Ceiling(width / 22) * 22; } else { width = minimum; } if (height > minimum) { height = (float)Math.Ceiling(height / 22) * 22; } else { height = minimum; } infoPanel.Size = new Vector2(width, height); // Setup button picker reflexPicker = new ReflexPicker(); NativePanel.Components.Add(reflexPicker); reflexPicker.Position = new Vector2(127, 148f); // Add "OK" button Button okButton = DaggerfallUI.AddButton(new Rect(263, 172, 39, 22), NativePanel); okButton.OnMouseClick += OkButton_OnMouseClick; }