Esempio n. 1
0
        public static SerializableContainerModel MakeSerializableContainerModel(ContainerModel rContainerModel)
        {
            var rItems = rContainerModel.ListItems();

            SerializableItemInstance[] sItems = new SerializableItemInstance[rItems.Length];
            for (int i = 0; i < rItems.Length; i++)
            {
                sItems[i] = SerializableItemInstance.MakeSerializableItemInstance(rItems[i]);
            }
            var sContainerModel = new SerializableContainerModel();

            sContainerModel.Items = sItems;
            return(sContainerModel);
        }
Esempio n. 2
0
        public static ContainerModel MakeContainerModel(SerializableContainerModel sContainerModel)
        {
            ContainerModel rContainerModel = new ContainerModel();

            foreach (SerializableItemInstance sItemInstance in sContainerModel.Items)
            {
                InventoryItemInstance rItemInstance = SerializableItemInstance.MakeItemInstance(sItemInstance);
                if (rItemInstance != null)
                {
                    rContainerModel.PutItem(rItemInstance);
                }
                else
                {
                    CDebug.LogEx(string.Format("Couldn't create real item instance for item in container"), LogLevel.Error, sContainerModel);
                }
            }

            return(rContainerModel);
        }