internal List <MatchGroup> GetMatchGroup(int rank, int group_count)
        {
            List <MatchGroup>    result = new List <MatchGroup>();
            ArenaMatchRuleConfig rule   = GetFitRule(rank);

            if (rule == null)
            {
                return(result);
            }
            int oneBegin, twoBegin, threeBegin, threeEnd;

            GetRankMatchRange(rank, out oneBegin, out twoBegin, out threeBegin, out threeEnd);
            List <int> ones   = GetRandomRank(rank, oneBegin, twoBegin, group_count);
            List <int> twos   = GetRandomRank(rank, twoBegin, threeBegin, group_count);
            List <int> threes = GetRandomRank(rank, threeBegin, threeEnd, group_count);

            for (int i = 0; i < group_count; ++i)
            {
                MatchGroup group = new MatchGroup();
                if (ones.Count > i)
                {
                    group.One = m_Rank.GetRankEntity(ones[i]);
                }
                if (twos.Count > i)
                {
                    group.Two = m_Rank.GetRankEntity(twos[i]);
                }
                if (threes.Count > i)
                {
                    group.Three = m_Rank.GetRankEntity(threes[i]);
                }
                result.Add(group);
            }
            return(result);
        }
Example #2
0
        private void InitRuleManager()
        {
            List <ArenaMatchRuleConfig> rules = new List <ArenaMatchRuleConfig>();

            foreach (var pair in ArenaConfigProvider.Instance.MatchRuleConfig.GetData())
            {
                ArenaMatchRuleConfig rule = (ArenaMatchRuleConfig)pair.Value;
                rules.Add(rule);
            }
            m_MatchRuleManager = new MatchRuleManager(m_ArenaRank, rules);
        }
        internal void GetRankMatchRange(int rank, out int oneBegin, out int twoBegin, out int threeBegin, out int threeEnd)
        {
            ArenaMatchRuleConfig rule = GetFitRule(rank);

            if (rule == null)
            {
                oneBegin = twoBegin = threeBegin = threeEnd = -1;
                return;
            }
            oneBegin   = GetLegalRank(rank - rule.OneBegin, m_Rank.MaxRank + 1);
            twoBegin   = GetLegalRank(rank - rule.TwoBegin, m_Rank.MaxRank + 1);
            threeBegin = GetLegalRank(rank - rule.ThreeBegin, m_Rank.MaxRank + 1);
            threeEnd   = GetLegalRank(rank - rule.ThreeEnd, m_Rank.MaxRank + 1);
        }