// Use this for initialization void Start() { mxThis = this.transform; xCamera = this.GetComponent <Camera>(); NFrame.NFIClass xLogicClass = NFrame.NFCKernelModule.Instance.GetLogicClassModule().GetElement("Scene"); List <string> xList = xLogicClass.GetConfigNameList(); for (int i = 0; i < xList.Count; ++i) { string strName = (string)xList[i]; string strCamOffestPos = NFrame.NFCKernelModule.Instance.GetElementModule().QueryPropertyString(strName, "CamOffestPos"); string strCamOffestRot = NFrame.NFCKernelModule.Instance.GetElementModule().QueryPropertyString(strName, "CamOffestRot"); NFrame.NFDataList xCamOffestPosList = new NFrame.NFDataList(strCamOffestPos, ','); NFrame.NFDataList xCamOffestRotList = new NFrame.NFDataList(strCamOffestRot, ','); if (xCamOffestPosList.Count() == 3 && xCamOffestRotList.Count() == 2) { OffestPos xOffestPos = new OffestPos(); xOffestPos.offsetX = float.Parse(xCamOffestPosList.StringVal(0)); xOffestPos.offsetY = float.Parse(xCamOffestPosList.StringVal(1)); xOffestPos.offsetZ = float.Parse(xCamOffestPosList.StringVal(2)); xOffestPos.XRot = float.Parse(xCamOffestRotList.StringVal(0)); xOffestPos.YRot = float.Parse(xCamOffestRotList.StringVal(1)); mxOffestPosList[int.Parse(strName)] = xOffestPos; } } }
public abstract int FindString(int nCol, string value, ref NFDataList varResult);
// Logic Event public void OnLoginSuccess(int eventId, NFDataList valueList) { //mUIModule.ShowUI<NFUISelectServer>(); RequireWorldList(); }
private void ADD_ROW(NFGUID self, string strRecordName, NFMsg.RecordAddRowStruct xAddStruct) { NFIObject go = NFCKernelModule.Instance.GetObject(self); 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] = NFNetController.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; default: break; } } else { //���� //Debug.LogException(i); } } NFIRecord xRecord = xRecordManager.GetRecord(strRecordName); if (null == xRecord) { xRecord = xRecordManager.AddRecord(strRecordName, 512, varListDesc); } 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(); 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"]; 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); xRecord.SetUpload(bUpload); } } } } }
public void RequireAddRow(NFGUID objectID, string strRecordName, int nRow) { NFMsg.ObjectRecordAddRow xData = new NFMsg.ObjectRecordAddRow(); xData.PlayerId = mHelpModule.NFToPB(objectID); xData.RecordName = ByteString.CopyFromUtf8(strRecordName); NFMsg.RecordAddRowStruct xRecordAddRowStruct = new NFMsg.RecordAddRowStruct(); xData.RowData.Add(xRecordAddRowStruct); xRecordAddRowStruct.Row = nRow; NFIObject xObject = mKernelModule.GetObject(objectID); NFIRecord xRecord = xObject.GetRecordManager().GetRecord(strRecordName); NFDataList xRowData = xRecord.QueryRow(nRow); for (int i = 0; i < xRowData.Count(); i++) { switch (xRowData.GetType(i)) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { NFMsg.RecordInt xRecordInt = new NFMsg.RecordInt(); xRecordInt.Row = nRow; xRecordInt.Col = i; xRecordInt.Data = xRowData.IntVal(i); xRecordAddRowStruct.RecordIntList.Add(xRecordInt); } break; case NFDataList.VARIANT_TYPE.VTYPE_FLOAT: { NFMsg.RecordFloat xRecordFloat = new NFMsg.RecordFloat(); xRecordFloat.Row = nRow; xRecordFloat.Col = i; xRecordFloat.Data = (float)xRowData.FloatVal(i); xRecordAddRowStruct.RecordFloatList.Add(xRecordFloat); } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { NFMsg.RecordString xRecordString = new NFMsg.RecordString(); xRecordString.Row = nRow; xRecordString.Col = i; xRecordString.Data = ByteString.CopyFromUtf8(xRowData.StringVal(i)); xRecordAddRowStruct.RecordStringList.Add(xRecordString); } break; case NFDataList.VARIANT_TYPE.VTYPE_OBJECT: { NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject(); xRecordObject.Row = nRow; xRecordObject.Col = i; xRecordObject.Data = mHelpModule.NFToPB(xRowData.ObjectVal(i)); xRecordAddRowStruct.RecordObjectList.Add(xRecordObject); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2: { NFMsg.RecordVector2 xRecordVector = new NFMsg.RecordVector2(); xRecordVector.Row = nRow; xRecordVector.Col = i; xRecordVector.Data = mHelpModule.NFToPB(xRowData.Vector2Val(i)); xRecordAddRowStruct.RecordVector2List.Add(xRecordVector); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3: { NFMsg.RecordVector3 xRecordVector = new NFMsg.RecordVector3(); xRecordVector.Row = nRow; xRecordVector.Col = i; xRecordVector.Data = mHelpModule.NFToPB(xRowData.Vector3Val(i)); xRecordAddRowStruct.RecordVector3List.Add(xRecordVector); } break; } } mxBody.SetLength(0); xData.WriteTo(mxBody); Debug.Log("send upload record addRow"); SendMsg((int)NFMsg.EGameMsgID.AckAddRow, mxBody); }
private void ADD_ROW(NFGUID self, string strRecordName, NFMsg.RecordAddRowStruct xAddStruct) { NFIObject go = mKernelModule.GetObject(self); if (go == null) { Debug.LogError("error id" + self); 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; if (addStringStruct.data != null) { recordVecData[addStringStruct.col] = addStringStruct.data.ToStringUtf8(); } else { recordVecData[addStringStruct.col] = ""; } } } 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); }
public abstract NFIProperty AddProperty(string strPropertyName, NFDataList varData);
public abstract void DoEvent(NFGUID self, int nEventID, NFDataList valueList);
public abstract void RegisterCallback(NFGUID self, int nEventID, NFIEvent.EventHandler handler, NFDataList valueList);
public abstract NFIRecord AddRecord(string strRecordName, int nRow, NFDataList varData);
public override void RegisterCallback(NFGUID self, int nEventID, NFIEvent.EventHandler handler, NFDataList valueList) { Dictionary <int, NFIEvent> xData; if (!mhtEvent.ContainsKey(self)) { xData = new Dictionary <int, NFIEvent>(); xData.Add(nEventID, new NFCEvent(self, nEventID, valueList)); mhtEvent.Add(self, xData); return; } xData = mhtEvent[self]; if (!xData.ContainsKey(nEventID)) { xData.Add(nEventID, new NFCEvent(self, nEventID, valueList)); return; } NFIEvent identEvent = (NFIEvent)mhtEvent[self][nEventID]; identEvent.RegisterCallback(handler); }
public T ShowUI <T>(bool bCloseLastOne = true, bool bPushHistory = true, NFDataList varList = null) where T : NFUIDialog { /* * if (mCurrentDialog != null && bCloseLastOne) * { * Debug.Log("close ui " + mCurrentDialog.gameObject.name); * * mCurrentDialog.gameObject.SetActive(false); * mCurrentDialog = null; * } */ string name = typeof(T).ToString(); GameObject uiObject; if (!mAllUIs.TryGetValue(name, out uiObject)) { GameObject perfb = Resources.Load <GameObject>("UI/" + name); if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.LinuxEditor) { //perfb = Resources.Load<GameObject>("UI/" + name); } else { //perfb = Resources.Load<GameObject>("UI/PC/" + name); } uiObject = GameObject.Instantiate(perfb); uiObject.name = name; uiObject.transform.SetParent(NFRoot.Instance().transform); mAllUIs.Add(name, uiObject); T panel = uiObject.GetComponent <T>(); panel.Init(); } else { uiObject.SetActive(true); Debug.Log("open ui " + uiObject.gameObject.name); } if (uiObject) { T panel = uiObject.GetComponent <T>(); if (varList != null) { panel.mUserData = varList; } mCurrentDialog = panel; uiObject.SetActive(true); Debug.Log("open ui " + uiObject.gameObject.name); if (bPushHistory) { mDialogs.Enqueue(panel); } return(panel); } return(null); }
public void OnSelectServer(int eventId, NFDataList valueList) { RequireRoleList(); }
public abstract int FindObject(int nCol, NFGUID value, ref NFDataList varResult);
public abstract int FindVector3(int nCol, NFVector3 value, ref NFDataList varResult);
public NFCEvent(NFGUID self, int nEventID, NFDataList valueList) { mSelf = self; mnEventID = nEventID; mArgValueList = valueList; }
public abstract bool SetProperty(string strPropertyName, NFDataList varData);
public abstract int AddRow(int nRow, NFDataList var);
private void LoadInstanceElement(NFIClass xLogicClass) { string strLogicPath = mstrRootPath; strLogicPath += xLogicClass.GetInstance(); XmlDocument xmldoc = new XmlDocument(); if (xLogicClass.GetEncrypt()) { /////////////////////////////////////////////////////////////////////////////////////// StreamReader cepherReader = new StreamReader(strLogicPath);; string strContent = cepherReader.ReadToEnd(); cepherReader.Close(); byte[] data = Convert.FromBase64String(strContent); string res = System.Text.ASCIIEncoding.Default.GetString(data); xmldoc.LoadXml(res); ///////////////////////////////////////////////////////////////// } else { 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; } } } } } }
// set data public abstract int SetValue(int nRow, NFDataList var);
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 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; } } } }
//public abstract int FindRow( int nRow ); public abstract int FindColValue(int nCol, NFDataList var, ref NFDataList varResult);
private void AttachObjectData(NFGUID self) { ObjectDataBuff xDataBuff; if (mxObjectDataBuff.TryGetValue(self, out xDataBuff)) { ////////////////record for (int j = 0; j < xDataBuff.xRecordList.record_list.Count; j++) { NFMsg.ObjectRecordBase xObjectRecordBase = xDataBuff.xRecordList.record_list[j]; string srRecordName = System.Text.Encoding.Default.GetString(xObjectRecordBase.record_name); for (int k = 0; k < xObjectRecordBase.row_struct.Count; ++k) { NFMsg.RecordAddRowStruct xAddRowStruct = xObjectRecordBase.row_struct[k]; ADD_ROW(self, System.Text.Encoding.Default.GetString(xObjectRecordBase.record_name), xAddRowStruct); } } ////////////////property NFIObject go = NFCKernelModule.Instance.GetObject(NFNetController.PBToNF(xDataBuff.xPropertyList.player_id)); NFIPropertyManager xPropertyManager = go.GetPropertyManager(); for (int j = 0; j < xDataBuff.xPropertyList.property_int_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xDataBuff.xPropertyList.property_int_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList varList = new NFDataList(); varList.AddInt(0); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetInt(xDataBuff.xPropertyList.property_int_list[j].data); } for (int j = 0; j < xDataBuff.xPropertyList.property_float_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xDataBuff.xPropertyList.property_float_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList varList = new NFDataList(); varList.AddFloat(0); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetFloat(xDataBuff.xPropertyList.property_float_list[j].data); } for (int j = 0; j < xDataBuff.xPropertyList.property_string_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xDataBuff.xPropertyList.property_string_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList varList = new NFDataList(); varList.AddString(""); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetString(System.Text.Encoding.Default.GetString(xDataBuff.xPropertyList.property_string_list[j].data)); } for (int j = 0; j < xDataBuff.xPropertyList.property_object_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xDataBuff.xPropertyList.property_object_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList varList = new NFDataList(); varList.AddObject(new NFGUID()); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetObject(NFNetController.PBToNF(xDataBuff.xPropertyList.property_object_list[j].data)); } } }
public abstract int FindInt(int nCol, Int64 value, ref NFDataList varResult);
public abstract int FindFloat(int nCol, double value, ref NFDataList varResult);
public void MainU3D() { Debug.Log("****************NFDataList******************"); NFDataList var = new NFDataList(); for (int i = 0; i < 9; i += 3) { var.AddInt(i); var.AddFloat((float)i + 1); var.AddString((i + 2).ToString()); } for (int i = 0; i < 9; i += 3) { Int64 n = var.IntVal(i); double f = var.FloatVal(i + 1); string str = var.StringVal(i + 2); Debug.Log(n); Debug.Log(f); Debug.Log(str); } Debug.Log("***************NFProperty*******************"); NFGUID ident = new NFGUID(0, 1); NFIObject gameObject = xKernel.CreateObject(ident, 0, 0, "", "", new NFDataList()); NFDataList valueProperty = new NFDataList(); valueProperty.AddInt(112221); gameObject.GetPropertyManager().AddProperty("111", valueProperty); Debug.Log(gameObject.QueryPropertyInt("111")); Debug.Log("***************NFRecord*******************"); NFDataList valueRecord = new NFDataList(); valueRecord.AddInt(0); valueRecord.AddFloat(0); valueRecord.AddString(""); valueRecord.AddObject(ident); gameObject.GetRecordManager().AddRecord("testRecord", 10, valueRecord); xKernel.SetRecordInt(ident, "testRecord", 0, 0, 112221); xKernel.SetRecordFloat(ident, "testRecord", 0, 1, 1122210.0f); xKernel.SetRecordString(ident, "testRecord", 0, 2, ";;;;;;112221"); xKernel.SetRecordObject(ident, "testRecord", 0, 3, ident); Debug.Log(gameObject.QueryRecordInt("testRecord", 0, 0)); Debug.Log(gameObject.QueryRecordFloat("testRecord", 0, 1)); Debug.Log(gameObject.QueryRecordString("testRecord", 0, 2)); Debug.Log(gameObject.QueryRecordObject("testRecord", 0, 3)); Debug.Log(" "); Debug.Log("***************PropertyNFEvent*******************"); //挂属性回调,挂表回调 xKernel.RegisterPropertyCallback(ident, "111", OnPropertydHandler); xKernel.SetPropertyInt(ident, "111", 2456); Debug.Log(" "); Debug.Log("***************RecordNFEvent*******************"); xKernel.RegisterRecordCallback(ident, "testRecord", OnRecordEventHandler); xKernel.SetRecordInt(ident, "testRecord", 0, 0, 1111111); Debug.Log(" "); Debug.Log("***************ClassNFEvent*******************"); xKernel.RegisterClassCallBack("CLASSAAAAA", OnClassHandler); xKernel.CreateObject(new NFGUID(0, 2), 0, 0, "CLASSAAAAA", "CONFIGINDEX", new NFDataList()); xKernel.DestroyObject(new NFGUID(0, 2)); Debug.Log(" "); Debug.Log("***************NFHeartBeat*******************"); xKernel.AddHeartBeat(new NFGUID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, 1); }