示例#1
0
 public Homework getPaper()
 {
     if (homeworks.Count > 1)
     {
         Homework ret = homeworks.Pop();
         parent = homeworks.Peek();
         return(ret);
     }
     parent = homeworks.Peek();
     return(null);
 }
示例#2
0
        public Homework GenerateHomework(float threshold)
        {
            GameObject nextButton = new TextureObject(MediaManager.textures["next button"], new Vector2(0, 650));
            GameObject prevButton = new TextureObject(MediaManager.textures["prev button"], new Vector2(600, 650));

            Paper[] papers = new Paper[problems.Length];
            for (int i = 0; i < problems.Length; i++)
            {
                papers[i] = problems[i].generatePaper(threshold);
            }

            Homework ret = new Homework(nextButton, prevButton, papers);

            return(ret);
        }
示例#3
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            //MediaManager.emilia.Stop();
            //MediaManager.dark_beat.Play();

            MediaManager.cam = zoomedOut;
            //only resets the game if we finished all the previous papers
            if (graded.numHomeworks() == (numPapers + 1))
            {
                if (numPapers < 3)
                {
                    numPapers = 3;
                }
                //clear the papers
                ungraded.clear();
                graded.clear();
                currentScore.zero();

                ungraded.addHomework(new Homework(EmptyObject.Instance, EmptyObject.Instance,
                                                  new Paper[] { new Paper(MediaManager.textures["hw done"], new Vector2(0, 0), new Answer[] { new Answer() }) }));

                //TODO: reincorporate UI

                //if we can, construct a set of papers and answers
                if (homeworks.Count != 0)
                {
                    HomeworkSet problemSet = homeworks.Dequeue();
                    MediaManager.textures["results sheet"] = problemSet.Results;
                    numPapers = 1;
                    for (int i = 0; i < numPapers; i++)
                    {
                        Homework h = problemSet.GenerateHomework(MediaManager.GetRandomFloat(0, 0.4));
                        ungraded.addHomework(h);
                    }
                }
                else
                {
                    game.ActiveGame = "SPLASHSCREEN";
                }
            }

            base.Initialize();
        }
示例#4
0
        public override bool ClickDown(Vector2 pos)
        {
            bool ret = base.ClickDown(pos);

            if (activeObject == ungraded && !drawableObjects.Contains(currentHomework))
            {
                //create new paper
                currentHomework = ungraded.getPaper();
                if (currentHomework != null)
                {
                    drawableObjects.Add(currentHomework);
                    clickableObjects.Add(currentHomework);
                }
                activeObject = currentHomework;
            }
            if (activeObject == graded && !drawableObjects.Contains(currentHomework))
            {
                //create new paper
                currentHomework = graded.getPaper();
                if (currentHomework != null)
                {
                    currentScore -= currentHomework.GetScore();
                    drawableObjects.Add(currentHomework);
                    clickableObjects.Add(currentHomework);
                }
                activeObject = currentHomework;
            }

            //puts the selected object at the front
            if (activeObject != null && (activeObject == currentHomework || activeObject == cheater || activeObject == pen))
            {
                drawableObjects.Remove(activeObject);
                clickableObjects.Remove(activeObject);
                drawableObjects.Add(activeObject);
                clickableObjects.Add(activeObject);
            }
            return(ret);
        }
示例#5
0
        public override bool ClickUp(Vector2 pos)
        {
            if (activeObject != null)
            {
                if (activeObject == currentHomework)
                {
                    if (graded.Contains(pos))
                    {
                        //destroy old paper
                        drawableObjects.Remove(currentHomework);
                        clickableObjects.Remove(currentHomework);
                        graded.addHomework(currentHomework);

                        if (ungraded.numHomeworks() == 0)
                        {
                            game.ActiveGame = "TARESULTS";
                            return(base.ClickUp(pos));
                        }
                        currentScore += currentHomework.GetScore();

                        currentHomework.ClickUp(pos);

                        currentHomework = null;
                        activeObject    = null;

                        //zoom in
                        MediaManager.cam = zoomedIn;
                    }
                    else
                    {
                        MediaManager.cam = zoomedOut;
                        if (ungraded.Contains(pos))
                        {
                            //destroy old paper
                            drawableObjects.Remove(currentHomework);
                            clickableObjects.Remove(currentHomework);
                            ungraded.addHomework(currentHomework);
                            currentHomework = null;
                            activeObject    = null;
                        }
                    }
                }
                else if (activeObject == pen)
                {
                    if (graded.peekPaper() != null)
                    {
                        currentScore -= graded.peekPaper().GetScore();
                        graded.peekPaper().TryStamp(pen.Position, false);
                        currentScore += graded.peekPaper().GetScore();
                    }
                    pen.SnapBack();
                }
                else if (activeObject == cheater)
                {
                    if (graded.peekPaper() != null)
                    {
                        currentScore -= graded.peekPaper().GetScore();
                        graded.peekPaper().TryStamp(cheater.Position, true);
                        currentScore += graded.peekPaper().GetScore();
                    }
                    cheater.SnapBack();
                }
                else
                {
                    MediaManager.cam = zoomedOut;
                }
            }
            else //if(!answerKey.Contains(pos))
            {
                MediaManager.cam = zoomedOut;
            }
            bool ret = base.ClickUp(pos);

            return(ret);
        }
示例#6
0
 public void addHomework(Homework p)
 {
     p.Position = Position;
     homeworks.Push(p);
     parent = p;
 }