Exemplo n.º 1
0
        //Create Judge object
        public Judge createJudge()
        {
            Judge judge = new Judge
            {
                JudgeName = judgeName
            };

            //Add judge to oobservablecollection so all judges are displayed in the panel, before team is created
            JudgeList.Add(judge);
            return(judge);
        }
Exemplo n.º 2
0
        public void TestFullContest()
        {
            DateTime endDate = new DateTime(2018, 2, 22);

            ContestInfo contestInfo = new ContestInfo("Svedala simhopps tävling", "Örebro", DateTime.Now, endDate, "Gustavsvik");

            Judge judge1 = new Judge("Karl", "Mal");
            Judge judge2 = new Judge("LAban", "Asda");
            Judge judge3 = new Judge("Leg", "Shin");
            Judge judge4 = new Judge("Handy", "Bandy");
            Judge judge5 = new Judge("Sammy", "Rol");

            JudgeList judgeList = new JudgeList();

            judgeList.Add(judge1);
            judgeList.Add(judge2);
            judgeList.Add(judge3);
            judgeList.Add(judge4);
            judgeList.Add(judge5);

            Contestant kalle = new Contestant("kalle", "Cool");
            Contestant pelle = new Contestant("pelle", "Holm");
            Contestant lars  = new Contestant("Lars", "Lerin");
            Contestant anna  = new Contestant("Anna", "Annasson");

            ContestantList contestantList = new ContestantList();

            contestantList.Add(kalle);
            contestantList.Add(pelle);
            contestantList.Add(lars);
            contestantList.Add(anna);

            // create the new Contest object
            Contest contest = new Contest(contestInfo, judgeList, contestantList);


            // create ContestantLists for a subcontest
            ContestantList branch1_Contestants = new ContestantList();

            branch1_Contestants.Add(kalle);
            branch1_Contestants.Add(pelle);
            branch1_Contestants.Add(lars);

            SubContestBranch branch1 = new SubContestBranch("Deltävling 1", contest, branch1_Contestants);


            // create second subcontest
            ContestantList branch2_Contestants = new ContestantList();

            branch2_Contestants.Add(kalle);
            branch2_Contestants.Add(pelle);
            branch2_Contestants.Add(anna);

            SubContestBranch branch2 = new SubContestBranch("Deltävling 2", contest, branch2_Contestants);

            // add the newly created subcontests to the contest
            contest.SubContestBranches.Add(branch1);
            contest.SubContestBranches.Add(branch2);


            // first dive of the subcontest
            Dive dive1Kalle = new Dive(new DiveCode(3.1));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Kalle = new ScoreList();

            scoreListDive1Kalle.Add(new Score(8, judge1));
            scoreListDive1Kalle.Add(new Score(5, judge2));
            scoreListDive1Kalle.Add(new Score(8.5, judge3));
            scoreListDive1Kalle.Add(new Score(7, judge4));
            scoreListDive1Kalle.Add(new Score(9, judge5));

            dive1Kalle.Scores = scoreListDive1Kalle;

            branch1.AddNewDive(kalle, dive1Kalle);


            // second dive
            Dive dive1Pelle = new Dive(new DiveCode(3.1));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Pelle = new ScoreList();

            scoreListDive1Pelle.Add(new Score(8, judge1));
            scoreListDive1Pelle.Add(new Score(5, judge2));
            scoreListDive1Pelle.Add(new Score(8.5, judge3));
            scoreListDive1Pelle.Add(new Score(7, judge4));
            scoreListDive1Pelle.Add(new Score(6.5, judge5));

            dive1Pelle.Scores = scoreListDive1Pelle;

            branch1.AddNewDive(pelle, dive1Pelle);


            // third dive
            Dive dive1Lars = new Dive(new DiveCode(3.1));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Lars = new ScoreList();

            scoreListDive1Lars.Add(new Score(7.5, judge1));
            scoreListDive1Lars.Add(new Score(9, judge2));
            scoreListDive1Lars.Add(new Score(8.5, judge3));
            scoreListDive1Lars.Add(new Score(7, judge4));
            scoreListDive1Lars.Add(new Score(6.5, judge5));

            dive1Lars.Scores = scoreListDive1Lars;

            branch1.AddNewDive(lars, dive1Lars);


            // first dive of second subcontest
            Dive dive2Kalle = new Dive(new DiveCode(2.8));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive2Kalle = new ScoreList();

            scoreListDive2Kalle.Add(new Score(8, judge1));
            scoreListDive2Kalle.Add(new Score(5, judge2));
            scoreListDive2Kalle.Add(new Score(8.5, judge3));
            scoreListDive2Kalle.Add(new Score(7, judge4));
            scoreListDive2Kalle.Add(new Score(9, judge5));

            dive2Kalle.Scores = scoreListDive1Kalle;

            branch2.AddNewDive(kalle, dive2Kalle);


            // second dive
            Dive dive2Pelle = new Dive(new DiveCode(2.9));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive2Pelle = new ScoreList();

            scoreListDive2Pelle.Add(new Score(8, judge1));
            scoreListDive2Pelle.Add(new Score(5, judge2));
            scoreListDive2Pelle.Add(new Score(8, judge3));
            scoreListDive2Pelle.Add(new Score(7, judge4));
            scoreListDive2Pelle.Add(new Score(6.5, judge5));

            dive2Pelle.Scores = scoreListDive1Pelle;

            branch2.AddNewDive(pelle, dive2Pelle);


            // third dive
            Dive dive1Anna = new Dive(new DiveCode(3.0));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Anna = new ScoreList();

            scoreListDive1Anna.Add(new Score(7.5, judge1));
            scoreListDive1Anna.Add(new Score(9, judge2));
            scoreListDive1Anna.Add(new Score(8.5, judge3));
            scoreListDive1Anna.Add(new Score(7, judge4));
            scoreListDive1Anna.Add(new Score(6.5, judge5));

            dive1Anna.Scores = scoreListDive1Anna;

            branch2.AddNewDive(anna, dive1Anna);

            Console.WriteLine("HEJ");

            foreach (var subContest in contest.SubContestBranches)
            {
                int i = 1;
                foreach (var result in subContest.GenerateSubContestResult())
                {
                    Console.WriteLine(i + ". " + result.Key.FirstName + " Score: " + result.Value);
                    i++;
                }
            }
        }
Exemplo n.º 3
0
        public Contest createTestContest()
        {
            DateTime endDate = new DateTime(2018, 2, 22);

            ContestInfo contestInfo = new ContestInfo("Svedala simhoppstävling", "Örebro", DateTime.Now, endDate, "Gustavsvik");

            Judge judge1 = new Judge(1, "Karl", "Mal", 22, "*****@*****.**", "male", "891017-6653", "Pappersvägen 3");
            Judge judge2 = new Judge(2, "Laban", "Asda", 45, "*****@*****.**", "male", "651011-6423", "Venavägen 8");
            Judge judge3 = new Judge(3, "Leg", "Shin", 33, "*****@*****.**", "male", "821201-5434", "Storgatan 1");
            Judge judge4 = new Judge(4, "Anna", "Pann", 29, "*****@*****.**", "female", "910413-4594", "Järnvägsgatan 33");
            Judge judge5 = new Judge(5, "Sammy", "Rol", 38, "*****@*****.**", "female", "880623-5921", "Skolgatan 28");

            JudgeList judgeList = new JudgeList();

            judgeList.Add(judge1);
            judgeList.Add(judge2);
            judgeList.Add(judge3);
            judgeList.Add(judge4);
            judgeList.Add(judge5);

            Contestant kalle = new Contestant(6, "Kalle", "Cool", 35, "*****@*****.**", "male", "78345345-435", "Storgatan 3");
            Contestant pelle = new Contestant(7, "Pelle", "Holm", 14, "*****@*****.**", "male", "04546387-1104", "Småttmisnöjdmedtillvaro gatan 25");
            Contestant lars  = new Contestant(8, "Lars", "Lerin", 50, "*****@*****.**", "male", "68345435-4352", "Brittmarie-gatan 89");
            Contestant anna  = new Contestant(9, "Anna", "Annasson", 28, "*****@*****.**", "female", "88376534534-3455", "Lokalgatan 8");

            ContestantList contestantList = new ContestantList();

            contestantList.Add(kalle);
            contestantList.Add(pelle);
            contestantList.Add(lars);
            contestantList.Add(anna);

            // create the new Contest object
            Contest contest = new Contest(contestInfo, judgeList, contestantList);


            // create ContestantLists for a subcontest
            ContestantList branch1_Contestants = new ContestantList();

            branch1_Contestants.Add(kalle);
            branch1_Contestants.Add(pelle);
            branch1_Contestants.Add(lars);

            SubContestBranch branch1 = new SubContestBranch("Deltävling 1", contest, branch1_Contestants);


            // create second subcontest
            ContestantList branch2_Contestants = new ContestantList();

            branch2_Contestants.Add(kalle);
            branch2_Contestants.Add(pelle);
            branch2_Contestants.Add(anna);

            SubContestBranch branch2 = new SubContestBranch("Deltävling 2", contest, branch2_Contestants);

            // add the newly created subcontests to the contest
            contest.SubContestBranches.Add(branch1);
            contest.SubContestBranches.Add(branch2);


            // first dive of the subcontest
            Dive dive1Kalle = new Dive(new DiveCode(3.1));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Kalle = new ScoreList();

            scoreListDive1Kalle.Add(new Score(8, judge1));
            scoreListDive1Kalle.Add(new Score(5, judge2));
            scoreListDive1Kalle.Add(new Score(8.5, judge3));
            scoreListDive1Kalle.Add(new Score(7, judge4));
            scoreListDive1Kalle.Add(new Score(9, judge5));

            dive1Kalle.Scores = scoreListDive1Kalle;

            branch1.AddNewDive(kalle, dive1Kalle);


            // second dive
            Dive dive1Pelle = new Dive(new DiveCode(3.1));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Pelle = new ScoreList();

            scoreListDive1Pelle.Add(new Score(8, judge1));
            scoreListDive1Pelle.Add(new Score(5, judge2));
            scoreListDive1Pelle.Add(new Score(8.5, judge3));
            scoreListDive1Pelle.Add(new Score(7, judge4));
            scoreListDive1Pelle.Add(new Score(6.5, judge5));

            dive1Pelle.Scores = scoreListDive1Pelle;

            branch1.AddNewDive(pelle, dive1Pelle);


            // third dive
            Dive dive1Lars = new Dive(new DiveCode(3.1));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Lars = new ScoreList();

            scoreListDive1Lars.Add(new Score(7.5, judge1));
            scoreListDive1Lars.Add(new Score(9, judge2));
            scoreListDive1Lars.Add(new Score(8.5, judge3));
            scoreListDive1Lars.Add(new Score(7, judge4));
            scoreListDive1Lars.Add(new Score(6.5, judge5));

            dive1Lars.Scores = scoreListDive1Lars;

            branch1.AddNewDive(lars, dive1Lars);


            // first dive of second subcontest
            Dive dive2Kalle = new Dive(new DiveCode(2.8));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive2Kalle = new ScoreList();

            scoreListDive2Kalle.Add(new Score(8, judge1));
            scoreListDive2Kalle.Add(new Score(5, judge2));
            scoreListDive2Kalle.Add(new Score(8.5, judge3));
            scoreListDive2Kalle.Add(new Score(7, judge4));
            scoreListDive2Kalle.Add(new Score(9, judge5));

            dive2Kalle.Scores = scoreListDive1Kalle;

            branch2.AddNewDive(kalle, dive2Kalle);


            // second dive
            Dive dive2Pelle = new Dive(new DiveCode(2.9));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive2Pelle = new ScoreList();

            scoreListDive2Pelle.Add(new Score(8, judge1));
            scoreListDive2Pelle.Add(new Score(5, judge2));
            scoreListDive2Pelle.Add(new Score(8, judge3));
            scoreListDive2Pelle.Add(new Score(7, judge4));
            scoreListDive2Pelle.Add(new Score(6.5, judge5));

            dive2Pelle.Scores = scoreListDive1Pelle;

            branch2.AddNewDive(pelle, dive2Pelle);


            // third dive
            Dive dive1Anna = new Dive(new DiveCode(3.0));

            // Scores come in from all the judges and is built into a full ScoreList
            ScoreList scoreListDive1Anna = new ScoreList();

            scoreListDive1Anna.Add(new Score(7.5, judge1));
            scoreListDive1Anna.Add(new Score(9, judge2));
            scoreListDive1Anna.Add(new Score(8.5, judge3));
            scoreListDive1Anna.Add(new Score(7, judge4));
            scoreListDive1Anna.Add(new Score(6.5, judge5));

            dive1Anna.Scores = scoreListDive1Anna;

            branch2.AddNewDive(anna, dive1Anna);

            return(contest);
        }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (GameManager.Instance.isPaused)
        {
            return;
        }

        JudgeList judge = JudgeList.Poor;

        elapsedTime += Time.deltaTime * 1000;

        foreach (JudgeList j in Enum.GetValues(typeof(JudgeList)))
        {
            if (Mathf.Abs(elapsedTime) < judgeTiming[(int)j])
            {
                judge = j;
                break;
            }
        }

        if (judge == JudgeList.Poor && elapsedTime > judgeTiming[(int)JudgeList.Bad])
        {
            GameManager.Instance.MissJudge();
            elapsedTime -= 2 * BgaManager.Instance.MsPerBeat;

            judgeText.text  = judge.ToString().ToUpper();
            judgeText.color = judgeColors[(int)judge];

            playerControl.AnimationState(judge);
        }

        bool isJumpButtonPressed;

        InputManagerInstance.GetJumpButtonPressed(out isJumpButtonPressed);

        if (isJumpButtonPressed && !isJumpButtonPressedPrev)
        {
            judgeText.text  = judge.ToString().ToUpper();
            judgeText.color = judgeColors[(int)judge];

            GameManager.Instance.JudgeScore += judgeScores[(int)judge];

            Debug.Log(judge + " (" + elapsedTime + ")");

            if (judge != JudgeList.Poor)
            {
                elapsedTime -= 2 * BgaManager.Instance.MsPerBeat;
            }

            playerControl.AnimationState(judge);

            if (new[] { JudgeList.Perfect, JudgeList.Great }.Contains(judge))
            {
                playerControl.ReadyToJump();
            }
            else
            {
                GameManager.Instance.ResetCombo();
                GameManager.Instance.life--;
            }
        }
        isJumpButtonPressedPrev = isJumpButtonPressed;
    }