public override ItemPropertyData SavePropertyData() { ItemPropertyData ipd = base.SavePropertyData(); ipd.propertyData = value.ToString(); return(ipd); }
//Item property classes are responsible for filling in their fields themselves, since their value types //and volatile data may change from class to class public virtual ItemPropertyData SavePropertyData() { ItemPropertyData ipd = new ItemPropertyData(); ipd.propertyType = GetType().ToString(); return(ipd); }
public void SerializerConfig_ItemPropertyData_ShouldBeEqual() { ItemPropertyData data = new ItemPropertyData { Comment = "it's a comment", Description = "it's a description", Name = "it's a name", Resref = "it's a resref", Tag = "it's a tag" }; ItemPropertyData result; using (MemoryStream stream = new MemoryStream()) { Serializer.Serialize(stream, data); stream.Position = 0; result = Serializer.Deserialize <ItemPropertyData>(stream); } Assert.IsTrue(_compareLogic.Compare(data, result).AreEqual); }
//Should override the load function and not call base, there is nothing the base can do that is useful at the current moment. //Alright this became kind of a mess. Its simple, but it was copy and paste code cause the inheritence for item properties is kindof trash. //Good area for refactoring when it comes to cleaning up the code base. Won't take long, basically just need to convert a class or two from storing //data as a float to int, since every item property class is storing as int right now except one or two. public virtual void LoadPropertyData(ItemPropertyData ipd) { Debug.LogError(ipd.propertyType + " not loading its property data succesfully"); }
public override void LoadPropertyData(ItemPropertyData ipd) { value = float.Parse(ipd.propertyData); }
public void ItemPropertyData_OnInstantiate_ShouldCreateGlobalID() { ItemPropertyData data = new ItemPropertyData(); Assert.IsTrue(!string.IsNullOrWhiteSpace(data.GlobalID)); }