Game Development Reference
In-Depth Information
public int AddComponentUI(XmlNode actorComponentValues,
XmlNode editorComponentValues, int lineNum)
{
string componentName = actorComponentValues.Name.ToString();
string componentXpath = XPathUtility.GetXPathToNode(actorComponentValues);
try
{
AddElementLabel(componentName, lineNum);
++lineNum;
int elementNum = 0;
foreach (XmlNode inputField in editorComponentValues)
{
string xpath = XPathUtility.GetXPathToNode(inputField);
string elementName = inputField.Attributes[
name
].Value;
string elementType = inputField.Attributes[
type
].Value;
XmlNode actorValues = actorComponentValues.ChildNodes[elementNum];
AddElementLabel(“”+ elementName, lineNum);
switch (elementType)
{
case “Vec3”:
AddVec3(actorValues, xpath, lineNum);
++lineNum;
break;
case
:
AddRGBA(actorValues, xpath, lineNum);
++lineNum;
break;
RGBA
case
:
AddFileElement(actorValues, xpath, lineNum);
++lineNum;
break;
File
// Imagine more code here to initialize more types!
default:
AddElementLabel(
“”
+ elementName +
:
+ elementType +
(unknown!)
, lineNum);
++lineNum;
break;
}
Search WWH ::




Custom Search