5 namespace HKI.Core.Variables
18 public override void Save(XmlNode parentNode)
20 XmlNode node = parentNode.OwnerDocument.CreateElement(name.Replace(
" ",
""));
21 parentNode.AppendChild(node);
23 XmlAttribute valueWidthAttribute = parentNode.OwnerDocument.CreateAttribute(
"ValueWidth");
24 valueWidthAttribute.Value = Value.Width.ToString();
25 node.Attributes.Append(valueWidthAttribute);
27 XmlAttribute valueHeightAttribute = parentNode.OwnerDocument.CreateAttribute(
"ValueHeight");
28 valueHeightAttribute.Value = Value.Height.ToString();
29 node.Attributes.Append(valueHeightAttribute);
32 public override void Load(XmlNode node)
34 if (node.Attributes == null)
36 Debug.LogError(
"(FloatWidthHeight) >" + name +
"< Loading failed because this XmlNode has not attributes!");
40 XmlAttribute valueWidthAttribute = node.Attributes[
"ValueWidth"];
41 if(valueWidthAttribute == null)
43 Debug.LogError(
"(FloatWidthHeight) >" + name +
"< Loading failed because this XmlNode has not an attribute with the name >ValueWidth<!");
47 XmlAttribute valueHeightAttribute = node.Attributes[
"ValueHeight"];
48 if (valueHeightAttribute == null)
50 Debug.LogError(
"(FloatWidthHeight) >" + name +
"< Loading failed because this XmlNode has not an attribute with the name >ValueHeight<!");
54 float parsedWidthValue;
55 if (!
float.TryParse(valueWidthAttribute.Value, out parsedWidthValue))
56 Debug.LogError(
"(FloatWidthHeight) >" + name +
"< Loading failed because parsing of >" + valueWidthAttribute.Value +
"< failed!");
58 float parsedHeightValue;
59 if (!
float.TryParse(valueHeightAttribute.Value, out parsedHeightValue))
60 Debug.LogError(
"(FloatWidthHeight) >" + name +
"< Loading failed because parsing of >" + valueHeightAttribute.Value +
"< failed!");
override void Load(XmlNode node)
override void Save(XmlNode parentNode)
This is a data type that combines a float width and a float height value into one value...
Implementation of a FloatingPointWidthHeight value as a HKIVar via HKIVarGeneric. ...
This class adds a generic implementation to HKIVar. This reduces the repetitive implementation of thi...