Beispiel #1
0
    public void QueryLotteryEntry(RichDataEntry entry)
    {
        JsonData result;

        if (!m_resultEntryMap.TryGetValue(entry.m_Issue, out result))
        {
            if (m_lastedIssue > entry.m_Issue)
            {
                entry.m_isExpired = true;
            }
            return;
        }


        string[] strArr = result["opencode"].ToString().Replace('+', ',').Split(',');
        entry.m_LotteryNumbers = new int[strArr.Length];
        for (int i = 0; i < strArr.Length; i++)
        {
            entry.m_LotteryNumbers[i] = int.Parse(strArr[i]);
        }

        //entry.m_Date = JsonMapper.ToObject<DateTime>(result["opentime"].ToJson());
        entry.m_Date = DateTime.Parse(result["opentime"].ToString());


        ILotteryRule rule = LotteryRuleFactory.GetLotteryRule(m_curType);

        rule.Compare(entry);

        entry.m_hasResult = true;
    }
Beispiel #2
0
    void Awake()
    {
        msRichEngine = this;

        m_setting.Load();

        m_dataCenter = new RichDataManager();
        m_dataCenter.LoadData();

        m_data = m_dataCenter.GetQueryArchieve();

        m_query = LotteryQueryFactory.GetLotteryQuery(m_setting.UseQueryAPI);

        m_timeCount = 0;    //保证第一次的query

        //修复错误
        foreach (var record in m_data.m_RecordsList)
        {
            ILotteryRule rule = LotteryRuleFactory.GetLotteryRule(record.m_LotteryType);

            foreach (var entry in record.m_RichList)
            {
                rule.Compare(entry);
            }
        }
    }
Beispiel #3
0
    private void btnSureClick()
    {
        if (mKeepNumbers == null)
        {
            UIController.Instance.mTextKeep.text = "守号号码:";
            RichEngine.Instance.m_dataCenter.SetKeepNumbers(UIController.Instance.mLottryType, mKeepNumbers);
            mListItemUI.refreshKeepText();
            btnCloseClick();
            return;
        }
        var rule = LotteryRuleFactory.GetLotteryRule(UIController.Instance.mLottryType);

        int[] nums = rule.CheckNumsAvailable(mKeepNumbers);
        if (nums != null)
        {
            UIController.Instance.mTextKeep.text = "守号号码:" + UIController.Instance.IntConvertString(nums);
            RichEngine.Instance.m_dataCenter.SetKeepNumbers(UIController.Instance.mLottryType, nums);
            mListItemUI.refreshKeepText();
            btnCloseClick();
        }
        else
        {
            UIController.Instance.setTip("输入号码规则不对", 3);
        }
    }
Beispiel #4
0
    void CompareLottery(ILotteryResultQuery query, RichLotteryRecord record)
    {
        List <RichDataEntry> removeList = new List <RichDataEntry>();
        bool hasNew = false;

        foreach (var entry in record.m_RichList)
        {
            if (entry.m_Issue > query.GetLastestIssueNo())
            {
                hasNew = true;
                continue;
            }

            //没有买
            if (!entry.m_hasBuy)
            {
                //并且不是最新一期时候 删除数据
                if (entry.m_Issue <= query.GetLastestIssueNo())
                {
                    removeList.Add(entry);
                }
                continue;
            }


            //没有超期 并且 没有结果 就查询
            if (!entry.m_isExpired && !entry.m_hasResult)
            {
                query.QueryLotteryEntry(entry);
            }
        }
        //删除需要删除的
        foreach (var rm in removeList)
        {
            record.m_RichList.Remove(rm);
        }

        //没有最新,要创建最新
        if (!hasNew)
        {
            RichDataEntry lastestEntry = query.GetLatestIssueInfo();

            var rule = LotteryRuleFactory.GetLotteryRule(record.m_LotteryType);

            var newEntry = rule.GetNextIssue(lastestEntry);

            record.m_RichList.Add(newEntry);
        }
    }