Exemple #1
0
 public void Build(RTSRenderer renderer, string rootPath, string model, string[] tex)
 {
     using (var sModel = File.OpenRead(Path.Combine(rootPath, model))) {
         View = new RTSBuildingModel(renderer, sModel);
     }
     View.ModelTexture     = renderer.LoadTexture2D(Path.Combine(rootPath, tex[0]));
     View.ColorCodeTexture = renderer.LoadTexture2D(Path.Combine(rootPath, tex[1]));
 }
 public void Build(RTSRenderer renderer, string rootPath, string model, string[] tex)
 {
     using (var sModel = File.OpenRead(Path.Combine(rootPath, model))) {
         Texture2D tAnim = AnimationFromBitmap(renderer, Path.Combine(rootPath, tex[0]));
         View = new RTSUnitModel(renderer, sModel, tAnim);
     }
     View.ModelTexture     = renderer.LoadTexture2D(Path.Combine(rootPath, tex[1]));
     View.ColorCodeTexture = renderer.LoadTexture2D(Path.Combine(rootPath, tex[2]));
 }
Exemple #3
0
        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);
        }
Exemple #4
0
        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;
            };
        }
Exemple #5
0
 private void BuildBBPanel(RTSRenderer renderer)
 {
     BBPanel = new RTSUIBuildingButtonPanel(wrMain, uic.BBRows, uic.BBColumns, uic.BBIconSize, uic.BBIconBuffer);
     BBPanel.BackPanel.Texture      = renderer.LoadTexture2D(uic.BBTexture);
     BBPanel.BackPanel.Parent       = rectBounds;
     BBPanel.BackPanel.AlignY       = Alignment.BOTTOM;
     BBPanel.BackPanel.OffsetAlignY = Alignment.BOTTOM;
     BBPanel.BackPanel.Offset       = new Point(0, 0);
     BBPanel.IconLibrary            = renderer.IconLibrary;
     BBPanel.BackPanel.Color        = UserConfig.MainScheme.WidgetBase;
 }
Exemple #6
0
 private void BuildSelectionPanel(RTSRenderer renderer)
 {
     SelectionPanel = new RTSUISelectionPanel(wrMain, uic.SelectionRows, uic.SelectionColumns, uic.SelectionIconSize, uic.SelectionIconBuffer);
     SelectionPanel.BackPanel.Texture      = renderer.LoadTexture2D(uic.SelectionTexture);
     SelectionPanel.IconLibrary            = renderer.IconLibrary;
     SelectionPanel.BackPanel.AlignX       = Alignment.LEFT;
     SelectionPanel.BackPanel.AlignY       = Alignment.BOTTOM;
     SelectionPanel.BackPanel.OffsetAlignX = Alignment.RIGHT;
     SelectionPanel.BackPanel.OffsetAlignY = Alignment.BOTTOM;
     SelectionPanel.BackPanel.Color        = UserConfig.MainScheme.WidgetBase;
     SelectionPanel.BackPanel.Offset       = new Point(0, 0);
     SelectionPanel.BackPanel.Parent       = BBPanel.BackPanel;
 }
        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;
        }