public string PrixToString()
 {
     if (Prix == 0)
     {
         return("--");
     }
     return(Prix.ToString("C2"));
 }
예제 #2
0
        private void AfficherNiveauEtPrix()
        {
            string niveauEnemy = "Niveau " + Niveau.ToString();
            string prixEnemy;

            if (Niveau >= 2)
            {
                prixEnemy = Prix.ToString() + " Pts";
            }
            else
            {
                prixEnemy = Prix.ToString() + " Or";
            }
            GestionSprite.DrawString(Arial, niveauEnemy, Position + new Vector2(76, 0), Color.White);
            GestionSprite.DrawString(Arial, prixEnemy, Position + new Vector2(76, 32), Color.Yellow);
        }
예제 #3
0
    protected override void OnMouseOver()
    {
        if (GameManager.isPaused)
        {
            return;
        }
        if (isDestroyed)
        {
            return;
        }

        string message = "Temps: +" + SatisfactionGénérée.ToString() + " s" + System.Environment.NewLine + System.Environment.NewLine +
                         "Prix: " + Prix.ToString("0.00") + " €" + System.Environment.NewLine + System.Environment.NewLine +
                         Description;

        PopUp.Show(Nom, message);
    }
예제 #4
0
 private void OnMouseUp()
 {
     if (GameManager.isPaused)
     {
         return;
     }
     if (GameManager.TenterAchat(Prix))
     {
         PopUp.Hide();
         GameManager.instance.PopUpTemps.enabled = true;
         GameManager.instance.PopUpTemps.text    = "+" + SatisfactionGénérée + "s";
         CancelInvoke("effacerPopUpTemps");
         GameManager.instance.Invoke("effacerPopUpTemps", 2);
         GameManager.instance.PopUpArgent.enabled = true;
         GameManager.instance.PopUpArgent.text    = "-" + Prix.ToString("0.00") + "€";
         CancelInvoke("effacerPopUpArgent");
         GameManager.instance.Invoke("effacerPopUpArgent", 2);
         isDestroyed = true;
         GameManager.AddSatisfaction(SatisfactionGénérée);
         GameManager.GenerateDéchet(DéchetGénérés);
         GameManager.GetNextAchat();
     }
 }
예제 #5
0
        private void spComm_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            string Trame = ((SerialPort)sender).ReadTo(((char)03).ToString()) + (char)03;

            Invoke(new Action(() =>
            {
#if Encryption
                Ecriture(Trame, "reception.txt", FileMode.Create, true);
                string Texte = Lecture("reception.txt", true);
#else
                Ecriture(Trame, "reception.txt", FileMode.Create);
                string Texte = Lecture("reception.txt");
#endif
                ResultatTrame RTrame = new ResultatTrame(Texte);
                if (RTrame.Valide)
                {
                    spComm.Write(((char)06).ToString()); //Envoie un ACK
                    m_Abandon = 0;                       //s'assure que le compteur de trame invalide recue est a 0

                    //Le code pour la verification de la date est ici:

                    bool DateValide = true;
                    if (RTrame.Heure < 8 || RTrame.Heure > 17)
                    {
                        DateValide = false;
                    }
                    else
                    {
                        if ((RTrame.Mois == 1 && RTrame.Jour == 1) || (RTrame.Mois == 10 && RTrame.Jour == 14) || (RTrame.Mois == 12 && RTrame.Jour == 25))
                        {
                            DateValide = false;
                        }
                    }

                    if (DateValide)
                    {
                        int Quantite;
                        decimal Prix;
                        if (InventaireUpdate(RTrame.Data, out Quantite, out Prix))
                        {
                            txtCheckSum.Text     = RTrame.CheckSum;
                            txtDate.Text         = RTrame.DateHeure;
                            txtNomArt.Text       = RTrame.Data; //Changer pour des vrai nom
                            txtPrixArt.Text      = Prix.ToString("C");
                            txtQuantitéRest.Text = Quantite.ToString();
                            txtTaxe.Text         = Math.Round((Prix * 0.14975M), 2, MidpointRounding.AwayFromZero).ToString("C");
                            txtTotal.Text        = Math.Round((Prix * 1.14975M), 2, MidpointRounding.AwayFromZero).ToString("C");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Merci pour votre travail hors des heures rémunérées");
                    }
                }
                else
                {
                    //code NAK goes here
                    m_Abandon++; //incremente la variable qui compte le nombre de trame invalide recue
#if Encryption
                    Ecriture(Texte + '\n', "ArchiveErreur.txt", FileMode.Append, false);
#else
                    Ecriture(Texte + '\n', "ArchiveErreur.txt", FileMode.Append);
#endif
                    if (m_Abandon > 10)                      //Verifie combien de fois la trame recue est invalide
                    {
                        spComm.Write(((char)24).ToString()); //Envoie un Cancel
                        m_Abandon = 0;
                    }
                    else
                    {
                        spComm.Write(((char)21).ToString());//Garde espoire que le lecteur de barre code vas dire quelque chose qui va faire du sens et lui demande de repeter (envoie un NAK)
                    }
                }
            }));
        }