public void UseSkill(NFrame.NFGUID ident, string strSkillConfigID, int nIndex, float fNowX, float xNowZ, float fTarX, float fTarZ, List <NFMsg.EffectData> xEffDataList, bool bClient) { if (mhtObject.ContainsKey(ident)) { if (bClient) { //执行状态 //发送数据 GameObject xGameObject = (GameObject)mhtObject[ident]; if (null != xGameObject) { //如果位置不一致,那么就闪烁(奔跑)前进,然后释放技能 //而且先保存伤害对象和伤害值,动作帧触发的时候调阅闪出<角色ID,动作,<被打角色ID,伤害值>> /////////////////////////////////////////////// //为某个技能确认需要打击的人以及信息,每次hit一个后删除此hit的一个,技能状态完成时全删除 //xSkillHitData.UseSkill(strSkillConfigID, objectList, damageList, resultList); ////////////////////////////////////////////////// string strConfigID = NFrame.NFCKernelModule.Instance.QueryPropertyString(ident, "ConfigID"); string strSkillRef = NFrame.NFCKernelModule.Instance.GetElementModule().QueryPropertyString(strConfigID, "SkillIDRef"); string strSkill = NFrame.NFCKernelModule.Instance.GetElementModule().QueryPropertyString(strConfigID, strSkillConfigID); NFIElement xSkillElement = NFrame.NFCKernelModule.Instance.GetElementModule().GetElement(strSkillConfigID); if (null != xSkillElement) { } } } else { //找伤害索引 //插入到帧 } } }
void RecordEventHandler(NFGUID self, string strRecordName, NFIRecord.ERecordOptype eType, int nRow, int nCol, NFDataList.TData oldVar, NFDataList.TData newVar) { if (ColValueCondition) { 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) { return; } } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { string value = xRecord.QueryString(nRow, ColConditionNum); if (value != ColConditionContent) { 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); 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 = nRow; 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: { 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; } }
public void RequireEnterGameServer(NFCoreEx.NFIDENTID objectID, string strAccount, string strRoleName, int nServerID) { NFMsg.ReqEnterGameServer xData = new NFMsg.ReqEnterGameServer(); xData.name = UnicodeEncoding.Default.GetBytes(strRoleName); xData.account = UnicodeEncoding.Default.GetBytes(strAccount); xData.game_id = nServerID; xData.id = NFToPB(objectID); MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ReqEnterGameServer>(stream, xData); SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_ENTER_GAME, stream); if (NFStart.Instance.bDebugMode) { //EGMI_ACK_OBJECT_ENTRY //property //EGMI_ACK_SWAP_SCENE //EGMI_ACK_OBJECT_ENTRY //property float fX = 0.0f; float fY = 0.0f; float fZ = 0.0f; NFIElement xElement = NFCElementManager.Instance.GetElement("1"); if (null != xElement) { string strRelivePos = xElement.QueryString("RelivePos"); string[] sArray = strRelivePos.Split(';'); if (sArray.Length > 0) { sArray = sArray[0].Split(','); } if (sArray.Length == 3) { fX = float.Parse(sArray[0]); fY = float.Parse(sArray[1]); fZ = float.Parse(sArray[2]); } } ///////////////////////////////////////////// //mainplayer NFMsg.AckPlayerEntryList xAckMainBodyData = new NFMsg.AckPlayerEntryList(); NFMsg.PlayerEntryInfo xInfo = new NFMsg.PlayerEntryInfo(); NFMsg.Ident xID = new NFMsg.Ident(); xInfo.object_guid = xID; xInfo.x = fX; xInfo.y = fY; xInfo.z = fZ; xInfo.career_type = 1; xInfo.player_state = 1; xInfo.config_id = UnicodeEncoding.Default.GetBytes(""); xInfo.scene_id = 1; xInfo.class_id = UnicodeEncoding.Default.GetBytes("Player"); xAckMainBodyData.object_list.Add(xInfo); MemoryStream xAckMianPlayerBodyStream = new MemoryStream(); Serializer.Serialize <NFMsg.AckPlayerEntryList>(xAckMianPlayerBodyStream, xAckMainBodyData); NFMsg.MsgBase xAckMianPlayerData = new NFMsg.MsgBase(); xAckMianPlayerData.player_id = xID; xAckMianPlayerData.msg_data = xAckMianPlayerBodyStream.ToArray(); MemoryStream xAckAllStream = new MemoryStream(); Serializer.Serialize <NFMsg.MsgBase>(xAckAllStream, xAckMianPlayerData); MsgHead head = new MsgHead(); head.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_OBJECT_ENTRY; head.unDataLen = (UInt32)xAckAllStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; xNet.mxBinMsgEvent.OnMessageEvent(head, xAckAllStream.ToArray()); ///////////////////////////////////////////// //property NFMsg.ObjectPropertyInt propertyData = new NFMsg.ObjectPropertyInt(); PropertyInt xPropertyInt = new PropertyInt(); xPropertyInt.property_name = UnicodeEncoding.Default.GetBytes("MOVE_SPEED"); xPropertyInt.data = 50000; propertyData.property_list.Add(xPropertyInt); propertyData.player_id = xID; MemoryStream xAckPropertyIntStream = new MemoryStream(); Serializer.Serialize <NFMsg.ObjectPropertyInt>(xAckPropertyIntStream, propertyData); NFMsg.MsgBase xPropertyIntMsg = new NFMsg.MsgBase(); xPropertyIntMsg.player_id = xID; xPropertyIntMsg.msg_data = xAckPropertyIntStream.ToArray(); MemoryStream xAckPropertyIntAllStream = new MemoryStream(); Serializer.Serialize <NFMsg.MsgBase>(xAckPropertyIntAllStream, xPropertyIntMsg); MsgHead xAckPropertyhead = new MsgHead(); xAckPropertyhead.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_INT; xAckPropertyhead.unDataLen = (UInt32)xAckPropertyIntAllStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; xNet.mxBinMsgEvent.OnMessageEvent(xAckPropertyhead, xAckPropertyIntAllStream.ToArray()); ///////////////////////////////////////////// xNet.mPlayerState = NFNet.PLAYER_STATE.E_PLAYER_GAMEING; //NFCRenderInterface.Instance.LoadScene(1, fX, fY, fZ); ///////////////////////////////////////////// //npc NFMsg.AckPlayerEntryList xAckNPCBodyData = new NFMsg.AckPlayerEntryList(); for (int i = 0; i < 5; ++i) { NFMsg.PlayerEntryInfo xNPCInfo = new NFMsg.PlayerEntryInfo(); NFMsg.Ident xNPCID = new NFMsg.Ident(); xNPCID.index = i + 10000; xNPCInfo.object_guid = xNPCID; xNPCInfo.x = fX + i; xNPCInfo.y = fY; xNPCInfo.z = fZ + i; xNPCInfo.career_type = 1; xNPCInfo.player_state = 1; xNPCInfo.config_id = UnicodeEncoding.Default.GetBytes(""); xNPCInfo.scene_id = 1; xNPCInfo.class_id = UnicodeEncoding.Default.GetBytes("Player"); xAckNPCBodyData.object_list.Add(xNPCInfo); } MemoryStream xAckNPCBodyStream = new MemoryStream(); Serializer.Serialize <NFMsg.AckPlayerEntryList>(xAckNPCBodyStream, xAckNPCBodyData); NFMsg.MsgBase xAckNPCrData = new NFMsg.MsgBase(); xAckNPCrData.player_id = xID; xAckNPCrData.msg_data = xAckNPCBodyStream.ToArray(); MemoryStream xAckAllNPCStream = new MemoryStream(); Serializer.Serialize <NFMsg.MsgBase>(xAckAllNPCStream, xAckNPCrData); MsgHead xNPCHead = new MsgHead(); xNPCHead.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_OBJECT_ENTRY; xNPCHead.unDataLen = (UInt32)xAckAllNPCStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; xNet.mxBinMsgEvent.OnMessageEvent(xNPCHead, xAckAllNPCStream.ToArray()); ////////////////////////////////////////////// } }