public static HandCardResult GetHandCardResult(HandCard handCard)
        {
            HandCardResult result = new HandCardResult();

            for (int i = 0; i < _judgeList.Count; i++)
            {
                JudgeFunction judgeFunction = _judgeList[i];
                int           cardNumLimit  = judgeFunction.CardNumLimit;
                if ((cardNumLimit != 0) && (cardNumLimit != handCard.Count))
                {
                    continue;
                }
                if (judgeFunction.Fun.Invoke(handCard))
                {
                    result.Level = judgeFunction.Level;
                    result.Odds  = judgeFunction.Odds;
                    if (judgeFunction.Odds == 0)
                    {
                        result.Odds = CaculateOdds(judgeFunction.Level, handCard);
                    }
                    break;
                }
            }

            // list.Count == 2是因为获取hash时需要OnesDigit
            if ((handCard.Count == 2) || (result.Level >= CardLevel.onesDigitIsZero))
            {
                result.OnesDigit = handCard.OnesDigit;
            }
            return(result);
        }
Exemplo n.º 2
0
        public static LogKind GetLogKind(HandCard handCard)
        {
            LogKind result = LogKind.other;

            for (int i = 0; i < _judgeFunciontList.Count; i++)
            {
                JudgeFunction judgeFunction = _judgeFunciontList[i];
                if (judgeFunction.Fun.Invoke(handCard))
                {
                    result = judgeFunction.Kind;
                    break;
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        public static ObservableCollection <JudgeFunction> GetJudgeFunctions(int matchID)
        {
            if (!CheckDBConnection())
            {
                return(null);
            }
            SqlDataReader sr = null;
            ObservableCollection <JudgeFunction> functions = new ObservableCollection <JudgeFunction>();

            try
            {
                SqlCommand sqlCmd = DVCommon.g_DataBaseCon.CreateCommand();
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.CommandText = "Proc_SY_GetJudgeFunctions";
                sqlCmd.Parameters.Add("@MatchID", SqlDbType.Int).Value = matchID;
                sqlCmd.Parameters.Add("@LanguageCode", SqlDbType.NVarChar, 10).Value = "ENG";
                sr = sqlCmd.ExecuteReader();

                while (sr.Read())
                {
                    JudgeFunction judge = new JudgeFunction();
                    judge.Function     = (string)GetNoNullValue(sr, "FunctionName", "");
                    judge.FunctionID   = (int)GetNoNullValue(sr, "F_FunctionID", -1);
                    judge.FunctionCode = (string)GetNoNullValue(sr, "F_FunctionCode", "");
                    functions.Add(judge);
                }
                return(functions);
            }
            catch (System.Exception ex)
            {
                AthleticsCommon.LastErrorMsg = "GetJudgeFunctions():" + ex.Message;
                return(null);
            }
            finally
            {
                if (sr != null)
                {
                    sr.Close();
                }
            }
        }