예제 #1
0
        public static void LoadDefault(AppModel model)
        {
//			Localization = LocalizationConfig.Default(model.Language);
//			Game = GameConfig.Default();
//			GameCenter = GameCenterConfig.Default();
//			Elements = ElementConfig.Default();
            Levels = LevelConfig.Default();
            Game   = GameConfig.Default();
        }
예제 #2
0
        public void WinVertical()
        {
            using (var uw = new PostgresUnitOfWork(connString))
            {
                User amir = User.NewUser("Amir");
                User budi = User.NewUser("Budi");

                uw.UserRepo.Create(amir);
                uw.UserRepo.Create(budi);

                Room room = new Room(2);
                uw.RoomRepo.Create(room);

                room.Join(amir);
                uw.RoomRepo.Join(room, amir);

                room.Join(budi);
                uw.RoomRepo.Join(room, budi);

                room.StartGame("tic-tac-toe", GameConfig.Default(), uw.UserRepo);
                uw.RoomRepo.ChangeGame(room, room.Game, GameConfig.Default());

                Move move;

                move = new TicTacToeMove(amir.ID, 4);
                room.Move(move);
                uw.RoomRepo.AddMove(room, move);

                move = new TicTacToeMove(budi.ID, 3);
                room.Move(move);
                uw.RoomRepo.AddMove(room, move);

                move = new TicTacToeMove(amir.ID, 7);
                room.Move(move);
                uw.RoomRepo.AddMove(room, move);

                move = new TicTacToeMove(budi.ID, 0);
                room.Move(move);
                uw.RoomRepo.AddMove(room, move);

                move = new TicTacToeMove(amir.ID, 1);
                room.Move(move);
                uw.RoomRepo.AddMove(room, move);

                move = new TicTacToeMove(budi.ID, 3);
                Exception ex = Assert.Throws <Exception>(() => room.Move(move));
                uw.RoomRepo.AddMove(room, move);

                Assert.Equal("game already ended", ex.Message);

                Assert.Equal(5, uw.UserRepo.FindById(amir.ID).Exp);
                Assert.Equal(2, uw.UserRepo.FindById(budi.ID).Exp);
            }
        }
예제 #3
0
        public static bool Load(AppModel model)
        {
            try
            {
//				Localization = LocalizationConfig.Load(model.Language);
//				Game = GameConfig.Default();//GameConfig.Load(GameConfig.FILE_NAME);
//				GameCenter = GameCenterConfig.Default();//GameCenterConfig.Load(GameCenterConfig.FILE_NAME);
//				Elements = ElementConfig.Default();
                Levels = LevelConfig.Default();
                Game   = GameConfig.Default();
            }
            catch (Exception e)
            {
                MonoLog.Log(MonoLogChannel.Exceptions, e);

                return(false);
            }

            return(true);
        }