示例#1
0
        public string Create(GameClient owner, int quizId, out Room room)
        {
            room          = new WaitingRoom();
            room.Parent   = Owner;
            room.IsInGame = false;
            room.AddOwner(owner);
            Quiz quiz = new Quiz();

            quiz.FromEntity(ServerMain.Instance.Database.GetQuiz(quizId));
            room.Quiz         = quiz;
            room.IsLocked     = false;
            room.NoOfQuestion = -1;
            Rooms.Add(room);
            Observer.OnRoomCreated(room.Parent, room.GetIdentifier());
            return(room.GetIdentifier());
        }
示例#2
0
        /// <summary>
        /// Teacher Session Game - GameSession don't need to keep track, so that GarbageCollector can be activated once no client is pointing a reference
        /// to the Game object.
        /// </summary>
        /// <param name="r"></param>
        /// <param name="game"></param>
        /// <returns></returns>
        public bool Create(WaitingRoom r, out Game[] game)
        {
            game = GameFactory.CreateGame(r);
            string prefix  = r.GetIdentifier();
            int    i       = 1;
            var    success = game.Where(x => x == null).Count() == 0;

            if (!success)
            {
                return(false);
            }
            return(success);
        }