Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LilaTournament"/> class.
        /// </summary>
        /// <param name="c">The client.</param>
        /// <param name="socket">The socket.</param>
        /// <param name="tournamentData">The tournament data.</param>
        internal LilaTournament(LilaClient c, LilaSocket socket, TournamentData tournamentData)
        {
            tournamentPing = new PPingVersion(0);
            Version        = tournamentData.SocketVersion;

            Client = c;

            this.socket         = socket;
            this.tournamentData = tournamentData;

            socket.OnDisconnect += OnDisconnect;

            socket.AddHandler <MPong>(OnPong);
            socket.AddHandler <MCrowd>(OnCrowd);
            socket.AddHandler <MReload>(OnReload);
            socket.AddHandler <MMessage>(OnMessage);
            socket.AddHandler <MTournamentRedirect>(OnRedirect);
            socket.AddHandler <MTournamentReminder>(OnReminder);
            socket.AddHandler <MResync>(OnResync);
            socket.AddHandler <MChallenges>(OnChallenges);
            socket.AddHandler <MDeployPre>(OnDeployPre);
            socket.AddHandler <MFollowingPlaying>(OnFollowingPlaying);
            socket.AddHandler <MFollowingStoppedPlaying>(OnFollowingStoppedPlaying);
            socket.AddHandler <MFollowingOnlines>(OnFollowingOnline);

            SendPing();
            socket.SchedulePacket(tournamentPing, 1000);
        }
    void WriteJudgeNamesXml(XmlWriter writer, int PoolIndex)
    {
        ResultsData RData = TournamentData.FindResultsData((EDivision)CurDivIndex, (ERound)CurRoundIndex, (EPool)PoolIndex);

        int ExCount = RData.ExJudgeIds.Count;

        for (int ExIndex = 0; ExIndex < ExCount; ++ExIndex)
        {
            string JudgeName = NameDatabase.FindInDatabase(RData.ExJudgeIds[ExIndex]).DisplayName;
            writer.WriteElementString("ns2:Ex" + (ExIndex + 1), JudgeName);
        }

        int AiCount = RData.AIJudgeIds.Count;

        for (int AiIndex = 0; AiIndex < AiCount; ++AiIndex)
        {
            string JudgeName = NameDatabase.FindInDatabase(RData.AIJudgeIds[AiIndex]).DisplayName;
            writer.WriteElementString("ns2:Ai" + (AiIndex + 1), JudgeName);
        }

        int DiffCount = RData.DiffJudgeIds.Count;

        for (int DiffIndex = 0; DiffIndex < DiffCount; ++DiffIndex)
        {
            string JudgeName = NameDatabase.FindInDatabase(RData.DiffJudgeIds[DiffIndex]).DisplayName;
            writer.WriteElementString("ns2:Diff" + (DiffIndex + 1), JudgeName);
        }
    }
Esempio n. 3
0
    void MoveTeamToJudgeCategory(int PlayerId, int CategoryIndex)
    {
        ResultsData Data = TournamentData.FindResultsData((EDivision)DivisionCombo.GetSelectedItemIndex(), (ERound)RoundCombo.GetSelectedItemIndex(), (EPool)CurPoolButtonIndex);

        if (Data != null)
        {
            Data.AIJudgeIds.Remove(PlayerId);
            Data.ExJudgeIds.Remove(PlayerId);
            Data.DiffJudgeIds.Remove(PlayerId);

            switch ((ECategory)CategoryIndex)
            {
            case ECategory.AI:
                Data.AIJudgeIds.Add(PlayerId);
                break;

            case ECategory.Ex:
                Data.ExJudgeIds.Add(PlayerId);
                break;

            case ECategory.Diff:
                Data.DiffJudgeIds.Add(PlayerId);
                break;
            }
        }
    }
    void FinishSendDivisionRPC(int InDivState)
    {
        bGettingDivision = false;

        try
        {
            using (Stream stream = Global.GenerateStreamFromString(AllDataBuilderString))
                Global.AllData = TournamentData.Load(stream);
        }
        catch (Exception e)
        {
            Debug.Log("Exception in FinishSendDivisionRPC: " + e.Message);
        }
        Global.DivDataState = InDivState;
        LastSyncedDivState  = InDivState;

        JudgerBase Judger = Global.GetActiveJudger();

        if (Judger)
        {
            SendJudgeNameId(Judger.JudgeGuid, Judger.GetJudgeNameId());
        }

        //Debug.Log(" finished: ");
    }
Esempio n. 5
0
        private TournamentData TransformMatchesToTournamentData(IEnumerable <VMatch> matches)
        {
            var tournamentData = new TournamentData();

            tournamentData.group = new Group();
            var match = matches.First();

            tournamentData.TournamentId        = match.TournamentId;
            tournamentData.Stage               = match.Stage;
            tournamentData.group.RegionId      = match.RegionId;
            tournamentData.group.name          = match.Type;
            tournamentData.group.structureType = match.Type;

            tournamentData.group.rounds = matches
                                          .Select(m => new Round {
                id = m.RoundId, name = m.Round
            }).Distinct().ToList();

            foreach (var round in tournamentData.group.rounds)
            {
                round.matches = matches.Where(m => m.RoundId == round.id)
                                .Select(m =>
                                        new Match
                {
                    id             = m.SeqNo,
                    winner         = m.WinnerTeam,
                    awayTeam       = m.AwayTeam,
                    homeTeam       = m.HomeTeam,
                    awayTeamResult = m.AwayTeamResult,
                    homeTeamResult = m.HomeTeamResult
                }).ToList();
            }
            return(tournamentData);
        }
Esempio n. 6
0
        public string GetTournaments()
        {
            var from = DateTime.Now.AddMonths(-1);
            var to   = DateTime.Now.AddDays(1);

            return(JsonConvert.SerializeObject(TournamentData.GetTournamentReport(CR, from, to)));
        }
Esempio n. 7
0
            /// <summary>
            /// Updates an existing tournament
            /// </summary>
            /// <param name="tournament">Tournament ID (e.g. 10230) or URL (e.g. 'single_elim' for challonge.com/single_elim). If assigned to a subdomain, URL format must be "subdomain-tournament_url" (e.g. 'test-mytourney' for test.challonge.com/mytourney) </param>
            /// <param name="url">Url of your tournament (letters, numbers and underscores only).
            /// Make sure it is unique (you can leave it blank and have challonge pick a random url for you)</param>
            /// <param name="name">Name of the tournament</param>
            /// <param name="type">Type of tournament</param>
            /// <param name="subdomain">Subdomain to assign the tournament to (requires write access to
            /// the subdomain)</param>
            /// <param name="description">Description/instructions to be displayed above the bracket</param>
            /// <param name="openSignup">Have Challonge host a sign-up page (otherwise, you manually add all participants)</param>
            /// <param name="holdThirdPlaceMatch">Single Elimination only. Include a match between semifinal losers?</param>
            /// <param name="ptsForMatchWin">Swiss only: number of points gained for a match win</param>
            /// <param name="ptsForMatchTie">Swiss only: number of points gained for a match tie</param>
            /// <param name="ptsForGameWin">Swiss only: number of points gained for a game win</param>
            /// <param name="ptsForGameTie">Swiss only: number of points gained for a game tie</param>
            /// <param name="ptsForBye">Swiss only: number of points gained for a bye</param>
            /// <param name="swissRounds">Number of rounds</param>
            /// <param name="rankedBy">How the participants are ranked</param>
            /// <param name="acceptAttachments">Allow match attachment uploads</param>
            /// <param name="hideForum">Hide the forum tab on your Challonge page</param>
            /// <param name="showRounds">Whether or not to label each round above the bracket</param>
            /// <param name="isPrivate">Hide this tournament from the public browsable index and your profile</param>
            /// <param name="notifyUsersWhenMatchesOpen">Whether or not to email registered Challonge
            /// participants when matches open up for them</param>
            /// <param name="notifyUsersWhenTournamentsEnds">Whether or not to email registered Challonge
            /// participants when this tournament ends</param>
            /// <param name="sequentialPairings">When enabled, instead of traditional seeding rules, make
            /// pairings by going straight down the list of participants. First round matches are filled in top
            /// to bottom, then qualifying matches (if applicable).</param>
            /// <param name="signupCap">Maximum number of participants in the bracket. Once the cap is reached,
            /// new participants will be put in waiting list, and <see cref="Participant.OnWaitingList"/> will
            /// be set to <see langword="true"/></param>
            /// <param name="startAt"></param>
            /// <param name="checkInDuration">Length of the participant check-in window in minutes.</param>
            /// <param name="grandFinalsModifier">Double elimination only: how the grand finals will be played</param>
            /// <returns>The updated tournament</returns>
            public async Task <Tournament> UpdateTournamentAsync(string tournament, string name = null,
                                                                 string url                                = null, TournamentType type  = TournamentType.SingleElimination, string subdomain = null,
                                                                 string description                        = null, bool openSignup      = false, bool holdThirdPlaceMatch = false,
                                                                 float ptsForMatchWin                      = 1.0f, float ptsForMatchTie = 0.5f, float ptsForGameWin       = 0f,
                                                                 float ptsForGameTie                       = 0f, float ptsForBye        = 1.0f, int?swissRounds           = null,
                                                                 TournamentRankingStats rankedBy           = TournamentRankingStats.MatchWins, bool acceptAttachments = false,
                                                                 bool hideForum                            = false, bool showRounds = false, bool isPrivate = false, bool notifyUsersWhenMatchesOpen = false,
                                                                 bool notifyUsersWhenTournamentsEnds       = false, bool sequentialPairings = false, int?signupCap = null,
                                                                 DateTimeOffset?startAt                    = null, int?checkInDuration = null,
                                                                 TournamentGrandFinals grandFinalsModifier = TournamentGrandFinals.TwoChances)
            {
                string request = $"https://api.challonge.com/v1/tournaments/{tournament}.json";

                Dictionary <string, string> parameters = PrepareParams(name, url, type, subdomain, description,
                                                                       openSignup, holdThirdPlaceMatch, ptsForMatchWin, ptsForMatchTie, ptsForGameWin, ptsForGameTie,
                                                                       ptsForBye, swissRounds, rankedBy, acceptAttachments, hideForum, showRounds, isPrivate,
                                                                       notifyUsersWhenMatchesOpen, notifyUsersWhenTournamentsEnds, sequentialPairings, signupCap, startAt,
                                                                       checkInDuration, grandFinalsModifier);

                FormUrlEncodedContent content = new FormUrlEncodedContent(parameters);

                TournamentData tournamentData = await PutAsync <TournamentData>(_httpClient, request, content);

                return(tournamentData.Tournament);
            }
Esempio n. 8
0
    // Update is called once per frame
    void Update()
    {
        if (!Input.GetMouseButton(0))
        {
            if (MovingNameId != -1)
            {
                bool    bMovedSuccess = false;
                Vector3 NewMousePos   = new Vector3(Input.mousePosition.x, Screen.height - Input.mousePosition.y, 0);
                for (int CatIndex = 0; CatIndex < 3; ++CatIndex)
                {
                    if (JudgeRects[CatIndex].Contains(NewMousePos))
                    {
                        bMovedSuccess = true;
                        MoveTeamToJudgeCategory(MovingNameId, CatIndex);
                        break;
                    }
                }

                if (!bMovedSuccess)
                {
                    ResultsData Data = TournamentData.FindResultsData((EDivision)DivisionCombo.GetSelectedItemIndex(), (ERound)RoundCombo.GetSelectedItemIndex(), (EPool)CurPoolButtonIndex);
                    if (Data != null)
                    {
                        Data.AIJudgeIds.Remove(MovingNameId);
                        Data.ExJudgeIds.Remove(MovingNameId);
                        Data.DiffJudgeIds.Remove(MovingNameId);
                    }
                }

                MovingNameId = -1;
            }
        }
    }
Esempio n. 9
0
    public static TournamentData Load(Stream InStream)
    {
        XmlSerializer  serializer = new XmlSerializer(typeof(TournamentData));
        TournamentData LoadedData = serializer.Deserialize(InStream) as TournamentData;

        return(LoadedData);
    }
 private void Start()
 {
     //CalendarController.Instance.InitializeCalendar(2020);
     initialData       = (InitialData)Tools.GetFile <InitialData>("Data/Misc/InitialData.asset");
     editingTournament = null;
     Show();
 }
Esempio n. 11
0
    void InitJudgersNameIds()
    {
        ResultsData RData = TournamentData.FindResultsData(CurDivision, CurRound, CurPool);

        if (RData != null)
        {
            for (int JudgeIndex = 0; JudgeIndex < AIJudges.Count; ++JudgeIndex)
            {
                if (AIJudges[JudgeIndex] != null && JudgeIndex < RData.AIJudgeIds.Count)
                {
                    AIJudges[JudgeIndex].NameId = RData.AIJudgeIds[JudgeIndex];
                }
            }

            for (int JudgeIndex = 0; JudgeIndex < ExJudges.Count; ++JudgeIndex)
            {
                if (ExJudges[JudgeIndex] != null && JudgeIndex < RData.ExJudgeIds.Count)
                {
                    ExJudges[JudgeIndex].NameId = RData.ExJudgeIds[JudgeIndex];
                }
            }

            for (int JudgeIndex = 0; JudgeIndex < DiffJudges.Count; ++JudgeIndex)
            {
                if (DiffJudges[JudgeIndex] != null && JudgeIndex < RData.DiffJudgeIds.Count)
                {
                    DiffJudges[JudgeIndex].NameId = RData.DiffJudgeIds[JudgeIndex];
                }
            }
        }
    }
Esempio n. 12
0
    public int GetCatIndexForGuid(string InGuid)
    {
        int InOrgIndex = GetJudgeIndexRaw(InGuid);

        if (bFestivalJudging)
        {
            ResultsData RData = TournamentData.FindResultsData(CurDivision, CurRound, CurFestivalPool);
            if (RData != null)
            {
                for (int JudgeIndex = 0; JudgeIndex < AIJudges.Count; ++JudgeIndex)
                {
                    NetworkJudgeData njd = AIJudges[JudgeIndex];
                    if (njd != null && njd.Guid == InGuid)
                    {
                        if (JudgeIndex < RData.AIJudgeIds.Count)
                        {
                            return(InOrgIndex);
                        }
                        else
                        {
                            return(InOrgIndex - RData.AIJudgeIds.Count);
                        }
                    }
                }
                for (int JudgeIndex = 0; JudgeIndex < ExJudges.Count; ++JudgeIndex)
                {
                    NetworkJudgeData njd = ExJudges[JudgeIndex];
                    if (njd != null && njd.Guid == InGuid)
                    {
                        if (JudgeIndex < RData.ExJudgeIds.Count)
                        {
                            return(InOrgIndex);
                        }
                        else
                        {
                            return(InOrgIndex - RData.ExJudgeIds.Count);
                        }
                    }
                }
                for (int JudgeIndex = 0; JudgeIndex < DiffJudges.Count; ++JudgeIndex)
                {
                    NetworkJudgeData njd = DiffJudges[JudgeIndex];
                    if (njd != null && njd.Guid == InGuid)
                    {
                        if (JudgeIndex < RData.DiffJudgeIds.Count)
                        {
                            return(InOrgIndex);
                        }
                        else
                        {
                            return(InOrgIndex - RData.DiffJudgeIds.Count);
                        }
                    }
                }
            }
        }

        return(InOrgIndex);
    }
        public string GetTournamentById(string id)
        {
            var idGuid = new Guid(id);

            var items = TournamentData.GetByIdDetailed(CR, idGuid);

            return(JsonConvert.SerializeObject(items));
        }
Esempio n. 14
0
 public void Populate(TournamentData _data)
 {
     currentRound = _data.CurrentRound;
     totalRounds  = _data.TotalRounds;
     matchList    = _data.Matches;
     UpdateMatchList();
     UpdateNavButtons();
 }
Esempio n. 15
0
    public void Populate(TournamentData _data)
    {
        Data = _data;

        titleLabel.text = Data.Name;

        gameObject.SetActive(true);
    }
Esempio n. 16
0
    public bool IsInSecondaryPool(string InGuid)
    {
        if (bFestivalJudging)
        {
            ResultsData JData = TournamentData.FindResultsData(CurDivision, CurRound, CurFestivalPool);
            if (JData != null)
            {
                for (int JudgeIndex = 0; JudgeIndex < AIJudges.Count; ++JudgeIndex)
                {
                    NetworkJudgeData njd = AIJudges[JudgeIndex];
                    if (njd != null && njd.Guid == InGuid)
                    {
                        if (JudgeIndex < JData.AIJudgeIds.Count)
                        {
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
                for (int JudgeIndex = 0; JudgeIndex < ExJudges.Count; ++JudgeIndex)
                {
                    NetworkJudgeData njd = ExJudges[JudgeIndex];
                    if (njd != null && njd.Guid == InGuid)
                    {
                        if (JudgeIndex < JData.ExJudgeIds.Count)
                        {
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
                for (int JudgeIndex = 0; JudgeIndex < DiffJudges.Count; ++JudgeIndex)
                {
                    NetworkJudgeData njd = DiffJudges[JudgeIndex];
                    if (njd != null && njd.Guid == InGuid)
                    {
                        if (JudgeIndex < JData.DiffJudgeIds.Count)
                        {
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
            }
        }

        return(false);
    }
 private Tournament Map_tournament_data(TournamentData eventData)
 {
     return(new Tournament()
     {
         Id = eventData.Id,
         Name = eventData.Name,
         Created = eventData.Created
     });
 }
Esempio n. 18
0
            private static async Task <TournamentApiResult> ParseTournamentApiResultAsync(string responseString, bool includeMatches, bool includeParticipants)
            {
                TournamentApiResult result = new TournamentApiResult();

                JsonElement rootElement = JsonDocument.Parse(responseString).RootElement;

                if (includeMatches)
                {
                    JsonElement matchesElement = rootElement.GetProperty("tournament").GetProperty("matches");

                    MemoryStream reader = new MemoryStream(Encoding.UTF8.GetBytes(matchesElement.GetRawText()));

                    MatchData[] matches = await JsonSerializer.DeserializeAsync <MatchData[]>(reader);

                    Match[] matchesResult = new Match[matches.Length];

                    for (int i = 0; i < matches.Length; i++)
                    {
                        matchesResult[i] = matches[i].Match;
                    }

                    result.Matches = matchesResult;
                }
                else
                {
                    result.Matches = null;
                }

                if (includeParticipants)
                {
                    JsonElement participantsElement = rootElement.GetProperty("tournament").GetProperty("participants");

                    MemoryStream      reader       = new MemoryStream(Encoding.UTF8.GetBytes(participantsElement.GetRawText()));
                    ParticipantData[] participants = await JsonSerializer.DeserializeAsync <ParticipantData[]>(reader);

                    Participant[] participantsResult = new Participant[participants.Length];

                    for (int i = 0; i < participants.Length; i++)
                    {
                        participantsResult[i] = participants[i].Participant;
                    }

                    result.Participants = participantsResult;
                }
                else
                {
                    result.Participants = null;
                }

                MemoryStream   stream         = new MemoryStream(Encoding.UTF8.GetBytes(responseString));
                TournamentData tournamentData = await JsonSerializer.DeserializeAsync <TournamentData>(stream);

                result.Tournament = tournamentData.Tournament;

                return(result);
            }
Esempio n. 19
0
        public IHttpActionResult GetTournamentData(double tournamentId, byte stage, int regionId)
        {
            var            matches = TournamentRepository.GetMathes(tournamentId, stage, regionId);
            TournamentData data    = null;

            if (matches.Count() > 0)
            {
                data = TransformMatchesToTournamentData(matches);
            }
            return(Json(data));
        }
Esempio n. 20
0
        private Event[] Map_tournament(string tournament_id, string created, CreateTournamentCommand cmd)
        {
            var tournament_data = new TournamentData()
            {
                Id      = tournament_id,
                Name    = cmd.Name,
                Created = created
            };

            return(new Event[] { new TournamentCreated(nameof(TournamentCreated),
                                                       new TournamentContext(tournament_id, nameof(TournamentContext)), tournament_data) });
        }
Esempio n. 21
0
    public static void LoadTournamentData()
    {
        if (Global.AllData == null)
        {
            Global.AllData = TournamentData.Load(Application.persistentDataPath + "/save.xml");
            if (Global.AllData == null)
            {
                Global.AllData = new TournamentData();
            }
        }

        LoadNameData();
    }
    public void CreateTournament()
    {
        TournamentData tournament;

        if (!isNewTournament)
        {
            tournament = editingTournament;
        }
        else
        {
            tournament = ScriptableObject.CreateInstance <TournamentData>();
            //tournament.Id = Guid.NewGuid().ToString();
        }
        List <TeamData>  teams   = new List <TeamData>(TeamList);
        List <MatchData> matches = new List <MatchData>(Championship.DataList);

        tournament.Name = Options.InputName.text;
        tournament.Type = (TournamentType)Options.TypeDropDown.value;
        tournament.Id   = Championship.TournamentId;

        switch ((TournamentType)Options.TypeDropDown.value)
        {
        case TournamentType.Championship:
            //tournament.Teams = teams;
            tournament.Matches = matches;
            int      t       = teams.Count;
            string[] teamIds = new string[t];
            tournament.TotalRounds = t - 1;
            if (homeAwayTeams.isOn)
            {
                tournament.TotalRounds *= 2;
            }
            for (int i = 0; i < t; i++)
            {
                teamIds[i] = teams[i].Id;
            }
            tournament.Attributes.TeamIds = teamIds;
            break;
        }

        if (isNewTournament)
        {
            AssetDatabase.CreateAsset(tournament, "Assets/Data/Tournaments/" + tournament.Name + ".asset");
        }
        EditorUtility.SetDirty(tournament);
        AssetDatabase.SaveAssets();

        LoadTournaments();
        //DataController.Instance.SaveGame();
        editingTournament = null;
    }
Esempio n. 23
0
    public int GetJudgeNameId()
    {
        if (JudgeNameId != -1 && !bIsDataDirty)
        {
            return(JudgeNameId);
        }

        if (CurPool != EPool.None)
        {
            ResultsData Data = TournamentData.FindResultsData(CurDivision, CurRound, CurPool);
            JudgeNameId = Data.GetNameId(JudgerCategory, JudgeCategoryIndex);
        }

        return(JudgeNameId);
    }
Esempio n. 24
0
        /// <summary>
        /// Joins a tournament.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <returns></returns>
        internal bool JoinTournament(TournamentData data)
        {
            if (_disposing)
            {
                return(false);
            }

            Uri host = new Uri("wss://socket.lichess.org");

            if (!Uri.TryCreate(string.Format("/tournament/{0}/socket/v2", data.Id), UriKind.Relative, out Uri relative))
            {
                return(false);
            }

            Uri absolute = new Uri(host, relative);

            if (random == null)
            {
                return(false);
            }

            UriBuilder gameBldr = new UriBuilder(absolute)
            {
                Query = string.Format("sri={0}", random.NextSri())
            };

            LilaSocket tournamentCon = new LilaSocket("Tournament-Socket", ResourceType.Thread);

            tournamentCon.AddCookies(lobbyCon.GetCookies());

            if (tournamentCon.Connect(gameBldr.Uri) && !_disposing)
            {
                //Disconnect from lobby
                if (lobbyCon.IsConnected())
                {
                    lobbyCon.Disconnect();
                }

                LilaTournament lilaTournament = new LilaTournament(this, tournamentCon, data);
                tournamentCons.TryAdd(data.Id, lilaTournament);

                Events.FireEventAsync(Events._onTournamentEnter, new TournamentEvent(this, lilaTournament));
                return(true);
            }

            tournamentCon.Dispose();
            return(false);
        }
Esempio n. 25
0
        /// <summary>
        /// Finds a Tournament entity using it's primary key.
        /// </summary>
        /// <param name="TournamentId">A key field.</param>
        /// <returns>A TournamentData object.</returns>
        /// <exception cref="Spring2.Core.DAO.FinderException">Thrown when no entity exists witht he specified primary key..</exception>
        public static TournamentData Load(IdType tournamentId)
        {
            WhereClause w = new WhereClause();

            w.And("TournamentId", tournamentId.DBValue);
            SqlDataReader dataReader = GetListReader(CONNECTION_STRING_KEY, VIEW, w, null);

            if (!dataReader.Read())
            {
                dataReader.Close();
                throw new FinderException("Load found no rows for Tournament.");
            }
            TournamentData data = GetDataObjectFromReader(dataReader);

            dataReader.Close();
            return(data);
        }
Esempio n. 26
0
        /// <summary>
        /// Returns an object which matches the values for the fields specified.
        /// </summary>
        /// <param name="Host">A field value to be matched.</param>
        /// <returns>The object found.</returns>
        /// <exception cref="Spring2.Core.DAO.FinderException">Thrown when no rows are found.</exception>
        public static TournamentData FindByHost(StringType host)
        {
            OrderByClause sort   = new OrderByClause("Host");
            WhereClause   filter = new WhereClause();

            filter.And("Host", host.DBValue);
            SqlDataReader dataReader = GetListReader(CONNECTION_STRING_KEY, VIEW, filter, sort);

            if (!dataReader.Read())
            {
                dataReader.Close();
                throw new FinderException("TournamentData.FindByHost found no rows.");
            }
            TournamentData data = GetDataObjectFromReader(dataReader);

            dataReader.Close();
            return(data);
        }
Esempio n. 27
0
        /// <summary>
        /// Returns an object which matches the values for the fields specified.
        /// </summary>
        /// <param name="TournamentId">A field value to be matched.</param>
        /// <returns>The object found.</returns>
        /// <exception cref="Spring2.Core.DAO.FinderException">Thrown when no rows are found.</exception>
        public static TournamentData FindByTournamentId(IdType tournamentId, Int32 limit)
        {
            OrderByClause sort   = new OrderByClause("TournamentId");
            WhereClause   filter = new WhereClause();

            filter.And("TournamentId", tournamentId.DBValue);
            SqlDataReader dataReader = GetListReader(CONNECTION_STRING_KEY, VIEW, filter, sort, limit);

            if (!dataReader.Read())
            {
                dataReader.Close();
                throw new FinderException("TournamentData.FindByTournamentId found no rows.");
            }
            TournamentData data = GetDataObjectFromReader(dataReader);

            dataReader.Close();
            return(data);
        }
Esempio n. 28
0
    void UpdateActiveJudgingJudgersCount()
    {
        int         Count = 0;
        ResultsData RData = TournamentData.FindResultsData(CurDivision, CurRound, CurPool);

        if (RData != null)
        {
            foreach (int id in RData.AIJudgeIds)
            {
                NetworkJudgeData NJData = GetJudgeDataFromNameId(RData, id);
                if (NJData != null && (NJData.bJudging || NJData.bEditing))
                {
                    ++Count;
                }
            }
            foreach (int id in RData.ExJudgeIds)
            {
                NetworkJudgeData NJData = GetJudgeDataFromNameId(RData, id);
                if (NJData != null && (NJData.bJudging || NJData.bEditing))
                {
                    ++Count;
                }
            }
            foreach (int id in RData.DiffJudgeIds)
            {
                NetworkJudgeData NJData = GetJudgeDataFromNameId(RData, id);
                if (NJData != null && (NJData.bJudging || NJData.bEditing))
                {
                    ++Count;
                }
            }

            if (Count != ActiveJudgingJudgers)
            {
                ActiveJudgingJudgers = Count;
                ++Global.CurDataState;

                UpdateFinishRoutineAndGoToNextTeam();
            }
        }
    }
Esempio n. 29
0
    public bool SetAIResults(AIData InData)
    {
        if (InData.JudgeNameId == -1)
        {
            return(false);
        }

        ResultsData rd          = TournamentData.FindResultsData(InData.Division, InData.Round, InData.Pool);
        int         ResultIndex = -1;

        for (int i = 0; i < rd.AIJudgeIds.Count; ++i)
        {
            if (InData.JudgeNameId == rd.AIJudgeIds[i])
            {
                ResultIndex = i;
                break;
            }
        }

        bool bNewScore = false;

        if (ResultIndex >= 0)
        {
            for (int DataIndex = 0; DataIndex <= ResultIndex; ++DataIndex)
            {
                if (DataIndex >= AIResults.Count)
                {
                    AIResults.Add(new AIData());
                }
            }

            if (!AIResults[ResultIndex].IsValid())
            {
                bNewScore = true;
            }

            AIResults[ResultIndex] = InData;
        }

        return(bNewScore);
    }
Esempio n. 30
0
    public void Populate(TournamentData _data)
    {
        Data = _data;

        titleLabel.text       = Data.Name;
        _teamAmountLabel.text = Data.Teams.Count + " TEAMS";
        List <TeamData> list;

        if (Data.CurrentRound == 0)
        {
            list = Data.SortTeamsBy("Name");
        }
        else
        {
            list = Data.SortTeamsBy("Points");
        }

        int max = 2;

        if (list.Count > 3)
        {
            max = 3;
        }
        team_2.text  = "";
        score_2.text = "";
        TMP_Text[] team = new TMP_Text[3] {
            team_0, team_1, team_2
        };
        TMP_Text[] score = new TMP_Text[3] {
            score_0, score_1, score_2
        };
        for (int i = 0; i < max; i++)
        {
            TeamData tData = list[i];
            team[i].text = tData.Name + " (" + tData.OveralRating + ")";
            if (tData.TournamentStatistics.ContainsKey(Data.Id))
            {
                score[i].text = tData.TournamentStatistics[Data.Id].Points + " pts";
            }
        }
    }