Пример #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);
        }
Пример #2
0
        public override IEnumerator ReceivePayload(VisualPayload payload)
        {
            var minRound = MinRoundNumber.GetFirstValue(payload.Data);
            var maxRound = MaxRoundNumber.GetFirstValue(payload.Data);

            var roundsList = new List <MutableObject>();

            for (int roundNum = minRound; roundNum <= maxRound; roundNum++)
            {
                var getScoresCommand = new GetScoresForRoundCommand(roundNum);

                var iterator = CommandProcessor.Execute(getScoresCommand);
                while (iterator.MoveNext())
                {
                    yield return(null);
                }

                var teamsList = ParseRoundData(payload.Data, getScoresCommand.Scores);

                var newRound = new MutableObject();
                newRound["Teams"] = teamsList;

                newRound["Round Number"] = roundNum;

                roundsList.Add(newRound);
            }

            RoundsTarget.SetValue(roundsList, payload.Data);

            var groupId = GroupId.GetFirstValue(payload.Data);

            var index = (DataShare.ContainsKey(groupId)
                ? DataShare[groupId]
                : 0);

            if (groupId != "")
            {
                DataShare[groupId] = index + 1;
            }

            DataIndexTarget.SetValue(index, payload.Data);

            var transmitIterator = Router.TransmitAll(payload);

            while (transmitIterator.MoveNext())
            {
                yield return(null);
            }
        }