public void write(UserToken token, byte type, int area, int command, object message) { byte[] value = MessageEncoding.encode(CreateSocketModel(type, area, command, message)); value = LengthEncoding.encode(value); token.write(value); }
static byte[] createBattleRoom() { SocketModel model = new SocketModel(); model.type = TypeProtocol.TYPE_BATTLE_ROOM; model.area = 0; model.command = BattleRoomProtocol.CREATE_ONE_C; model.message = null; var message = MessageEncoding.encode(model); return(LengthEncoding.encode(message)); }
public void brocast(byte type, int area, int command, object message, UserToken exToken = null) { byte[] value = MessageEncoding.encode(CreateSocketModel(type, area, command, message)); value = LengthEncoding.encode(value); foreach (UserToken item in list) { if (item != exToken) { byte[] bs = new byte[value.Length]; Array.Copy(value, 0, bs, 0, value.Length); item.write(bs); } } }
public void brocast(byte type, int area, int command, ReturnDTO message, UserToken exToken = null) { byte[] value = MessageEncoding.encode(createSocketModel(type, area, command, message)); value = LengthEncoding.encode(value); foreach (var item in list) { if (exToken != item) { byte[] bs = new byte[value.Length]; Array.Copy(value, bs, value.Length); item.write(bs); } } }
static byte[] login() { AccountInfoDTO accountInfoDTO = new AccountInfoDTO(); accountInfoDTO.accountName = "admin"; accountInfoDTO.password = "******"; SocketModel model = new SocketModel(); model.type = TypeProtocol.TYPE_LOGIN; model.area = 0; model.command = LoginProtocol.LOGIN_CREQ; model.message = accountInfoDTO; var message = MessageEncoding.encode(model); return(LengthEncoding.encode(message)); }
private static byte[] useskill() { SocketModel model = new SocketModel(); model.type = TypeProtocol.TYPE_BATTLE_ROOM; model.area = 0; model.command = BattleRoomProtocol.USE_SKILL_C; RoomDTO dto = new RoomDTO(); dto.roomId = roomDTO.roomId; dto.roomRoleId = roomDTO.roomRoleId; model.message = dto; var message = MessageEncoding.encode(model); return(LengthEncoding.encode(message)); }
public void writeToUsers(int[] users, byte type, int area, int command, object message) { byte[] value = MessageEncoding.encode(CreateSocketModel(type, area, command, message)); value = LengthEncoding.encode(value); foreach (int item in users) { UserToken token = userBiz.getToken(item); if (token == null) { continue; } byte[] bs = new byte[value.Length]; Array.Copy(value, 0, bs, 0, value.Length); token.write(bs); } }
public void writeToUsers(long[] users, byte type, int area, int command, ReturnDTO message) { byte[] value = MessageEncoding.encode(createSocketModel(type, area, command, message)); value = LengthEncoding.encode(value); foreach (var item in users) { UserToken token = getToken(item); if (token == null) { continue; } byte[] bs = new byte[value.Length]; Array.Copy(value, bs, value.Length); token.write(bs); } }
private static byte[] usecard() { SocketModel model = new SocketModel(); model.type = TypeProtocol.TYPE_BATTLE_ROOM; model.area = 0; model.command = BattleRoomProtocol.USE_CARD_C; RoomDTO dto = new RoomDTO(); dto.roomId = roomDTO.roomId; dto.roomRoleId = roomDTO.roomRoleId; dto.map.Add(CommonFieldProtocol.useCardId, selfInfo[0].cardIds[0]); dto.map.Add(CommonFieldProtocol.targetIds, new List <string> { otherInfo[0].roomRoleId }); model.message = dto; var message = MessageEncoding.encode(model); return(LengthEncoding.encode(message)); }
public void Write(UserToken token, byte type, int area, int command, object message) { byte[] send = MessageEncoding.encode(CreatSocketModel(type, area, command, message)); send = LengthEncoding.encode(send); token.write(send); }