private void RecreateControls()
        {
            Elements.Clear();
            var stats = m_sortedStats;

            if (stats.Count == 0)
            {
                return;
            }

            OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            if (Position == Vector2.Zero)
            {
                var position = new Vector2(0.025f, 0.016f);
                Position = MyGuiScreenHudBase.ConvertHudToNormalizedGuiPosition(ref position);
            }

            ColorMask = new Vector4(ColorMask.X, ColorMask.Y, ColorMask.Z, 0.75f);

            float heightMultiplier = 0.0f;

            foreach (var stat in stats)
            {
                heightMultiplier += stat.StatDefinition.GuiDef.HeightMultiplier;
            }

            var verticalPadding    = 0.005f;
            var statControlPadding = MyGuiConstants.TEXTURE_HUD_STATS_BG.PaddingSizeGui;
            var statControlHeight  = 0.025f - 2.0f * statControlPadding.Y;
            var statControlGap     = statControlHeight / 4.0f;

            Size = new Vector2(0.191f, 4.0f * verticalPadding + statControlHeight * heightMultiplier + (stats.Count - 1) * statControlGap);

            m_statControls = new Dictionary <MyStringHash, MyGuiControlStat>();

            var statControlWidth = Size.X - 2.0f * statControlPadding.X;
            var nextStatControlY = -Size.Y / 2.0f + verticalPadding;

            foreach (var stat in stats)
            {
                var statControl = new MyGuiControlStat(stat,
                                                       position: new Vector2(0.0f, nextStatControlY) + statControlPadding,
                                                       originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP,
                                                       size: new Vector2(statControlWidth, stat.StatDefinition.GuiDef.HeightMultiplier * statControlHeight));
                m_statControls.Add(stat.StatId, statControl);
                Elements.Add(statControl);
                statControl.RecreateControls();
                nextStatControlY += statControl.Size.Y + statControlGap;
            }
        }
        private void RecreateControls()
        {
			Elements.Clear();
			var stats = m_sortedStats;
			if (stats.Count == 0)
				return;

			OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
			var position = new Vector2(0.025f, 0.016f);
			Position = MyGuiScreenHudBase.ConvertHudToNormalizedGuiPosition(ref position);

			ColorMask = new Vector4(ColorMask.X, ColorMask.Y, ColorMask.Z, 0.75f);

			float heightMultiplier = 0.0f;
			foreach(var stat in stats)
			{
				heightMultiplier += stat.StatDefinition.GuiDef.HeightMultiplier;
			}

			var verticalPadding = 0.005f;
			var statControlPadding = MyGuiConstants.TEXTURE_HUD_STATS_BG.PaddingSizeGui;
			var statControlHeight = 0.025f - 2.0f*statControlPadding.Y;
			var statControlGap = statControlHeight/4.0f;
			Size = new Vector2(0.191f, 4.0f*verticalPadding + statControlHeight*heightMultiplier + (stats.Count-1)*statControlGap );
			
			m_statControls = new List<MyGuiControlStat>();

			var statControlWidth = Size.X - 2.0f*statControlPadding.X;
			var nextStatControlY = -Size.Y/2.0f + verticalPadding;

			foreach (var stat in stats)
			{
				var statControl = new MyGuiControlStat(	stat,
														position: new Vector2(0.0f, nextStatControlY) + statControlPadding,
														originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP,
														size: new Vector2(statControlWidth, stat.StatDefinition.GuiDef.HeightMultiplier * statControlHeight));
				m_statControls.Add(statControl);
				Elements.Add(statControl);
				statControl.RecreateControls();
				nextStatControlY += statControl.Size.Y + statControlGap;
			}
        }