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);
        }
示例#2
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);
        }