Ejemplo n.º 1
0
 public void SendDataBlock(DataBlock dataBlock)
 {
     using (NetPacket packet = new NetPacket())
     {
         // -- Create string from datablock bytes
         string datablockString = Encoding.ASCII.GetString(dataBlock.GetBytes());
         Logger.Log(LogLevel.L2_Info, "Sending datablock to server: " + datablockString, "NetworkMessages.FromClient");
         packet.Write(datablockString);
         this.Send(packet);
     }
 }
Ejemplo n.º 2
0
    void Awake()
    {
        // -- Initialize Logger
        Logger.SetPrinter(new Printer());

        // -- Initialize the Configuration class
        Configuration.Initialize();

        // -- Set Logger filter from Configuration
        Logger.SetFilter(Configuration.LoggerFilter);

        // -- Spawn an instance of Network Manager (This will run the constructor)
        NetworkManager.GetInstance();
    }
Ejemplo n.º 3
0
    protected override void HandleMessage(NetPacketBase packet)
    {
        try
        {
            // -- Create datablock from string
            DataBlock dataBlock = new DataBlock(Encoding.ASCII.GetBytes(packet.Read <string>()));

            // -- Pass datablock to datablock controller
            _networkManager.ProcessDataBlock(dataBlock);
        }
        catch (Exception e)
        {
            Logger.Log(LogLevel.L4_RecoverableError, "Error handling messge in NetworkSocket: " + e.StackTrace, "NetworkMessages.FromServer");
        }
    }
Ejemplo n.º 4
0
 public static void Initialize()
 {
     Logger.Log(LogLevel.L2_Info, "Configuration initialized.");
 }
Ejemplo n.º 5
0
 protected override void OnDisconnected()
 {
     Logger.Log(LogLevel.L2_Info, "Disconnected.", "Network.Disconnect");
 }
Ejemplo n.º 6
0
 protected override void OnConnected()
 {
     Logger.Log(LogLevel.L2_Info, "Connected to " + this.Socket.RemoteEndPoint.ToString(), "Network.Connect");
 }