/// <summary> /// 出售 /// </summary> /// <param name="uid"></param> /// <param name="count"></param> public void RequestSell(ulong uid, ushort count) { C2S_ITEM_SELL req = SingleInstanceCache.GetInstanceByType <C2S_ITEM_SELL>(); req.protocolID = (ushort)KC2S_Protocol.c2s_item_sell; req.uid = uid; req.count = count; NetworkManager.Instance.SendToGameServer(req); }
public void RequestRelive(PlayerReliveType playerReliveType) { GameplayProxy gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; C2S_PLAYER_RELIVE request = SingleInstanceCache.GetInstanceByType <C2S_PLAYER_RELIVE>(); request.protocolID = (ushort)KC2S_Protocol.c2s_player_relive; request.relive_type = (ushort)playerReliveType; NetworkManager.Instance.SendToGameServer(request); }
/// <summary> /// 移动道具 /// </summary> /// <param name="itemUid"></param> /// <param name="targetContainer"></param> /// <param name="targetPos"></param> public void ReqestMove(ulong itemUid, ulong targetContainer, int targetPos, ulong mark) { C2S_MOVE_ITEM req = SingleInstanceCache.GetInstanceByType <C2S_MOVE_ITEM>(); req.protocolID = (ushort)KC2S_Protocol.c2s_move_item; req.mark = mark; req.src_item_uid = itemUid; req.dest_container_uid = targetContainer; req.dest_pos = (ushort)targetPos; NetworkManager.Instance.SendToGameServer(req); }
public void SendCastSkill(uint skillID, SkillCastOperation castOperation, uint casterUID, List <C2S_TargetInfo> skillTargets , UnityEngine.Quaternion targetDir) { C2S_CAST_SKILL_TPS msg = SingleInstanceCache.GetInstanceByType <C2S_CAST_SKILL_TPS>(); msg.protocolID = (ushort)KC2S_Protocol.c2s_cast_skill_tps; msg.cast_type = (short)castOperation; msg.skill_id = skillID; msg.caster_id = casterUID; msg.target_info_list.Clear(); msg.target_info_list = skillTargets; msg.x = targetDir.x; msg.y = targetDir.y; msg.z = targetDir.z; msg.w = targetDir.w; NetworkManager.Instance.SendToGameServer(msg); }
/// <summary> /// 发送数据 /// </summary> /// <param name="protocol"></param> /// <param name="strFunc"></param> /// <param name="values"></param> private void CallServer(KC2S_Protocol protocol, string strFunc, params object[] values) { if (callServerProto == null) { callServerProto = SingleInstanceCache.GetInstanceByType <C2S_CALL_SERVER>(); callServerProto.data = new byte[1024];//第一次创建,申请足够的大小.. callServerBuffWriter = new BinaryWriter(new MemoryStream(callServerProto.data)); } callServerBuffWriter.Seek(0, SeekOrigin.Begin); callServerProto.protocolID = (byte)protocol; callServerBuffWriter.Write((short)0); WriteParam(callServerBuffWriter, strFunc, values); callServerProto._dataLength_ = (int)callServerBuffWriter.Seek(0, SeekOrigin.Current); callServerBuffWriter.Seek(0, SeekOrigin.Begin); callServerBuffWriter.Write((short)(callServerProto._dataLength_ - 2)); callServerBuffWriter.Seek(callServerProto._dataLength_, SeekOrigin.Begin); NetworkManager.Instance.SendToGameServer(callServerProto); }