private void BuildMinimap(RTSRenderer renderer, UICMinimap uic) { Minimap = new RTSUIMinimap(renderer, wrMain, renderer.Minimap.Terrain, null, uic); Minimap.WidgetBase.AlignX = Alignment.RIGHT; Minimap.WidgetBase.AlignY = Alignment.BOTTOM; Minimap.WidgetBase.OffsetAlignX = Alignment.RIGHT; Minimap.WidgetBase.OffsetAlignY = Alignment.BOTTOM; Minimap.WidgetBase.Parent = rectBounds; }
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; }; }