internal static void SerializePlaceableItemsUsingCustomSerializationSystem(string savePath, List <PlaceableItem> itemsUsingCustomSerializationSystem)
        {
            PlaceableItemSerializationWrapper placeableItemSerializationWrapper = new PlaceableItemSerializationWrapper();

            foreach (PlaceableItem item in itemsUsingCustomSerializationSystem)
            {
                if (ActivePlaceableItemCreators.HasCreatorFromEnum(item.itemType) == false)
                {
                    continue;
                }

                Utilities.Logger.Print($"Modded Placeable Item Serializing {item}...");
                IACMFPlaceableItemCustomSerializationSystem serializationSystem = ActivePlaceableItemCreators.GetCreatorFromEnum(item.itemType) as IACMFPlaceableItemCustomSerializationSystem;

                PlaceableItemSerializable placeableItemSerializable = serializationSystem.SerializeItem(item);
                if (placeableItemSerializable == null)
                {
                    Utilities.Logger.Error($"{item} SerializeItem returned null.");
                    ShowErrorDialog();
                }
                else
                {
                    placeableItemSerializationWrapper.Add(placeableItemSerializable);
                }
            }

            bool result = Utilities.JsonSerialization.Serialize(placeableItemSerializationWrapper, savePath + MODDED_PLACEABLE_ITEM_SAVE_FILE_NAME);

            if (result == false)
            {
                ShowErrorDialog();
            }

            Utilities.Logger.Print($"Modded Placeable Items Serialization successful.");
        }
        internal static void DeserializePlaceableItemsUsingCustomSerializationSystem(string savePath)
        {
            if (File.Exists(savePath + MODDED_PLACEABLE_ITEM_SAVE_FILE_NAME) == false)
            {
                return;
            }

            bool deserializeResult = Utilities.JsonSerialization.Deserialize(out PlaceableItemSerializationWrapper placeableItemSerializationWrapper, savePath + MODDED_PLACEABLE_ITEM_SAVE_FILE_NAME);

            if (deserializeResult == false)
            {
                DialogPopup.DialogManager.QueueMessagePanel($"A error occured while trying to deserialize modded vehicles. Please check the output log to see why.");
            }

            foreach (PlaceableItemSerializable pis in placeableItemSerializationWrapper.GetPlaceableItems())
            {
                if (ActivePlaceableItemCreators.HasCreatorFromEnum(pis.itemType) == false)
                {
                    continue;
                }

                IACMFPlaceableItemCustomSerializationSystem serializationSystem = ActivePlaceableItemCreators.GetCreatorFromEnum(pis.itemType) as IACMFPlaceableItemCustomSerializationSystem;
                bool result = serializationSystem.DeserializeItem(pis);
                if (result == false)
                {
                    Utilities.Logger.Error($"{pis} || {serializationSystem} DeserializeItem returned false.");
                    ShowErrorDialog();
                }
            }

            Utilities.Logger.Print($"Modded Placeable Items Deserialization successful.");
        }
            public static bool Prefix(bool _debugPrints, string _savePath)
            {
                ItemSerializer.savePath    = _savePath;
                ItemSerializer.debugPrints = true;
                List <PlaceableItem> originalItemList = new List <PlaceableItem>(Singleton <BuildingController> .Instance.allItemsArray.array);
                List <PlaceableItem> itemsUsingDefaultSerializationSystem = new List <PlaceableItem>();
                List <PlaceableItem> itemsUsingCustomSerializationSystem  = new List <PlaceableItem>();

                foreach (PlaceableItem pl in originalItemList)
                {
                    if (pl == null)
                    {
                        continue;
                    }

                    bool isModded             = ActivePlaceableItemCreators.HasCreatorFromEnum(pl.itemType);
                    bool usesCustomSerializer = ActivePlaceableItemCreators.GetCreatorFromEnum(pl.itemType) is IACMFPlaceableItemCustomSerializationSystem;

                    if (isModded && usesCustomSerializer)
                    {
                        itemsUsingCustomSerializationSystem.Add(pl);
                    }
                    else
                    {
                        itemsUsingDefaultSerializationSystem.Add(pl);
                    }
                }

                DynamicArray <PlaceableItem> itemsToUseDefaultSerialisationBehaviour = new DynamicArray <PlaceableItem>(256);

                itemsToUseDefaultSerialisationBehaviour.AddRange(itemsUsingDefaultSerializationSystem.ToArray());
                ItemSerializer.SerializeItems(itemsToUseDefaultSerialisationBehaviour);
                PlaceableItemSerializer.SerializePlaceableItemsUsingCustomSerializationSystem(ItemSerializer.savePath, itemsUsingCustomSerializationSystem);
                return(false);
            }
        public static bool Prefix(ref GameObject __result, Enums.ItemType itemType)
        {
            IPlaceableItemCreator placeableItemCreator = ActivePlaceableItemCreators.GetCreatorFromEnum(itemType);

            if (placeableItemCreator != null)
            {
                __result = placeableItemCreator.Prefab;
                return(false);
            }

            return(true);
        }