private void Decode_Strategie_Changement_Etat(Communication.Communication_Message message) { Action_Strategie decoder = new Action_Strategie(); Action_Strategie.Action_Datas data = new Action_Strategie.Action_Datas(); //décompose les datas du message recu data = decoder.Trame_To_Data(message.Trame); //Ajoute une ligne à l'historique des changements d'états de la Strategie if (Action_History_go != null) { Action_History_go.GetComponent <Action_History>().Update_Action(data); } //Met à jour le tableau avec l'ensemble des actions Action_Liste.Update_Action(data, data.Robot_ID); }
public void Update_Action(Action_Strategie.Action_Datas data) { if (Action_Data == null) { Action_Data = new Action_Strategie(); Action_Data.Datas = new Action_Strategie.Action_Datas(); } Action_Data.Datas = data; Text_Action_ID.GetComponent <TextMeshProUGUI>().text = Action_Data.Datas.ID.ToString(); if (Action_Data.Name == null) { //N'affiche le nom que pour la création string text = new string(data.Name, 0, data.Name_Length); Action_Data.Name = text; Text_Action_Name.GetComponent <TextMeshProUGUI>().text = Action_Data.Name; } Action_Line previous_values = Action_Liste.Get_Existing_Line(data.ID, data.Robot_ID); if (previous_values != null && data.State != previous_values.Action_Data.Datas.State) { Text_Action_State.GetComponent <TextMeshProUGUI>().fontStyle = FontStyles.Bold; Text_Action_State.GetComponent <TextMeshProUGUI>().color = Color.red; } Text_Action_State.GetComponent <TextMeshProUGUI>().text = Action_Data.Datas.State.ToString(); if (previous_values != null && data.Step != previous_values.Action_Data.Datas.Step) { Text_Action_Step.GetComponent <TextMeshProUGUI>().fontStyle = FontStyles.Bold; Text_Action_Step.GetComponent <TextMeshProUGUI>().color = Color.red; } Text_Action_Step.GetComponent <TextMeshProUGUI>().text = Action_Data.Datas.Step.ToString(); if (previous_values != null && data.Priority != previous_values.Action_Data.Datas.Priority) { Text_Action_Priority.GetComponent <TextMeshProUGUI>().fontStyle = FontStyles.Bold; Text_Action_Priority.GetComponent <TextMeshProUGUI>().color = Color.red; } Text_Action_Priority.GetComponent <TextMeshProUGUI>().text = Action_Data.Datas.Priority.ToString(); if (previous_values != null && data.Points != previous_values.Action_Data.Datas.Points) { Text_Action_Points.GetComponent <TextMeshProUGUI>().fontStyle = FontStyles.Bold; Text_Action_Points.GetComponent <TextMeshProUGUI>().color = Color.red; } Text_Action_Points.GetComponent <TextMeshProUGUI>().text = Action_Data.Datas.Points.ToString(); if (previous_values != null && data.Qui_Fait != previous_values.Action_Data.Datas.Qui_Fait) { Text_Action_Qui_Fait.GetComponent <TextMeshProUGUI>().fontStyle = FontStyles.Bold; Text_Action_Qui_Fait.GetComponent <TextMeshProUGUI>().color = Color.red; } Text_Action_Qui_Fait.GetComponent <TextMeshProUGUI>().text = Action_Data.Datas.Qui_Fait.ToString(); if (previous_values != null && data.Qui_Peut != previous_values.Action_Data.Datas.Qui_Peut) { Text_Action_Qui_Peut.GetComponent <TextMeshProUGUI>().fontStyle = FontStyles.Bold; Text_Action_Qui_Peut.GetComponent <TextMeshProUGUI>().color = Color.red; } Text_Action_Qui_Peut.GetComponent <TextMeshProUGUI>().text = Action_Data.Datas.Qui_Peut.ToString(); if (previous_values != null && data.Temps_mini != previous_values.Action_Data.Datas.Temps_mini) { Text_Action_Temps_mini.GetComponent <TextMeshProUGUI>().fontStyle = FontStyles.Bold; Text_Action_Temps_mini.GetComponent <TextMeshProUGUI>().color = Color.red; } Text_Action_Temps_mini.GetComponent <TextMeshProUGUI>().text = ((int)(Action_Data.Datas.Temps_mini) * 10).ToString(); if (previous_values != null && data.Temps_maxi != previous_values.Action_Data.Datas.Temps_maxi) { Text_Action_Temps_maxi.GetComponent <TextMeshProUGUI>().fontStyle = FontStyles.Bold; Text_Action_Temps_maxi.GetComponent <TextMeshProUGUI>().color = Color.red; } Text_Action_Temps_maxi.GetComponent <TextMeshProUGUI>().text = ((int)(Action_Data.Datas.Temps_maxi) * 10).ToString(); }