public bool DoCmd(string strArg, string strGMID) { NFMsg.EGameMsgID xMsgID = (NFMsg.EGameMsgID)Enum.Parse(typeof(NFMsg.EGameMsgID), strGMID); if (!mxGM.ContainsKey(xMsgID)) { Debug.LogWarning("GMID Error"); return(false); } string strOriginArg = (string)mxGM[xMsgID]; NFDataList xOriginArgList = new NFDataList(strOriginArg, ','); NFDataList xNowArgList = new NFDataList(strArg, ','); if (xOriginArgList.Count() != xNowArgList.Count()) { Debug.LogWarning("Arg Count Error"); return(false); } NFDataList xNowDataList = new NFDataList(); for (int i = 0; i < xOriginArgList.Count(); ++i) { string strOriginType = xOriginArgList.StringVal(i); switch (strOriginType) { case "VTYPE_INT": { string strNowDataInt = xNowArgList.StringVal(i); int nData = 0; if (!int.TryParse(strNowDataInt, out nData)) { Debug.LogWarning("Arg:" + i + " Can not parse to int:" + strNowDataInt); return(false); } xNowDataList.AddInt(nData); } break; case "VTYPE_FLOAT": { string strNowDataFloat = xNowArgList.StringVal(i); float fData = 0; if (!float.TryParse(strNowDataFloat, out fData)) { Debug.LogWarning("Arg:" + i + " Can not parse to float:" + strNowDataFloat); return(false); } xNowDataList.AddFloat(fData); } break; case "VTYPE_STRING": { string strNowData = xNowArgList.StringVal(i); xNowDataList.AddString(strNowData); } break; case "VTYPE_OBJECT": { string strNowDataObject = xNowArgList.StringVal(i); NFGUID xIdent = new NFGUID(); if (!xIdent.Parse(strNowDataObject)) { Debug.LogWarning("Arg:" + i + " Can not parse to Object:" + strNowDataObject); return(false); } xNowDataList.AddObject(xIdent); } break; default: break; } //NFDataList.VARIANT_TYPE } switch (xMsgID) { case NFMsg.EGameMsgID.EGMI_REQ_SWAP_SCENE: { //NFNetController.Instance.mxNetSender.RequireSwapScene(NFNetController.Instance.xMainRoleID, (int)xNowDataList.IntVal(0), (int)xNowDataList.IntVal(1), (int)xNowDataList.IntVal(3), 0f, 0f, 0f); } break; case NFMsg.EGameMsgID.EGMI_REQ_CMD_PROPERTY_INT: { //NFNetController.Instance.mxNetSender.RequireGMPropertyInt(NFNetController.Instance.xMainRoleID, xNowDataList.StringVal(0), xNowDataList.IntVal(1)); } break; case NFMsg.EGameMsgID.EGMI_REQ_CMD_PROPERTY_FLOAT: { //NFNetController.Instance.mxNetSender.RequireGMPropertyFloat(NFNetController.Instance.xMainRoleID, xNowDataList.StringVal(0), xNowDataList.FloatVal(1)); } break; case NFMsg.EGameMsgID.EGMI_REQ_CMD_PROPERTY_STR: { //NFNetController.Instance.mxNetSender.RequireGMPropertyStr(NFNetController.Instance.xMainRoleID, xNowDataList.StringVal(0), xNowDataList.StringVal(1)); } break; case NFMsg.EGameMsgID.EGMI_REQ_CMD_PROPERTY_OBJECT: { //NFNetController.Instance.mxNetSender.RequireGMPropertyObject(NFNetController.Instance.xMainRoleID, xNowDataList.StringVal(0), xNowDataList.ObjectVal(1)); } break; case NFMsg.EGameMsgID.EGMI_REQ_CMD_RECORD_INT: { //NFNetController.Instance.mxNetSender.RequireGMRecordInt(NFNetController.Instance.xMainRoleID, xNowDataList.StringVal(0), xNowDataList.IntVal(1), xNowDataList.IntVal(2), xNowDataList.IntVal(3)); } break; case NFMsg.EGameMsgID.EGMI_REQ_CMD_RECORD_FLOAT: { //NFNetController.Instance.mxNetSender.RequireGMRecordFloat(NFNetController.Instance.xMainRoleID, xNowDataList.StringVal(0), xNowDataList.IntVal(1), xNowDataList.IntVal(2), xNowDataList.FloatVal(3)); } break; case NFMsg.EGameMsgID.EGMI_REQ_CMD_RECORD_STR: { //NFNetController.Instance.mxNetSender.RequireGMRecordStr(NFNetController.Instance.xMainRoleID, xNowDataList.StringVal(0), xNowDataList.IntVal(1), xNowDataList.IntVal(2), xNowDataList.StringVal(3)); } break; case NFMsg.EGameMsgID.EGMI_REQ_CMD_RECORD_OBJECT: { //NFNetController.Instance.mxNetSender.RequireGMRecordObject(NFNetController.Instance.xMainRoleID, xNowDataList.StringVal(0), xNowDataList.IntVal(1), xNowDataList.IntVal(2), xNowDataList.ObjectVal(3)); } break; case NFMsg.EGameMsgID.EGMI_REQ_PICK_ITEM: { //NFNetController.Instance.mxNetSender.RequirePickUpItem(NFNetController.Instance.xMainRoleID, xNowDataList.ObjectVal(0)); } break; case NFMsg.EGameMsgID.EGMI_REQ_CMD_NORMAL: { //NFNetController.Instance.mxNetSender.RequireNormalGM(NFNetController.Instance.xMainRoleID, (NFMsg.ReqCommand.EGameCommandType)xNowDataList.IntVal(0) // , xNowDataList.StringVal(1), xNowDataList.StringVal(2), xNowDataList.IntVal(3), xNowDataList.FloatVal(4), xNowDataList.ObjectVal(5)); } break; default: break; } return(true); }
//////////////////////////////////////////////////////////// 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(); } }