Exemple #1
0
 public static void Postfix(SG_Shop_ItemSelectedPanel __instance, InventoryDataObject_BASE theController, SimGameState ___simState, LocalizableText ___MechPartCountText,
                            GameObject ___FullMechWeightClassDisplayObject, GameObject ___MechPartCountDisplayObject)
 {
     ___FullMechWeightClassDisplayObject.SetActive(false);
     ___MechPartCountDisplayObject.SetActive(true);
     SG_Shop_ItemSelectedPanel_FillInMechPartDetail.Postfix(__instance, theController, ___simState, ___MechPartCountText);
 }
        public static bool AddItemToInventory(MechLabInventoryWidget_ListView __instance, InventoryDataObject_BASE ItemData)
        {
            LogDebug("ShopTabLagFix: AddItemToInventory");
            var _this  = __instance;
            var _items = _this.ListView.Items;
            InventoryDataObject_BASE listElementController_BASE = null;

            foreach (InventoryDataObject_BASE listElementController_BASE2 in _this.inventoryData)
            {
                if (listElementController_BASE2.GetItemType() == ItemData.GetItemType() && listElementController_BASE2.IsDuplicateContent(ItemData) && _this.ParentDropTarget != null && _this.StackQuantities)
                {
                    listElementController_BASE = listElementController_BASE2;
                    break;
                }
            }

            if (listElementController_BASE != null)
            {
                listElementController_BASE.ModifyQuantity(1);
            }
            else
            {
                // OnItemAdded logic does not seem to be needed?
                // HBSLoopScroll 219-228
                _items.Add(ItemData);
            }
            return(false);
        }
 public static void Postfix(SG_Shop_ItemSelectedPanel __instance, InventoryDataObject_BASE theController, SimGameState ___simState, LocalizableText ___MechPartCountText)
 {
     if (theController.mechDef == null)
     {
         return;
     }
     ___MechPartCountText.SetText(SimpleMechAssembly_Main.GetMechCountDescrString(___simState, theController.mechDef));
 }
Exemple #4
0
        public static void Postfix(SG_Shop_ItemSelectedPanel __instance, InventoryDataObject_BASE theController, SimGameState ___simState, LocalizableText ___MechPartCountText)
        {
            if (theController.mechDef == null)
            {
                return;
            }
            int pieces    = ___simState.GetItemCount(theController.mechDef.Description.Id, "MECHPART", SimGameState.ItemCountType.UNDAMAGED_ONLY);
            int needed    = ___simState.Constants.Story.DefaultMechPartMax;
            int varpieces = SimpleMechAssembly_Main.GetNumPartsForAssembly(___simState, theController.mechDef);
            int owned     = SimpleMechAssembly_Main.GetNumberOfMechsOwnedOfType(___simState, theController.mechDef);

            ___MechPartCountText.SetText(string.Format("{0}({1})/{3}({2})", pieces, varpieces, owned, needed));
        }