public bool OnPlayerMove(NFIDataList valueList) { NFGUID tar = valueList.ObjectVal(0); if (tar == NFCPlayerLogic.Instance().mRoleID) { return(true); } OtherPlayer player = transform.Find(tar.ToString()).GetComponent <OtherPlayer>(); double fSpeed = valueList.FloatVal(1); NFVector3 pos = valueList.Vector3Val(2); player.MoveTo(new Vector3(pos.X(), pos.Y(), pos.Z())); return(true); }
public void RequireAddRow(NFrame.NFGUID self, string strRecordName, int nRow) { NFMsg.ObjectRecordAddRow xData = new NFMsg.ObjectRecordAddRow(); xData.player_id = NFBinarySendLogic.NFToPB(self); xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName); NFMsg.RecordAddRowStruct xRecordAddRowStruct = new NFMsg.RecordAddRowStruct(); xData.row_data.Add(xRecordAddRowStruct); xRecordAddRowStruct.row = nRow; NFIObject xObject = NFCKernelModule.Instance.GetObject(self); NFIRecord xRecord = xObject.GetRecordManager().GetRecord(strRecordName); NFIDataList xRowData = xRecord.QueryRow(nRow); for (int i = 0; i < xRowData.Count(); i++) { switch (xRowData.GetType(i)) { case NFIDataList.VARIANT_TYPE.VTYPE_INT: { NFMsg.RecordInt xRecordInt = new NFMsg.RecordInt(); xRecordInt.row = nRow; xRecordInt.col = i; xRecordInt.data = xRowData.IntVal(i); xRecordAddRowStruct.record_int_list.Add(xRecordInt); } break; case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT: { NFMsg.RecordFloat xRecordFloat = new NFMsg.RecordFloat(); xRecordFloat.row = nRow; xRecordFloat.col = i; xRecordFloat.data = (float)xRowData.FloatVal(i); xRecordAddRowStruct.record_float_list.Add(xRecordFloat); } break; case NFIDataList.VARIANT_TYPE.VTYPE_STRING: { NFMsg.RecordString xRecordString = new NFMsg.RecordString(); xRecordString.row = nRow; xRecordString.col = i; xRecordString.data = System.Text.Encoding.Default.GetBytes(xRowData.StringVal(i)); xRecordAddRowStruct.record_string_list.Add(xRecordString); } break; case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT: { NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject(); xRecordObject.row = nRow; xRecordObject.col = i; xRecordObject.data = NFBinarySendLogic.NFToPB(xRowData.ObjectVal(i)); xRecordAddRowStruct.record_object_list.Add(xRecordObject); } break; case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR2: { NFMsg.RecordVector2 xRecordVector = new NFMsg.RecordVector2(); xRecordVector.row = nRow; xRecordVector.col = i; xRecordVector.data = NFBinarySendLogic.NFToPB(xRowData.Vector2Val(i)); xRecordAddRowStruct.record_vector2_list.Add(xRecordVector); } break; case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR3: { NFMsg.RecordVector3 xRecordVector = new NFMsg.RecordVector3(); xRecordVector.row = nRow; xRecordVector.col = i; xRecordVector.data = NFBinarySendLogic.NFToPB(xRowData.Vector3Val(i)); xRecordAddRowStruct.record_vector3_list.Add(xRecordVector); } break; } } MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ObjectRecordAddRow>(stream, xData); Debug.Log("send upload record addRow"); SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_ADD_ROW, stream); }
public void OnGUI(NFIKernelModule kernel, int nHeight, int nWidth) { if (buttonLeft == null) { buttonLeft = GUI.skin.button; buttonLeft.alignment = TextAnchor.MiddleLeft; } int nElementWidth = 300; int nElementHeight = 20; GUI.color = Color.red; strInfo = GUI.TextField(new Rect(0, nHeight - 20, nElementWidth, 20), strInfo); strCommand = GUI.TextField(new Rect(nElementWidth, nHeight - 20, 350, 20), strCommand); if (GUI.Button(new Rect(nElementWidth + 350, nHeight - 20, 100, 20), "cmd")) { } GUI.color = Color.white; NFIDataList objectList = kernel.GetObjectList(); scrollPositionFirst = GUI.BeginScrollView(new Rect(0, nElementHeight, nElementWidth / 2 + 20, nHeight - 100), scrollPositionFirst, new Rect(0, 0, nElementWidth, objectList.Count() * (nElementHeight))); //all object for (int i = 0; i < objectList.Count(); i++) { NFGUID ident = objectList.ObjectVal(i); if (GUI.Button(new Rect(0, i * nElementHeight, nElementWidth, nElementHeight), ident.nHead64.ToString() + "_" + ident.nData64.ToString())) { xTargetIdent = ident; strTableName = ""; strInfo = ident.ToString(); } } GUI.EndScrollView(); //////////////// if (!xTargetIdent.IsNull()) { NFIObject go = kernel.GetObject(xTargetIdent); if (null != go) { NFIDataList recordLlist = go.GetRecordManager().GetRecordList(); NFIDataList propertyList = go.GetPropertyManager().GetPropertyList(); int nAllElement = 1; for (int j = 0; j < recordLlist.Count(); j++) { string strRecordName = recordLlist.StringVal(j); if (strRecordName.Length > 0) { nAllElement++; } } for (int j = 0; j < propertyList.Count(); j++) { string strPropertyName = propertyList.StringVal(j); if (strPropertyName.Length > 0) { nAllElement++; } } ////////////////// scrollPositionSecond = GUI.BeginScrollView(new Rect(nElementWidth / 2 + 25, nElementHeight, nElementWidth / 2 + 25, nHeight - 100), scrollPositionSecond, new Rect(0, 0, nElementWidth, (nAllElement + 1) * (nElementHeight) + 1)); int nElementIndex = 0; GUI.Button(new Rect(0, nElementIndex * nElementHeight, nElementWidth, nElementHeight), xTargetIdent.ToString()); nElementIndex++; //all record for (int j = 0; j < recordLlist.Count(); j++) { string strRecordName = recordLlist.StringVal(j); if (strRecordName.Length > 0) { if (GUI.Button(new Rect(0, nElementIndex * nElementHeight, nElementWidth, nElementHeight), "++" + strRecordName)) { strTableName = strRecordName; } nElementIndex++; } } /////////////////////////////// //all property for (int k = 0; k < propertyList.Count(); k++) { string strPropertyValue = null; string strPropertyName = propertyList.StringVal(k); NFIProperty property = go.GetPropertyManager().GetProperty(strPropertyName); NFIDataList.VARIANT_TYPE eType = property.GetType(); switch (eType) { case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT: strPropertyValue = property.QueryFloat().ToString(); break; case NFIDataList.VARIANT_TYPE.VTYPE_INT: strPropertyValue = property.QueryInt().ToString(); break; case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT: strPropertyValue = property.QueryObject().nData64.ToString(); break; case NFIDataList.VARIANT_TYPE.VTYPE_STRING: strPropertyValue = property.QueryString(); break; default: strPropertyValue = "?"; break; } if (strPropertyName.Length > 0) { if (GUI.Button(new Rect(0, nElementIndex * nElementHeight, nElementWidth, nElementHeight), strPropertyName + ":" + strPropertyValue)) { strTableName = ""; strInfo = strPropertyName + ":" + strPropertyValue; } nElementIndex++; } } GUI.EndScrollView(); //////////////////////// if (strTableName.Length > 0) { NFIRecord record = go.GetRecordManager().GetRecord(strTableName); if (null != record) { int nRow = record.GetRows(); int nCol = record.GetCols(); int nOffest = 30; scrollPositionThird = GUI.BeginScrollView(new Rect(nElementWidth + 50, nElementHeight, nElementWidth * 3, nHeight / 2), scrollPositionThird, new Rect(0, 0, nElementWidth * nCol + nOffest, nRow * nElementHeight + nOffest)); string selString = null; for (int row = 0; row < nRow; row++) { GUI.Button(new Rect(0, row * nElementHeight + nOffest, nOffest, nElementHeight), row.ToString()); //row for (int col = 0; col < nCol; col++) { if (0 == row) { GUI.Button(new Rect(col * nElementWidth + nOffest, 0, nElementWidth, nElementHeight), col.ToString() + " [" + record.GetColType(col) + "]"); } if (record.IsUsed(row)) { NFIDataList.VARIANT_TYPE eType = record.GetColType(col); switch (eType) { case NFIDataList.VARIANT_TYPE.VTYPE_INT: selString = record.QueryInt(row, col).ToString(); break; case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT: selString = record.QueryFloat(row, col).ToString(); break; case NFIDataList.VARIANT_TYPE.VTYPE_STRING: selString = record.QueryString(row, col).ToString(); break; case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT: selString = record.QueryObject(row, col).nData64.ToString(); break; default: selString = "UnKnowType"; break; } } else { selString = "NoUse"; } if (GUI.Button(new Rect(col * nElementWidth + nOffest, row * nElementHeight + nOffest, nElementWidth, nElementHeight), selString)) { strInfo = "Row:" + row.ToString() + " Col:" + col.ToString() + " " + selString; } } } GUI.EndScrollView(); } } } } }