Example #1
0
 /// <summary>
 /// Constructeur paramétré recevant la position du sprite.
 /// </summary>
 /// <param name="x">Coordonnée initiale x (horizontale) du sprite.</param>
 /// <param name="y">Coordonnée initiale y (verticale) du sprite.</param>
 public Personnage(float x, float y)
     : base(x, y)
 {
     // Par défaut, le sprite est celui faisant face au personnage.
     this.directionDeplacement = Direction.Gauche;
     this.etat = Etats.Stationnaire;
 }
Example #2
0
 /// <summary>
 /// On change d'état en faisant un fadeout
 /// <param name="etat">Prochain etat</param>
 public void FadeOut(Etats etat)
 {
     etatJeuProchain      = etat;
     _faderAlpha          = 0f;
     _faderAlphaIncrement = 10;
     fading = true;
 }
        public static void ChangerEtatCitoyen(Citoyen citoyen, Etats etat)
        {
            citoyen.Etat = etat;
            citoyen.Records.Add(new Record(DateTime.Now, etat));

            if (etat == Etats.Infecte)
            {
                checkContact(citoyen);
            }
        }
Example #4
0
        /// <summary>
        /// Наполняет заместители реальных справочников данными
        /// </summary>
        protected void CreateProxy()
        {
            //CertificationDocTypes
            CertificationDocTypes.Clear();
            foreach (var doc in CertificationDocTypesDB)
            {
                CertificationDocTypes.Add(new CertificationDocumentTypeProxy(doc));
            }

            //SinistreeTypes
            SinistreeTypes.Clear();
            foreach (var doc in SinistreeTypesDB)
            {
                SinistreeTypes.Add(new SinistreeTypeProxy(doc));
            }

            //SujetDocumentTypes
            SujetDocumentTypes.Clear();
            foreach (var doc in SujetDocumentTypesDB)
            {
                SujetDocumentTypes.Add(new SujetDocumentTypeProxy(doc));
            }

            //UtilisationTypes
            UtilisationTypes.Clear();
            foreach (var doc in UtilisationTypesDB)
            {
                UtilisationTypes.Add(new UtilisationTypeProxy(doc));
            }

            //JuridiqueTypes
            JuridiqueTypes.Clear();
            foreach (var doc in JuridiqueTypesDB)
            {
                JuridiqueTypes.Add(new JuridiqueTypeProxy(doc));
            }

            //Etats
            Etats.Clear();
            foreach (var doc in EtatsDB)
            {
                Etats.Add(new EtatProxy(doc));
            }


            //Направляем уведомление об изменении свойств
            RaisePropertyChanged(nameof(CertificationDocTypes));
            RaisePropertyChanged(nameof(SinistreeTypes));
            RaisePropertyChanged(nameof(SujetDocumentTypes));
            RaisePropertyChanged(nameof(UtilisationTypes));
            RaisePropertyChanged(nameof(JuridiqueTypes));
            RaisePropertyChanged(nameof(Etats));
        }
Example #5
0
 /*
  * Constructeur avec surnom
  */
 public Monstre(string Surnom) : base()
 {
     this.Surnom            = Surnom;
     this.NiveauExperience  = 1;
     this.PointsExperience  = 0;
     this.ptsVieActuels     = PtsVieBase;
     this.ptsEnergieActuels = PtsEnergieBase;
     this.Etats             = new List <EtatActif>();
     this.HabiletesActives  = new List <Habilete>();
     this.Attaque           = Attaque;
     this.Defense           = Defense;
     Etats.Add(EtatActif.Vivant);
 }
Example #6
0
        /// <summary>
        /// Constructeur paramétré recevant la position du sprite.
        /// </summary>
        /// <param name="x">Coordonnée initiale x (horizontale) du sprite.</param>
        /// <param name="y">Coordonnée initiale y (verticale) du sprite.</param>
        public JoueurSprite(float x, float y)
            : base(x, y)
        {
            //// Par défaut, le sprite est stationnaire et fait face au joueur.
            this.directionDeplacement = Direction.Droite;
            this.etat = Etats.Stationnaire;

            //// Sélectionner et paramétrer le bruitage d'effets sonores.
            ////this.AttackInstanceFX = AttackFX.CreateInstance();

            //// Sélectionner et paramétrer le bruitage de fond.
            this.attackInstanceFX          = attackFX.CreateInstance();
            this.attackInstanceFX.Volume   = 0.0f;
            this.attackInstanceFX.IsLooped = false;
        }
        public Citoyen(string cin, string nom, string prenom, string dateDeNaissance, Etats etat, byte doses, Regions region)
        {
            this.CIN             = cin.ToUpper();
            this.nom             = nom.ToUpper();
            this.prenom          = prenom.ToUpper();
            this.dateDeNaissance = DateTime.ParseExact(dateDeNaissance, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            this.Etat            = etat;
            DosesInjectee        = doses;
            Region = region;


            Isolations = new List <Isolation>();
            Rencontres = new List <Rencontre>();
            Tests      = new List <Test>();
            Records    = new List <Record>();
        }
        public Citoyen(string cin, string nom, string prenom, string dateDeNaissance, Regions region, Etats etat)
        {
            this.CIN             = cin;
            this.nom             = nom;
            this.prenom          = prenom;
            this.dateDeNaissance = DateTime.ParseExact(dateDeNaissance, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            this.Etat            = etat;
            Region = region;


            Tests      = new List <Test>();
            Records    = new List <Record>();
            Isolations = new List <Isolation>();
            Rencontres = new List <Rencontre>();
        }
Example #9
0
    /*
     *  Constructeur bo
     */

    public JeuRetro(String n) : base(n)
    {
        this.notice = false;
        this.etat   = Etats.Inconnu;
    }
Example #10
0
 /*
  *   Constructeur 0
  */
 public JeuRetro() : base()
 {
     this.notice = false;
     this.etat   = Etats.Inconnu;
 }
Example #11
0
        /// <summary>
        /// Boucle de jeu
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public void Update(GameTime gameTime)
        {
            if (vaisseauJoueur != null && vaisseauJoueur.NbVies < 1)
            {
                etatJeu = Etats.Pause;
                this.SuspendreEffetsSonores(true);
                this.ClearLists();
                this.vaisseauJoueur = null;
                jeuFini             = true;
            }

            if (fading)
            {
                _faderAlpha += _faderAlphaIncrement;

                // Lighting things back!
                if (_faderAlpha >= 255)
                {
                    switchScenes         = true;
                    _faderAlphaIncrement = -_faderAlphaIncrement;
                }
                else if (_faderAlpha <= 0)
                {
                    fading = false;
                }
            }

            if (this.EtatJeu == Etats.Demarrer)
            {
                if (!fading)
                {
                    this.menuManager.MenuCourant.GetInput(gameTime);
                }
                else
                {
                    if (switchScenes)
                    {
                        this.EtatJeu = etatJeuProchain;
                        if (EtatJeu == Etats.Info)
                        {
                            menuManager.MenuCourant = menuManager.TrouverMenu("Information");
                        }
                    }
                }
            }
            else if (this.EtatJeu == Etats.Info)
            {
                if (!fading)
                {
                    if (switchScenes)
                    {
                        switchScenes = false;
                    }
                    this.menuManager.MenuCourant.GetInput(gameTime);
                }
                else
                {
                    if (switchScenes && this.etatJeuProchain == Etats.Demarrer)
                    {
                        switchScenes            = false;
                        this.EtatJeu            = etatJeuProchain;
                        menuManager.MenuCourant = menuManager.TrouverMenu("MainMenu");
                    }
                }
            }
            else if (this.EtatJeu == Etats.Jouer || this.EtatJeu == Etats.Pause)
            {
                if (!fading)
                {
                    if (switchScenes)
                    {
                        switchScenes            = false;
                        menuManager.MenuCourant = null;
                        SuspendreEffetsSonores(false);
                    }
                    // Permettre de quitter le jeu via le service d'input.
                    if (ServiceHelper.Get <IInputService>().Quitter(1))
                    {
                        this.Initialize();
                        this.LoadContent();
                        return;
                    }

                    // Est-ce que le bouton de pause a été pressé?
                    if (ServiceHelper.Get <IInputService>().Pause(1))
                    {
                        this.Pause = !Pause;
                    }

                    // Si le jeu est en pause, interrompre la mise à jour
                    if (Pause)
                    {
                        return;
                    }

                    float delayTimer = (float)gameTime.ElapsedGameTime.TotalSeconds;
                    delaySecondRestant -= delayTimer;

                    if (delaySecondRestant <= 0)
                    {
                        delaySecondRestant = delaySecond;
                        pointsAutre       += 1f;
                    }
                    // Mettre à joueur les sprites du jeu
                    this.vaisseauJoueur.Update(gameTime, this.graphics);
                    this.arrierePlanEspace.Update(gameTime, this.graphics);

                    this.updateEnnemi(gameTime);

                    // Mettre à jour les obus
                    this.UpdateObus(gameTime);

                    // Mettre à jour les particules d'explosion
                    this.UpdateParticulesExplosions(gameTime);

                    foreach (EnnemiSprite sprite in listeEnnemis)
                    {
                        bool collision = sprite.Collision(vaisseauJoueur);

                        if (!this.vaisseauJoueur.IsRespawned && collision)
                        {
                            this.vaisseauJoueur.Health -= 5f;
                            this.listeEnnemisFini.Add(sprite);
                            this.CreerExplosion(sprite, particulesExplosions, gameTime, 1f);
                            bruitageExplosion.Play(0.25f, 0f, 0f);
                            if (vaisseauJoueur.Health < 1)
                            {
                                vaisseauJoueur.IsRespawned   = true;
                                vaisseauJoueur.NbVies       -= 1;
                                this.vaisseauJoueur.Position = this.vaisseauJoueur.PositionInitiale;
                            }
                        }
                    }

                    foreach (EnnemiSprite s in listeEnnemisFini)
                    {
                        listeEnnemis.Remove(s);
                    }

                    UpdatePowerUps(gameTime);
                }
            }
        }
Example #12
0
        /// <summary>
        /// Fonction déléguée fournie à tous les menus du jeu pour traiter les sélections 
        /// de l'usager.
        /// </summary>
        /// <param name="nomMenu">Nom du menu d'où provient la sélection.</param>
        /// <param name="item">Item de menu sélectionné.</param>
        protected void SelectionItemMenu(string nomMenu, ItemDeMenu item)
        {
            // Est-ce le menu pour quitter le jeu?
            if (nomMenu == "QuitterMenu")
            {
                // Deux sélections possibles : Oui ou Non
                switch (item.Nom)
                {
                    case "Oui":         // L'usager veut quitter le jeu
                        this.etatJeu = this.EtatJeu = Etats.Quitter;
                        break;

                    case "Non":         // L'usager ne veut pas quitter le jeu
                        this.MenuCourant = null;
                        break;

                    default:
                        break;
                }
            }
        }
Example #13
0
        /// <summary>
        /// Permet au jeu d'effectuer toute initialisation avant de commencer à jouer.
        /// Cette fonction membre peut demander les services requis et charger tout contenu
        /// non graphique pertinent. L'invocation de base.Initialize() itèrera parmi les
        /// composants afin de les initialiser individuellement.
        /// </summary>
        protected override void Initialize()
        {
            // Initialiser la vue de la caméra à la taille de l'écran.
            this.camera = new Camera(new Rectangle(0, 0, this.graphics.GraphicsDevice.Viewport.Width, this.graphics.GraphicsDevice.Viewport.Height));

            // Activer la gestion de services.
            ServiceHelper.Game = this;

            // Activer le service de gestion de l'input. Essayer premièrement
            // d'activer la manette, sinon le clavier
            GamePadState gamepadState = GamePad.GetState(PlayerIndex.One);
            if (gamepadState.IsConnected)
            {
                this.Components.Add(new ManetteService(this));
            }
            else
            {
                this.Components.Add(new ClavierService(this));
            }

            this.listeProjectiles = new List<Sprite>();
            this.listeProjectileFini = new List<Sprite>();

            this.listeBloc = new List<Sprite>();
            this.listeBlocFini = new List<Sprite>();

            this.listeOgres = new List<Ennemi>();
            this.listeOgresFini = new List<Ennemi>();

            this.listeSwitch = new List<Sprite>();
            this.listeSwitchFini = new List<Sprite>();

            this.listePorte = new List<Sprite>();
            this.listePorteFini = new List<Sprite>();

            this.listePorteHorizontale = new List<Sprite>();
            this.listePorteHorizontaleFini = new List<Sprite>();

            this.listeVideJoueur = new List<Sprite>();
            this.listeVideJoueurFini = new List<Sprite>();

            this.listeFood = new List<Sprite>();
            this.listeFoodFini = new List<Sprite>();
            this.boolFood = true;

            this.listeClef = new List<Sprite>();
            this.listeClefFini = new List<Sprite>();
            this.boolClef = false;
            this.portesClefOuvert[0] = false;

            // Créer les attributs de gestion des explosions.
            this.randomExplosions = new Random();

            this.randomPJEnemi = new Random();
            this.probPJ = 0.01f;

            // Le jeu est en cours de démarrage. Notez qu'on évite d'exploiter la prorpiété EtatJeu
            // car le setter de cette dernière manipule des effets sonores qui ne sont pas encore
            // chargées par LoadContent()
            this.etatJeu = Etats.Demarrer;

            base.Initialize();
        }
Example #14
0
 void setState(Etats state)
 {
 }
 public Record(DateTime date, Etats etat)
 {
     this.date = date;
     this.etat = etat;
 }
Example #16
0
        /// <summary>
        /// Сохраняет все внесенные изменения
        /// </summary>
        protected void SaveChanges()
        {
            try
            {
                //Шаблонный код вызван отсутствием поддержки обновления ключей БД со стороны EntityFramework.
                //Из-за этого операции вставки, удаления и изменения проводятся через объект заместитель, который позволяет
                //в случае замены ключа осуществить вставку нового ключа с перепривязкой к нему всех загруженных значений.
                //Полагаю, что по соображениям производительности справочники лучше менять с помощью SQL
                #region Шаблонный код обработки заместителей
                //CertificationDocTypes
                var delCertificationDocTypes = CertificationDocTypesDB.Except(
                    CertificationDocTypes.Where(d => !d.Added).Select(d => d.InnerReference)).ToList();
                foreach (var del in delCertificationDocTypes)
                {
                    ContextDb.Entry <CertificationDocumentType>(del).State = EntityState.Deleted;
                }

                var addCertificationDocTypes = CertificationDocTypes.Where(d => d.Added);
                foreach (var add in addCertificationDocTypes)
                {
                    CertificationDocumentType newType = new CertificationDocumentType()
                    {
                        Nom = add.Nom
                    };
                    ContextDb.CertificationDocumentTypes.Attach(newType);
                    ContextDb.Entry <CertificationDocumentType>(newType).State = EntityState.Added;
                }

                var modCertificationDocTypes = CertificationDocTypes.Where(m => m.Modifed);
                foreach (var mod in modCertificationDocTypes)
                {
                    CertificationDocumentType oldType = mod.InnerReference;
                    CertificationDocumentType newType = new CertificationDocumentType()
                    {
                        Nom = mod.Nom
                    };
                    ContextDb.CertificationDocumentTypes.Attach(newType);
                    ContextDb.Entry <CertificationDocumentType>(newType).State = EntityState.Added;

                    foreach (var child in oldType.CertificationDocuments.ToList())
                    {
                        child.CertificationDocumentTypeNom = newType.Nom;
                        ContextDb.Entry(child).Property(p => p.CertificationDocumentTypeNom).IsModified = true;
                    }


                    ContextDb.Entry <CertificationDocumentType>(oldType).State = EntityState.Deleted;
                }

                //SinistreeTypes
                var delSinistreeTypes = SinistreeTypesDB.Except(
                    SinistreeTypes.Where(d => !d.Added).Select(d => d.InnerReference)).ToList();
                foreach (var del in delSinistreeTypes)
                {
                    ContextDb.Entry <SinistreeType>(del).State = EntityState.Deleted;
                }

                var addSinistreeTypes = SinistreeTypes.Where(d => d.Added);
                foreach (var add in addSinistreeTypes)
                {
                    SinistreeType newType = new SinistreeType()
                    {
                        Nom = add.Nom
                    };
                    ContextDb.SinistreeTypes.Attach(newType);
                    ContextDb.Entry <SinistreeType>(newType).State = EntityState.Added;
                }

                var modSinistreeTypes = SinistreeTypes.Where(m => m.Modifed);
                foreach (var mod in modSinistreeTypes)
                {
                    SinistreeType oldType = mod.InnerReference;
                    SinistreeType newType = new SinistreeType()
                    {
                        Nom = mod.Nom
                    };
                    ContextDb.SinistreeTypes.Attach(newType);
                    ContextDb.Entry <SinistreeType>(newType).State = EntityState.Added;

                    foreach (var child in oldType.SinistreeRegions.ToList())
                    {
                        child.SinistreeTypeNom = newType.Nom;
                        ContextDb.Entry(child).Property(p => p.SinistreeTypeNom).IsModified = true;
                    }


                    ContextDb.Entry <SinistreeType>(oldType).State = EntityState.Deleted;
                }

                //SujetDocumentTypes
                var delSujetDocumentTypes = SujetDocumentTypesDB.Except(
                    SujetDocumentTypes.Where(d => !d.Added).Select(d => d.InnerReference)).ToList();
                foreach (var del in delSujetDocumentTypes)
                {
                    ContextDb.Entry <SujetDocumentType>(del).State = EntityState.Deleted;
                }

                var addSujetDocumentTypes = SujetDocumentTypes.Where(d => d.Added);
                foreach (var add in addSujetDocumentTypes)
                {
                    SujetDocumentType newType = new SujetDocumentType()
                    {
                        Nom = add.Nom
                    };
                    ContextDb.SujetDocumentTypes.Attach(newType);
                    ContextDb.Entry <SujetDocumentType>(newType).State = EntityState.Added;
                }

                var modSujetDocumentTypes = SujetDocumentTypes.Where(m => m.Modifed);
                foreach (var mod in modSujetDocumentTypes)
                {
                    SujetDocumentType oldType = mod.InnerReference;
                    SujetDocumentType newType = new SujetDocumentType()
                    {
                        Nom = mod.Nom
                    };
                    ContextDb.SujetDocumentTypes.Attach(newType);
                    ContextDb.Entry <SujetDocumentType>(newType).State = EntityState.Added;

                    foreach (var child in oldType.SujetDocuments.ToList())
                    {
                        child.SujetDocumentTypeNom = newType.Nom;
                        ContextDb.Entry(child).Property(p => p.SujetDocumentTypeNom).IsModified = true;
                    }


                    ContextDb.Entry <SujetDocumentType>(oldType).State = EntityState.Deleted;
                }


                //UtilisationTypes
                var delUtilisationTypes = UtilisationTypesDB.Except(
                    UtilisationTypes.Where(d => !d.Added).Select(d => d.InnerReference)).ToList();
                foreach (var del in delUtilisationTypes)
                {
                    ContextDb.Entry <UtilisationType>(del).State = EntityState.Deleted;
                }

                var addUtilisationTypes = UtilisationTypes.Where(d => d.Added);
                foreach (var add in addUtilisationTypes)
                {
                    UtilisationType newType = new UtilisationType()
                    {
                        Nom = add.Nom
                    };
                    ContextDb.UtilisationTypes.Attach(newType);
                    ContextDb.Entry <UtilisationType>(newType).State = EntityState.Added;
                }

                var modUtilisationTypes = UtilisationTypes.Where(m => m.Modifed);
                foreach (var mod in modUtilisationTypes)
                {
                    UtilisationType oldType = mod.InnerReference;
                    UtilisationType newType = new UtilisationType()
                    {
                        Nom = mod.Nom
                    };
                    ContextDb.UtilisationTypes.Attach(newType);
                    ContextDb.Entry <UtilisationType>(newType).State = EntityState.Added;

                    foreach (var child in oldType.Utilisations.ToList())
                    {
                        child.UtilisationTypeNom = newType.Nom;
                        ContextDb.Entry(child).Property(p => p.UtilisationTypeNom).IsModified = true;
                    }


                    ContextDb.Entry <UtilisationType>(oldType).State = EntityState.Deleted;
                }

                //Etats
                var delEtats = EtatsDB.Except(
                    Etats.Where(d => !d.Added).Select(d => d.InnerReference)).ToList();
                foreach (var del in delEtats)
                {
                    ContextDb.Entry <Etat>(del).State = EntityState.Deleted;
                }

                var addEtats = Etats.Where(d => d.Added);
                foreach (var add in addEtats)
                {
                    Etat newType = new Etat()
                    {
                        Nom = add.Nom
                    };
                    ContextDb.Etats.Attach(newType);
                    ContextDb.Entry <Etat>(newType).State = EntityState.Added;
                }

                var modEtats = Etats.Where(m => m.Modifed);
                foreach (var mod in modEtats)
                {
                    Etat oldType = mod.InnerReference;
                    Etat newType = new Etat()
                    {
                        Nom = mod.Nom
                    };
                    ContextDb.Etats.Attach(newType);
                    ContextDb.Entry <Etat>(newType).State = EntityState.Added;

                    foreach (var child in oldType.Sujets.ToList())
                    {
                        child.Nationalite = newType.Nom;
                        ContextDb.Entry(child).Property(p => p.Nationalite).IsModified = true;
                    }


                    ContextDb.Entry <Etat>(oldType).State = EntityState.Deleted;
                }

                //JuridiqueTypes
                var delJuridiqueTypes = JuridiqueTypesDB.Except(
                    JuridiqueTypes.Where(d => !d.Added).Select(d => d.InnerReference)).ToList();
                foreach (var del in delJuridiqueTypes)
                {
                    foreach (var tran in del.TransactionTypes.ToList())
                    {
                        ContextDb.Entry <TransactionType>(tran).State = EntityState.Deleted;
                    }
                    ContextDb.Entry <JuridiqueType>(del).State = EntityState.Deleted;
                }

                var addJuridiqueTypes = JuridiqueTypes.Where(d => d.Added);
                foreach (var add in addJuridiqueTypes)
                {
                    JuridiqueType newType = new JuridiqueType()
                    {
                        Nom = add.Nom
                    };
                    ContextDb.JuridiqueTypes.Attach(newType);
                    ContextDb.Entry <JuridiqueType>(newType).State = EntityState.Added;
                }

                var modJuridiqueTypes = JuridiqueTypes.Where(m => m.Modifed);
                foreach (var mod in modJuridiqueTypes)
                {
                    JuridiqueType oldType = mod.InnerReference;
                    JuridiqueType newType = new JuridiqueType()
                    {
                        Nom = mod.Nom
                    };
                    ContextDb.JuridiqueTypes.Attach(newType);
                    ContextDb.Entry <JuridiqueType>(newType).State = EntityState.Added;

                    foreach (var child in oldType.TransactionTypes.ToList())
                    {
                        child.JuridiqueTypeNom = newType.Nom;
                        ContextDb.Entry(child).Property(p => p.JuridiqueTypeNom).IsModified = true;
                    }


                    ContextDb.Entry <JuridiqueType>(oldType).State = EntityState.Deleted;
                }

                ObservableCollection <TransactionType> TransactionTypesDB = new ObservableCollection <TransactionType>(JuridiqueTypesDB.SelectMany(j => j.TransactionTypes).ToList());
                foreach (var jur in JuridiqueTypes)
                {
                    foreach (var tr in jur.TransactionTypes)
                    {
                        if (tr.JuridiqueType == null)
                        {
                            tr.JuridiqueType = jur;
                        }
                    }
                }
                ObservableCollection <TransactionTypeProxy> TransactionTypes = new ObservableCollection <TransactionTypeProxy>(JuridiqueTypes.SelectMany(j => j.TransactionTypes).ToList());

                //TransactionTypes
                var delTransactionTypes = TransactionTypesDB.Except(
                    TransactionTypes.Where(d => !d.Added).Select(d => d.InnerReference)).ToList();
                foreach (var del in delTransactionTypes)
                {
                    ContextDb.Entry <TransactionType>(del).State = EntityState.Deleted;
                }

                var addTransactionTypes = TransactionTypes.Where(d => d.Added);
                foreach (var add in addTransactionTypes)
                {
                    TransactionType newType = new TransactionType()
                    {
                        Nom = add.Nom, JuridiqueTypeNom = add.JuridiqueType.Nom
                    };
                    ContextDb.TransactionTypes.Attach(newType);
                    ContextDb.Entry <TransactionType>(newType).State = EntityState.Added;
                }

                var modTransactionTypes = TransactionTypes.Where(m => m.Modifed);
                foreach (var mod in modTransactionTypes)
                {
                    TransactionType oldType = mod.InnerReference;
                    TransactionType newType = new TransactionType()
                    {
                        Nom = mod.Nom, JuridiqueTypeNom = mod.JuridiqueType.Nom
                    };
                    ContextDb.TransactionTypes.Attach(newType);
                    ContextDb.Entry <TransactionType>(newType).State = EntityState.Added;

                    foreach (var child in oldType.Transactions.ToList())
                    {
                        child.TransactionTypeNom = newType.Nom;
                        ContextDb.Entry(child).Property(p => p.TransactionTypeNom).IsModified = true;
                    }


                    ContextDb.Entry <TransactionType>(oldType).State = EntityState.Deleted;
                }
                #endregion


                if (ContextDb.ChangeTracker.HasChanges())                       //Если были зафиксированы изменения
                {
                    ContextDb.SaveChanges();
                    CreateProxy();                                              //Воссоздаем заместителей
                    //Уведомляем об изменении справочников
                    Messenger.Default.Send <ReferenceRefreshedMessage>(new ReferenceRefreshedMessage());
                }
            }
            catch (Exception e)
            {
                string    message = "Редактирование нарушает целостность данных:\n" + e.Message;
                Exception ie      = e.InnerException;
                while (ie != null)
                {
                    message += '\n' + ie.Message;
                    ie       = ie.InnerException;
                }
                message += "\nДля сохранения целостности данных результаты редактирования аннулированы";

                MessageBox.Show(message, "Ошибка ввода данных", MessageBoxButton.OK);

                //Отменяем внесенные изменения
                ContextDb.DiscardAllChanges();

                LoadDataAsync();                                //Полная перезагрузка данных
            }
        }
Example #17
0
        /// <summary>
        /// On initialize les variables
        /// </summary>
        public void Initialize()
        {
            _faderTexture = new Texture2D(graphics.GraphicsDevice, 1, 1);
            var colors = new Color[] { Color.White };

            _faderTexture.SetData <Color>(colors);
            this.menuManager = new MenuManager(this);

            // Ajust le nom du jeu
            this.game.Window.Title = "projetJeu";

            // Ajuste les dimensions du jeu
            this.graphics.PreferredBackBufferWidth  = 800;
            this.graphics.PreferredBackBufferHeight = 480;
            this.graphics.ApplyChanges();

            this._faderAlphaIncrement = 10f;
            this.delaySecond          = 1f;
            this.delaySecondRestant   = 1f;

            this.listeEnnemis              = new List <Sprite>();
            this.listeEnnemisFini          = new List <Sprite>();
            this.listeObusEnnemis          = new List <Obus>();
            this.listeObusJoueur           = new List <Obus>();
            this.listeParticulesExplosions = new List <ParticuleExplosion>();
            this.listeObusFini             = new List <Obus>();
            this.listePowerUp              = new List <PowerUp>();
            this.listePowerUpFini          = new List <PowerUp>();

            ClearLists();

            this.points      = 0f;
            this.pointsAutre = 0f;

            // Activer le service de gestion du clavier
            if (ServiceHelper.Game == null)
            {
                ServiceHelper.Game = this.game;
                this.game.Components.Add(new ClavierService(this.game));
            }

            // Initialiser la vue de la caméra à la taille de l'écran.
            this.camera = new Camera(new Rectangle(0, 0, this.graphics.GraphicsDevice.Viewport.Width, this.graphics.GraphicsDevice.Viewport.Height));

            // Le jeu est en cours de démarrage. Notez qu'on évite d'exploiter la prorpiété EtatJeu
            // car le setter de cette dernière manipule des effets sonores qui ne sont pas encore
            // chargées par LoadContent()
            this.etatJeu = Etats.Demarrer;

            // Créer les attributs de gestion des ennemis.
            this.randomEnnemis  = new Random();
            this.randomPowerup  = new Random();
            this.probEnnemis    = 0.005f;
            this.probEnnemiType = 0.4f;
            this.probPowerUp    = 0.35f;

            this.jeuFini = false;

            redPixel = new Texture2D(graphics.GraphicsDevice, 1, 1);
            redPixel.SetData <Color>(new[] { Color.Red });
            greenPixel = new Texture2D(graphics.GraphicsDevice, 1, 1);
            greenPixel.SetData <Color>(new[] { Color.Green });
            invisiblePixel = new Texture2D(graphics.GraphicsDevice, 1, 1);
            invisiblePixel.SetData <Color>(new[] { Color.Transparent });

            // Créer les attributs de gestion des explosions.
            this.randomExplosions = new Random();
        }
Example #18
0
 /// <summary>
 /// Constructeur paramétré recevant la position du sprite.
 /// </summary>
 /// <param name="x">Coordonnée initiale x (horizontale) du sprite.</param>
 /// <param name="y">Coordonnée initiale y (verticale) du sprite.</param>
 public Personnage(float x, float y)
     : base(x, y)
 {
     // Par défaut, le sprite est celui faisant face aux Joueur du partie.
     this.direction = Directions.Sud;
     this.etat = Etats.Stationnaire;
 }