public AlertTuple(int frames, WidgetRenderer wr, int buf, int w, int h, int th) { FramesLeft = frames; Base = new RectWidget(wr); Base.Color = UserConfig.MainScheme.WidgetBase; Base.Width = w; Base.Height = h; Icon = new RectWidget(wr); Icon.Offset = new Point(buf, buf); Icon.Color = Color.White; Icon.Height = h - buf * 2; Icon.Width = Icon.Height; Icon.Parent = Base; Text = new TextWidget(wr); Text.AlignY = Alignment.MID; Text.OffsetAlignX = Alignment.RIGHT; Text.OffsetAlignY = Alignment.MID; Text.Color = UserConfig.MainScheme.Text; Text.Offset = new Point(buf, 0); Text.Parent = Icon; Text.Height = th; }
public RTSUnitDataPanel(RTSRenderer renderer, WidgetRenderer wr, UICUnitData _uic, UICCombatStats _uicCS) { uic = _uic; iconLib = renderer.IconLibrary; WidgetBase = new RectWidget(wr, renderer.LoadTexture2D(uic.PanelImage)); WidgetBase.Width = uic.PanelSize.X; WidgetBase.Height = uic.PanelSize.Y; WidgetBase.Color = uic.PanelColor; icon = new RectWidget(wr); icon.Width = uic.IconSize; icon.Height = uic.IconSize; icon.Color = Color.White; icon.Offset = new Point(uic.IconBuffer, uic.IconBuffer); icon.Parent = WidgetBase; rectHealthBack = new RectWidget(wr); rectHealthBack.Width = uic.IconSize; rectHealthBack.Height = uic.HealthHeight; rectHealthBack.AlignX = Alignment.MID; rectHealthBack.OffsetAlignX = Alignment.MID; rectHealthBack.OffsetAlignY = Alignment.BOTTOM; rectHealthBack.Offset = new Point(0, uic.IconBuffer); rectHealthBack.Color = UserConfig.MainScheme.WidgetBorder; rectHealthBack.Parent = icon; rectHealthFore = new RectWidget(wr); rectHealthFore.Width = uic.IconSize; rectHealthFore.Height = uic.HealthHeight; rectHealthFore.AlignX = Alignment.MID; rectHealthFore.AlignY = Alignment.MID; rectHealthFore.OffsetAlignX = Alignment.MID; rectHealthFore.OffsetAlignY = Alignment.MID; rectHealthFore.Offset = new Point(0, 0); rectHealthFore.Color = uic.HealthMaxColor; rectHealthFore.Parent = rectHealthBack; txtName = new TextWidget(wr); txtName.Height = uic.TextHeight; txtName.OffsetAlignX = Alignment.RIGHT; txtName.Offset = new Point(uic.IconBuffer, 0); txtName.Color = UserConfig.MainScheme.Text; txtName.Parent = icon; combatData = new RectButton(wr, uic.CombatSize, uic.CombatSize, Color.Gray, Color.White, renderer.LoadTexture2D(uic.CombatImage)); combatData.AlignX = Alignment.RIGHT; combatData.AlignY = Alignment.BOTTOM; combatData.OffsetAlignX = Alignment.RIGHT; combatData.OffsetAlignY = Alignment.BOTTOM; combatData.Parent = WidgetBase; uiCStats = new RTSUICombatStats(wr, _uicCS); uiCStats.WidgetBase.AlignY = Alignment.BOTTOM; uiCStats.WidgetBase.Anchor = new Point(1000000, 1000000); uiCSHover = new RTSUIHoverPanel(combatData, uiCStats.WidgetBase); }
public RTSUIAlertQueue(WidgetRenderer _wr, UICAlertQueue _uic) { uic = _uic; wr = _wr; WidgetBase = new RectWidget(wr); WidgetBase.Color = Color.Transparent; WidgetBase.LayerOffset = 0.01f; WidgetBase.OffsetAlignX = Alignment.RIGHT; WidgetBase.Offset = new Point(-uic.Width, 0); lRects = new LinkedList <AlertTuple>(); }
private void BuildBounds(RTSRenderer renderer) { rectBounds = new RectWidget(wrMain); rectBounds.Color = Color.Transparent; rectBounds.Anchor = new Point(0, 0); rectBounds.AlignX = Alignment.LEFT; rectBounds.AlignY = Alignment.TOP; rectBounds.Width = renderer.G.Viewport.Width; rectBounds.Height = renderer.G.Viewport.Height; renderer.Window.ClientSizeChanged += (sender, args) => { rectBounds.Width = renderer.G.Viewport.Width; rectBounds.Height = renderer.G.Viewport.Height; }; rectBounds.LayerDepth = 1f; }
public override void Build() { input = new InputManager(); wr = new WidgetRenderer(G, game.Content.Load <SpriteFont>(@"Fonts\Default")); wBackPanel = new RectWidget(wr); wBackPanel.Anchor = new Point(0, 0); wBackPanel.Width = 200; wBackPanel.Height = G.Viewport.Height; wBackPanel.LayerDepth = 1f; wBackPanel.Color = new Color(14, 14, 14, 230); sP = new ColorSwatch(10, 30, 170, 15, 35, 5, Color.Black, 0.9f, wr); sS = new ColorSwatch(10, 120, 170, 15, 35, 5, Color.Black, 0.9f, wr); sT = new ColorSwatch(10, 210, 170, 15, 35, 5, Color.Black, 0.9f, wr); sP.OnColorChange += (c) => { colorScheme.Primary = c; }; sS.OnColorChange += (c) => { colorScheme.Secondary = c; }; sT.OnColorChange += (c) => { colorScheme.Tertiary = c; }; }
public RTSUIMinimap(RTSRenderer renderer, WidgetRenderer wr, Texture2D tPhys, Texture2D tImp, UICMinimap uic) { tPhysical = tPhys; tImpact = tImp; WidgetBase = new RectWidget(wr); WidgetBase.Width = uic.ButtonWidth + uic.MapSize + uic.Buffer * 2; WidgetBase.Height = uic.MapSize + uic.Buffer * 2; WidgetBase.Color = uic.BaseColor; int bh = uic.MapSize / 2; btnPhysical = new RectButton(wr, uic.ButtonWidth, bh, uic.PhysicalInactiveColor, uic.PhysicalActiveColor, renderer.LoadTexture2D(uic.PhysicalTexture) ); btnImpact = new RectButton(wr, uic.ButtonWidth, bh, uic.ImpactInactiveColor, uic.ImpactActiveColor, renderer.LoadTexture2D(uic.ImpactTexture) ); btnPhysical.Offset = new Point(uic.Buffer, uic.Buffer); btnPhysical.Parent = WidgetBase; btnImpact.OffsetAlignY = Alignment.BOTTOM; btnImpact.Parent = btnPhysical; MapRect = new RectWidget(wr, tPhysical); MapRect.Width = uic.MapSize; MapRect.Height = uic.MapSize; MapRect.Color = Color.White; MapRect.OffsetAlignX = Alignment.RIGHT; MapRect.Parent = btnPhysical; btnPhysical.OnButtonPress += (b, p) => { MapRect.Texture = tPhysical; }; btnImpact.OnButtonPress += (b, p) => { MapRect.Texture = tImpact; }; }
public RTSUICombatStats(WidgetRenderer wr, UICCombatStats _uic) { uic = _uic; WidgetBase = new RectWidget(wr); WidgetBase.Color = uic.BaseColor; WidgetBase.Width = uic.PanelWidth; WidgetBase.Height = (uic.TextHeight + uic.TextBuffer) * 5 + uic.TextBuffer; WidgetBase.LayerDepth = 0.1f; texts = new TextWidget[2 * 5]; string[] s = { "Damage", "Range", "Attack Speed", "Armor", "Crit. Chance" }; for (int i = 0; i < texts.Length; i++) { texts[i] = new TextWidget(wr); texts[i].OffsetAlignX = Alignment.MID; texts[i].AlignY = Alignment.BOTTOM; texts[i].Height = uic.TextHeight; texts[i].Color = uic.TextColor; if (i % 2 == 0) { texts[i].AlignX = Alignment.RIGHT; texts[i].Offset = new Point(-uic.TextSeparation / 2, (i / 2 + 1) * (uic.TextHeight + uic.TextBuffer)); texts[i].Text = s[i / 2]; } else { texts[i].AlignX = Alignment.LEFT; texts[i].Offset = new Point(uic.TextSeparation / 2, (i / 2 + 1) * (uic.TextHeight + uic.TextBuffer)); } texts[i].Parent = WidgetBase; } }
public RTSUIPanel2D(WidgetRenderer wr, int r, int c, int s, int buf) { Rows = r; Columns = c; groups = new RTSUIGroup <T> [Columns * Rows]; int i = 0; for (int y = 0; y < Rows; y++) { for (int x = 0; x < Columns; x++) { groups[i] = new RTSUIGroup <T>(wr, s); if (x > 0) { groups[i].Widget.Parent = groups[i - 1].Widget; groups[i].Widget.Offset = new Point(buf, 0); groups[i].Widget.OffsetAlignX = Alignment.RIGHT; } i++; } if (y > 0) { int yi = y * Columns; groups[yi].Widget.Parent = groups[yi - Columns].Widget; groups[yi].Widget.Offset = new Point(0, buf); groups[yi].Widget.OffsetAlignY = Alignment.BOTTOM; } } BackPanel = new RectWidget(wr); BackPanel.Width = Columns * s + (Columns + 1) * buf; BackPanel.Height = Rows * s + (Rows + 1) * buf; groups[0].Widget.Parent = BackPanel; groups[0].Widget.Offset = new Point(buf, buf); LayerDepth = 1f; Clear(); }
public void Dispose() { if (rectBase != null) { rectBase.Dispose(); rectBase = null; } if (rectPopPic != null) { rectPopPic.Dispose(); rectPopPic = null; } if (rectCapital != null) { rectCapital.Dispose(); rectCapital = null; } if (textPopCur != null) { textPopCur.Dispose(); textPopCur = null; } if (textPopCap != null) { textPopCap.Dispose(); textPopCap = null; } if (textCapital != null) { textCapital.Dispose(); textCapital = null; } if (textVictory != null) { textVictory.Dispose(); textVictory = null; } }
public ColorSwatch(int x, int y, int w, int hPart, int hFull, int border, Color bColor, float lD, WidgetRenderer r) { wBorder = new RectWidget(r); wBorder.Anchor = new Point(x, y); wBorder.Width = w + border * 2; wBorder.Height = hPart * 3 + hFull + border * 2; wBorder.LayerDepth = lD; wBorder.Color = bColor; lD -= 0.001f; x += border; y += border; int sw = w - border; int sh = hPart - border; var csbb = new Microsoft.Xna.Framework.Color(28, 28, 28); wR = new RectWidget(r); wR.Anchor = new Point(x, y); wR.Width = w; wR.Height = hPart; wR.LayerDepth = lD; wR.Color = Microsoft.Xna.Framework.Color.Red; y += hPart; sbR = new ScrollBar(r); sbR.Color = csbb; sbR.Width = sw; sbR.Height = sh; sbR.LayerDepth = lD - 0.01f; sbR.ScrollButton.ActiveWidth = sw / 5; sbR.ScrollButton.ActiveHeight = sh; sbR.ScrollButton.InactiveWidth = sw / 5; sbR.ScrollButton.InactiveHeight = sh; sbR.ScrollButton.InactiveColor = Microsoft.Xna.Framework.Color.Black; sbR.ScrollButton.ActiveColor = Microsoft.Xna.Framework.Color.White; sbR.ScrollButton.LayerDepth = lD - 0.02f; sbR.Parent = wR; sbR.OffsetAlignX = Alignment.MID; sbR.OffsetAlignY = Alignment.MID; sbR.AlignX = Alignment.MID; sbR.AlignY = Alignment.MID; sbR.IsVertical = false; sbR.OnScrollValueChanged += (sb, v) => { col.X = v; sbR.ScrollButton.InactiveColor = new Color(col.X, 0f, 0f); wCol.Color = new Color(col.X, col.Y, col.Z); if (OnColorChange != null) { OnColorChange(col); } }; sbR.ScrollRatio = 0; wG = new RectWidget(r); wG.Anchor = new Point(x, y); wG.Width = w; wG.Height = hPart; wG.LayerDepth = lD; wG.Color = Microsoft.Xna.Framework.Color.Green; y += hPart; sbG = new ScrollBar(r); sbG.Color = csbb; sbG.Width = sw; sbG.Height = sh; sbG.LayerDepth = lD - 0.01f; sbG.ScrollButton.ActiveWidth = sw / 5; sbG.ScrollButton.ActiveHeight = sh; sbG.ScrollButton.InactiveWidth = sw / 5; sbG.ScrollButton.InactiveHeight = sh; sbG.ScrollButton.InactiveColor = Microsoft.Xna.Framework.Color.Black; sbG.ScrollButton.ActiveColor = Microsoft.Xna.Framework.Color.White; sbG.ScrollButton.LayerDepth = lD - 0.02f; sbG.Parent = wG; sbG.OffsetAlignX = Alignment.MID; sbG.OffsetAlignY = Alignment.MID; sbG.AlignX = Alignment.MID; sbG.AlignY = Alignment.MID; sbG.IsVertical = false; sbG.OnScrollValueChanged += (sb, v) => { col.Y = v; sbG.ScrollButton.InactiveColor = new Color(0f, col.Y, 0f); wCol.Color = new Color(col.X, col.Y, col.Z); if (OnColorChange != null) { OnColorChange(col); } }; sbG.ScrollRatio = 0; wB = new RectWidget(r); wB.Anchor = new Point(x, y); wB.Width = w; wB.Height = hPart; wB.LayerDepth = lD; wB.Color = Microsoft.Xna.Framework.Color.Blue; y += hPart; sbB = new ScrollBar(r); sbB.Color = csbb; sbB.Width = sw; sbB.Height = sh; sbB.LayerDepth = lD - 0.01f; sbB.ScrollButton.ActiveWidth = sw / 5; sbB.ScrollButton.ActiveHeight = sh; sbB.ScrollButton.InactiveWidth = sw / 5; sbB.ScrollButton.InactiveHeight = sh; sbB.ScrollButton.InactiveColor = Microsoft.Xna.Framework.Color.Black; sbB.ScrollButton.ActiveColor = Microsoft.Xna.Framework.Color.White; sbB.ScrollButton.LayerDepth = lD - 0.02f; sbB.Parent = wB; sbB.OffsetAlignX = Alignment.MID; sbB.OffsetAlignY = Alignment.MID; sbB.AlignX = Alignment.MID; sbB.AlignY = Alignment.MID; sbB.IsVertical = false; sbB.OnScrollValueChanged += (sb, v) => { col.Z = v; sbB.ScrollButton.InactiveColor = new Color(0f, 0f, col.Z); wCol.Color = new Color(col.X, col.Y, col.Z); if (OnColorChange != null) { OnColorChange(col); } }; sbB.ScrollRatio = 0; wCol = new RectWidget(r); wCol.Anchor = new Point(x, y); wCol.Width = w; wCol.Height = hFull; wCol.LayerDepth = lD; Color = Vector3.One; }
public RTSBuildingDataPanel(RTSRenderer renderer, WidgetRenderer wr, UICBuildingData _uic) { uic = _uic; iconLib = renderer.IconLibrary; WidgetBase = new RectWidget(wr, renderer.LoadTexture2D(uic.PanelImage)); WidgetBase.Width = uic.PanelSize.X; WidgetBase.Height = uic.PanelSize.Y; WidgetBase.Color = uic.PanelColor; icon = new RectWidget(wr); icon.Width = uic.IconSize; icon.Height = uic.IconSize; icon.Color = Color.White; icon.Offset = new Point(uic.IconBuffer, uic.IconBuffer); icon.Parent = WidgetBase; rectHealthBack = new RectWidget(wr); rectHealthBack.Width = uic.IconSize; rectHealthBack.Height = uic.HealthHeight; rectHealthBack.AlignX = Alignment.MID; rectHealthBack.OffsetAlignX = Alignment.MID; rectHealthBack.OffsetAlignY = Alignment.BOTTOM; rectHealthBack.Offset = new Point(0, uic.IconBuffer); rectHealthBack.Color = UserConfig.MainScheme.WidgetBorder; rectHealthBack.Parent = icon; rectHealthFore = new RectWidget(wr); rectHealthFore.Width = uic.IconSize; rectHealthFore.Height = rectHealthBack.Height; rectHealthFore.AlignX = Alignment.MID; rectHealthFore.AlignY = Alignment.MID; rectHealthFore.OffsetAlignX = Alignment.MID; rectHealthFore.OffsetAlignY = Alignment.MID; rectHealthFore.Offset = new Point(0, 0); rectHealthFore.Color = uic.HealthMaxColor; rectHealthFore.Parent = rectHealthBack; queueButtons = new RectButton[6]; queueButtons[0] = new RectButton(wr, uic.QueueIconMainSize, uic.QueueIconMainSize, Color.White, uic.QueueButtonHighlightColor); queueButtons[0].AlignY = Alignment.BOTTOM; queueButtons[0].OffsetAlignY = Alignment.BOTTOM; queueButtons[0].OffsetAlignX = Alignment.RIGHT; queueButtons[0].Offset = new Point(uic.IconBuffer, 0); queueButtons[0].Parent = rectHealthBack; for (int i = 1; i < 6; i++) { queueButtons[i] = new RectButton(wr, uic.QueueIconQueuedSize, uic.QueueIconQueuedSize, Color.White, uic.QueueButtonHighlightColor); queueButtons[i].AlignY = Alignment.BOTTOM; queueButtons[i].OffsetAlignY = Alignment.BOTTOM; queueButtons[i].OffsetAlignX = Alignment.RIGHT; queueButtons[i].Parent = queueButtons[i - 1]; } rectQueueBack = new RectWidget(wr); rectQueueBack.Width = uic.QueueIconQueuedSize * 5; rectQueueBack.Height = uic.QueueIconMainSize - uic.QueueIconQueuedSize; rectQueueBack.OffsetAlignX = Alignment.RIGHT; rectQueueBack.Color = UserConfig.MainScheme.WidgetBorder; rectQueueBack.Parent = queueButtons[0]; rectQueueFore = new RectWidget(wr); rectQueueFore.Width = uic.IconSize; rectQueueFore.Height = rectQueueBack.Height; rectQueueFore.AlignY = Alignment.MID; rectQueueFore.OffsetAlignY = Alignment.MID; rectQueueFore.Offset = new Point(0, 0); rectQueueFore.Color = uic.QueueMaxColor; rectQueueFore.Parent = rectQueueBack; txtName = new TextWidget(wr); txtName.Height = uic.TextHeight; txtName.OffsetAlignX = Alignment.RIGHT; txtName.Offset = new Point(uic.IconBuffer, 0); txtName.Color = UserConfig.MainScheme.Text; txtName.Parent = icon; }
public TeamInitWidget(WidgetRenderer wr, int w, int h, int buf, Color cBack, ButtonHighlightOptions bh1, ButtonHighlightOptions bh2, Color cText) { BackRect = new RectWidget(wr); BackRect.Width = w; BackRect.Height = h; BackRect.Offset = new Point(0, 0); BackRect.OffsetAlignY = Alignment.BOTTOM; BackRect.Color = cBack; BackRect.LayerDepth = 1f; int wh = h - buf * 2; TextIndex = new TextWidget(wr); TextIndex.Offset = new Point(buf, 0); TextIndex.OffsetAlignX = Alignment.LEFT; TextIndex.OffsetAlignY = Alignment.MID; TextIndex.AlignX = Alignment.LEFT; TextIndex.AlignY = Alignment.MID; TextIndex.Height = wh; TextIndex.Color = cText; TextIndex.Parent = BackRect; TextIndex.LayerDepth = 0.3f; TextUser = new TextWidget(wr); TextUser.Offset = new Point(buf, 0); TextUser.OffsetAlignX = Alignment.RIGHT; TextUser.OffsetAlignY = Alignment.MID; TextUser.AlignX = Alignment.LEFT; TextUser.AlignY = Alignment.MID; TextUser.Height = wh; TextUser.Color = cText; TextUser.Parent = TextIndex; TextUser.LayerDepth = 0.3f; ButtonScheme = new RectButton(wr, bh1, bh2); ButtonScheme.Offset = new Point(-buf, 0); ButtonScheme.OffsetAlignX = Alignment.RIGHT; ButtonScheme.OffsetAlignY = Alignment.MID; ButtonScheme.AlignX = Alignment.RIGHT; ButtonScheme.AlignY = Alignment.MID; ButtonScheme.Parent = BackRect; ButtonScheme.LayerDepth = 0.3f; TextScheme = new TextWidget(wr); TextScheme.Height = bh1.Height; TextScheme.Text = "Default"; TextScheme.Offset = new Point(0, 0); TextScheme.OffsetAlignX = Alignment.MID; TextScheme.OffsetAlignY = Alignment.MID; TextScheme.AlignX = Alignment.MID; TextScheme.AlignY = Alignment.MID; TextScheme.Parent = ButtonScheme; TextScheme.Color = cText; TextScheme.LayerDepth = 0f; ButtonRace = new RectButton(wr, bh1, bh2); ButtonRace.Offset = new Point(-buf, 0); ButtonRace.OffsetAlignX = Alignment.LEFT; ButtonRace.OffsetAlignY = Alignment.MID; ButtonRace.AlignX = Alignment.RIGHT; ButtonRace.AlignY = Alignment.MID; ButtonRace.Parent = ButtonScheme; ButtonRace.LayerDepth = 0.3f; TextRace = new TextWidget(wr); TextRace.Height = bh1.Height; TextRace.Text = "Race"; TextRace.Offset = new Point(0, 0); TextRace.OffsetAlignX = Alignment.MID; TextRace.OffsetAlignY = Alignment.MID; TextRace.AlignX = Alignment.MID; TextRace.AlignY = Alignment.MID; TextRace.Parent = ButtonRace; TextRace.Color = cText; TextRace.LayerDepth = 0f; ButtonPlayerType = new RectButton(wr, bh1, bh2); ButtonPlayerType.Offset = new Point(-buf, 0); ButtonPlayerType.OffsetAlignX = Alignment.LEFT; ButtonPlayerType.OffsetAlignY = Alignment.MID; ButtonPlayerType.AlignX = Alignment.RIGHT; ButtonPlayerType.AlignY = Alignment.MID; ButtonPlayerType.Parent = ButtonRace; ButtonPlayerType.LayerDepth = 0.3f; TextPlayerType = new TextWidget(wr); TextPlayerType.Height = bh1.Height; TextPlayerType.Text = "None"; TextPlayerType.Offset = new Point(0, 0); TextPlayerType.OffsetAlignX = Alignment.MID; TextPlayerType.OffsetAlignY = Alignment.MID; TextPlayerType.AlignX = Alignment.MID; TextPlayerType.AlignY = Alignment.MID; TextPlayerType.Parent = ButtonPlayerType; TextPlayerType.Color = cText; TextPlayerType.LayerDepth = 0f; ButtonScheme.Hook(); ButtonRace.Hook(); ButtonPlayerType.Hook(); ButtonScheme.OnButtonPress += ButtonScheme_OnButtonPress; ButtonRace.OnButtonPress += ButtonRace_OnButtonPress; ButtonPlayerType.OnButtonPress += ButtonPlayerType_OnButtonPress; }
public LEMenu(WidgetRenderer wr, UICLEMenu _uic) { uic = _uic; WidgetBase = new RectWidget(wr); WidgetBase.Color = UserConfig.MainScheme.WidgetBase; WidgetBase.Width = uic.TextInputBufferSize.X + uic.WidgetSpacing * 2; btns = new RectButton[5]; for (int i = 0; i < btns.Length; i++) { btns[i] = new RectButton(wr, i == 0 ? uic.TextInputBufferSize.X : (uic.TextInputBufferSize.X - uic.WidgetSpacing) / 2, uic.TextInputBufferSize.Y, UserConfig.MainScheme.WidgetInactive, UserConfig.MainScheme.WidgetActive ); } txts = new TextWidget[3]; for (int i = 0; i < txts.Length; i++) { txts[i] = new TextWidget(wr); txts[i].Height = uic.TextHeight; txts[i].Color = UserConfig.MainScheme.Text; txts[i].OffsetAlignX = Alignment.MID; txts[i].AlignX = Alignment.MID; if (i != 0) { txts[i].OffsetAlignY = Alignment.MID; txts[i].AlignY = Alignment.MID; } } txts[0].Text = "Map Name"; txts[1].Text = "Save"; txts[2].Text = "Load"; tInputs = new TextInputWidget[3]; for (int i = 0; i < tInputs.Length; i++) { tInputs[i] = new TextInputWidget(wr); tInputs[i].Height = uic.TextHeight; tInputs[i].Color = UserConfig.MainScheme.Text; tInputs[i].Caret.Width = 1; tInputs[i].Caret.Color = uic.CaretColor; tInputs[i].OffsetAlignX = Alignment.MID; tInputs[i].OffsetAlignY = Alignment.MID; tInputs[i].AlignX = Alignment.MID; tInputs[i].AlignY = Alignment.MID; } MapLocation = uic.DefaultMapLocText; MapWidth = uic.DefaultWidth; MapHeight = uic.DefaultHeight; txts[0].Parent = WidgetBase; txts[0].Offset = new Point(0, uic.WidgetSpacing); btns[0].OffsetAlignX = Alignment.MID; btns[0].OffsetAlignY = Alignment.BOTTOM; btns[0].Offset = new Point(0, uic.WidgetSpacing); btns[0].AlignX = Alignment.MID; btns[0].Parent = txts[0]; btns[1].OffsetAlignX = Alignment.LEFT; btns[1].OffsetAlignY = Alignment.BOTTOM; btns[1].Offset = new Point(0, uic.WidgetSpacing); btns[1].AlignX = Alignment.LEFT; btns[1].Parent = btns[0]; btns[2].OffsetAlignX = Alignment.RIGHT; btns[2].OffsetAlignY = Alignment.BOTTOM; btns[2].Offset = new Point(0, uic.WidgetSpacing); btns[2].AlignX = Alignment.RIGHT; btns[2].Parent = btns[0]; for (int i = 0; i < 3; i++) { tInputs[i].Parent = btns[i]; } for (int i = 0; i < 2; i++) { btns[i + 3].OffsetAlignY = Alignment.BOTTOM; btns[i + 3].Offset = new Point(0, uic.WidgetSpacing); btns[i + 3].Parent = btns[i + 1]; txts[i + 1].Parent = btns[i + 3]; } WidgetBase.Height = btns[4].Y + btns[4].Height + uic.WidgetSpacing; for (int i = 0; i < 3; i++) { btns[i].OnButtonPress += GetInputActivator(i); } }
public RTSUITeamDataPanel(WidgetRenderer wr) { rectBase = new RectWidget(wr); rectBase.Height = 60; rectPopPic = new RectWidget(wr); rectPopPic.Height = rectBase.Height - 4; rectPopPic.Width = rectPopPic.Height; rectPopPic.Offset = new Point(2, 2); rectPopPic.Parent = rectBase; rectCapital = new RectWidget(wr); rectCapital.Height = rectBase.Height / 2; rectCapital.OffsetAlignX = Alignment.RIGHT; rectCapital.AlignX = Alignment.RIGHT; rectCapital.Parent = rectBase; rectCapital.Color = Color.Transparent; textPopCur = new TextWidget(wr); textPopCur.Offset = new Point(5, 0); textPopCur.OffsetAlignX = Alignment.RIGHT; textPopCur.AlignY = Alignment.BOTTOM; textPopCur.OffsetAlignY = Alignment.MID; textPopCur.Height = rectBase.Height / 2; textPopCur.Parent = rectPopPic; textPopCap = new TextWidget(wr); textPopCap.Offset = new Point(5, 0); textPopCap.OffsetAlignX = Alignment.RIGHT; textPopCap.AlignY = Alignment.TOP; textPopCap.OffsetAlignY = Alignment.MID; textPopCap.Height = rectBase.Height / 2; textPopCap.Parent = rectPopPic; textCapital = new TextWidget(wr); textCapital.AlignX = Alignment.MID; textCapital.AlignY = Alignment.MID; textCapital.OffsetAlignX = Alignment.MID; textCapital.OffsetAlignY = Alignment.MID; textCapital.Height = (int)(rectCapital.Height * 0.9); textCapital.Parent = rectCapital; textVictory = new TextWidget(wr); textVictory.AlignX = Alignment.MID; textVictory.AlignY = Alignment.TOP; textVictory.OffsetAlignX = Alignment.MID; textVictory.OffsetAlignY = Alignment.BOTTOM; textVictory.Height = (int)(rectCapital.Height * 0.9); textVictory.Parent = rectCapital; Width = 400; ColorBase = UserConfig.MainScheme.WidgetBase; ColorPop = Color.White; ColorText = UserConfig.MainScheme.Text; VictoryText = "Victory Condition"; Capital = 0; Population = 0; PopulationCap = 0; }