Esempio 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);
     }
 }
Esempio 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();
    }
Esempio 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");
        }
    }
Esempio n. 4
0
 public static void Initialize()
 {
     Logger.Log(LogLevel.L2_Info, "Configuration initialized.");
 }
Esempio n. 5
0
 protected override void OnDisconnected()
 {
     Logger.Log(LogLevel.L2_Info, "Disconnected.", "Network.Disconnect");
 }
Esempio n. 6
0
 protected override void OnConnected()
 {
     Logger.Log(LogLevel.L2_Info, "Connected to " + this.Socket.RemoteEndPoint.ToString(), "Network.Connect");
 }