public override bool SetString(int nRow, int nCol, string value) { if (nRow >= 0 && nRow < mnRow) { if (!mhtRecordVec.ContainsKey(nRow)) { AddRow(nRow); } NFIDataList valueList = (NFIDataList)mhtRecordVec[nRow]; if (valueList.GetType(nCol) == NFIDataList.VARIANT_TYPE.VTYPE_STRING) { if (valueList.StringVal(nCol) != value) { NFIDataList.TData oldValue = new NFIDataList.TData(NFIDataList.VARIANT_TYPE.VTYPE_STRING); NFIDataList.TData newValue = new NFIDataList.TData(NFIDataList.VARIANT_TYPE.VTYPE_STRING); oldValue.Set(valueList.StringVal(nCol)); newValue.Set(value); valueList.SetString(nCol, value); if (null != doHandleDel) { doHandleDel(mSelf, mstrRecordName, eRecordOptype.Updata, nRow, nCol, oldValue, newValue); } } } return(true); } return(false); }
public NFCDataList(NFIDataList src) { for (int i = 0; i < src.Count(); i++ ) { switch (src.GetType(i)) { case VARIANT_TYPE.VTYPE_INT: AddInt(src.IntVal(i)); break; case VARIANT_TYPE.VTYPE_FLOAT: AddFloat(src.FloatVal(i)); break; case VARIANT_TYPE.VTYPE_STRING: AddString(src.StringVal(i)); break; case VARIANT_TYPE.VTYPE_OBJECT: AddObject(src.ObjectVal(i)); break; case VARIANT_TYPE.VTYPE_VECTOR2: AddVector2(src.Vector2Val(i)); break; case VARIANT_TYPE.VTYPE_VECTOR3: AddVector3(src.Vector3Val(i)); break; default: break; } } }
public NFCDataList(NFIDataList src) { for (int i = 0; i < src.Count(); i++) { switch (src.GetType(i)) { case VARIANT_TYPE.VTYPE_INT: AddInt(src.IntVal(i)); break; case VARIANT_TYPE.VTYPE_FLOAT: AddFloat(src.FloatVal(i)); break; case VARIANT_TYPE.VTYPE_STRING: AddString(src.StringVal(i)); break; case VARIANT_TYPE.VTYPE_OBJECT: AddObject(src.ObjectVal(i)); break; case VARIANT_TYPE.VTYPE_VECTOR2: AddVector2(src.Vector2Val(i)); break; case VARIANT_TYPE.VTYPE_VECTOR3: AddVector3(src.Vector3Val(i)); break; default: break; } } }
public void OnClassHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { NFIObject xObject = NFCKernelModule.Instance.GetObject(self); NFIPropertyManager xPropertyManager = xObject.GetPropertyManager(); NFIDataList xPropertyNameList = xPropertyManager.GetPropertyList(); for (int i = 0; i < xPropertyNameList.Count(); i++) { string strPropertyName = xPropertyNameList.StringVal(i); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (xProperty.GetUpload()) { xProperty.RegisterCallback(OnPropertyHandler); } } NFIRecordManager xRecordManager = xObject.GetRecordManager(); NFIDataList xRecordNameList = xRecordManager.GetRecordList(); for (int i = 0; i < xRecordNameList.Count(); i++) { string strRecodeName = xRecordNameList.StringVal(i); NFIRecord xRecord = xRecordManager.GetRecord(strRecodeName); if (xRecord.GetUpload()) { xRecord.RegisterCallback(OnRecordHandler); } } } }
public NFCProperty(NFGUID self, string strPropertyName, NFIDataList varData) { mSelf = self; msPropertyName = strPropertyName; mxData = new NFIDataList.TData(varData.GetType(0)); switch (varData.GetType(0)) { case NFIDataList.VARIANT_TYPE.VTYPE_INT: mxData.Set(varData.IntVal(0)); break; case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT: mxData.Set(varData.FloatVal(0)); break; case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE: mxData.Set(varData.DoubleVal(0)); break; case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT: mxData.Set(varData.ObjectVal(0)); break; case NFIDataList.VARIANT_TYPE.VTYPE_STRING: mxData.Set(varData.StringVal(0)); break; default: break; } }
public NFCProperty( NFGUID self, string strPropertyName, NFIDataList varData) { mSelf = self; msPropertyName = strPropertyName; mxData = new NFIDataList.TData(varData.GetType(0)); switch (varData.GetType(0)) { case NFIDataList.VARIANT_TYPE.VTYPE_INT: mxData.Set(varData.IntVal(0)); break; case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT: mxData.Set(varData.FloatVal(0)); break; case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE: mxData.Set(varData.DoubleVal(0)); break; case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT: mxData.Set(varData.ObjectVal(0)); break; case NFIDataList.VARIANT_TYPE.VTYPE_STRING: mxData.Set(varData.StringVal(0)); break; default: break; } }
public override string QueryString(int nRow, int nCol) { NFIDataList valueList = QueryRow(nRow); if (null != valueList) { return(valueList.StringVal(nCol)); } return(NFIDataList.NULL_STRING); }
public override int FindString(int nCol, string value, ref NFIDataList varResult) { foreach (int i in mhtRecordVec.Keys) { NFIDataList valueList = (NFIDataList)mhtRecordVec[i]; if (valueList.StringVal(nCol) == value) { varResult.AddInt(i); } } return(varResult.Count()); }
public override int FindString(int nCol, string value) { foreach (int i in mhtRecordVec.Keys) { NFIDataList valueList = (NFIDataList)mhtRecordVec[i]; if (valueList.StringVal(nCol) == value) { return(i); } } return(-1); }
void AddBasePropertyFormOther(string strName, string strOther) { NFILogicClass xOtherClass = GetElement(strOther); NFILogicClass xLogicClass = GetElement(strName); if (null != xLogicClass && null != xOtherClass) { NFIDataList 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 InitRecord(NFGUID self, string strClassName) { NFILogicClass xLogicClass = mxLogicClassModule.GetElement(strClassName); NFIDataList 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(); xRecordManager.AddRecord(strRecordyName, xRecord.GetRows(), xRecord.GetColsData()); } }
void InitProperty(NFGUID self, string strClassName) { NFILogicClass xLogicClass = mxLogicClassModule.GetElement(strClassName); NFIDataList 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(); xPropertyManager.AddProperty(strPropertyName, xProperty.GetData()); } }
void InitProperty(NFGUID self, string strClassName) { NFILogicClass xLogicClass = mxLogicClassModule.GetElement(strClassName); NFIDataList 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()); } } }
public override void Shut() { NFIDataList xRecordList = mRecordManager.GetRecordList(); if (null != xRecordList) { for (int i = 0; i < xRecordList.Count(); ++i) { string strRecordName = xRecordList.StringVal(i); NFIRecord xRecord = mRecordManager.GetRecord(strRecordName); if (null != xRecord) { xRecord.Clear(); } } } mRecordManager = null; mPropertyManager = null; mHeartManager = null; return; }
public void RequirePropertyString(NFrame.NFGUID objectID, string strPropertyName, NFIDataList.TData newVar) { NFMsg.ObjectPropertyString xData = new NFMsg.ObjectPropertyString(); xData.player_id = NFBinarySendLogic.NFToPB(objectID); NFMsg.PropertyString xPropertyString = new NFMsg.PropertyString(); xPropertyString.property_name = System.Text.Encoding.Default.GetBytes(strPropertyName); xPropertyString.data = System.Text.Encoding.Default.GetBytes(newVar.StringVal()); xData.property_list.Add(xPropertyString); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ObjectPropertyString>(stream, xData); Debug.Log("send upload String"); NFStart.Instance.GetFocusSender().SendMsg(objectID, NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_STRING, stream); }
public override bool SetData(NFIDataList.TData x) { if (NFIDataList.VARIANT_TYPE.VTYPE_UNKNOWN == mxData.GetType() || x.GetType() == mxData.GetType()) { switch (mxData.GetType()) { case NFIDataList.VARIANT_TYPE.VTYPE_INT: SetInt(x.IntVal()); break; case NFIDataList.VARIANT_TYPE.VTYPE_STRING: SetString(x.StringVal()); break; case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT: SetFloat((float)x.DoubleVal()); break; case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE: SetDouble(x.DoubleVal()); break; case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT: SetObject(x.ObjectVal()); break; default: break; } return true; } return false; }
public override bool SetData(NFIDataList.TData x) { if (NFIDataList.VARIANT_TYPE.VTYPE_UNKNOWN == mxData.GetType() || x.GetType() == mxData.GetType()) { switch (mxData.GetType()) { case NFIDataList.VARIANT_TYPE.VTYPE_INT: SetInt(x.IntVal()); break; case NFIDataList.VARIANT_TYPE.VTYPE_STRING: SetString(x.StringVal()); break; case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT: SetFloat(x.FloatVal()); break; case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT: SetObject(x.ObjectVal()); break; case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR2: SetVector2(x.Vector2Val()); break; case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR3: SetVector3(x.Vector3Val()); break; default: break; } return true; } return false; }
public void RequireRecordString(NFrame.NFGUID self, string strRecordName, int nRow, int nCol, NFIDataList.TData newVar) { NFMsg.ObjectRecordString xData = new NFMsg.ObjectRecordString(); xData.player_id = NFBinarySendLogic.NFToPB(self); xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName); NFMsg.RecordString xRecordString = new NFMsg.RecordString(); xData.property_list.Add(xRecordString); xRecordString.row = nRow; xRecordString.col = nCol; xRecordString.data = System.Text.Encoding.Default.GetBytes(newVar.StringVal()); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ObjectRecordString>(stream, xData); Debug.Log("send upload record string"); SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_RECORD_STRING, stream); }
public override NFIObject CreateObject(NFGUID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, NFIDataList arg) { if (!mhtObject.ContainsKey(self)) { NFIObject xNewObject = new NFCObject(self, nContainerID, nGroupID, strClassName, strConfigIndex); mhtObject.Add(self, xNewObject); NFCDataList varConfigID = new NFCDataList(); varConfigID.AddString(strConfigIndex); xNewObject.GetPropertyManager().AddProperty("ConfigID", varConfigID); NFCDataList varConfigClass = new NFCDataList(); varConfigClass.AddString(strClassName); xNewObject.GetPropertyManager().AddProperty("ClassName", varConfigClass); if (arg.Count() % 2 == 0) { for (int i = 0; i < arg.Count() - 1; i += 2) { string strPropertyName = arg.StringVal(i); NFIDataList.VARIANT_TYPE eType = arg.GetType(i + 1); switch (eType) { case NFIDataList.VARIANT_TYPE.VTYPE_INT: { NFIDataList xDataList = new NFCDataList(); xDataList.AddInt(arg.IntVal(i+1)); xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList); } break; case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT: { NFIDataList xDataList = new NFCDataList(); xDataList.AddFloat(arg.FloatVal(i + 1)); xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList); } break; case NFIDataList.VARIANT_TYPE.VTYPE_STRING: { NFIDataList xDataList = new NFCDataList(); xDataList.AddString(arg.StringVal(i + 1)); xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList); } break; case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT: { NFIDataList xDataList = new NFCDataList(); xDataList.AddObject(arg.ObjectVal(i + 1)); xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList); } break; case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR2: { NFIDataList xDataList = new NFCDataList(); xDataList.AddVector2(arg.Vector2Val(i + 1)); xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList); } break; case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR3: { NFIDataList xDataList = new NFCDataList(); xDataList.AddVector3(arg.Vector3Val(i + 1)); xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList); } break; default: break; } } } InitProperty(self, strClassName); InitRecord(self, strClassName); ClassHandleDel xHandleDel = (ClassHandleDel)mhtClassHandleDel[strClassName]; if (null != xHandleDel && null != xHandleDel.GetHandler()) { NFIObject.ClassEventHandler xHandlerList = xHandleDel.GetHandler(); xHandlerList(self, nContainerID, nGroupID, NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE, strClassName, strConfigIndex); xHandlerList(self, nContainerID, nGroupID, NFIObject.CLASS_EVENT_TYPE.OBJECT_LOADDATA, strClassName, strConfigIndex); xHandlerList(self, nContainerID, nGroupID, NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH, strClassName, strConfigIndex); } //NFCLog.Instance.Log(NFCLog.LOG_LEVEL.DEBUG, "Create object: " + self.ToString() + " ClassName: " + strClassName + " SceneID: " + nContainerID + " GroupID: " + nGroupID); return xNewObject; } return null; }
public override NFIObject CreateObject(NFGUID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, NFIDataList arg) { if (!mhtObject.ContainsKey(self)) { NFIObject xNewObject = new NFCObject(self, nContainerID, nGroupID, strClassName, strConfigIndex); mhtObject.Add(self, xNewObject); NFCDataList varConfigID = new NFCDataList(); varConfigID.AddString(strConfigIndex); xNewObject.GetPropertyManager().AddProperty("ConfigID", varConfigID); NFCDataList varConfigClass = new NFCDataList(); varConfigClass.AddString(strClassName); xNewObject.GetPropertyManager().AddProperty("ClassName", varConfigClass); if (arg.Count() % 2 == 0) { for (int i = 0; i < arg.Count() - 1; i += 2) { string strPropertyName = arg.StringVal(i); NFIDataList.VARIANT_TYPE eType = arg.GetType(i + 1); switch (eType) { case NFIDataList.VARIANT_TYPE.VTYPE_INT: { NFIDataList xDataList = new NFCDataList(); xDataList.AddInt(arg.IntVal(i + 1)); xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList); } break; case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT: { NFIDataList xDataList = new NFCDataList(); xDataList.AddFloat(arg.FloatVal(i + 1)); xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList); } break; case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE: { NFIDataList xDataList = new NFCDataList(); xDataList.AddDouble(arg.DoubleVal(i + 1)); xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList); } break; case NFIDataList.VARIANT_TYPE.VTYPE_STRING: { NFIDataList xDataList = new NFCDataList(); xDataList.AddString(arg.StringVal(i + 1)); xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList); } break; case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT: { NFIDataList xDataList = new NFCDataList(); xDataList.AddObject(arg.ObjectVal(i + 1)); xNewObject.GetPropertyManager().AddProperty(strPropertyName, xDataList); } break; default: break; } } } InitProperty(self, strClassName); InitRecord(self, strClassName); ClassHandleDel xHandleDel = (ClassHandleDel)mhtClassHandleDel[strClassName]; if (null != xHandleDel && null != xHandleDel.GetHandler()) { NFIObject.ClassEventHandler xHandlerList = xHandleDel.GetHandler(); xHandlerList(self, nContainerID, nGroupID, NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE, strClassName, strConfigIndex); xHandlerList(self, nContainerID, nGroupID, NFIObject.CLASS_EVENT_TYPE.OBJECT_LOADDATA, strClassName, strConfigIndex); xHandlerList(self, nContainerID, nGroupID, NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH, strClassName, strConfigIndex); } //NFCLog.Instance.Log(NFCLog.LOG_LEVEL.DEBUG, "Create object: " + self.ToString() + " ClassName: " + strClassName + " SceneID: " + nContainerID + " GroupID: " + nGroupID); return(xNewObject); } return(null); }