Пример #1
0
        private static void MS_InitPkLoop_Update(DateTime now)
        {
            ZhanDuiZhengBaMatchConfig matchConfig = ZhanDuiZhengBa_K._Config.MatchConfigList.Find((ZhanDuiZhengBaMatchConfig _m) => _m.ID == ZhanDuiZhengBa_K.SyncData.RealActID);
            List <ZhanDuiZhengBa_K.JoinRolePkData> tmpRoleDatas = new List <ZhanDuiZhengBa_K.JoinRolePkData>();

            using (List <RangeKey> .Enumerator enumerator = ZhanDuiZhengBaUtils.GetDayPkGroupRange(ZhanDuiZhengBa_K.SyncData.RealActID).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    RangeKey range = enumerator.Current;
                    List <ZhanDuiZhengBa_K.JoinRolePkData> groupRoles = ZhanDuiZhengBa_K.TodayJoinRoleDatas.FindAll((ZhanDuiZhengBa_K.JoinRolePkData _r) => _r.Group >= range.Left && _r.Group <= range.Right);
                    if (groupRoles != null && groupRoles.Count == 2)
                    {
                        ZhanDuiZhengBa_K.JoinRolePkData joinRole  = groupRoles[0];
                        ZhanDuiZhengBa_K.JoinRolePkData joinRole2 = groupRoles[1];
                        if (joinRole.CurrGameID <= 0)
                        {
                            if (!ZhanDuiZhengBa_K.CreateGameFuBen(now, matchConfig, joinRole, joinRole2))
                            {
                                return;
                            }
                        }
                    }
                    else if (groupRoles != null && groupRoles.Count == 1)
                    {
                        if (!Consts.TestMode)
                        {
                            ZhanDuiZhengBa_K.JoinRolePkData joinRole3 = groupRoles[0];
                            joinRole3.ToServerID   = 0;
                            joinRole3.CurrGameID   = 0;
                            joinRole3.WaitReqEnter = false;
                        }
                        else
                        {
                            ZhanDuiZhengBa_K.JoinRolePkData joinRole  = groupRoles[0];
                            ZhanDuiZhengBa_K.JoinRolePkData joinRole2 = groupRoles[0];
                            if (joinRole.CurrGameID <= 0)
                            {
                                if (!ZhanDuiZhengBa_K.CreateGameFuBen(now, matchConfig, joinRole, joinRole2))
                                {
                                    return;
                                }
                            }
                        }
                    }
                }
            }
            ZhanDuiZhengBa_K.StateMachine.SetCurrState(5, now);
        }