void Init() { m_enableBackgroundFade = true; m_size = new Vector2(0.99f, 0.95f); // Add screen title AddCaption(); m_inventoryItemsRepository = new MyInventoryItemsRepository(); m_allItemsInventory = new MyInventory(); m_allItemsInventory.FillInventoryWithAllItems(null, 100, true); InitControls(); AddOkAndCancelButtonControls(); }
public MyGuiScreenInventory(List<MySmallShipBuilderWithName> smallShipsBuilders, int currentShipBuilderIndex, float money, bool tradeForMoney, MyMwcObjectBuilder_Inventory otherSidesInventoryBuilder, StringBuilder otherSideInventoryName, MyGuiScreenInventoryType inventoryScreenType, bool resetWasAnythingTrasferedAfterComboboxChanged = false) : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(1.0f, 1.0f), true, MyGuiManager.GetInventoryScreenBackgroundTexture()) { ScreenTimeout = TimeSpan.MaxValue; m_isInventoryLocked = true; m_resetWasAnythingTrasferedAfterComboboxChanged = resetWasAnythingTrasferedAfterComboboxChanged; m_isTransferingInProgress = false; m_wasAnythingTrasfered = false; m_smallShipsBuilders = smallShipsBuilders; m_smallShipsInventoryItemIDs = new List<MySmallShipInventoryItemIDs>(smallShipsBuilders.Count); m_currentShipBuilderIndex = currentShipBuilderIndex; m_otherSideInventoryBuilder = otherSidesInventoryBuilder; if (m_otherSideInventoryBuilder != null) { m_otherSideInventoryItemIDs = new List<int>(); } m_shipInventoryHideList = new List<int>(); m_otherSideInventoryHideList = new List<int>(); m_tradeForMoney = tradeForMoney; m_inventoryScreenType = inventoryScreenType; m_itemsRepository = new MyInventoryItemsRepository(); m_removedInventoryItemIDs = new List<int>(); LoadInventoryItemsFromObjectBuilders(); if (m_inventoryScreenType == MyGuiScreenInventoryType.GodEditor) { AddCaption(MyTextsWrapperEnum.ShipCustomizationCaption, new Vector2(0, 0.005f)); } else { AddCaption(MyTextsWrapperEnum.ShipInventoryCaption, new Vector2(0, 0.005f)); } m_enableBackgroundFade = false; m_backgroundFadeColor = Vector4.Zero; OnEnterCallback += OnOkClickDelegate; m_shipTexture = GetShipTexture(); m_shipPanel = new MyGuiControlPanel(this, new Vector2(0.005f, -0.2347f), new Vector2(480 / 1600f, 367 / 1200f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, m_shipTexture, null, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); Controls.Add(m_shipPanel); InitControls(otherSideInventoryName); FillOtherSideInventoryListbox(); FillShipCustomizationListboxes(m_currentShipBuilderIndex); FillShipsCombobox(); SwitchToShip(m_currentShipBuilderIndex); SetMoney(money); if (m_tradeForMoney) { UpdateOtherSideInventoryListboxForTrading(); } MyAudio.AddCue2D(MySoundCuesEnum.GuiWheelControlOpen); }