private void EGMI_ACK_PROPERTY_OBJECT(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize <NFMsg.MsgBase>(stream); NFMsg.ObjectPropertyObject propertyData = new NFMsg.ObjectPropertyObject(); propertyData = Serializer.Deserialize <NFMsg.ObjectPropertyObject>(new MemoryStream(xMsg.msg_data)); NFIObject go = NFCKernel.Instance.GetObject(PBToNF(propertyData.player_id)); for (int i = 0; i < propertyData.property_list.Count; i++) { NFIPropertyManager propertyManager = go.GetPropertyManager(); NFIProperty property = propertyManager.GetProperty(System.Text.Encoding.Default.GetString(propertyData.property_list[i].property_name)); if (null == property) { NFIDataList varList = new NFCDataList(); varList.AddObject(new NFIDENTID()); property = propertyManager.AddProperty(System.Text.Encoding.Default.GetString(propertyData.property_list[i].property_name), varList); } property.SetObject(PBToNF(propertyData.property_list[i].data)); } }
//////////////////////////////////////////////////////////// void OnOpratorGUI(int nHeight, int nWidth) { ////////////////////////////////// if (null != mxClient && mxClient.IsConnected() && mPlayerState == PLAYER_STATE.E_PLAYER_GAMEING) { ////聊天 scrollVecChatMsg = GUI.BeginScrollView(new Rect(350, nHeight / 2 + 20, 240, nHeight / 2 - 50), scrollVecChatMsg, new Rect(0, 0, 1500, 3000)); int nChatIndex = 0; for (int i = mxListener.aChatMsgList.Count - 1; i >= 0; i--) { string strData = (string)mxListener.aChatMsgList[i]; GUI.Label(new Rect(0, nChatIndex * 20, 2000, 20), strData); nChatIndex++; } GUI.EndScrollView(); ////网络消息 scrollVecMsg = GUI.BeginScrollView(new Rect(560 + 40, nHeight / 2 + 20, 240, nHeight / 2 - 50), scrollVecMsg, new Rect(0, 0, 1500, 3000)); int nNetIndex = 0; for (int i = mxListener.aMsgList.Count - 1; i >= 0; i--) { string strData = (string)mxListener.aMsgList[i]; GUI.Label(new Rect(0, nNetIndex * 20, 2000, 20), strData); nNetIndex++; } GUI.EndScrollView(); //操作功能区 scrollVecBtn = GUI.BeginScrollView(new Rect(850, 535, 410, nHeight / 2 - 50), scrollVecBtn, new Rect(0, 0, 500, 1200)); //////////////////////////////////////////////////////////////////////////////////////////////// if (GUI.Button(new Rect(0, 0, 100, 50), "SwapScene")) { mxSendLogic.RequireSwapScene(nMainRoleID, 0, int.Parse(strReqSwapSceneID), -1); } strReqSwapSceneID = GUI.TextField(new Rect(100, 0, 100, 50), strReqSwapSceneID); strReqSwapGroupID = GUI.TextField(new Rect(200, 0, 100, 50), strReqSwapGroupID); //////////////////////////////////////////////////////////////////////////////////////////////// if (GUI.Button(new Rect(0, 50, 100, 50), "Move")) { mxSendLogic.RequireMove(nMainRoleID, float.Parse(strReqMoveX), float.Parse(strReqMoveZ)); } strReqMoveX = GUI.TextField(new Rect(100, 50, 100, 50), strReqMoveX); strReqMoveZ = GUI.TextField(new Rect(200, 50, 100, 50), strReqMoveZ); //////////////////////////////////////////////////////////////////////////////////////////////// if (GUI.Button(new Rect(0, 100, 100, 50), "Chat")) { mxSendLogic.RequireChat(nMainRoleID, new NFrame.NFGUID(), 3, strChatData); //test if (false) { int value = int.Parse(strChatData); NFIObject obj = NFCKernelModule.Instance.GetObject(nMainRoleID); NFIPropertyManager propertyManager = obj.GetPropertyManager(); NFIProperty property = propertyManager.GetProperty("Gold"); property.SetInt(value); } } strChatData = GUI.TextField(new Rect(100, 100, 300, 50), strChatData); //////////////////////////////////////////////////////////////////////////////////////////////// if (GUI.Button(new Rect(0, 150, 100, 50), "UseSkill")) { NFGUID xMonsterID = new NFGUID(); xMonsterID.Parse(strReqKillNPCID, out xMonsterID); mxSendLogic.RequireUseSkill(nMainRoleID, "", xMonsterID, 0f, 0f, 0f, 0f); } strReqKillID = GUI.TextField(new Rect(100, 150, 100, 50), strReqKillID); strReqKillNPCID = GUI.TextField(new Rect(200, 150, 200, 50), strReqKillNPCID); /* * * * //////////////////////////////////////////////////////////////////////////////////////////////// * * if (GUI.Button(new Rect(0, 150, 100, 50), "交任务")) * { * sendLogic.RequireCompeleteTask(nSelfID, strReqAcceptTaskID); * } * strReqAcceptTaskID = GUI.TextField(new Rect(100, 150, 100, 50), strReqAcceptTaskID); * * //////////////////////////////////////////////////////////////////////////////////////////////// * * * * //////////////////////////////////////////////////////////////////////////////////////////////// * if (GUI.Button(new Rect(0, 250, 100, 50), "使用道具")) * { * sendLogic.RequireUseItem(long.Parse(strReqUseItemID), nSelfID); * } * strReqUseItemID = GUI.TextField(new Rect(100, 250, 100, 50), strReqUseItemID); * * //////////////////////////////////////////////////////////////////////////////////////////////// * * if (GUI.Button(new Rect(0, 300, 100, 50), "拾取")) * { * sendLogic.RequirePickUpItem(long.Parse(strPickUpItemID)); * } * strPickUpItemID = GUI.TextField(new Rect(100, 300, 100, 50), strPickUpItemID); * * //////////////////////////////////////////////////////////////////////////////////////////////// * if (GUI.Button(new Rect(0, 450, 100, 50), "接任务")) * { * sendLogic.RequireAcceptTask(strReqAcceptTaskID); * } * strReqAcceptTaskID = GUI.TextField(new Rect(100, 450, 100, 50), strReqAcceptTaskID); * */ // if (GUI.Button(new Rect(0, 350, 100, 50), "Set Property")) // { // //mxSendLogic.RequireProperty(nMainRoleID, strReqSetProperty, int.Parse(strReqPropertyValue)); // } // strReqSetProperty = GUI.TextField(new Rect(100, 350, 100, 50), strReqSetProperty); // strReqPropertyValue = GUI.TextField(new Rect(200, 350, 100, 50), strReqPropertyValue); //////////////////////////////////////////////////////////////////////////////////////////////// /* * if (GUI.Button(new Rect(0, 400, 100, 50), "添加道具")) * { * sendLogic.RequireItem(strReqAddItem, int.Parse(strAddCount)); * } * strReqAddItem = GUI.TextField(new Rect(100, 400, 100, 50), strReqAddItem); * strAddCount = GUI.TextField(new Rect(200, 400, 100, 50), strAddCount); */ //////////////////////////////////////////////////////////////////////////////////////////////// GUI.EndScrollView(); } }
void OnGMGUI(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; NFDataList objectList = mKernelModule.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 = mKernelModule.GetObject(xTargetIdent); if (null != go) { NFDataList recordLlist = go.GetRecordManager().GetRecordList(); NFDataList 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 List <string> xRecordList = new List <string>(); for (int j = 0; j < recordLlist.Count(); j++) { xRecordList.Add(recordLlist.StringVal(j)); } xRecordList.Sort(); for (int j = 0; j < xRecordList.Count; j++) { string strRecordName = xRecordList[j]; if (strRecordName.Length > 0) { if (GUI.Button(new Rect(0, nElementIndex * nElementHeight, nElementWidth, nElementHeight), "++" + strRecordName)) { strTableName = strRecordName; } nElementIndex++; } } /////////////////////////////// //all property List <string> xPropertyList = new List <string>(); for (int k = 0; k < propertyList.Count(); k++) { xPropertyList.Add(propertyList.StringVal(k)); } xPropertyList.Sort(); for (int k = 0; k < xPropertyList.Count; k++) { string strPropertyValue = null; string strPropertyName = xPropertyList[k]; NFIProperty property = go.GetPropertyManager().GetProperty(strPropertyName); NFDataList.VARIANT_TYPE eType = property.GetType(); switch (eType) { case NFDataList.VARIANT_TYPE.VTYPE_FLOAT: strPropertyValue = property.QueryFloat().ToString(); break; case NFDataList.VARIANT_TYPE.VTYPE_INT: strPropertyValue = property.QueryInt().ToString(); break; case NFDataList.VARIANT_TYPE.VTYPE_OBJECT: strPropertyValue = property.QueryObject().ToString(); break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: strPropertyValue = property.QueryString(); break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2: strPropertyValue = property.QueryVector2().ToString(); break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3: strPropertyValue = property.QueryVector3().ToString(); 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) + "]" + record.GetColTag(col)); } if (record.IsUsed(row)) { NFDataList.VARIANT_TYPE eType = record.GetColType(col); switch (eType) { case NFDataList.VARIANT_TYPE.VTYPE_INT: selString = record.QueryInt(row, col).ToString(); break; case NFDataList.VARIANT_TYPE.VTYPE_FLOAT: selString = record.QueryFloat(row, col).ToString(); break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: selString = record.QueryString(row, col); break; case NFDataList.VARIANT_TYPE.VTYPE_OBJECT: selString = record.QueryObject(row, col).ToString(); break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2: selString = record.QueryObject(row, col).ToString(); break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3: selString = record.QueryObject(row, col).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(); } } } } }
private void EGMI_ACK_OBJECT_PROPERTY_ENTRY(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize <NFMsg.MsgBase>(stream); NFMsg.MultiObjectPropertyList xMultiObjectPropertyList = new NFMsg.MultiObjectPropertyList(); xMultiObjectPropertyList = Serializer.Deserialize <NFMsg.MultiObjectPropertyList>(new MemoryStream(xMsg.msg_data)); for (int i = 0; i < xMultiObjectPropertyList.multi_player_property.Count; i++) { NFMsg.ObjectPropertyList xPropertyData = xMultiObjectPropertyList.multi_player_property[i]; NFIObject go = NFCKernel.Instance.GetObject(PBToNF(xPropertyData.player_id)); NFIPropertyManager xPropertyManager = go.GetPropertyManager(); for (int j = 0; j < xPropertyData.property_int_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xPropertyData.property_int_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFIDataList varList = new NFCDataList(); varList.AddInt(0); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetInt(xPropertyData.property_int_list[j].data); } for (int j = 0; j < xPropertyData.property_float_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xPropertyData.property_float_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFIDataList varList = new NFCDataList(); varList.AddFloat(0); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetFloat(xPropertyData.property_float_list[j].data); } for (int j = 0; j < xPropertyData.property_string_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xPropertyData.property_string_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFIDataList varList = new NFCDataList(); varList.AddString(""); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetString(System.Text.Encoding.Default.GetString(xPropertyData.property_string_list[j].data)); } for (int j = 0; j < xPropertyData.property_object_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xPropertyData.property_object_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFIDataList varList = new NFCDataList(); varList.AddObject(new NFIDENTID()); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetObject(PBToNF(xPropertyData.property_object_list[j].data)); } } }