void Awake() { Main = this; this.connection_distribution = new ClientToInstancePackets.Distribution() { Default = OnReceive_Default, out_Error_c = OnReceive_Error_c, out_Verify_Result_c = OnReceive_Verify_Result_c, out_Map_Reset_c = OnReceive_Map_Reset_c, out_Map_TerrainBlock_c = OnReceive_Map_TerrainBlock_c, out_Player_SetControl_c = OnReceive_Player_SetControl_c, out_Character_Add_c = OnReceive_Character_Add_c, out_Character_Remove_c = OnReceive_Character_Remove_c, out_Character_Position_c = OnReceive_Character_Position_c, out_Character_Movement_c = OnReceive_Character_Movement_c, out_Character_UpdateStats_c = OnReceive_Character_UpdateStats_c }; this.Log.MessageLogged += Debug.Log; }
public bool DistributePacket(IPacketDistributor distributor) { if (IsConnected) { return(connection.DistributePacket(distributor)); } else { return(false); } }
public void DistributePackets(IPacketDistributor distributor) { lock (connection_lock) { if (IsConnected) { while (connection.DistributePacket(distributor) == true) { } } } }
public AuthorizingConnection(NetConnection c) { this.Connection = c; this.Timer = new Stopwatch(); distributor = new ClientToMasterPackets.Distribution() { out_AccountAuthorize_Attempt_m = OnReceive_AccountAuthorize_Attempt_m }; Timer.Start(); Log = new DebugLogger("AuthingCon"); }
public ClientLink(ActionDispersion actionDispersion, AccountInfo accountInfo, NetConnection clientConnection) { this.connection_distribution = new ClientToMasterPackets.Distribution() { out_Menu_CharacterListItem_Select_m = OnReceive_Menu_CharacterListItem_Select_m }; this.actionDispersion = actionDispersion; this.AccountInfo = accountInfo; this.connection = clientConnection; this.Log = new DebugLogger("ClLink:" + accountInfo.Name); this.Log.MessageLogged += Console.WriteLine; }
public VerifyingClient(TcpClient tcpClient) { this.connection_distributor = new ClientToInstancePackets.Distribution() { out_Verify_Details_i = OnReceive_Verify_Details_i }; this.connection = new NetConnection(tcpClient); this.connection.Start(); this.receiveTimer.Start(); this.Log.MessageLogged += Console.WriteLine; }
void Awake() { Main = this; this.connection_distribute = new ClientToMasterPackets.Distribution() { out_ErrorCode_c = OnReceive_ErrorCode_c, out_AccountAuthorize_Response_c = OnReceive_AccountAuthorize_Response_c, out_Menu_CharacterListItem_c = OnReceive_Menu_CharacterListItem_c, out_Connection_WorldServerInfo_c = OnReceive_Connection_WorldServerInfo_c }; this.Log.MessageLogged += Debug.Log; }
/// <returns>If a packet was distributed.</returns> public bool DistributePacket(IPacketDistributor distributor) { bool sentPacket = false; lock (receiveBuffer_lock) { try { sentPacket = (distributor.DistributePacket(ref receiveBuffer) == true); } catch (Packet.InvalidPacketRead e) { Log.Log("Invalid packet read: " + e.ToString()); this.Close(); } } return(sentPacket); }