Exemple #1
0
        static void Main(string[] args)
        {
            SetConsoleCtrlHandler(new HandlerRoutine(ConsoleCtrlCheck), true);

            game         = new GameWords();
            game.OnTime += game.WinByTime;
            game.ChangeLanguage();
            game.CreatePlayers();
            game.Menu();

            Console.WriteLine("CTRL+C,CTRL+BREAK or suppress the application to exit");

            while (!isclosing)
            {
                ;
            }
        }
Exemple #2
0
        public void Save(GameWords g)
        {
            Load();
            bool isIt = false;

            foreach (GameWords gm in CollectionGameWords.gameWordsCollection)
            {
                if (String.Equals(g.Player1.Name, gm.Player1.Name) && String.Equals(g.Player2.Name, gm.Player2.Name))
                {
                    gm.Player1.Wins += g.Player1.Wins;
                    gm.Player2.Wins += g.Player2.Wins;
                    isIt             = true;
                    break;
                }
            }
            if (!isIt)
            {
                CollectionGameWords.gameWordsCollection.Add(g);
            }

            String json = JsonConvert.SerializeObject(CollectionGameWords.gameWordsCollection);

            File.WriteAllText("GameWords.json", json, Encoding.UTF8);
        }
Exemple #3
0
 public GameWords(GameWords g)
 {
     Player1 = g.Player1;
     Player2 = g.Player2;
 }