Esempio n. 1
0
        public int AddKuaFuFuBenRoleData(KuaFuFuBenRoleData kuaFuFuBenRoleData, int maxRoleCount, GameElementWarRoleCountChanged handler)
        {
            int roleCount = -1;

            lock (this)
            {
                if (RoleDict.Count < maxRoleCount && !RoleDict.ContainsKey(kuaFuFuBenRoleData.RoleId))
                {
                    RoleCount++;

                    TeamCombatSum += kuaFuFuBenRoleData.ZhanDouLi;
                    RoleDict[kuaFuFuBenRoleData.RoleId] = kuaFuFuBenRoleData;
                    roleCount = RoleDict.Count;

                    if (null != handler)
                    {
                        handler(this, roleCount);
                    }

                    return(roleCount);
                }
            }

            return(roleCount);
        }
Esempio n. 2
0
        public int AddKuaFuFuBenRoleData(KuaFuFuBenRoleData kuaFuFuBenRoleData)
        {
            int roleCount = -1;

            lock (this)
            {
                if (RoleDict.Count < Consts.YongZheZhanChangRoleCountTotal && !RoleDict.ContainsKey(kuaFuFuBenRoleData.RoleId))
                {
                    if (RoleCountSide1 < RoleCountSide2)
                    {
                        RoleCountSide1++;
                        kuaFuFuBenRoleData.Side = 1;
                    }
                    else
                    {
                        RoleCountSide2++;
                        kuaFuFuBenRoleData.Side = 2;
                    }

                    RoleDict[kuaFuFuBenRoleData.RoleId] = kuaFuFuBenRoleData;
                    roleCount = RoleDict.Count;
                    return(roleCount);
                }
            }

            return(roleCount);
        }
Esempio n. 3
0
        public int AddKuaFuFuBenRoleData(KuaFuFuBenRoleData kuaFuFuBenRoleData)
        {
            int roleCount = -1;

            lock (this)
            {
                if (RoleDict.Count < Consts.TianTiRoleCountTotal && !RoleDict.ContainsKey(kuaFuFuBenRoleData.RoleId))
                {
                    if (RoleCountSide1 < Consts.TianTiRoleCountPerSide)
                    {
                        RoleCountSide1++;
                        kuaFuFuBenRoleData.Side = 1;
                    }
                    else if (RoleCountSide2 < Consts.TianTiRoleCountPerSide)
                    {
                        RoleCountSide2++;
                        kuaFuFuBenRoleData.Side = 2;
                    }
                    else
                    {
                        return(roleCount);
                    }

                    RoleDict[kuaFuFuBenRoleData.RoleId] = kuaFuFuBenRoleData;
                    roleCount = RoleDict.Count;
                    return(roleCount);
                }
            }

            return(roleCount);
        }
Esempio n. 4
0
        public int AddKuaFuFuBenRoleData(KuaFuFuBenRoleData kuaFuFuBenRoleData)
        {
            int roleCount = -1;

            lock (this)
            {
                if (this.RoleDict.Count < 2 && !this.RoleDict.ContainsKey(kuaFuFuBenRoleData.RoleId))
                {
                    if (this.RoleCountSide1 < 1)
                    {
                        this.RoleCountSide1++;
                        kuaFuFuBenRoleData.Side = 1;
                    }
                    else
                    {
                        if (this.RoleCountSide2 >= 1)
                        {
                            return(roleCount);
                        }
                        this.RoleCountSide2++;
                        kuaFuFuBenRoleData.Side = 2;
                    }
                    this.RoleDict[kuaFuFuBenRoleData.RoleId] = kuaFuFuBenRoleData;
                    roleCount = this.RoleDict.Count;
                    return(roleCount);
                }
            }
            return(roleCount);
        }
        public int AddKuaFuFuBenRoleData(KuaFuFuBenRoleData kuaFuFuBenRoleData, GameFuBenRoleCountChanged handler)
        {
            int roleCount = -1;

            lock (this)
            {
                if (this.RoleDict.Count < Consts.HuanYingSiYuanRoleCountTotal && !this.RoleDict.ContainsKey(kuaFuFuBenRoleData.RoleId))
                {
                    if (this.RoleCountSide1 < Consts.HuanYingSiYuanRoleCountPerSide)
                    {
                        this.RoleCountSide1++;
                        kuaFuFuBenRoleData.Side = 1;
                    }
                    else
                    {
                        if (this.RoleCountSide2 >= Consts.HuanYingSiYuanRoleCountPerSide)
                        {
                            return(roleCount);
                        }
                        this.RoleCountSide2++;
                        kuaFuFuBenRoleData.Side = 2;
                    }
                    this.RoleDict[kuaFuFuBenRoleData.RoleId] = kuaFuFuBenRoleData;
                    roleCount = this.RoleDict.Count;
                    if (null != handler)
                    {
                        handler(this, roleCount);
                    }
                    return(roleCount);
                }
            }
            return(roleCount);
        }
Esempio n. 6
0
        public int AddKuaFuFuBenRoleData(KuaFuFuBenRoleData kuaFuFuBenRoleData, int maxRoleCount)
        {
            int roleCount = -1;

            lock (this)
            {
                if (this.RoleDict.Count < maxRoleCount && !this.RoleDict.ContainsKey(kuaFuFuBenRoleData.RoleId))
                {
                    this.TeamCombatSum += (long)kuaFuFuBenRoleData.ZhanDouLi;
                    this.RoleDict[kuaFuFuBenRoleData.RoleId] = kuaFuFuBenRoleData;
                    roleCount = this.RoleDict.Count;
                    return(roleCount);
                }
            }
            return(roleCount);
        }