public void Process(string command, IEnumerable<string> args)
        {
            QuizView viewer = new QuizView();
            //viewer.Render(string question, List<string> response);
            Random rand = new Random();
            new RetreaveQuestion().Process("", Enumerable.Repeat(rand.Next(0,4).ToString(),1));
            Console.WriteLine("Please select 1-4");

            //user input somehow captured and entered into instance of the Karens party chooser Model, usersParty var updated by method

            // end of questions or exit
        }
        public ActionResult EditPost(QuizView view)
        {
            var quiz = cx.Quizzes.Find(view.Id);

            quiz.Name          = view.Name;
            quiz.Value         = view.Value;
            quiz.TimeLimit     = view.TimeLimit;
            quiz.Type          = view.Type;
            quiz.TestingType   = view.TestingType;
            quiz.TimeLimitType = view.TimeLimitType;

            cx.SaveChanges();

            return(RedirectToAction("Sections", new { id = view.Id }));
        }
Example #3
0
        // GET: Lesson/Details/5
        public ActionResult Details(string token, string courseId, string lessonName)
        {
            string username = AuthLogic.CheckToken(token);

            if (username == "")
            {
                throw new Exception("NotAuthorized");
            }
            ViewData["token"] = token;

            var course = Course.GetCourse(courseId);

            if (username == course.ModelCourse.Author)
            {
                ViewData["isAuthor"] = true;
            }
            else
            {
                ViewData["isAuthor"] = false;
            }

            var lessonView = new LessonView();

            foreach (var courseLesson in course.ModelCourse.Lessons)
            {
                if (courseLesson.Name == lessonName)
                {
                    lessonView = LessonView.CastFromLesson(courseLesson, courseId);
                    break;
                }
            }
            if (lessonView.Words == null)
            {
                lessonView.Words = new List <WordView>();
            }

            // For now there are only generic tests; later there might be lesson-specific tests,
            // so those will be included here as well...)
            var bllQuizzes = Quiz.GetAllGenericQuizzes();

            lessonView.Quiz = QuizView.CastFromBllQuiz(bllQuizzes);

            return(View(lessonView));
        }
Example #4
0
    public void NextQuestion()
    {
        if (questions.Count == 0)
        {
            QuizController.prevScore = score;
            Application.LoadLevel("StartMenu");
            return;
        }
        Question question = questions[0];

        questions.RemoveAt(0);

        Action next = delegate() {
            if (question is CompositionQuestion)
            {
                this.currentQuizView = compositionQuizView;
            }
            else if (question is CompareQuestion)
            {
                this.currentQuizView = compareQuizView;
            }


            if (currentQuizView == null)
            {
                NextQuestion();
                return;
            }
            this.cat.transform.parent   = this.currentQuizView.transform;
            this.cat.transform.position = Vector3.zero;
            this.currentQuizView.Show();
            this.currentQuizView.Fill(question);
        };

        if (this.currentQuizView != null)
        {
            this.currentQuizView.Hide(next);
        }
        else
        {
            next();
        }
    }
Example #5
0
    void Awake()
    {
        this.score     = 0;
        this.header    = GameObject.Find("GameGUIHeader").GetComponent <GameGUIText>();
        this.scoreText = GameObject.Find("ScoreHeader").GetComponent <GameGUIText> ();
        this.scoreText.SetTextPure("Score: " + 0);
        this.cat       = GameObject.Find("CatObject");
        this.catStates = new Dictionary <string, GameObject> {
            { "Happy", GameObject.Find("HappyCat") },
            { "Neutral", GameObject.Find("NeutralCat") },
            { "Sad", GameObject.Find("SadCat") },
        };
        this.catStates ["Happy"].SetActive(false);
        this.catStates ["Sad"].SetActive(false);
        foreach (QuizView view in GameObject.FindObjectsOfType <QuizView>())
        {
            quizViews.Add(view);
            switch (view.gameObject.name)
            {
            case "CompositionQuizView":
                compositionQuizView         = view;
                this.cat.transform.parent   = compositionQuizView.transform;
                this.cat.transform.position = Vector3.zero;
                break;

            case "CompareQuizView":
                compareQuizView             = view;
                this.cat.transform.parent   = compareQuizView.transform;
                this.cat.transform.position = Vector3.zero;
                break;
            }
        }
        if (compositionQuizView == null)
        {
            Debug.LogWarning("No composition view!");
        }
        if (compareQuizView == null)
        {
            Debug.LogWarning("No compare view!");
        }
    }
        public ActionResult AddPost(QuizView view)
        {
            var CurrentUser = cx.Users.Find(UserManager.FindByName(User.Identity.Name).Id);

            var model = new Quiz()
            {
                Name          = view.Name,
                Value         = view.Value,
                TimeLimit     = view.TimeLimit,
                Type          = view.Type,
                TestingType   = view.TestingType,
                TimeLimitType = view.TimeLimitType,
                User          = CurrentUser,
            };

            cx.Quizzes.Add(model);

            cx.SaveChanges();

            return(RedirectToAction("Sections", new { id = model.Id }));
        }
        public ActionResult Edit(int?id)
        {
            var quiz = cx.Quizzes.Find(id);

            if (quiz == null)
            {
                return(HttpNotFound());
            }

            var model = new QuizView()
            {
                Id            = quiz.Id,
                Name          = quiz.Name,
                Value         = quiz.Value,
                TimeLimit     = quiz.TimeLimit,
                Type          = quiz.Type,
                TestingType   = quiz.TestingType,
                TimeLimitType = quiz.TimeLimitType
            };

            return(View(model));
        }
        public void OpenQuizWindow()
        {
            Window quizWindow = new QuizView(_sessionService, _quizDataService, this);

            quizWindow.Show();
        }
        public ViewResult Quiz()
        {
            QuizView quiz = new QuizView(repo);

            return(View(quiz));
        }