private void OnNPCHPHandler(NFGUID self, string strProperty, NFDataList.TData oldVar, NFDataList.TData newVar) { if (newVar.IntVal() <= 0) { GameObject xNPC = GetObject(self); if (null != xNPC) { //HeroAnima xHeroAnima = xNPC.GetComponent<HeroAnima>(); //xHeroAnima.DeathTrigger(); //xHeroAnima.SetState(HeroAnima.AnimaState.DEAD, true); } } }
void PropertyEventHandler(NFGUID self, string strProperty, NFDataList.TData oldVar, NFDataList.TData newVar) { this.runSpeed = newVar.IntVal() / 100.0f; }
void RecordEventHandler(NFGUID self, string strRecordName, NFIRecord.ERecordOptype eType, int nRow, int nCol, NFDataList.TData oldVar, NFDataList.TData newVar) { if (ColValueCondition) { if (eType == NFIRecord.ERecordOptype.Add) { if (ColConditionNum >= 0 && ColConditionContent.Length > 0) { NFIRecord xRecord = mkernelModule.FindRecord(self, recordName); if (xRecord != null) { if (xRecord.GetCols() > ColConditionNum) { switch (xRecord.GetColType(ColConditionNum)) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { long value = xRecord.QueryInt(nRow, ColConditionNum); if (value.ToString() != ColConditionContent) { //remove return; } } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { string value = xRecord.QueryString(nRow, ColConditionNum); if (value != ColConditionContent) { //remove return; } } break; default: break; } } } } } else if (eType == NFIRecord.ERecordOptype.Update) { if (nCol == ColConditionNum) { if (ColConditionNum >= 0 && ColConditionContent.Length > 0) { NFIRecord xRecord = mkernelModule.FindRecord(self, recordName); if (xRecord != null) { if (xRecord.GetCols() > ColConditionNum) { switch (xRecord.GetColType(ColConditionNum)) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { long value = newVar.IntVal(); if (value.ToString() != ColConditionContent) { //remove DestroyObject(nRow); return; } } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { string value = newVar.StringVal(); if (value != ColConditionContent) { //remove DestroyObject(nRow); return; } } break; default: break; } } } } } } } if (ColPropertyCondition) { if (ColConditionNum >= 0 && ColConditionPropertyName.Length > 0 && ColConditionPropertyValue.Length > 0) { NFIRecord xRecord = mkernelModule.FindRecord(self, recordName); if (xRecord != null) { if (xRecord.GetCols() > ColConditionNum) { switch (xRecord.GetColType(ColConditionNum)) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { long value = xRecord.QueryInt(nRow, ColConditionNum); NFIElement xElement = mElementModule.GetElement(value.ToString()); if (xElement == null) { Debug.LogError("Col:" + ColConditionNum.ToString() + " Value:" + value.ToString()); return; } NFIProperty xProperty = xElement.GetPropertyManager().GetProperty(ColConditionPropertyName); if (xProperty == null) { Debug.LogError("Col:" + ColConditionNum.ToString() + " Value:" + value.ToString() + " Property:" + ColConditionPropertyName); return; } if (xProperty.GetData() != null) { switch (xProperty.GetData().GetType()) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { if (xProperty.QueryInt().ToString() != ColConditionPropertyValue) { return; } } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { if (xProperty.QueryString() != ColConditionPropertyValue) { return; } } break; } } } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { string value = xRecord.QueryString(nRow, ColConditionNum); NFIElement xElement = mElementModule.GetElement(value); if (xElement == null) { Debug.LogError("Col:" + ColConditionNum.ToString() + " Value:" + value); return; } NFIProperty xProperty = xElement.GetPropertyManager().GetProperty(ColConditionPropertyName); if (xProperty == null) { Debug.LogError("Col:" + ColConditionNum.ToString() + " Value:" + value + " Property:" + ColConditionPropertyName); return; } if (xProperty.GetData() != null) { switch (xProperty.GetData().GetType()) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { if (xProperty.QueryInt().ToString() != ColConditionPropertyValue) { return; } } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { if (xProperty.QueryString() != ColConditionPropertyValue) { return; } } break; } } } break; default: break; } } } } } switch (eType) { case NFIRecord.ERecordOptype.Add: { NFRecordRowData rowData = new NFRecordRowData(); rowData.row = nRow; rowData.recordName = strRecordName; rowData.id = self; _data.Add(rowData); NFRoot.Instance().StartCoroutine(CreateObject(self, rowViewItem, rowData)); } break; case NFIRecord.ERecordOptype.Del: { int nIndex = -1; for (int i = 0; i < _data.Count; ++i) { NFRecordRowData rowData = _data[i]; if (rowData.row == nRow) { nIndex = i; break; } } if (nIndex >= 0) { _data.RemoveAt(nIndex); } NFRecordRowView[] rowViews = this.GetComponentsInChildren <NFRecordRowView>(); for (int i = 0; i < rowViews.Length; ++i) { NFRecordRowData rowData = rowViews[i].GetData(); if (rowData != null && rowData.row == nRow) { GameObject.Destroy(rowViews[i].gameObject); break; } } } break; case NFIRecord.ERecordOptype.Update: { if (ColValueCondition) { if (nCol == ColConditionNum) { int nIndex = -1; for (int i = 0; i < _data.Count; ++i) { NFRecordRowData rowData = _data[i]; if (rowData.row == nRow) { nIndex = i; break; } } if (nIndex < 0) { //add a new one NFRecordRowData rowData = new NFRecordRowData(); rowData.row = nRow; rowData.recordName = strRecordName; rowData.id = self; _data.Add(rowData); NFRoot.Instance().StartCoroutine(CreateObject(self, rowViewItem, rowData)); } } } { NFRecordRowView[] rowViews = this.GetComponentsInChildren <NFRecordRowView>(); for (int i = 0; i < rowViews.Length; ++i) { NFRecordRowData rowData = rowViews[i].GetData(); if (rowData != null && rowData.row == nRow) { rowViews[i].SetData(self, recordName, this, rowData); break; } } } } break; case NFIRecord.ERecordOptype.Create: break; case NFIRecord.ERecordOptype.Cleared: _data.Clear(); break; default: break; } }