public void TestSaveItemCustomProperty() { campfire = new CampfireItem(); campfire.Data.ItemName = "Campfire Custom Props"; campfire.Data.itemUUID = System.Guid.NewGuid().ToString(); // Test add string custom property StringProperty MyDescriptionProperty = new StringProperty("description", "Campfire really warm :)"); campfire.Data.Properties.Add(MyDescriptionProperty); // string description = (campfire.Data as WorldData).Properties.Get<string>("description"); // Debug.Log("The saved value is [" + description + "]"); // Test add vector3 custom property Vector3Property MyVector3Property = new Vector3Property("position", new Vector3(11, 22, 33)); campfire.Data.Properties.Add(MyVector3Property); IBaseData dataInterface = campfire as IBaseData; if (dataInterface != null) { DBModel.CreateItem(dataInterface); Debug.Log("[TestSaveItemCustomProperty] The item with custom properties was successfully created."); } else { Debug.LogError("[TestSaveItemCustomProperty] The item with custom properties data does not implement the IBaseData interface."); } }
public BaseItem FactoryCloneItemFromData() { string originalUUID = itemUUID; CampfireItem factoredItem = new CampfireItem(this); factoredItem.Data.itemUUID = originalUUID; return(factoredItem); }