示例#1
0
        public void InitControls()
        {
            AddActivatedCheckbox(new Vector2(-0.07f, -0.1f), CargoBox.Activated);

            AddIdTextBox(new Vector2(-0.16f, -0.15f), CargoBox.EntityId.Value.NumericValue);

            m_cargoBoxTypeCombobox = new MyGuiControlCombobox(
                this,
                new Vector2(0, -0.2f),
                MyGuiControlPreDefinedSize.LONGMEDIUM,
                MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                MyGuiConstants.COMBOBOX_TEXT_SCALE,
                6,
                false,
                false,
                false);

            foreach (MyMwcObjectBuilder_CargoBox_TypesEnum cargoBoxType in Enum.GetValues(typeof(MyMwcObjectBuilder_CargoBox_TypesEnum)))
            {
                var cargoBoxHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(
                    MyMwcObjectBuilderTypeEnum.CargoBox, (int)cargoBoxType);
                m_cargoBoxTypeCombobox.AddItem((int)cargoBoxType, MyGuiManager.GetBlankTexture(), cargoBoxHelper.Description);
            }
            m_cargoBoxTypeCombobox.SortItemsByValueText();

            m_cargoBoxTypeCombobox.SelectItemByKey((int)CargoBox.CargoBoxType);

            Controls.Add(m_cargoBoxTypeCombobox);
        }
        void DoChanges()
        {
            MyTextsWrapper.ActualLanguage     = (MyLanguagesEnum)m_languageCombobox.GetSelectedKey();
            MyDialoguesWrapper.ActualLanguage = (MyLanguagesEnum)m_languageCombobox.GetSelectedKey();
            MyMissions.ReloadTexts();
            MyGuiObjectBuilderHelpers.ReloadTexts();
            MyGuiManager.RecreateControls();
            MyHudNotification.ReloadTexts();
            foreach (var entity in MinerWars.AppCode.Game.Entities.MyEntities.GetEntities())
            {
                entity.UpdateHudMarker(true);
                var cont = entity as MinerWars.AppCode.Game.Entities.MyPrefabContainer;
                if (cont != null)
                {
                    foreach (var prefab in cont.GetPrefabs())
                    {
                        prefab.UpdateHudMarker(true);
                    }
                }
            }

            MySubtitles.Enabled    = m_subtitlesCheckbox.Checked;
            MyConfig.Notifications = m_notificationsCheckbox.Checked;
            MyConfig.Save();
        }
示例#3
0
        private void DrawTexts()
        {
            m_oreName.Clear();
            m_oreCount.Clear();
            foreach (MyMwcObjectBuilder_Ore_TypesEnum key in Enum.GetValues(typeof(MyMwcObjectBuilder_Ore_TypesEnum)))
            {
                int val = (int)MySession.PlayerShip.Inventory.GetTotalAmountOfInventoryItems(MyMwcObjectBuilderTypeEnum.Ore, (int)key);
                if (val > 0)
                {
                    m_oreName.Append(MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.Ore, (int)key).Description);
                    m_oreName.Append(ORE_TEXT_SEPARATOR);
                    m_oreName.AppendLine();

                    m_oreCount.Append(val);
                    m_oreCount.AppendLine();
                }
            }

            MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsWhite(), m_oreName,
                                    MyGuiManager.GetScreenTextRightTopPosition() - ORE_INFORMATION_RIGHT_OFFSET, MyGuiConstants.LABEL_TEXT_SCALE,
                                    MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);

            MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsWhite(), m_oreCount,
                                    MyGuiManager.GetScreenTextRightTopPosition(), MyGuiConstants.LABEL_TEXT_SCALE,
                                    MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
        }
示例#4
0
        protected override void AddPrefabItems(MyTreeViewItem parentItem, MyMwcObjectBuilder_Prefab_AppearanceEnum appearanceTextureEnum, BuildTypesEnum buildType, CategoryTypesEnum categoryType)
        {
            MyMwcLog.WriteLine("GAME AddPrefabItems - START");

            Vector2 itemSize = MyGuiConstants.CHECKBOX_SIZE * 3;

            foreach (MyMwcObjectBuilderTypeEnum enumValue in MyGuiPrefabHelpers.MyMwcPrefabTypesEnumValues)
            {
                foreach (int prefabId in MyMwcObjectBuilder_Base.GetObjectBuilderIDs(enumValue))
                {
                    MyPrefabConfiguration config             = MyPrefabConstants.GetPrefabConfiguration(enumValue, prefabId);
                    MyGuiPrefabHelper     prefabModuleHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(enumValue, prefabId) as MyGuiPrefabHelper;

                    if (config == null)
                    {
                        continue;
                    }

                    if (config.FactionSpecific.HasValue && config.FactionSpecific.Value != appearanceTextureEnum)
                    {
                        continue;
                    }

                    if (config.BuildType == buildType && config.CategoryType == categoryType && config.EnabledInEditor)
                    {
                        MyMwcObjectBuilder_PrefabBase prefabObjectBuilder   = MyPrefabFactory.GetInstance().CreatePrefabObjectBuilder(enumValue, prefabId, appearanceTextureEnum);
                        MyBuildingSpecification       buildingSpecification = MyBuildingSpecifications.GetBuildingSpecification(prefabObjectBuilder);
                        MyTexture2D previewTexture = MyGuiManager.GetPrefabPreviewTexture(enumValue, prefabId, appearanceTextureEnum);
                        AddTreeViewItem(parentItem, prefabModuleHelper.Description, previewTexture, itemSize, MyGuiManager.GetBlankTexture(), MyGuiManager.GetBlankTexture(), MyGuiConstants.CHECKBOX_SIZE, prefabObjectBuilder, buildingSpecification);
                    }
                }
            }

            MyMwcLog.WriteLine("GAME AddPrefabItems - END");
        }
示例#5
0
        private void OnGenerateListOfAssets(MyGuiControlButton sender)
        {
            string trimPath = @"Models2\";
            foreach (MyMwcObjectBuilderTypeEnum enumValue in MyGuiPrefabHelpers.MyMwcPrefabTypesEnumValues)
            {
                foreach (int prefabId in MyMwcObjectBuilder_Base.GetObjectBuilderIDs(enumValue))
                {
                    MyGuiPrefabHelper prefabModuleHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(enumValue, prefabId) as MyGuiPrefabHelper;
                    MyPrefabConfiguration config = MyPrefabConstants.GetPrefabConfiguration(enumValue, prefabId);
                    string assetName = MyModels.GetModelAssetName(config.ModelLod0Enum);
                    int trimIndex = assetName.IndexOf(trimPath);
                    if (trimIndex >= 0)
                    {
                        assetName = assetName.Substring(trimIndex + trimPath.Length);
                    }

                    MyMwcLog.WriteLine(string.Format("{0};{1}", prefabModuleHelper.Description, assetName));
                }
            }

            foreach (MyMwcObjectBuilder_SmallShip_TypesEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_TypesEnumValues)
            {
                MyGuiSmallShipHelperSmallShip smallShipHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip, (int)enumValue) as MyGuiSmallShipHelperSmallShip;
                var properties = MyShipTypeConstants.GetShipTypeProperties(enumValue);
                string assetName = MyModels.GetModelAssetName(properties.Visual.ModelLod0Enum);
                int trimIndex = assetName.IndexOf(trimPath);
                if (trimIndex >= 0)
                {
                    assetName = assetName.Substring(trimIndex + trimPath.Length);
                }

                MyMwcLog.WriteLine(string.Format("{0};{1}", smallShipHelper.Description, assetName));
            }
        }
        private StringBuilder GetTemplatePrefix(MyMwcObjectBuilder_SmallShip_TypesEnum shipType)
        {
            StringBuilder prefix = new StringBuilder();

            MyMwcUtils.AppendStringBuilder(prefix, ((MyGuiSmallShipHelperSmallShip)MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip, (int)shipType)).Name);
            prefix.Append(" - ");
            return(prefix);
        }
示例#7
0
 /// <summary>
 /// Returns description of bulding requirement
 /// </summary>
 /// <returns></returns>
 public StringBuilder GetDescription()
 {
     m_description.Clear();
     m_description.Append(Amount);
     MyMwcUtils.AppendStringBuilder(m_description, m_amountAndDescriptionSeparator);
     MyMwcUtils.AppendStringBuilder(m_description, MyGuiObjectBuilderHelpers.GetGuiHelper(ObjectBuilderType, ObjectBuilderId).Description);
     return(m_description);
 }
示例#8
0
        private void AddSmallShipWeaponsItems(MyTreeViewItem parentItem)
        {
            Vector2 itemSize = MyGuiManager.GetNormalizedSizeFromScreenSize(new Vector2(64, 64));

            foreach (MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_Weapon_TypesEnumValues)
            {
                MyMwcObjectBuilder_SmallShip_Weapon weaponObjectBuilder   = new MyMwcObjectBuilder_SmallShip_Weapon(enumValue);
                MyBuildingSpecification             buildingSpecification = MyBuildingSpecifications.GetBuildingSpecification(weaponObjectBuilder);
                MyGuiSmallShipHelperWeapon          smallShipWeaponHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip_Weapon, (int)enumValue) as MyGuiSmallShipHelperWeapon;
                AddTreeViewItem(parentItem, smallShipWeaponHelper.Description, smallShipWeaponHelper.Icon, itemSize, MyGuiManager.GetBlankTexture(), MyGuiManager.GetBlankTexture(), MyGuiConstants.CHECKBOX_SIZE, weaponObjectBuilder, buildingSpecification);
            }
        }
        private void AddBot(MyMwcObjectBuilder_SmallShip bldr)
        {
            BotTemplate newTemplate = new BotTemplate();
            MyMwcObjectBuilder_SmallShip_Bot botBuilder = bldr as MyMwcObjectBuilder_SmallShip_Bot;

            System.Diagnostics.Debug.Assert(botBuilder != null);

            newTemplate.m_builder = new MyMwcObjectBuilder_SmallShip_Bot(
                bldr.ShipType,
                bldr.Inventory,
                bldr.Weapons,
                bldr.Engine,
                bldr.AssignmentOfAmmo,
                bldr.Armor,
                bldr.Radar,
                bldr.ShipMaxHealth,
                bldr.ShipHealthRatio,
                bldr.ArmorHealth,
                bldr.Oxygen,
                bldr.Fuel,
                bldr.ReflectorLight,
                bldr.ReflectorLongRange,
                bldr.Faction,
                botBuilder != null ? botBuilder.AITemplate : MyAITemplateEnum.DEFAULT,
                botBuilder != null ? botBuilder.Aggressivity : 0,
                botBuilder != null ? botBuilder.SeeDistance : 1000,
                botBuilder != null ? botBuilder.SleepDistance : 1000,
                MyPatrolMode.CYCLE,
                null,
                BotBehaviorType.IDLE,
                MyLightsConstants.MAX_SPOTLIGHT_SHADOW_RANGE, 0, false, true); // faction will be assigned after spawnpoint genertation
            MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip, (int)bldr.ShipType);
            //m_comboItems.AddItem(i, MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip, bldr.ShipType);

            //  MyMwcObjectBuilderTypeEnum.SmallShip, (int)m_inventory.SmallShips[i]).Description);

            newTemplate.m_name = ((MyGuiSmallShipHelperSmallShip)MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip, (int)bldr.ShipType)).Name.ToString();//bldr.ShipType.ToString();

            // find nearest new non template index
            int index = -1;

            foreach (int key in m_bots.Keys)
            {
                if (index < key && key < TEMPLATE_INDEX_OFFSET)
                {
                    index = key;
                }
            }
            index++;

            AddBot(index, newTemplate);
        }
        private void OnEditBot(MyMwcObjectBuilder_SmallShip bldr)
        {
            BotTemplate newTemplate = new BotTemplate();
            MyMwcObjectBuilder_SmallShip_Bot botBuilder = bldr as MyMwcObjectBuilder_SmallShip_Bot;

            System.Diagnostics.Debug.Assert(botBuilder != null);

            newTemplate.m_builder = new MyMwcObjectBuilder_SmallShip_Bot(
                bldr.ShipType,
                bldr.Inventory,
                bldr.Weapons,
                bldr.Engine,
                bldr.AssignmentOfAmmo,
                bldr.Armor,
                bldr.Radar,
                bldr.ShipMaxHealth,
                bldr.ShipHealthRatio,
                bldr.ArmorHealth,
                bldr.Oxygen,
                bldr.Fuel,
                bldr.ReflectorLight,
                bldr.ReflectorLongRange,
                bldr.Faction,
                botBuilder != null ? botBuilder.AITemplate : MyAITemplateEnum.DEFAULT,
                botBuilder != null ? botBuilder.Aggressivity : 0,
                botBuilder != null ? botBuilder.SeeDistance : 1000,
                botBuilder != null ? botBuilder.SleepDistance : 1000,
                MyPatrolMode.CYCLE,
                null,
                BotBehaviorType.IDLE,
                MyLightsConstants.MAX_SPOTLIGHT_SHADOW_RANGE, bldr.AIPriority, false, true); // faction will be assigned after spawnpoint genertation
            newTemplate.m_name = bldr.ShipType.ToString();
            int key = m_selectShipsListbox.GetSelectedItem().Key;

            m_selectShipsListbox.RemoveItem(key);

            var itemName = MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip, (int)newTemplate.m_builder.ShipType).Description;

            m_selectShipsListbox.AddItem(key, itemName);

            m_bots[key] = newTemplate;
        }
示例#11
0
        private void InitCombobox()
        {
            m_shipTypeCombobox = new MyGuiControlCombobox(
                this,
                new Vector2(0, -0.3f),
                MyGuiControlPreDefinedSize.MEDIUM,
                MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                MyGuiConstants.COMBOBOX_TEXT_SCALE);

            foreach (MyMwcObjectBuilder_SmallShip_TypesEnum shipType in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_TypesEnumValues)
            {
                int shipTypeNumber = (int)shipType;
                var helper         = MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip, shipTypeNumber);
                m_shipTypeCombobox.AddItem(shipTypeNumber, helper.Name);
            }

            m_shipTypeCombobox.SelectItemByIndex(0);

            m_shipTypeCombobox.OnSelect += Combobox_OnSelect;

            Controls.Add(m_shipTypeCombobox);
        }
示例#12
0
        public static MyInventoryItem CreateInventoryItemFromObjectBuilder(MyMwcObjectBuilder_Base objectBuilder, float amount)
        {
            float maxAmount   = MyGameplayConstants.GetGameplayProperties(objectBuilder, MyMwcObjectBuilder_FactionEnum.Euroamerican).MaxAmount;
            float amountToAdd = Math.Min(maxAmount, amount);

            int objectBuilderId = objectBuilder.GetObjectBuilderId().HasValue ? objectBuilder.GetObjectBuilderId().Value : 0;

            MyGuiHelperBase guiHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(objectBuilder.GetObjectBuilderType(), objectBuilderId);

            MyCommonDebugUtils.AssertDebug(guiHelper != null);

            //warning: use default faction for get gameplay properties for inventory item
            MyGameplayProperties inventoryItemProperties = MyGameplayConstants.GetGameplayProperties(objectBuilder.GetObjectBuilderType(), objectBuilderId, MyMwcObjectBuilder_FactionEnum.Euroamerican);

            MyCommonDebugUtils.AssertDebug(inventoryItemProperties != null);



            MyInventoryItem item = MyInventory.InventoryItemsPool.Allocate();

            item.Start(guiHelper, inventoryItemProperties, objectBuilder, amountToAdd);
            return(item);
        }
示例#13
0
        public override bool HandleInput(MyGuiInput input, bool hasKeyboardActiveControl, bool hasKeyboardActiveControlPrevious, bool receivedFocusInThisUpdate)
        {
            //If this control is not enable, do nothing
            if (!IsEnabled)
            {
                return(false);
            }

            bool isKeyPress = false;
            bool backwardSelectDirection = input.IsKeyPress(Keys.LeftShift) || input.IsKeyPress(Keys.RightShift);
            int  deltaWheelPos           = input.PreviousMouseScrollWheelValue() - input.MouseScrollWheelValue();

            if (deltaWheelPos != 0) // determine just direction
            {
                deltaWheelPos /= Math.Abs(deltaWheelPos);
            }

            if (input.IsNewGameControlPressed(MyGameControlEnums.SELECT_AMMO_BULLET))
            {
                isKeyPress      = true;
                m_selectedGroup = MyMwcObjectBuilder_AmmoGroupEnum.Bullet;
            }

            if (input.IsNewGameControlPressed(MyGameControlEnums.SELECT_AMMO_MISSILE))
            {
                isKeyPress      = true;
                m_selectedGroup = MyMwcObjectBuilder_AmmoGroupEnum.Missile;
            }

            if (input.IsNewGameControlPressed(MyGameControlEnums.SELECT_AMMO_CANNON))
            {
                isKeyPress      = true;
                m_selectedGroup = MyMwcObjectBuilder_AmmoGroupEnum.Cannon;
            }

            if (input.IsNewGameControlPressed(MyGameControlEnums.SELECT_AMMO_UNIVERSAL_LAUNCHER_FRONT))
            {
                isKeyPress      = true;
                m_selectedGroup = MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront;
            }

            if (input.IsNewGameControlPressed(MyGameControlEnums.SELECT_AMMO_UNIVERSAL_LAUNCHER_BACK))
            {
                isKeyPress      = true;
                m_selectedGroup = MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack;
            }

            // in case of wheel direction modify flags to run correct code
            if (deltaWheelPos > 0 && Visible && IsEnabled)
            {
                isKeyPress = true;
                backwardSelectDirection = false;
            }
            // in case of wheel direction modify flags to run correct code
            if (deltaWheelPos < 0 && Visible && IsEnabled)
            {
                isKeyPress = true;
                backwardSelectDirection = true;
            }

            if (isKeyPress)
            {
                if (Visible == false)
                {
                    //I am here when the menu opens
                    LoadAmmoFromShip();
                    //If player change fire commands during game play, we need to show actual buttons names.
                    //ReloadControlText();
                    MyGuiSmallShipHelperAmmo.ResetDescription();
                }
                else
                {
                    if (m_selectedGroup == m_selectedGroupLast)
                    {
                        // if (!MyFakes.MW25D)
                        {
                            if (!backwardSelectDirection)
                            {
                                m_selectedIndex++;
                            }
                            else
                            {
                                m_selectedIndex--;
                            }
                        }
                        // else
                        //   m_selectedIndex = 0;
                    }
                    else
                    {
                        //I am here when category is changed
                        LoadAmmoFromShip();
                        MyGuiSmallShipHelperAmmo.ResetDescription();
                    }

                    if (m_selectedIndex >= m_ammoTypesAmounts.Count)
                    {
                        m_selectedIndex = 0;
                    }
                    if (m_selectedIndex < 0)
                    {
                        m_selectedIndex = m_ammoTypesAmounts.Count - 1;
                    }
                }

                Visible             = true;
                m_selectedGroupLast = m_selectedGroup;
                if (m_selectedIndex < m_ammoTypesAmounts.Count && m_selectedIndex >= 0)
                {
                    m_selectedAmmo = m_ammoTypesAmounts[m_selectedIndex].Type;
                }

                MyAudio.AddCue2D(MySoundCuesEnum.SfxHudWeaponScroll);
            }


            //Because I do not want the gun fired before I made the choice, the menu disappears after the release of key (not press)
            if (Visible)
            {
                if (!MySession.Is25DSector)
                {
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_PRIMARY) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_SECONDARY) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Secondary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_THIRD) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Third, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_FOURTH) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Fourth, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_FIFTH) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Fifth, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }

                    if (input.IsNewKeyPress(Keys.Escape))
                    {
                        Visible = false;
                    }
                }
                else
                {  //MyFakes.MW25D
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_PRIMARY) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_SECONDARY) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_THIRD) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_FOURTH) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_FIFTH) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }

                    if (input.IsNewKeyPress(Keys.Escape))
                    {
                        Visible = false;
                    }
                }

                for (int i = m_ammoTypesAmounts.Count - 1; i >= 0; i--)
                {
                    int itemsPerColumn = 7;

                    int orderX = (int)m_selectedGroup + i / itemsPerColumn;
                    int orderY = i % itemsPerColumn;

                    /*
                     * Vector2 mousePos = MyGuiManager.MouseCursorPosition;
                     * if (MyVideoModeManager.IsTripleHead() == true)
                     *  mousePos += new Vector2(-1, 0);
                     *
                     * if (MyGuiSmallShipHelpers.GetMyGuiSmallShipHelperAmmo(m_ammoTypesAmounts[i].Type).IsPointInMyArea(mousePos))
                     * {
                     * }
                     */
                    //if (MyGuiSmallShipHelpers.GetMyGuiSmallShipHelperAmmo(m_ammoTypesAmounts[i].Type).IsPointInMyArea(MyGuiManager.MouseCursorPosition))
                    MyGuiSmallShipHelperAmmo ammoHelper =
                        MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)m_ammoTypesAmounts[i].Type) as MyGuiSmallShipHelperAmmo;
                    if (ammoHelper.IsPointInMyArea(MyGuiManager.MouseCursorPosition))
                    {
                        if (m_selectedIndex != i || m_selectedAmmo != m_ammoTypesAmounts[m_selectedIndex].Type)
                        {
                            MyAudio.AddCue2D(MySoundCuesEnum.SfxHudWeaponScroll);
                        }
                        m_selectedIndex = i;
                        m_selectedAmmo  = m_ammoTypesAmounts[m_selectedIndex].Type;
                    }
                }

                //if (!MyFakes.MW25D)
                {
                    if (m_isPressLast &&
                        !input.IsGameControlPressed(MyGameControlEnums.FIRE_PRIMARY) &&
                        !input.IsGameControlPressed(MyGameControlEnums.FIRE_SECONDARY) &&
                        !input.IsGameControlPressed(MyGameControlEnums.FIRE_THIRD) &&
                        !input.IsGameControlPressed(MyGameControlEnums.FIRE_FOURTH) &&
                        !input.IsGameControlPressed(MyGameControlEnums.FIRE_FIFTH))
                    {
                        //I am here when the menu closes
                        m_isPressLast = false;
                        Visible       = false;
                        MyAudio.AddCue2D(MySoundCuesEnum.SfxHudWeaponSelect);
                    }
                }

                /*  else
                 * {
                 *    if (isKeyPress)
                 *        MyAudio.AddCue2D(MySoundCuesEnum.SfxHudWeaponSelect);
                 * } */
            }

            /*
             * if (MyFakes.MW25D)
             * {
             * return false;
             * }   */

            return(base.HandleInput(input, hasKeyboardActiveControl, hasKeyboardActiveControlPrevious, receivedFocusInThisUpdate));
        }
示例#14
0
        //  Called when we finished harvesting current voxel
        void StartReleaseVoxel()
        {
            if (m_parentMinerShip == null || m_parentMinerShip.IsDead() || m_parentMinerShip.Inventory == null)
            {
                return;
            }

            StartImplodeCue();
            BoundingSphere explosion = new BoundingSphere(m_headPositionTransformed, MyVoxelConstants.VOXEL_SIZE_IN_METRES * 1);

            //remove decals
            MyDecals.HideTrianglesAfterExplosion(m_inVoxelMap, ref explosion);
            //cut off

            var minedMaterialsWithContents = MyVoxelGenerator.CutOutSphereFastWithMaterials(m_inVoxelMap, explosion);

            var dustEffect = MyParticlesManager.CreateParticleEffect((int)MyParticleEffectsIDEnum.Harvester_Finished);

            dustEffect.WorldMatrix = Matrix.CreateTranslation(m_headPositionTransformed);

            bool hudHarvestingCompletePlayed = false;
            bool harvestingFinishedAsyncSent = false;

            var minedOres = new Dictionary <int, float>();

            foreach (var minedMaterialWithContent in minedMaterialsWithContents)
            {
                MyOreRatioFromVoxelMaterial[] oreFromVoxel = MyVoxelMapOreMaterials.GetOreFromVoxelMaterial(minedMaterialWithContent.Key);
                if (oreFromVoxel != null && this.Parent == MySession.PlayerShip)
                {
                    // accumulate amounts of the same type
                    foreach (MyOreRatioFromVoxelMaterial oreRatio in oreFromVoxel)
                    {
                        float amount    = minedMaterialWithContent.Value * oreRatio.Ratio * MyHarvestingTubeConstants.MINED_CONTENT_RATIO;
                        float oldAmount = 0;
                        minedOres.TryGetValue((int)oreRatio.OreType, out oldAmount);
                        minedOres[(int)oreRatio.OreType] = amount + oldAmount;
                    }

                    if (!harvestingFinishedAsyncSent)
                    {
                        try
                        {
                            // Disabled, still unused on server
                            //var client = MySectorServiceClient.GetCheckedInstance();
                            //client.HarvestingFinishedAsync(minedMaterialWithContent.Key, (byte)(minedMaterialWithContent.Value * MyVoxelConstants.VOXEL_CONTENT_FULL_FLOAT));
                        }
                        catch (Exception)
                        {
                            Debug.Fail("Cannot send harvesting to server");
                        }
                        harvestingFinishedAsyncSent = true;
                    }

                    if (!hudHarvestingCompletePlayed)
                    {
                        hudHarvestingCompletePlayed = true;
                        MyAudio.AddCue2D(MySoundCuesEnum.HudHarvestingComplete);
                    }
                }
            }


            bool inventoryFullWarningPlayed = false;

            // add ores to inventory
            foreach (var ore in minedOres)
            {
                float amountLeft = m_parentMinerShip.Inventory.AddInventoryItem(MyMwcObjectBuilderTypeEnum.Ore, ore.Key, ore.Value, false);

                float amountAdded = ore.Value - amountLeft;
                if (amountAdded > 0f)
                {
                    MyHudNotification.AddNotification(new MyHudNotification.MyNotification(MyTextsWrapperEnum.HarvestNotification, 3500, textFormatArguments: new object[]
                    {
                        amountAdded,
                        ((MyGuiOreHelper)MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.Ore, ore.Key)).Name
                    }
                                                                                           ));
                }

                if (amountLeft > 0f)
                {
                    MyHudNotification.AddNotification(new MyHudNotification.MyNotification(MyTextsWrapperEnum.HarvestNotificationInventoryFull, MyGuiManager.GetFontMinerWarsRed(), 3500,
                                                                                           textFormatArguments: new object[]
                    {
                        amountLeft,
                        ((MyGuiOreHelper)MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.Ore, ore.Key)).Name
                    }
                                                                                           ));
                    if (!inventoryFullWarningPlayed)
                    {
                        MyAudio.AddCue2D(MySoundCuesEnum.HudInventoryFullWarning);
                        inventoryFullWarningPlayed = true;
                    }
                }
            }

            StartReturningBack();
        }
        //protected MyGuiControlEntityUse(IMyGuiControlsParent parent, Vector2 size, MyEntity entity)
        //    : base(parent, Vector2.Zero, size, Vector4.One, new StringBuilder(entity.DisplayName), MyGuiManager.GetHubItemBackground())
        //{
        //    m_entity = entity;
        //    m_topLeftPosition = -m_size.Value / 2f + new Vector2(0.025f, 0.025f);
        //    Controls.Add(new MyGuiControlLabel(this, m_topLeftPosition + new Vector2(0.063f, 0.0f), null, GetEntityName(entity), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
        //    LoadControls();
        //}

        //protected MyGuiControlEntityUse(IMyGuiControlsParent parent, Vector2 size, MyEntity entity, MyTexture2D texture):this(parent,size,entity)
        //{
        //    m_texture = texture;
        //}

        protected MyGuiControlEntityUse(IMyGuiControlsParent parent, Vector2 size, MyEntity entity)
            : this(parent, size, entity, MyGuiObjectBuilderHelpers.GetGuiHelper(entity.GetObjectBuilder(true)).Icon)
        {
        }
示例#16
0
        private void GeneratePrefabPreviews(int sizeInPixels, DirectoryInfo directoryInfo)
        {
            var directoryPrefabs = Directory.CreateDirectory(Path.Combine(directoryInfo.FullName, "Prefabs"));

            //foreach (MyMwcObjectBuilderTypeEnum enumValue in MyGuiPrefabHelpers.MyMwcPrefabTypesEnumValues)
            var enumValue = MyMwcObjectBuilderTypeEnum.Prefab;
            {
                int index = 0;
                //var prefabIds = MyMwcObjectBuilder_Base.GetObjectBuilderIDs(enumValue);
                var prefabIds = new[] { 534 };

                //if (enumValue == MyMwcObjectBuilderTypeEnum.PrefabFoundationFactory) continue;
                // scanners has own preview texture
                //if (enumValue == MyMwcObjectBuilderTypeEnum.PrefabScanner) continue;

                foreach (int prefabId in prefabIds)
                {
                    if (prefabId == (ushort)MyMwcObjectBuilder_Prefab_TypesEnum.SimpleObject)
                    {
                        continue;
                    }

                    MyPrefabConfiguration config = MyPrefabConstants.GetPrefabConfiguration(enumValue, prefabId);

                    if (config == null)
                    {
                        continue;
                    }

                    string assetName = GetPreviewFileName(config, prefabId);

                    foreach (var faction in MyGuiPrefabHelpers.MyMwcFactionTextureEnumValues)
                    //var faction = MyMwcObjectBuilder_Prefab_AppearanceEnum.None;
                    {
                        var appearance = (MyMwcObjectBuilder_Prefab_AppearanceEnum)faction;

                        if (config.FactionSpecific.HasValue && config.FactionSpecific.Value != appearance)
                        {
                            continue;
                        }

                        var prefabTypeName = MyGuiObjectBuilderHelpers.GetGuiHelper(enumValue, prefabId).Description;
                        Debug.WriteLine(string.Format("Exporting prefab preview for {0}: {1}/{2} ..", prefabTypeName,
                                                      1 + (ushort)faction + 8 * index, 8 * prefabIds.Length));

                        var result = RenderPrefabPreview(prefabId, config, appearance,
                                                         sizeInPixels, sizeInPixels, 1.5f);

                        string fileName = Path.Combine(directoryPrefabs.FullName,
                                                       "v" + String.Format("{0:00}", (ushort)faction + 1),
                                                       string.Format("{0}.dds", assetName));

                        if (File.Exists(fileName))
                        {
                            File.Delete(fileName);
                        }

                        //TODO
                        //MyDDSFile.DDSToFile(fileName, true, result, false);
                    }

                    index++;
                }
            }
        }
        void Init()
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.73f, 0.93f);
            Vector2 controlsOriginLeft  = GetControlsOriginLeftFromScreenSize() + new Vector2(0.02f, 0.01f);
            Vector2 controlsOriginRight = GetControlsOriginRightFromScreenSize();

            // Add screen title
            AddCaption();

            #region Faction nationality

            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * CONTROLS_DELTA, null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_selectShipFactionCombobox = new MyGuiControlCombobox(this, controlsOriginRight + 1 * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0),
                                                                   MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 5);

            foreach (MyMwcObjectBuilder_FactionEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_ShipFactionNationalityEnumValues)
            {
                MyGuiHelperBase factionNationalityHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipFactionNationality(enumValue);
                m_selectShipFactionCombobox.AddItem((int)enumValue, null, factionNationalityHelper.Description);
            }

            m_selectShipFactionCombobox.SelectItemByKey(1);
            Controls.Add(m_selectShipFactionCombobox);

            #endregion

            // AI Template
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2 * CONTROLS_DELTA, null, MyTextsWrapperEnum.AITemplate, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_selectAITemplateCombobox = new MyGuiControlCombobox(this, controlsOriginRight + 2 * CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0),
                                                                  MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 5);

            foreach (MyAITemplateEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_BotAITemplateValues)
            {
                MyGuiHelperBase aiTemplateHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipBotAITemplate(enumValue);
                if (aiTemplateHelper != null)
                {
                    m_selectAITemplateCombobox.AddItem((int)enumValue, null, aiTemplateHelper.Description);
                }
            }

            m_selectAITemplateCombobox.SelectItemByKey(0);
            Controls.Add(m_selectAITemplateCombobox);

            // Aggresivity
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3 * CONTROLS_DELTA, null, MyTextsWrapperEnum.Aggressivity, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_aggresivitySlider = new MyGuiControlSlider(this, controlsOriginRight + 3 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2, 0), MyGuiConstants.SLIDER_WIDTH,
                                                         0, 1, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                         new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);

            m_aggresivityLabel = new MyGuiControlLabel(this, controlsOriginRight + 3 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH, 0), null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR,
                                                       MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            Controls.Add(m_aggresivitySlider);
            Controls.Add(m_aggresivityLabel);

            m_aggresivitySlider.OnChange += OnAggresivityChanged;
            OnAggresivityChanged(m_aggresivitySlider);

            // See distance
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 4 * CONTROLS_DELTA, null, MyTextsWrapperEnum.SeeDistance, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_seeDistanceSlider = new MyGuiControlSlider(this, controlsOriginRight + 4 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2, 0), MyGuiConstants.SLIDER_WIDTH,
                                                         0, 1000, MyGuiConstants.SLIDER_BACKGROUND_COLOR,
                                                         new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f);

            m_seeDistanceLabel = new MyGuiControlLabel(this, controlsOriginRight + 4 * CONTROLS_DELTA + new Vector2(MyGuiConstants.SLIDER_WIDTH, 0), null, MyTextsWrapperEnum.SetShipFaction, MyGuiConstants.LABEL_TEXT_COLOR,
                                                       MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            Controls.Add(m_seeDistanceSlider);
            Controls.Add(m_seeDistanceLabel);

            m_seeDistanceSlider.OnChange += OnSeeDistanceChanged;
            OnSeeDistanceChanged(m_seeDistanceSlider);

            #region Smallship Model

            MyGuiControlLabel smallShipLabel = new MyGuiControlLabel(this, controlsOriginLeft + 5 * CONTROLS_DELTA, null, MyTextsWrapperEnum.ChooseModel, MyGuiConstants.LABEL_TEXT_COLOR,
                                                                     MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            Controls.Add(smallShipLabel);

            //COMBOBOX - small ship
            var comboboxPredefinedSize = MyGuiControlPreDefinedSize.LONGMEDIUM;
            var comboboxSize           = MyGuiControlCombobox.GetPredefinedControlSize(comboboxPredefinedSize);
            m_selectSmallShipCombobox = new MyGuiControlCombobox(
                this,
                controlsOriginLeft + 5 * CONTROLS_DELTA + 0.5f * new Vector2(comboboxSize.X, 0) + new Vector2(0.19f, 0.01f),
                comboboxPredefinedSize,
                MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                MyGuiConstants.COMBOBOX_TEXT_SCALE,
                6,
                true,
                false,
                true);

            if (m_templatesBuilders == null)
            {
                foreach (MyMwcObjectBuilder_SmallShip_TypesEnum enumValue in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_TypesEnumValues)
                {
                    //MyGuiSmallShipHelperSmallShip smallShipHelper = MyGuiSmallShipHelpers.GetMyGuiSmallShipHelperSmallShip(enumValue);
                    MyGuiSmallShipHelperSmallShip smallShipHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip, (int)enumValue) as MyGuiSmallShipHelperSmallShip;
                    m_selectSmallShipCombobox.AddItem((int)enumValue, smallShipHelper.Icon, smallShipHelper.Name);
                }
                m_selectSmallShipCombobox.SelectItemByKey(1);
            }
            else
            {
                for (int i = 0; i < m_templatesBuilders.Count; i++)
                {
                    var templateBuilder = m_templatesBuilders[i];
                    m_selectSmallShipCombobox.AddItem(i, templateBuilder.Name);
                }
            }

            m_selectSmallShipCombobox.OnSelectItemDoubleClick += OnOkClick;
            Controls.Add(m_selectSmallShipCombobox);
            #endregion

            if (m_bot != null)
            {
                Controls.Add(new MyGuiControlButton(this, controlsOriginLeft + 10 * CONTROLS_DELTA + new Vector2(0.07f, 0.02f), MyGuiConstants.PROGRESS_CANCEL_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                    MyTextsWrapperEnum.Inventory, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnInventoryClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

                AddActivatedCheckbox(controlsOriginLeft, m_bot.Activated);
            }

            AddOkAndCancelButtonControls(new Vector2(0, -0.02f));
        }
示例#18
0
 /// <summary>
 /// Returns description of bulding requirement
 /// </summary>
 /// <returns></returns>
 public StringBuilder GetDescription()
 {
     return(MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.Blueprint, (int)BlueprintType).Description);
 }
示例#19
0
        public override void Draw()
        {
            /*    if (MyFakes.MW25D)
             *  {
             *      Visible = true;
             *      //m_mouseCursorHoverTexture = null;
             *     // return;
             *  }
             */
            if (!Visible)
            {
                return;
            }


            MyGuiManager.BeginSpriteBatch();
            var offset = new Vector2(VideoMode.MyVideoModeManager.IsTripleHead() ? -1 : 0, 0);

            /*
             * // Draw information:
             * Vector2 screenSizeNormalize = MyGuiManager.GetNormalizedSize(MyGuiManager.GetAmmoSelectKeyConfirmBorderTexture(), MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_INFO_SCALE);
             * screenSizeNormalize.X *= MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_SCALE.X;
             * screenSizeNormalize.Y *= MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_SCALE.Y;
             */

            var screenSizeNormalize = new Vector2(918f / 1600f, 314f / 1200f);

            //if (!MyFakes.MW25D)
            if (Visible)
            {
                MyGuiManager.DrawSpriteBatch(MyGuiManager.GetAmmoSelectKeyConfirmBorderTexture(),
                                             MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_POSITION + offset, screenSizeNormalize,
                                             MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_COLOR, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

                MyGuiManager.DrawStringCentered(MyGuiManager.GetFontMinerWarsBlue(), m_text,
                                                MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_TEXT_INFO_POSITION + offset, MyGuiConstants.AMMO_SELECTION_CONFIRMATION_TEXT_SCALE,
                                                MyGuiConstants.AMMO_SELECTION_CONFIRM_INFO_TEXT_COLOR, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

                MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsBlue(), m_textValues,
                                        MyGuiConstants.AMMO_SELECTION_CONFIRM_BORDER_TEXT_POSITION + offset, MyGuiConstants.AMMO_SELECTION_CONFIRMATION_TEXT_INFO_SCALE,
                                        MyGuiConstants.AMMO_SELECTION_CONFIRM_INFO_TEXT_COLOR, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            }

            MyGuiSmallShipHelperAmmo.DrawSpriteBatchBackground(MyGuiConstants.SELECT_AMMO_BACKGROUND_COLOR);

            foreach (MyMwcObjectBuilder_AmmoGroupEnum item in MyGuiSmallShipHelpers.MyMwcObjectBuilder_SmallShip_AssignmentOfAmmo_GroupEnumValues)
            {
                MyGuiSmallShipHelpers.GetMyGuiSmallShipHelperAmmo(item).DrawSpriteBatchMenuHeader((int)item - 1, (m_selectedGroup == item), m_selectedIndex, m_backgroundColor.Value);
            }

            if (!Visible)
            {
                MyGuiManager.EndSpriteBatch();
                return;
            }

            for (int i = m_ammoTypesAmounts.Count - 1; i >= 0; i--)
            {
                int itemsPerColumn = 7;

                int orderX = i / itemsPerColumn;
                int orderY = i % itemsPerColumn;

                MyGuiSmallShipHelperAmmo ammoHelper = MyGuiObjectBuilderHelpers.GetGuiHelper(
                    MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)m_ammoTypesAmounts[i].Type) as MyGuiSmallShipHelperAmmo;
                //MyGuiSmallShipHelpers.GetMyGuiSmallShipHelperAmmo(m_ammoTypesAmounts[i].Type).DrawSpriteBatchMenuItem(
                //    orderX - 1, orderY - 1, (i == m_selectedIndex), m_ammoTypesAmounts[i].Amount, m_backgroundColor.Value, i, (int)m_selectedGroup);
                ammoHelper.DrawSpriteBatchMenuItem(orderX - 1, orderY - 1, (i == m_selectedIndex), m_ammoTypesAmounts[i].Amount, m_backgroundColor.Value, i, (int)m_selectedGroup);
            }


            MyGuiSmallShipHelperAmmo.DrawSpriteBatchTooltip();

            MyGuiManager.EndSpriteBatch();
        }