/// <summary> /// 将远程调用的方法解码为EntityAttachedPluto调用。 /// </summary> /// <param name="data">远程调用方法的二进制数组</param> /// <param name="unLen">数据偏移量</param> protected override void DoDecode(byte[] data, ref int unLen) { //ushort klen = (ushort)VUInt16.Instance.Decode(data, ref unLen); var info = new BaseAttachedInfo(); info.typeId = (ushort)VUInt16.Instance.Decode(data, ref unLen); //entity type id info.id = (uint)VUInt32.Instance.Decode(data, ref unLen); //entity unique id info.dbid = (ulong)VUInt64.Instance.Decode(data, ref unLen); //dbid var entity = DefParser.Instance.GetEntityByID(info.typeId); if (entity != null) { info.entity = entity; info.props = new List <EntityPropertyValue>(); while (unLen < data.Length) { //还有数据就解析 var index = (ushort)VUInt16.Instance.Decode(data, ref unLen); EntityDefProperties prop; var flag = entity.Properties.TryGetValue(index, out prop); if (flag) { info.props.Add(new EntityPropertyValue(prop, prop.VType.Decode(data, ref unLen))); } } } Arguments = new object[1] { info }; if (RPCMsgLogManager.IsRecord) { RPCMsgLogManager.Receive(MSGIDType.CLIENT_ENTITY_ATTACHED, Arguments); } }
protected override void DoDecode(byte[] data, ref int unLen) { var info = new AttachedInfo(); info.id = (uint)VUInt32.Instance.Decode(data, ref unLen); //entity unique id info.props = new List <EntityPropertyValue>(); if (GetEntity != null) { var entity = GetEntity(info.id); if (entity != null) { while (unLen < data.Length) { //还有数据就解析 var index = VUInt16.Instance.Decode(data, ref unLen); EntityDefProperties prop; var flag = entity.Properties.TryGetValue((ushort)index, out prop); if (flag) { info.props.Add(new EntityPropertyValue(prop, prop.VType.Decode(data, ref unLen))); } } } } Arguments = new object[1] { info }; if (RPCMsgLogManager.IsRecord) { RPCMsgLogManager.Receive(MSGIDType.CLIENT_OTHER_ENTITY_ATTRI_SYNC, Arguments); } }
protected override void DoDecode(byte[] data, ref int unLen) { Arguments = new Object[1]; Arguments[0] = VUInt32.Instance.Decode(data, ref unLen); if (RPCMsgLogManager.IsRecord) { RPCMsgLogManager.Receive(MSGIDType.CLIENT_AOI_DEL_ENTITY, Arguments); } }
protected override void DoDecode(byte[] data, ref int unLen) { FuncName = MSGIDType.CLIENT_CHECK_RESP.ToString(); Arguments = new Object[1]; Arguments[0] = VUInt8.Instance.Decode(data, ref unLen); if (RPCMsgLogManager.IsRecord) { RPCMsgLogManager.Receive(MSGIDType.CLIENT_CHECK_RESP, Arguments); } }
/// <summary> /// 将远程调用的方法解码为BaseLogin调用。 /// </summary> /// <param name="data">远程调用方法的二进制数组</param> /// <param name="unLen">数据偏移量</param> protected override void DoDecode(byte[] data, ref int unLen) { FuncName = MSGIDType.CLIENT_NOTIFY_ATTACH_BASEAPP.ToString(); Arguments = new Object[3]; Arguments[0] = VString.Instance.Decode(data, ref unLen); Arguments[1] = VUInt16.Instance.Decode(data, ref unLen); Arguments[2] = VString.Instance.Decode(data, ref unLen); if (RPCMsgLogManager.IsRecord) { RPCMsgLogManager.Receive(MSGIDType.CLIENT_NOTIFY_ATTACH_BASEAPP, Arguments); } }
protected override void DoDecode(byte[] data, ref int unLen) { /*[UINT16][UINT16][UINT32][UINT8][INT16][INT16] [UINT16] [UINT16][UINT32][UINT8][INT16][INT16] [....] [UINT16] [UINT16][UINT32][UINT8][INT16][INT16] [....] ... * 总长度 etype eid face x y 单个aoi长度 etype eid face x y 属性 单个aoi长度 etype eid face x y 属性 */ var list = new List <CellAttachedInfo>(); while (unLen < data.Length) { var entityInfo = new CellAttachedInfo(); var entityLength = (ushort)VUInt16.Instance.Decode(data, ref unLen); //单个entity数据总长度 var endIdx = unLen + entityLength; //结束位置 entityInfo.typeId = (ushort)VUInt16.Instance.Decode(data, ref unLen); entityInfo.id = (uint)VUInt32.Instance.Decode(data, ref unLen); // eid entityInfo.face = (byte)VUInt8.Instance.Decode(data, ref unLen); // rotation var entityX = (UInt16)VUInt16.Instance.Decode(data, ref unLen); var entityY = (UInt16)VUInt16.Instance.Decode(data, ref unLen); var entityZ = (UInt16)VUInt16.Instance.Decode(data, ref unLen); entityInfo.x = (short)entityX; entityInfo.y = (short)entityY; entityInfo.z = (short)entityZ; var entity = DefParser.Instance.GetEntityByID(entityInfo.typeId); if (entity != null) { entityInfo.entity = entity; entityInfo.props = new List <EntityPropertyValue>(); while (unLen < endIdx) { //还有数据就解析 var index = VUInt16.Instance.Decode(data, ref unLen); EntityDefProperties prop; var flag = entity.Properties.TryGetValue((ushort)index, out prop); if (flag) { entityInfo.props.Add(new EntityPropertyValue(prop, prop.VType.Decode(data, ref unLen))); } } } list.Add(entityInfo); } Arguments = new Object[1]; Arguments[0] = list; //LoggerHelper.Debug("list: " + list.Count); if (RPCMsgLogManager.IsRecord) { RPCMsgLogManager.Receive(MSGIDType.CLIENT_AOI_ENTITIES, list.PackList()); } }
protected override void DoDecode(byte[] data, ref int unLen) { info.face = (byte)VUInt8.Instance.Decode(data, ref unLen); var x = (UInt16)VUInt16.Instance.Decode(data, ref unLen); var y = (UInt16)VUInt16.Instance.Decode(data, ref unLen); var z = (UInt16)VUInt16.Instance.Decode(data, ref unLen); info.x = (short)x; info.y = (short)y; info.z = (short)z; Arguments = new object[1] { info }; if (RPCMsgLogManager.IsRecord) { RPCMsgLogManager.Receive(MSGIDType.CLIENT_ENTITY_POS_SYNC, Arguments); } }
protected override void DoDecode(byte[] data, ref int unLen) { var info = new CellAttachedInfo(); //info.id = (uint)VUInt32.Instance.Decode(data, ref unLen); // eid //info.face = (byte)VUInt8.Instance.Decode(data, ref unLen);// rotation //info.x = (short)VInt16.Instance.Decode(data, ref unLen); //x //info.y = (short)VInt16.Instance.Decode(data, ref unLen); //y var x = (UInt16)VUInt16.Instance.Decode(data, ref unLen); var y = (UInt16)VUInt16.Instance.Decode(data, ref unLen); info.x = (short)x; info.y = (short)y; Arguments = new Object[1]; Arguments[0] = info; if (RPCMsgLogManager.IsRecord) { RPCMsgLogManager.Receive(MSGIDType.CLIENT_ENTITY_POS_PULL, Arguments); } }
/// <summary> /// 将远程调用的方法解码为RpcCall调用。 /// </summary> /// <param name="data">远程调用方法的二进制数组</param> /// <param name="unLen">数据偏移量</param> protected override void DoDecode(byte[] data, ref int unLen) { FuncID = (ushort)VUInt16.Instance.Decode(data, ref unLen); if (CurrentEntity == null) { throw new DefineParseException(String.Format("Decode error: Current Entity is not set.")); } var method = CurrentEntity.TryGetClientMethod(FuncID); if (method == null) { throw new DefineParseException( String.Format("Decode error: Can not find function '{0}' in entity '{1}'.", FuncID, CurrentEntity.Name)); } FuncName = method.FuncName; Arguments = new Object[method.ArgsType.Count]; for (var i = 0; i < method.ArgsType.Count; i++) { Arguments[i] = method.ArgsType[i].Decode(data, ref unLen); } if (RPCMsgLogManager.IsRecord) { var list = new List <object>(2 + Arguments.Length); list.Add(FuncID); list.Add(FuncName); for (var i = 0; i < Arguments.Length; i++) { if (method.ArgsType[i].VType == VType.V_BLOB) { list.Add(Arguments[i] != null ? (Arguments[i] as byte[]).PackArray() : null); } else { list.Add(Arguments[i]); } } RPCMsgLogManager.Receive(MSGIDType.CLIENT_RPC_RESP, list.ToArray()); } }
protected override void DoDecode(byte[] data, ref int unLen) { var info = new CellAttachedInfo(); info.typeId = (ushort)VUInt16.Instance.Decode(data, ref unLen); info.id = (uint)VUInt32.Instance.Decode(data, ref unLen); // eid info.face = (byte)VUInt8.Instance.Decode(data, ref unLen); // rotation var x = (UInt16)VUInt16.Instance.Decode(data, ref unLen); var y = (UInt16)VUInt16.Instance.Decode(data, ref unLen); var z = (UInt16)VUInt16.Instance.Decode(data, ref unLen); info.x = (short)x; info.y = (short)y; info.z = (short)z; var entity = DefParser.Instance.GetEntityByID(info.typeId); if (entity != null) { info.entity = entity; info.props = new List <EntityPropertyValue>(); while (unLen < data.Length) { //还有数据就解析 var index = VUInt16.Instance.Decode(data, ref unLen); EntityDefProperties prop; var flag = entity.Properties.TryGetValue((ushort)index, out prop); if (flag) { info.props.Add(new EntityPropertyValue(prop, prop.VType.Decode(data, ref unLen))); } } } Arguments = new object[1] { info }; if (RPCMsgLogManager.IsRecord) { RPCMsgLogManager.Receive(MSGIDType.CLIENT_AOI_NEW_ENTITY, Arguments); } }