Exemplo n.º 1
0
        protected override void OnProcessOutputSchema(MutableObject newSchema)
        {
            // We don't modify the input schema in adapters... We may derive values from input schemas, but adapters always send a novel schema...

            var roundScores = new RoundScores();

            roundScores.Add(new TeamScores()
            {
                SubmissionScores = new List <SubmissionScore>()
                {
                    new SubmissionScore()
                }
            });

            var teamsList = ParseRoundData(newSchema, roundScores);

            var newRound = new MutableObject();

            newRound["Teams"] = teamsList;

            newRound["Round Number"] = 0;

            var roundsList = new List <MutableObject>();

            roundsList.Add(newRound);

            RoundsTarget.SetValue(roundsList, newSchema);
            DataIndexTarget.SetValue(1, newSchema);

            Router.TransmitAllSchema(newSchema);
        }
Exemplo n.º 2
0
        private List <MutableObject> ParseRoundData(MutableObject mutable, RoundScores scoresEntry)
        {
            var teamsList = new List <MutableObject>();

            foreach (var team in scoresEntry)
            {
                //var teamColor = ColorUtility.HsvtoRgb((float)randomGen.NextDouble(), .8f, 1f);

                var teamColor = TeamColorPalette.ColorFromIndex(team.TeamID);

                var scoresList = new List <MutableObject>();

                foreach (var entry in team.SubmissionScores)
                {
                    var newMutable = TurnSubmissionIntoMutable(entry, team, teamColor);

                    scoresList.Add(newMutable);
                }

                var teamEntry = new MutableObject()
                {
                    { "Team Name", team.TeamName },
                    { "Team Id", team.TeamID },
                    { "Team Color", teamColor },
                    { "Scores", scoresList }
                };

                teamsList.Add(teamEntry);
            }

            return(teamsList);
        }
Exemplo n.º 3
0
 public ContestantCompetitionScore(params RoundScore[] scores)
 {
     foreach (var score in scores)
     {
         RoundScores.Add(score);
     }
 }
        private List <MutableObject> ParseRoundData(MutableObject mutable, RoundScores scoresEntry, int roundNum)
        {
            //var randomGen = new Random(1337);

            var scoresList = new List <MutableObject>();

            foreach (var team in scoresEntry)
            {
                //var teamColor = ColorUtility.HsvtoRgb((float)randomGen.NextDouble(), .8f, 1f);

                var teamColor = TeamColorPalette.ColorFromIndex(team.TeamID);

                foreach (var entry in team.SubmissionScores)
                {
                    var newMutable = TurnSubmissionIntoMutable(entry, team, teamColor);

                    newMutable["Team Name"]    = team.TeamName;
                    newMutable["Team ID"]      = team.TeamID;
                    newMutable["Team Color"]   = teamColor;
                    newMutable["Round Number"] = roundNum;

                    scoresList.Add(newMutable);
                }
            }

            return(scoresList);
        }
Exemplo n.º 5
0
    public RoundScores getFinalScores()
    {
        RoundScores sc = new RoundScores();

        sc.pirateScore.Add(rounds[0].getPiratesFinalScore());
        sc.pirateScore.Add(rounds[1].getPiratesFinalScore());
        sc.pirateScore.Add(rounds[2].getPiratesFinalScore());

        sc.superCorpScore.Add(rounds[0].getSuperCorpFinalScore());
        sc.superCorpScore.Add(rounds[1].getSuperCorpFinalScore());
        sc.superCorpScore.Add(rounds[2].getSuperCorpFinalScore());

        return sc;
    }
Exemplo n.º 6
0
        // TODO: What does Ok property mean in this class??
        public override void HandleResponse(byte[] response)
        {
            var stream = new MemoryStream(response);

            Scores = RoundScores.FromStream(stream);
        }