Пример #1
0
        private void DrawPowerGroupInfo(MyHudConsumerGroupInfo info)
        {
            var   fsRect        = MyGuiManager.GetSafeFullscreenRectangle();
            float namesOffset   = -0.25f / (fsRect.Width / (float)fsRect.Height);
            var   posValuesBase = new Vector2(0.985f, 0.65f); // coordinates in SafeFullscreenRectangle, but DrawString works with SafeGuiRectangle.
            var   posNamesBase  = new Vector2(posValuesBase.X + namesOffset, posValuesBase.Y);
            var   posValues     = ConvertHudToNormalizedGuiPosition(ref posValuesBase);
            var   posNames      = ConvertHudToNormalizedGuiPosition(ref posNamesBase);

            info.Data.DrawBottomUp(posNames, posValues, m_textScale);
        }
Пример #2
0
 private void DrawPowerGroupInfo(MyHudConsumerGroupInfo info)
 {
     var fsRect = MyGuiManager.GetSafeFullscreenRectangle();
     float namesOffset = -0.25f / (fsRect.Width / (float)fsRect.Height);
     var posValuesBase = new Vector2(0.985f, 0.65f); // coordinates in SafeFullscreenRectangle, but DrawString works with SafeGuiRectangle.
     var posNamesBase = new Vector2(posValuesBase.X + namesOffset, posValuesBase.Y);
     var posValues = ConvertHudToNormalizedGuiPosition(ref posValuesBase);
     var posNames = ConvertHudToNormalizedGuiPosition(ref posNamesBase);
     info.Data.DrawBottomUp(posNames, posValues, m_textScale);
 }
Пример #3
0
        /// <summary>
        /// Computes number of groups that have enough energy to work.
        /// </summary>
        public void UpdateHud(MyHudConsumerGroupInfo info)
        {
            bool isWorking = true;
            int workingGroupCount = 0;
            int i = 0;
            for (; i < m_consumerDataByPriority.Length; ++i)
            {
                if (isWorking && m_consumerDataByPriority[i].AvailablePower < m_consumerDataByPriority[i].RequiredInput &&
                    !m_consumerDataByPriority[i].IsPowerAdaptible)
                    isWorking = false;

                if (isWorking)
                    ++workingGroupCount;

                info.SetGroupDeficit((MyConsumerGroupEnum)i, Math.Max(m_consumerDataByPriority[i].RequiredInput - m_consumerDataByPriority[i].AvailablePower, 0.0f));
            }

            info.WorkingGroupCount = workingGroupCount;
        }