コード例 #1
0
		public MyGuiControlBlockInfo(MyControlBlockInfoStyle style, bool progressMode = true, bool largeBlockInfo = true)
			: base(backgroundTexture: new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_LARGE_DEFAULT.Texture))
		{
			m_style = style;
			m_progressMode = progressMode;

			m_leftColumnBackground = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
			m_leftColumnBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
			Elements.Add(m_leftColumnBackground);

			m_titleBackground = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
			m_titleBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
			Elements.Add(m_titleBackground);

			if (m_progressMode)
			{
				m_integrityBackground = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
				m_integrityBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
				Elements.Add(m_integrityBackground);

				m_integrityForeground = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
				m_integrityForeground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
				Elements.Add(m_integrityForeground);

				m_integrityCriticalLine = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
				m_integrityCriticalLine.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
				Elements.Add(m_integrityCriticalLine);
			}

            //m_blockIconPanelBackground = new MyGuiControlPanel();
            //m_blockIconPanelBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            //m_blockIconPanelBackground.BackgroundTexture = new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT.Texture);
            //m_blockIconPanelBackground.Size = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
            //m_blockIconPanelBackground.Size *= new Vector2(0.75f, 1);
            //Elements.Add(m_blockIconPanelBackground);

            //m_blockIconPanel = new MyGuiControlPanel();
            //m_blockIconPanel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            //m_blockIconPanel.Size = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
            //m_blockIconPanel.Size *= new Vector2(0.75f, 1);
            //Elements.Add(m_blockIconPanel);

            m_blockIconImage = new MyGuiControlImage();
            m_blockIconImage.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_blockIconImage.BackgroundTexture = new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT.Texture);
            m_blockIconImage.Size = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
            m_blockIconImage.Size *= new Vector2(0.75f, 1);
            Elements.Add(m_blockIconImage);

			m_blockTypePanelBackground = new MyGuiControlPanel();
			m_blockTypePanelBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
			m_blockTypePanelBackground.BackgroundTexture = new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT.Texture);
			m_blockTypePanelBackground.Size = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
			m_blockTypePanelBackground.Size *= new Vector2(0.75f, 1);
			Elements.Add(m_blockTypePanelBackground);

			m_blockTypePanel = new MyGuiControlPanel();
			m_blockTypePanel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
			m_blockTypePanel.Size = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
			m_blockTypePanel.Size *= new Vector2(0.75f, 1);
			m_blockTypePanel.BackgroundTexture = new MyGuiCompositeTexture(largeBlockInfo ? @"Textures\GUI\Icons\Cubes\LargeBlock.dds" : @"Textures\GUI\Icons\Cubes\SmallBlock.dds");
			Elements.Add(m_blockTypePanel);

			m_blockNameLabel = new MyGuiControlLabel(text: String.Empty);
			m_blockNameLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
			m_blockNameLabel.TextScale = 1 * baseScale;
			m_blockNameLabel.Font = m_style.BlockNameLabelFont;
			m_blockNameLabel.AutoEllipsis = true;
			Elements.Add(m_blockNameLabel);

			String blockTypeLabelText = String.Empty;
			if (style.EnableBlockTypeLabel)
				blockTypeLabelText = MyTexts.GetString(largeBlockInfo ? MySpaceTexts.HudBlockInfo_LargeShip_Station : MySpaceTexts.HudBlockInfo_SmallShip);
			m_blockTypeLabel = new MyGuiControlLabel(text: blockTypeLabelText);
			m_blockTypeLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
			m_blockTypeLabel.TextScale = 1 * baseScale;
			m_blockTypeLabel.Font = MyFontEnum.White;
			Elements.Add(m_blockTypeLabel);

			m_componentsLabel = new MyGuiControlLabel(text: MyTexts.GetString(m_style.ComponentsLabelText));
			m_componentsLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
			m_componentsLabel.TextScale = m_smallerFontSize * baseScale;
			m_componentsLabel.Font = m_style.ComponentsLabelFont;
			Elements.Add(m_componentsLabel);

			m_installedRequiredLabel = new MyGuiControlLabel(text: MyTexts.GetString(m_style.InstalledRequiredLabelText));
			m_installedRequiredLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
			m_installedRequiredLabel.TextScale = m_smallerFontSize * baseScale;
			m_installedRequiredLabel.Font = m_style.InstalledRequiredLabelFont;
			Elements.Add(m_installedRequiredLabel);

            m_blockBuiltByLabel = new MyGuiControlLabel(text: String.Empty);
            m_blockBuiltByLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
            m_blockBuiltByLabel.TextScale = m_smallerFontSize * baseScale;
            m_blockBuiltByLabel.Font = m_style.InstalledRequiredLabelFont;
            Elements.Add(m_blockBuiltByLabel);

			if (m_progressMode)
			{
				m_integrityLabel = new MyGuiControlLabel(text: String.Empty);
				m_integrityLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM;
				m_integrityLabel.Font = m_style.IntegrityLabelFont;
				m_integrityLabel.TextScale = 0.75f * baseScale;
				Elements.Add(m_integrityLabel);
			}

			m_separator = new MyGuiControlSeparatorList();
			Elements.Add(m_separator);

			EnsureLineControls(m_componentLines.Capacity);
			Size = m_progressMode ? new Vector2(0.325f, 0.4f) : new Vector2(0.22f, 0.4f);
		}
コード例 #2
0
        public MyGuiControlBlockInfo(MyControlBlockInfoStyle style, bool progressMode = true, bool largeBlockInfo = true)
            : base(backgroundTexture: new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_LARGE_DEFAULT.Texture))
        {
            m_style        = style;
            m_progressMode = progressMode;

            m_leftColumnBackground             = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
            m_leftColumnBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            Elements.Add(m_leftColumnBackground);

            m_titleBackground             = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
            m_titleBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            Elements.Add(m_titleBackground);

            if (m_progressMode)
            {
                m_integrityBackground             = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
                m_integrityBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
                Elements.Add(m_integrityBackground);

                m_integrityForeground             = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
                m_integrityForeground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
                Elements.Add(m_integrityForeground);

                m_integrityCriticalLine             = new MyGuiControlPanel(backgroundColor: Color.Red.ToVector4());
                m_integrityCriticalLine.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
                Elements.Add(m_integrityCriticalLine);
            }

            m_blockIconPanelBackground                   = new MyGuiControlPanel();
            m_blockIconPanelBackground.OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_blockIconPanelBackground.BackgroundTexture = new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT.Texture);
            m_blockIconPanelBackground.Size              = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
            m_blockIconPanelBackground.Size             *= new Vector2(0.75f, 1);
            Elements.Add(m_blockIconPanelBackground);

            m_blockIconPanel             = new MyGuiControlPanel();
            m_blockIconPanel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_blockIconPanel.Size        = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
            m_blockIconPanel.Size       *= new Vector2(0.75f, 1);
            Elements.Add(m_blockIconPanel);

            m_blockTypePanelBackground                   = new MyGuiControlPanel();
            m_blockTypePanelBackground.OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
            m_blockTypePanelBackground.BackgroundTexture = new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT.Texture);
            m_blockTypePanelBackground.Size              = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
            m_blockTypePanelBackground.Size             *= new Vector2(0.75f, 1);
            Elements.Add(m_blockTypePanelBackground);

            m_blockTypePanel                   = new MyGuiControlPanel();
            m_blockTypePanel.OriginAlign       = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
            m_blockTypePanel.Size              = m_progressMode ? new Vector2(0.088f) : new Vector2(0.04f);
            m_blockTypePanel.Size             *= new Vector2(0.75f, 1);
            m_blockTypePanel.BackgroundTexture = new MyGuiCompositeTexture(largeBlockInfo ? @"Textures\GUI\Icons\Cubes\LargeBlock.dds" : @"Textures\GUI\Icons\Cubes\SmallBlock.dds");
            Elements.Add(m_blockTypePanel);

            m_blockNameLabel              = new MyGuiControlLabel(text: String.Empty);
            m_blockNameLabel.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_blockNameLabel.TextScale    = 1 * baseScale;
            m_blockNameLabel.Font         = m_style.BlockNameLabelFont;
            m_blockNameLabel.AutoEllipsis = true;
            Elements.Add(m_blockNameLabel);

            String blockTypeLabelText = String.Empty;

            if (style.EnableBlockTypeLabel)
            {
                blockTypeLabelText = MyTexts.GetString(largeBlockInfo ? MySpaceTexts.HudBlockInfo_LargeShip_Station : MySpaceTexts.HudBlockInfo_SmallShip);
            }
            m_blockTypeLabel             = new MyGuiControlLabel(text: blockTypeLabelText);
            m_blockTypeLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_blockTypeLabel.TextScale   = 1 * baseScale;
            m_blockTypeLabel.Font        = MyFontEnum.White;
            Elements.Add(m_blockTypeLabel);

            m_componentsLabel             = new MyGuiControlLabel(text: MyTexts.GetString(m_style.ComponentsLabelText));
            m_componentsLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_componentsLabel.TextScale   = m_smallerFontSize * baseScale;
            m_componentsLabel.Font        = m_style.ComponentsLabelFont;
            Elements.Add(m_componentsLabel);

            m_installedRequiredLabel             = new MyGuiControlLabel(text: MyTexts.GetString(m_style.InstalledRequiredLabelText));
            m_installedRequiredLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
            m_installedRequiredLabel.TextScale   = m_smallerFontSize * baseScale;
            m_installedRequiredLabel.Font        = m_style.InstalledRequiredLabelFont;
            Elements.Add(m_installedRequiredLabel);

            if (m_progressMode)
            {
                m_integrityLabel             = new MyGuiControlLabel(text: String.Empty);
                m_integrityLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM;
                m_integrityLabel.Font        = m_style.IntegrityLabelFont;
                m_integrityLabel.TextScale   = 0.75f * baseScale;
                Elements.Add(m_integrityLabel);
            }

            m_separator = new MyGuiControlSeparatorList();
            Elements.Add(m_separator);

            EnsureLineControls(m_componentLines.Capacity);
            Size = m_progressMode ? new Vector2(0.325f, 0.4f) : new Vector2(0.22f, 0.4f);
        }