public ActionResult Sanctuary()
        {
            List <Animal> listOfAnimals = _animal.GetList((int)Session["profileID"]);
            Options       options       = _options.Get((int)Session["profileID"]);

            TempData["profileName"] = options.profileName;
            return(View(listOfAnimals));
        }
Exemplo n.º 2
0
        /**********************************************************************
         * Purpose: Saves the name of the selected profile to the session variable,
         * note the parameter must be nullable. The parameter passed in is an index
         * to the profile the user selected on the choose profiles page.
         ***********************************************************************/
        public void SelectedProfile(int?id)
        {
            int selectedIndex = (int)id;

            List <Profile>      allProfs = _profileRepo.GetList();
            Options             options  = new Options();
            OptionsDBRepository repo     = new OptionsDBRepository();

            //find the profile the user clicked
            for (int i = 0; i < allProfs.Count(); i++)
            {
                //assign the used profileID to the session variables
                if (i == selectedIndex)
                {
                    Session["profileID"] = allProfs[i].ID;
                    options = repo.Get((int)Session["profileID"]);
                    Session["toggleSound"] = options.toggleSound; //set Session variables for toggle music and sound
                    Session["toggleMusic"] = options.toggleMusic;
                }
            }
        }
        //set model values
        public PlayModel SetModel()
        {
            if (User.Identity.IsAuthenticated)
            {
                ProfileProgress progress = _progress.Get((int)Session["profileID"]);
                _model.CurrentMap = progress.CurrentMap;
                if (_model.CurrentMap == 0)                                       //If MapID equals 0, no ProfileProgress
                {
                    NewMap();                                                     //call function to set map and animal to save
                    progress          = _progress.Get((int)Session["profileID"]); //requery progress
                    _model.CurrentMap = progress.CurrentMap;                      //set current map for model
                }

                Options options = _options.Get((int)Session["profileID"]);
                int     level   = 0;

                _model.Animal      = progress.AnimalID;
                _model.CurrentNode = progress.CurrentNode;
                _model.Avatar      = options.AvatarID;
                _model.MapNodes    = _node.GetList(progress.CurrentMap);

                //set difficulty level for Play/Map display in View
                if (options.SubjectFilter == "Reading")
                {
                    level = options.ReadingDifficultyLevel;
                }
                else if (options.SubjectFilter == "Math")
                {
                    level = options.MathDifficultyLevel;
                }
                else
                {
                    level = options.ReadingDifficultyLevel > options.MathDifficultyLevel ?
                            options.ReadingDifficultyLevel : options.MathDifficultyLevel;
                }

                //Set grade level for Play/Map display in View
                if (level == 1)
                {
                    _model.GradeLevel = "Pre-Preschool";
                }
                else if (level == 2)
                {
                    _model.GradeLevel = "Preschool";
                }
                else if (level == 3)
                {
                    _model.GradeLevel = "Pre-Kindergarten";
                }
                else
                {
                    _model.GradeLevel = "Kindergarten";
                }

                //Set name and subject filter for Play/Map display in View
                _model.ProfileName = options.profileName;
                _model.Subject     = options.SubjectFilter;
                if (_model.Subject == "" || _model.Subject == "Any")
                {
                    _model.Subject = "All";
                }
            }
            else     //set model for free play mode
            {
                _model.ProfileName = "Free Play";
                _model.GradeLevel  = "All";
                _model.Subject     = "All";
                _model.CurrentMap  = (int)Session["fp_mapID"];
                _model.CurrentNode = (int)Session["fp_nodeID"];
                _model.Animal      = (int)Session["fp_animalID"];
                _model.Avatar      = (int)Session["fp_avatarID"];
                _model.MapNodes    = _node.GetList((int)Session["fp_mapID"]);
            }
            return(_model);
        }
Exemplo n.º 4
0
 public ActionResult InnerOptions()
 {
     m_options = new OptionsModel(m_optionsRepository.Get((int)Session["profileID"]));
     return(View(m_options));
 }
Exemplo n.º 5
0
        public void ShowAvatarImageTest()
        {
            int expectedImageID = 1;

            Options profile = _options.Get(profileID);      //get profile from database
            Images  image   = _image.Get(profile.AvatarID); //get profile image from database

            Assert.AreEqual(expectedImageID, image.ID);
        }