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 ScrollMenu(WidgetRenderer wr, int w, int h, int bCount, int sbw, int sbh) { Widget = new RectWidget(wr); Widget.Width = w; Widget.Height = h * bCount; scrollBar = new ScrollBar(wr); scrollBar.IsVertical = true; scrollBar.Width = sbw; scrollBar.ScrollButton.InactiveWidth = scrollBar.Width; scrollBar.ScrollButton.InactiveHeight = sbh; scrollBar.ScrollButton.ActiveWidth = scrollBar.Width; scrollBar.ScrollButton.ActiveHeight = sbh; scrollBar.Height = Widget.Height; scrollBar.OffsetAlignX = Alignment.RIGHT; scrollBar.Parent = Widget; scrollBar.ScrollRatio = 0; buttons = new RectButton[bCount]; buttonsText = new TextWidget[buttons.Length]; for(int i = 0; i < buttons.Length; i++) { buttons[i] = new RectButton(wr, Widget.Width, h, Color.Black, Color.White); if(i > 0) { buttons[i].Parent = buttons[i - 1]; buttons[i].OffsetAlignY = Alignment.BOTTOM; buttons[i].LayerOffset = 0f; } else { buttons[i].Parent = Widget; } buttonsText[i] = new TextWidget(wr); buttonsText[i].Height = (int)(TEXT_H_RATIO * buttons[i].Height); buttonsText[i].Text = ""; buttonsText[i].Offset = new Point(TEXT_X_OFF, 0); buttonsText[i].AlignX = Alignment.LEFT; buttonsText[i].AlignY = Alignment.MID; buttonsText[i].OffsetAlignX = Alignment.LEFT; buttonsText[i].OffsetAlignY = Alignment.MID; buttonsText[i].Parent = buttons[i]; } BaseColor = Color.Black; HighlightColor = Color.DarkSlateGray; TextColor = Color.White; ScrollBarBaseColor = Color.Red; }
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 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; }
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 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 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; }