public override int CountNumQuantity(string num, PlayWay playWay) { if (this.CompanySupportNumLen == null || this.CompanySupportNumLen.Count == 0) throw new ApplicationException("公司支持号码长度不能为空!"); if (!num.IsNum()) throw new ArgumentException(string.Format("num:{0} 不是数字", num)); int quantity = TransToMethod(playWay)(); return quantity; }
public override int CountNumQuantity(string num, PlayWay playWay) { if (!num.IsPL2()) throw new ArgumentException(string.Format("num:{0} not a pl2 number", num)); if (this.CompanySupportNumLen == null || this.CompanySupportNumLen.Count == 0) throw new ApplicationException("公司支持号码长度不能为空!"); //var nums = num.Split('#'); //if (nums[0] == nums[1]) // throw new ArgumentException("包组过关2应该使用两个不同数字!"); return CompanySupportNumLen.Sum(it => it.Count) * 2; }
public override int CountNumQuantity(string num, PlayWay playWay) { if (!num.IsPL3()) throw new ArgumentException(string.Format("num:{0} not a pl3 number", num)); if (this.CompanySupportNumLen == null || this.CompanySupportNumLen.Count == 0) throw new ApplicationException("公司支持号码长度不能为空!"); //var nums = num.Split('#'); //foreach (var n in nums) //{ // if (nums.Count(it => it == n) > 1) // throw new ArgumentException("包组过关3应该使用3个不相同的号码!"); //} return CompanySupportNumLen.Sum(it => it.Count) * 3; }
/// <summary> /// 计算号码数量. /// </summary> /// <param name="num">号码.</param> /// <param name="isFullPermutation">是否全排列下注(化).</param> /// <param name="playWay">玩法.</param> /// <returns></returns> public abstract int CountNumQuantity(string num, PlayWay playWay);
protected Func<int> TransToMethod(PlayWay playWay) { string wayName = playWay.ToString().Replace("+", "And"); string methodName = "Get" + wayName; string key = string.Format("{0}_{1}", this.GetType().Name, methodName); Func<int> getMethod; if (!MethodDic.TryGetValue(key, out getMethod)) { lock (_lockHelper) { if (!MethodDic.TryGetValue(key, out getMethod)) { var method = this.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance); LambdaExpression lambda = LambdaExpression.Lambda<Func<int>>(Expression.Call(Expression.Constant(this), method)); getMethod = lambda.Compile() as Func<int>; MethodDic.Add(key, getMethod); } } } return getMethod; }
public GamePlayWay FindGamePlayWay(GameType gameType, PlayWay playWay) { string key = string.Format("{0}_{1}", (int)gameType, (int)playWay); GamePlayWay gpw; if (!MixKeyGWPDic.TryGetValue(key, out gpw)) { lock (_lockHelper) { if (!MixKeyGWPDic.TryGetValue(key, out gpw)) { gpw = GamePlayWays.Find(it => it.GameType == gameType && it.PlayWay == playWay); MixKeyGWPDic.Add(key, gpw); } } } return gpw; }