Exemple #1
0
        public void Start()
        {
            SaveLog("Запуск игрового сервера");

            if (!_serverWork)
            {
                _serverWork = true;

                if (File.Exists("sessions.dat") &&
                    QuestionOutput != null &&
                    QuestionOutput("Найдена сохраненная сессия!\r\n Хотите её восстановить?"))
                {
                    DeserializeSessionsGames();

                    return;
                }


                // Load games and players
                // Start
                LoadGames();
                LoadAccounts();

                ServerEmulator.GetRandomStatus(Accounts);

                SelectActiveAccounts();
                SelectGame();

                StartGame();
            }
        }
Exemple #2
0
        private void LoadAccounts()
        {
            // DB
            SaveLog("Загрузка пользователей");

            Accounts = new List <Account>
            {
                new Gamer(0, "Milena", ServerEmulator.GetRandomPassHash()),
                new Gamer(1, "Dima", ServerEmulator.GetRandomPassHash()),
                new Gamer(2, "darkness", ServerEmulator.GetRandomPassHash()),
                new Gamer(3, "Viktor", ServerEmulator.GetRandomPassHash()),
                new Gamer(4, "IronMan", ServerEmulator.GetRandomPassHash()),
                new Gamer(5, "Rabbit", ServerEmulator.GetRandomPassHash()),
                new Gamer(6, "Samurai", ServerEmulator.GetRandomPassHash()),
                new Gamer(7, "Fox", ServerEmulator.GetRandomPassHash()),
                new Gamer(8, "Dog12", ServerEmulator.GetRandomPassHash()),
                new Gamer(9, "Stark", ServerEmulator.GetRandomPassHash()),
                new Gamer(10, "Antoni", ServerEmulator.GetRandomPassHash()),
                new Gamer(11, "Halk", ServerEmulator.GetRandomPassHash()),
                new Gamer(12, "Marshmallow", ServerEmulator.GetRandomPassHash()),
                new Gamer(13, "Nagibator228", ServerEmulator.GetRandomPassHash()),
                new Gamer(14, "volk", ServerEmulator.GetRandomPassHash()),
                new Gamer(15, "zoro", ServerEmulator.GetRandomPassHash()),
                new Gamer(16, "stalker", ServerEmulator.GetRandomPassHash()),
                new Gamer(17, "Rock123", ServerEmulator.GetRandomPassHash()),
                new Gamer(18, "Linda", ServerEmulator.GetRandomPassHash()),
                new Gamer(19, "Sniper", ServerEmulator.GetRandomPassHash()),
                new Gamer(20, "Viper", ServerEmulator.GetRandomPassHash()),
                new Gamer(21, "mistic", ServerEmulator.GetRandomPassHash()),
            };
        }
Exemple #3
0
        private void SelectGame()
        {
            SaveLog("Распределение игроков в очереди по играм");

            if (QueueActiveAccount.Count != 0)
            {
                while (QueueActiveAccount.Count != 0 && Games.Count != 0)
                {
                    Account gamer = QueueActiveAccount.Dequeue();
                    Games[ServerEmulator.GetRandomIndxGame(Games.Count)].AddGamer(gamer);
                }

                foreach (var game in Games)
                {
                    game.GetCountPlayersFormat();
                }
                Games.Sort();
            }
        }