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 ProcessLogicClassIncludeFiles(NFIClass classObject) { List <string> includeFiles = classObject.GetIncludeFileList(); foreach (var item in includeFiles) { AddBasePropertyFormOther(classObject.GetName(), item); AddBaseRecordFormOther(classObject.GetName(), item); } }
private void ProcessLogicClassIncludeFiles(NFIClass classObject) { List <string> includeFiles = classObject.GetIncludeFileList(); foreach (var item in includeFiles) { LoadLogicClassProperty(classObject, item); LoadLogicClassRecord(classObject, item); } }
void AddBasePropertyFormOther(NFIClass xLogicClass, string strOther) { NFIClass xOtherClass = GetElement(strOther); if (null != xLogicClass && null != xOtherClass) { NFDataList xValue = xOtherClass.GetPropertyManager().GetPropertyList(); for (int i = 0; i < xValue.Count(); ++i) { NFIProperty xProperty = xOtherClass.GetPropertyManager().GetProperty(xValue.StringVal(i)); xLogicClass.GetPropertyManager().AddProperty(xValue.StringVal(i), xProperty.GetData()); } } }
void AddBaseRecordFormOther(NFIClass xLogicClass, string strOther) { NFIClass xOtherClass = GetElement(strOther); if (null != xLogicClass && null != xOtherClass) { NFDataList xValue = xOtherClass.GetRecordManager().GetRecordList(); for (int i = 0; i < xValue.Count(); ++i) { NFIRecord record = xOtherClass.GetRecordManager().GetRecord(xValue.StringVal(i)); xLogicClass.GetRecordManager().AddRecord(xValue.StringVal(i), record.GetRows(), record.GetColsData(), record.GetTagData()); } } }
void InitRecord(NFGUID self, string strClassName) { NFIClass xLogicClass = mxLogicClassModule.GetElement(strClassName); NFDataList xDataList = xLogicClass.GetRecordManager().GetRecordList(); for (int i = 0; i < xDataList.Count(); ++i) { string strRecordyName = xDataList.StringVal(i); NFIRecord xRecord = xLogicClass.GetRecordManager().GetRecord(strRecordyName); NFIObject xObject = GetObject(self); NFIRecordManager xRecordManager = xObject.GetRecordManager(); NFIRecord record = xRecordManager.AddRecord(strRecordyName, xRecord.GetRows(), xRecord.GetColsData(), xRecord.GetTagData()); if (record != null) { record.SetUpload(xRecord.GetUpload()); } } }
void InitProperty(NFGUID self, string strClassName) { NFIClass xLogicClass = mxLogicClassModule.GetElement(strClassName); NFDataList xDataList = xLogicClass.GetPropertyManager().GetPropertyList(); for (int i = 0; i < xDataList.Count(); ++i) { string strPropertyName = xDataList.StringVal(i); NFIProperty xProperty = xLogicClass.GetPropertyManager().GetProperty(strPropertyName); NFIObject xObject = GetObject(self); NFIPropertyManager xPropertyManager = xObject.GetPropertyManager(); NFIProperty property = xPropertyManager.AddProperty(strPropertyName, xProperty.GetData()); //if property==null ,means this property alreay exist in manager if (property != null) { property.SetUpload(xProperty.GetUpload()); } } }
private void ADD_ROW(NFGUID self, string strRecordName, NFMsg.RecordAddRowStruct xAddStruct) { NFIObject go = mKernelModule.GetObject(self); if (go == null) { return; } NFIRecordManager xRecordManager = go.GetRecordManager(); Hashtable recordVecDesc = new Hashtable(); Hashtable recordVecData = new Hashtable(); for (int k = 0; k < xAddStruct.record_int_list.Count; ++k) { NFMsg.RecordInt addIntStruct = (NFMsg.RecordInt)xAddStruct.record_int_list[k]; if (addIntStruct.col >= 0) { recordVecDesc[addIntStruct.col] = NFDataList.VARIANT_TYPE.VTYPE_INT; recordVecData[addIntStruct.col] = addIntStruct.data; } } for (int k = 0; k < xAddStruct.record_float_list.Count; ++k) { NFMsg.RecordFloat addFloatStruct = (NFMsg.RecordFloat)xAddStruct.record_float_list[k]; if (addFloatStruct.col >= 0) { recordVecDesc[addFloatStruct.col] = NFDataList.VARIANT_TYPE.VTYPE_FLOAT; recordVecData[addFloatStruct.col] = addFloatStruct.data; } } for (int k = 0; k < xAddStruct.record_string_list.Count; ++k) { NFMsg.RecordString addStringStruct = (NFMsg.RecordString)xAddStruct.record_string_list[k]; if (addStringStruct.col >= 0) { recordVecDesc[addStringStruct.col] = NFDataList.VARIANT_TYPE.VTYPE_STRING; recordVecData[addStringStruct.col] = System.Text.Encoding.Default.GetString(addStringStruct.data); } } for (int k = 0; k < xAddStruct.record_object_list.Count; ++k) { NFMsg.RecordObject addObjectStruct = (NFMsg.RecordObject)xAddStruct.record_object_list[k]; if (addObjectStruct.col >= 0) { recordVecDesc[addObjectStruct.col] = NFDataList.VARIANT_TYPE.VTYPE_OBJECT; recordVecData[addObjectStruct.col] = mHelpModule.PBToNF(addObjectStruct.data); } } for (int k = 0; k < xAddStruct.record_vector2_list.Count; ++k) { NFMsg.RecordVector2 addObjectStruct = (NFMsg.RecordVector2)xAddStruct.record_vector2_list[k]; if (addObjectStruct.col >= 0) { recordVecDesc[addObjectStruct.col] = NFDataList.VARIANT_TYPE.VTYPE_VECTOR2; recordVecData[addObjectStruct.col] = mHelpModule.PBToNF(addObjectStruct.data); } } for (int k = 0; k < xAddStruct.record_vector3_list.Count; ++k) { NFMsg.RecordVector3 addObjectStruct = (NFMsg.RecordVector3)xAddStruct.record_vector3_list[k]; if (addObjectStruct.col >= 0) { recordVecDesc[addObjectStruct.col] = NFDataList.VARIANT_TYPE.VTYPE_VECTOR3; recordVecData[addObjectStruct.col] = mHelpModule.PBToNF(addObjectStruct.data); } } NFDataList varListDesc = new NFDataList(); NFDataList varListData = new NFDataList(); for (int m = 0; m < recordVecDesc.Count; m++) { if (recordVecDesc.ContainsKey(m) && recordVecData.ContainsKey(m)) { NFDataList.VARIANT_TYPE nType = (NFDataList.VARIANT_TYPE)recordVecDesc[m]; switch (nType) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { varListDesc.AddInt(0); varListData.AddInt((Int64)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_FLOAT: { varListDesc.AddFloat(0.0f); varListData.AddFloat((float)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { varListDesc.AddString(""); varListData.AddString((string)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_OBJECT: { varListDesc.AddObject(new NFGUID()); varListData.AddObject((NFGUID)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2: { varListDesc.AddVector2(new NFVector2()); varListData.AddVector2((NFVector2)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3: { varListDesc.AddVector3(new NFVector3()); varListData.AddVector3((NFVector3)recordVecData[m]); } break; default: break; } } else { //���� //Debug.LogException(i); } } NFIRecord xRecord = xRecordManager.GetRecord(strRecordName); if (null == xRecord) { string strClassName = mKernelModule.QueryPropertyString(self, NFrame.IObject.ClassName); NFIClass xLogicClass = mClassModule.GetElement(strClassName); NFIRecord xStaticRecord = xLogicClass.GetRecordManager().GetRecord(strRecordName); xRecord = xRecordManager.AddRecord(strRecordName, 512, varListDesc, xStaticRecord.GetTagData()); } xRecord.AddRow(xAddStruct.row, varListData); }
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; } } } }
private void LoadInstanceElement(NFIClass xLogicClass) { string strLogicPath = mstrRootPath; strLogicPath += xLogicClass.GetInstance(); XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(strLogicPath); XmlNode xRoot = xmldoc.SelectSingleNode("XML"); XmlNodeList xNodeList = xRoot.SelectNodes("Object"); for (int i = 0; i < xNodeList.Count; ++i) { //NFCLog.Instance.Log("Class:" + xLogicClass.GetName()); XmlNode xNodeClass = xNodeList.Item(i); XmlAttribute strID = xNodeClass.Attributes["Id"]; //NFCLog.Instance.Log("ClassID:" + strID.Value); NFIElement xElement = GetElement(strID.Value); if (null == xElement) { xElement = new NFCElement(); AddElement(strID.Value, xElement); xLogicClass.AddConfigName(strID.Value); XmlAttributeCollection xCollection = xNodeClass.Attributes; for (int j = 0; j < xCollection.Count; ++j) { XmlAttribute xAttribute = xCollection[j]; NFIProperty xProperty = xLogicClass.GetPropertyManager().GetProperty(xAttribute.Name); if (null != xProperty) { NFDataList.VARIANT_TYPE eType = xProperty.GetType(); switch (eType) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { NFDataList xValue = new NFDataList(); xValue.AddInt(int.Parse(xAttribute.Value)); NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue); property.SetUpload(xProperty.GetUpload()); } break; case NFDataList.VARIANT_TYPE.VTYPE_FLOAT: { NFDataList xValue = new NFDataList(); xValue.AddFloat(float.Parse(xAttribute.Value)); NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue); property.SetUpload(xProperty.GetUpload()); } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { NFDataList xValue = new NFDataList(); xValue.AddString(xAttribute.Value); NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue); property.SetUpload(xProperty.GetUpload()); } break; case NFDataList.VARIANT_TYPE.VTYPE_OBJECT: { NFDataList xValue = new NFDataList(); xValue.AddObject(new NFGUID(0, int.Parse(xAttribute.Value))); NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue); property.SetUpload(xProperty.GetUpload()); } break; default: break; } } } } } }
private void LoadInstanceElement(NFIClass xLogicClass) { string strLogicPath = mstrRootPath; strLogicPath += xLogicClass.GetInstance(); strLogicPath = strLogicPath.Replace(".xml", ""); TextAsset textAsset = (TextAsset)Resources.Load(strLogicPath); XmlDocument xmldoc = new XmlDocument(); xmldoc.LoadXml(textAsset.text); XmlNode xRoot = xmldoc.SelectSingleNode("XML"); XmlNodeList xNodeList = xRoot.SelectNodes("Object"); for (int i = 0; i < xNodeList.Count; ++i) { //NFCLog.Instance.Log("Class:" + xLogicClass.GetName()); XmlNode xNodeClass = xNodeList.Item(i); XmlAttribute strID = xNodeClass.Attributes["Id"]; //NFCLog.Instance.Log("ClassID:" + strID.Value); NFIElement xElement = GetElement(strID.Value); if (null == xElement) { xElement = new NFElement(); AddElement(strID.Value, xElement); xLogicClass.AddConfigName(strID.Value); XmlAttributeCollection xCollection = xNodeClass.Attributes; for (int j = 0; j < xCollection.Count; ++j) { XmlAttribute xAttribute = xCollection[j]; NFIProperty xProperty = xLogicClass.GetPropertyManager().GetProperty(xAttribute.Name); if (null != xProperty) { NFDataList.VARIANT_TYPE eType = xProperty.GetType(); switch (eType) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { try { NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_INT); xValue.Set(int.Parse(xAttribute.Value)); NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue); property.SetUpload(xProperty.GetUpload()); } catch { Debug.LogError("ID:" + strID.Value + " Property Name:" + xAttribute.Name + " Value:" + xAttribute.Value); } } break; case NFDataList.VARIANT_TYPE.VTYPE_FLOAT: { try { NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_FLOAT); xValue.Set(float.Parse(xAttribute.Value, CultureInfo.InvariantCulture.NumberFormat)); NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue); property.SetUpload(xProperty.GetUpload()); } catch { Debug.LogError("ID:" + strID.Value + " Property Name:" + xAttribute.Name + " Value:" + xAttribute.Value); } } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_STRING); xValue.Set(xAttribute.Value); NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue); property.SetUpload(xProperty.GetUpload()); } break; case NFDataList.VARIANT_TYPE.VTYPE_OBJECT: { try { NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_OBJECT); xValue.Set(new NFGUID(0, int.Parse(xAttribute.Value))); NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue); property.SetUpload(xProperty.GetUpload()); } catch { Debug.LogError("ID:" + strID.Value + " Property Name:" + xAttribute.Name + " Value:" + xAttribute.Value); } } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2: { try { NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR2); //xValue.Set(new NFGUID(0, int.Parse(xAttribute.Value))); NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue); property.SetUpload(xProperty.GetUpload()); } catch { Debug.LogError("ID:" + strID.Value + " Property Name:" + xAttribute.Name + " Value:" + xAttribute.Value); } } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3: { try { NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR3); //xValue.Set(new NFGUID(0, int.Parse(xAttribute.Value))); NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue); property.SetUpload(xProperty.GetUpload()); } catch { Debug.LogError("ID:" + strID.Value + " Property Name:" + xAttribute.Name + " Value:" + xAttribute.Value); } } break; default: break; } } } } } }