Exemple #1
0
        public static void TestGuerrierInit()
        {
            //coucou
            Goule            Simon      = new Goule("Simon", 2);
            Goule            Hector     = new Goule("Hector", 2);
            Goule            Pierre     = new Goule("Pierre", 2);
            Goule            Paul       = new Goule("Paul", 2);
            List <Character> characters = new List <Character> {
                Simon, Hector, Pierre, Paul
            };

            fightManager = new FightManager(characters, 0);
            fightManager.StartCombat();
            Console.ReadLine();
        }
Exemple #2
0
        public static void ProgramProf()
        {
            //coucou
            Character        Simon      = new Character("Simon", 100, 100, 50, 100, 200, 2);
            Character        Hector     = new Character("Hector", 75, 125, 25, 125, 200, 2);
            Character        Pierre     = new Character("Pierre", 125, 75, 25, 125, 200, 2);
            Character        Paul       = new Character("Paul", 50, 50, 50, 75, 200, 4);
            List <Character> characters = new List <Character> {
                Simon, Hector, Pierre, Paul
            };
            FightManager fightManager = new FightManager(characters, 0);

            fightManager.StartCombat();
            Console.ReadLine();
        }
Exemple #3
0
        public static FightManager LoadJson(string json)
        {
            //string output = JsonConvert.SerializeObject(c);

            /*string output = JsonConvert.SerializeObject(c, Formatting.Indented,new JsonSerializerSettings
             *  {
             *      ReferenceLoopHandling = ReferenceLoopHandling.Serialize
             *  });*/
            fightManager = JsonConvert.DeserializeObject <FightManager>(json, new JsonSerializerSettings
            {
                //ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
                TypeNameHandling = TypeNameHandling.All
                                   //MetadataPropertyHandling = MetadataPropertyHandling.Ignore
            });
            return(fightManager);
        }
Exemple #4
0
        public static string SaveJson(FightManager f)
        {
            //string output = JsonConvert.SerializeObject(c);
            string output = JsonConvert.SerializeObject(f, Formatting.Indented, new JsonSerializerSettings
            {
                //ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
                TypeNameHandling = TypeNameHandling.All
                                   //MetadataPropertyHandling = MetadataPropertyHandling.Default
            });

            /*string output = JsonConvert.SerializeObject(f, Formatting.Indented, new JsonSerializerSettings
             *  {
             *      PreserveReferencesHandling = PreserveReferencesHandling.Objects
             *  });*/
            Console.WriteLine(output);
            return(output);
        }
Exemple #5
0
 public void SetFightManager(FightManager fightManager)
 {
     this.fightManager = fightManager;
 }