Пример #1
0
        public void _Init()
        {
            float start = JHSTime.Time;

            dbService     = DbService.Instance;
            leagueManager = LeagueManager.Instance;
            leagueManager.RequiredGames = Settings.MIN_GAMES_TO_DECIDE_RANKING_SKILLS;
            List <RankConfig> configs = ConfigManager.GetRankConfigs();

            leagueManager._Configure(configs);
            leagueManager.OnPlayerChanged  = OnPlayerChanged;
            leagueManager.OnPlayerDemoted  = OnPlayerDemoted;
            leagueManager.OnPlayerPromoted = OnPlayerPromoted;
            leagueManager.OnPlayerRemoved  = OnPlayerRemoved;
            foreach (RankConfig config in configs)
            {
                LeagueType rank = config.RankId;

                IList <Rankings> usr = DbService.Instance.GetRank(rank);
                foreach (Rankings usrrank in usr)
                {
                    RankinngOBJ obj = dbService.GetRankinData(new RankinngOBJ(usrrank.UserId, usrrank.PlayerName));
                    if (obj != null)
                    {
                        KnownPlayers.Add(usrrank.UserId, obj);
                        leagueManager._AddPlayer(obj.RefLeagueData);
                    }
                }
            }
            LOG.Info("Finished loading ranking, time-consuming:" + (JHSTime.Time - start) + " sec.");
            LOG.Info(leagueManager.ToString());
        }