private void LoadLogicClassInclude(string strName) { NFIClass xLogicClass = GetElement(strName); if (null != xLogicClass) { string strLogicPath = mstrPath + xLogicClass.GetPath(); strLogicPath = strLogicPath.Replace(".xml", ""); TextAsset textAsset = (TextAsset)Resources.Load(strLogicPath); XmlDocument xmldoc = new XmlDocument(); xmldoc.LoadXml(textAsset.text); XmlNode xRoot = xmldoc.SelectSingleNode("XML"); XmlNode xNodePropertys = xRoot.SelectSingleNode("Includes"); XmlNodeList xNodeList = xNodePropertys.SelectNodes("Include"); for (int i = 0; i < xNodeList.Count; ++i) { XmlNode xPropertyNode = xNodeList.Item(i); XmlAttribute strID = xPropertyNode.Attributes["Id"]; int start = strID.Value.LastIndexOf('/') + 1; int end = strID.Value.LastIndexOf('.'); string className = strID.Value.Substring(start, end - start); xLogicClass.AddIncludeFile(className); } } }
private void LoadLogicClassRecord(string strName) { NFIClass xLogicClass = GetElement(strName); if (null != xLogicClass) { string strLogicPath = mstrPath + xLogicClass.GetPath(); strLogicPath = strLogicPath.Replace(".xml", ""); TextAsset textAsset = (TextAsset)Resources.Load(strLogicPath); XmlDocument xmldoc = new XmlDocument(); xmldoc.LoadXml(textAsset.text); XmlNode xRoot = xmldoc.SelectSingleNode("XML"); XmlNode xNodePropertys = xRoot.SelectSingleNode("Records"); if (null != xNodePropertys) { XmlNodeList xNodeList = xNodePropertys.SelectNodes("Record"); if (null != xNodeList) { for (int i = 0; i < xNodeList.Count; ++i) { XmlNode xRecordNode = xNodeList.Item(i); string strID = xRecordNode.Attributes["Id"].Value; string strRow = xRecordNode.Attributes["Row"].Value; string strUpload = xRecordNode.Attributes["Upload"].Value; bool bUpload = strUpload.Equals("1"); NFDataList xValue = new NFDataList(); NFDataList xTag = new NFDataList(); XmlNodeList xTagNodeList = xRecordNode.SelectNodes("Col"); for (int j = 0; j < xTagNodeList.Count; ++j) { XmlNode xColTagNode = xTagNodeList.Item(j); XmlAttribute strTagID = xColTagNode.Attributes["Tag"]; XmlAttribute strTagType = xColTagNode.Attributes["Type"]; xTag.AddString(strTagID.Value); switch (strTagType.Value) { case "int": { xValue.AddInt(0); } break; case "float": { xValue.AddFloat(0.0); } break; case "string": { xValue.AddString(""); } break; case "object": { xValue.AddObject(new NFGUID(0, 0)); } break; case "vector2": { xValue.AddVector2(NFVector2.Zero()); } break; case "vector3": { xValue.AddVector3(NFVector3.Zero()); } break; default: break; } } NFIRecord xRecord = xLogicClass.GetRecordManager().AddRecord(strID, int.Parse(strRow), xValue, xTag); xRecord.SetUpload(bUpload); } } } } }
private void LoadLogicClassProperty(string strName) { NFIClass xLogicClass = GetElement(strName); if (null != xLogicClass) { string strLogicPath = mstrPath + xLogicClass.GetPath(); strLogicPath = strLogicPath.Replace(".xml", ""); TextAsset textAsset = (TextAsset)Resources.Load(strLogicPath); XmlDocument xmldoc = new XmlDocument(); xmldoc.LoadXml(textAsset.text); XmlNode xRoot = xmldoc.SelectSingleNode("XML"); XmlNode xNodePropertys = xRoot.SelectSingleNode("Propertys"); XmlNodeList xNodeList = xNodePropertys.SelectNodes("Property"); for (int i = 0; i < xNodeList.Count; ++i) { XmlNode xPropertyNode = xNodeList.Item(i); XmlAttribute strID = xPropertyNode.Attributes["Id"]; XmlAttribute strType = xPropertyNode.Attributes["Type"]; XmlAttribute strUpload = xPropertyNode.Attributes["Upload"]; bool bUpload = strUpload.Value.Equals("1"); switch (strType.Value) { case "int": { NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_INT); NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue); xProperty.SetUpload(bUpload); } break; case "float": { NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_FLOAT); NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue); xProperty.SetUpload(bUpload); } break; case "string": { NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_STRING); NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue); xProperty.SetUpload(bUpload); } break; case "object": { NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_OBJECT); NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue); xProperty.SetUpload(bUpload); } break; case "vector2": { NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR2); NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue); xProperty.SetUpload(bUpload); } break; case "vector3": { NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR3); NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue); xProperty.SetUpload(bUpload); } break; default: break; } } } }
private void LoadLogicClassProperty(string strName) { NFIClass xLogicClass = GetElement(strName); if (null != xLogicClass) { XmlDocument xmldoc = new XmlDocument(); string strLogicPath = mstrPath + xLogicClass.GetPath(); if (RuntimePlatform.Android == Application.platform || RuntimePlatform.IPhonePlayer == Application.platform) { strLogicPath = strLogicPath.Replace(".xml", ""); TextAsset textAsset = (TextAsset)Resources.Load(strLogicPath); xmldoc.LoadXml(textAsset.text); } else { try { xmldoc.Load(strLogicPath); } catch (Exception e) { Debug.LogFormat("Load Config Error {0}", e.ToString()); } } XmlNode xRoot = xmldoc.SelectSingleNode("XML"); XmlNode xNodePropertys = xRoot.SelectSingleNode("Propertys"); XmlNodeList xNodeList = xNodePropertys.SelectNodes("Property"); for (int i = 0; i < xNodeList.Count; ++i) { XmlNode xPropertyNode = xNodeList.Item(i); XmlAttribute strID = xPropertyNode.Attributes["Id"]; XmlAttribute strType = xPropertyNode.Attributes["Type"]; XmlAttribute strUpload = xPropertyNode.Attributes["Upload"]; bool bUpload = strUpload.Value.Equals("1"); switch (strType.Value) { case "int": { NFDataList xValue = new NFDataList(); xValue.AddInt(0); NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue); xProperty.SetUpload(bUpload); } break; case "float": { NFDataList xValue = new NFDataList(); xValue.AddFloat(0.0); NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue); xProperty.SetUpload(bUpload); } break; case "string": { NFDataList xValue = new NFDataList(); xValue.AddString(""); NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue); xProperty.SetUpload(bUpload); } break; case "object": { NFDataList xValue = new NFDataList(); xValue.AddObject(new NFGUID(0, 0)); NFIProperty xProperty = xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue); xProperty.SetUpload(bUpload); } break; default: break; } } } }