void test()
    {
        List <Communication> list_com = new List <Communication>();

        Communication_Trame test_trame = new Communication_Trame();

        Structures_Echange.Logger_Debug Logger = new Structures_Echange.Logger_Debug();

        for (int i = 0; i < 30; i++)
        {
            list_com = Logger.Send_Logger("test " + i.ToString(), Logger_Debug_Color.Color_Black);

            Lecteurs_Messages.Received_Messages.AddRange(list_com);
        }

        for (int i = 0; i < 30; i++)
        {
            list_com = Logger.Send_Logger("test " + i.ToString(), Logger_Debug_Color.Color_Blue);

            Lecteurs_Messages.Received_Messages.AddRange(list_com);
        }

        for (int i = 0; i < 30; i++)
        {
            list_com = Logger.Send_Logger("test " + i.ToString(), Logger_Debug_Color.Color_Red);

            Lecteurs_Messages.Received_Messages.AddRange(list_com);
        }
    }
    private void Decodage_Logger(Communication_Trame input_trame)
    {
        if (LogMessages.Count >= Max_Log_Message_Number)
        {
            Destroy(LogMessages[0].textobject.gameObject);
            LogMessages.RemoveAt(0);
        }


        Structures_Echange.Logger_Debug Logger = new Structures_Echange.Logger_Debug();
        //Transforme la trame en Message utile
        Logger_Debug_Data received_message = Logger.Trame_To_Data(input_trame);

        string recieved_log = "[" + DateTime.Now.ToLongTimeString() + ":" + DateTime.Now.Millisecond.ToString() + "] ";


        recieved_log += new string(received_message.Text, 0, received_message.Nombre_Carateres);
        Logger_Debug_Color color = received_message.Color;

        //Crée un nouveau message de Log
        Log_Message newLogMessage = new Log_Message();

        newLogMessage.text        = recieved_log;
        newLogMessage.messageType = received_message.Color;

        //Crée le gameObject associé
        GameObject newgameobject = Instantiate(Log_Message_Prefab, Fenetre_Logger.transform);

        newLogMessage.textobject      = newgameobject.GetComponent <Text>();
        newLogMessage.textobject.text = newLogMessage.text;

        switch (received_message.Color)
        {
        default:
        case Logger_Debug_Color.Color_Black:
            newLogMessage.textobject.color = Color.black;
            break;

        case Logger_Debug_Color.Color_Blue:
            newLogMessage.textobject.color = Color.blue;
            break;

        case Logger_Debug_Color.Color_Red:
            newLogMessage.textobject.color = Color.red;
            break;
        }

        //Ajoute ce log à la liste
        LogMessages.Add(newLogMessage);
    }
示例#3
0
 //Envoi d'un message de Log (str), de la couleur (color)
 public List <Communication> Send_Logger(string str, Structures_Echange.Logger_Debug.Logger_Debug_Color color)
 {
     //Transforme le message de log, en une liste de messages de communication
     Structures_Echange.Logger_Debug logger = new Structures_Echange.Logger_Debug();
     return(logger.Send_Logger(str, color));
 }