public MyHudConsumerGroupInfo()
        {
            m_groupNames = new MyStringId[typeof(MyConsumerGroupEnum).GetEnumValues().Length];

            GroupCount            = m_groupNames.Length;
            m_missingPowerByGroup = new float[GroupCount];
            WorkingGroupCount     = GroupCount;

            m_data = new MyHudNameValueData(GroupCount+1, showBackgroundFog: true);

            Reload();
        }
        public MyHudConsumerGroupInfo()
        {
            m_groupNames = new MyStringId[typeof(MyConsumerGroupEnum).GetEnumValues().Length];

            GroupCount            = m_groupNames.Length;
            m_missingPowerByGroup = new float[GroupCount];
            WorkingGroupCount     = GroupCount;

            m_data = new MyHudNameValueData(GroupCount + 1, showBackgroundFog: true);

            Reload();
        }
Beispiel #3
0
        public void Reload()
        {
            if (m_groupNames == null && MyResourceDistributorComponent.SinkGroupPrioritiesTotal != -1)
            {
                m_groupNames = new MyStringId[MyResourceDistributorComponent.SinkGroupPrioritiesTotal];

                GroupCount            = m_groupNames.Length;
                m_missingPowerByGroup = new float[GroupCount];
                WorkingGroupCount     = GroupCount;

                m_data = new MyHudNameValueData(GroupCount + 1, showBackgroundFog: true);
            }

            if (m_groupNames == null)
            {
                return;
            }

            MyResourceDistributorComponent.InitializeMappings();
            var distributionGroups = MyDefinitionManager.Static.GetDefinitionsOfType <MyResourceDistributionGroupDefinition>();

            var sinkSubtypesToIndex = MyResourceDistributorComponent.SinkSubtypesToPriority;

            foreach (var distributionGroup in distributionGroups)
            {
                if (!distributionGroup.IsSource)
                {
                    int priorityIndex;
                    if (!sinkSubtypesToIndex.TryGetValue(distributionGroup.Id.SubtypeId, out priorityIndex))
                    {
                        Debug.Fail("Sink subtype " + distributionGroup.Id.SubtypeName + " not found!");
                        continue;
                    }
                    m_groupNames[priorityIndex] = MyStringId.GetOrCompute(distributionGroup.Id.SubtypeName);
                }
            }

            /*      m_groupNames[(int)MyResourceSinkGroupEnum.Charging]     = MySpaceTexts.HudEnergyGroupCharging;
             * m_groupNames[(int)MyResourceSinkGroupEnum.Conveyors]    = MySpaceTexts.HudEnergyGroupConveyors;
             * m_groupNames[(int)MyResourceSinkGroupEnum.Defense]      = MySpaceTexts.HudEnergyGroupDefense;
             * m_groupNames[(int)MyResourceSinkGroupEnum.Doors]        = MySpaceTexts.HudEnergyGroupDoors;
             * m_groupNames[(int)MyResourceSinkGroupEnum.Factory]      = MySpaceTexts.HudEnergyGroupFactory;
             * m_groupNames[(int)MyResourceSinkGroupEnum.Gyro]         = MySpaceTexts.HudEnergyGroupGyroscope;
             * m_groupNames[(int)MyResourceSinkGroupEnum.Thrust]       = MySpaceTexts.HudEnergyGroupThrust;
             * m_groupNames[(int)MyResourceSinkGroupEnum.Utility]      = MySpaceTexts.HudEnergyGroupUtility;
             * m_groupNames[(int)MyResourceSinkGroupEnum.BatteryBlock] = MySpaceTexts.HudEnergyGroupBatteries;*/
            Data[GroupCount].NameFont  = MyFontEnum.Red;
            Data[GroupCount].ValueFont = MyFontEnum.Red;
        }
	    public void Reload()
	    {
		    if (m_groupNames == null && MyResourceDistributorComponent.SinkGroupPrioritiesTotal != -1)
		    {
				m_groupNames = new MyStringId[MyResourceDistributorComponent.SinkGroupPrioritiesTotal];

			    GroupCount = m_groupNames.Length;
			    m_missingPowerByGroup = new float[GroupCount];
			    WorkingGroupCount = GroupCount;

			    m_data = new MyHudNameValueData(GroupCount + 1, showBackgroundFog: true);
		    }

		    if (m_groupNames == null)
			    return;

            MyResourceDistributorComponent.InitializeMappings();
		    var distributionGroups = MyDefinitionManager.Static.GetDefinitionsOfType<MyResourceDistributionGroupDefinition>();

			var sinkSubtypesToIndex = MyResourceDistributorComponent.SinkSubtypesToPriority;
		    foreach (var distributionGroup in distributionGroups)
		    {
                if (!distributionGroup.IsSource)
                {
                    int priorityIndex;
                    if(!sinkSubtypesToIndex.TryGetValue(distributionGroup.Id.SubtypeId, out priorityIndex))
                    {
                        Debug.Fail("Sink subtype " + distributionGroup.Id.SubtypeName + " not found!");
                        continue;
                    }
                    m_groupNames[priorityIndex] = MyStringId.GetOrCompute(distributionGroup.Id.SubtypeName);
                }
		    }

		    /*      m_groupNames[(int)MyResourceSinkGroupEnum.Charging]     = MySpaceTexts.HudEnergyGroupCharging;
            m_groupNames[(int)MyResourceSinkGroupEnum.Conveyors]    = MySpaceTexts.HudEnergyGroupConveyors;
            m_groupNames[(int)MyResourceSinkGroupEnum.Defense]      = MySpaceTexts.HudEnergyGroupDefense;
            m_groupNames[(int)MyResourceSinkGroupEnum.Doors]        = MySpaceTexts.HudEnergyGroupDoors;
            m_groupNames[(int)MyResourceSinkGroupEnum.Factory]      = MySpaceTexts.HudEnergyGroupFactory;
            m_groupNames[(int)MyResourceSinkGroupEnum.Gyro]         = MySpaceTexts.HudEnergyGroupGyroscope;
            m_groupNames[(int)MyResourceSinkGroupEnum.Thrust]       = MySpaceTexts.HudEnergyGroupThrust;
            m_groupNames[(int)MyResourceSinkGroupEnum.Utility]      = MySpaceTexts.HudEnergyGroupUtility;
            m_groupNames[(int)MyResourceSinkGroupEnum.BatteryBlock] = MySpaceTexts.HudEnergyGroupBatteries;*/
		    Data[GroupCount].NameFont = MyFontEnum.Red;
		    Data[GroupCount].ValueFont = MyFontEnum.Red;
	    }
 public MyHudCharacterInfo()
 {
     m_data = new MyHudNameValueData(typeof(LineEnum).GetEnumValues().Length);
     Reload();
 }
 public MyHudScenarioInfo()
 {
     m_data = new MyHudNameValueData(typeof(LineEnum).GetEnumValues().Length);
     Reload();
 }