Ejemplo n.º 1
0
        public bool AssginKfFuben(GameTypes gameType, long gameId, int roleNum, out int kfSrvId)
        {
            kfSrvId = 0;

            lock (Mutex)
            {
                long        payload     = long.MaxValue;
                ClientAgent assignAgent = null;

                foreach (var sid in AllKfServerId)
                {
                    ClientAgent agent = null;
                    if (ServerId2ClientAgent.TryGetValue(sid, out agent) &&
                        agent.IsAlive &&
                        agent.TotalRolePayload < payload)
                    {
                        payload     = agent.TotalRolePayload;
                        assignAgent = agent;
                    }
                }

                if (assignAgent != null)
                {
                    assignAgent.AssginKfFuben(gameType, gameId, roleNum);
                    kfSrvId = assignAgent.ClientInfo.ServerId;
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        public bool SpecialKfFuben(GameTypes gameType, long gameId, int roleNum, out int kfSrvId)
        {
            kfSrvId = 0;
            ClientAgent assignAgent = null;
            int         serverId    = KuaFuServerManager.GetSpecialLineId(gameType);
            bool        result;

            if (serverId <= 0)
            {
                kfSrvId = -3;
                result  = false;
            }
            else
            {
                lock (this.Mutex)
                {
                    ClientAgent agent = null;
                    if (this.ServerId2ClientAgent.TryGetValue(serverId, out agent) && agent.IsAlive)
                    {
                        assignAgent = agent;
                    }
                    else
                    {
                        kfSrvId = -100;
                    }
                    if (assignAgent != null)
                    {
                        assignAgent.AssginKfFuben(gameType, gameId, roleNum);
                        kfSrvId = assignAgent.ClientInfo.ServerId;
                        return(true);
                    }
                }
                result = false;
            }
            return(result);
        }