Example #1
0
        public List <OrganizeRst> GetNoticeStage()
        {
            //CPlayerCtrl.LoadPlayerInfos(txt_svrForder.Text + "\\DataBase\\saves\\players.dat", true);
            List <OrganizeAttr> organizeAttr = COrganizeCtrl.LoadOrganizeInfos(BaseForlder + "\\DataBase\\saves\\organize.dat", true);

            m_NoticeOrganizeRst.Clear();

            foreach (var it in organizeAttr)
            {
                int stageId = it.StageId;
                if (m_NoticeStage.Contains(stageId))
                {
                    OrganizeRst organizeRst = new OrganizeRst();

                    organizeRst.stage  = stageId; //get stage name by stage id
                    organizeRst.legion = CFormat.GameStrToSimpleCN(it.OrganizeName);
                    organizeRst.leader = CFormat.GameStrToSimpleCN(it.OrganizeLeaderZh);

                    m_NoticeOrganizeRst.Add(organizeRst);
                }
            }

            return(m_NoticeOrganizeRst);
        }
Example #2
0
        public List <OrganizeConstRst> GetNoticeConstStage(int flag)
        {
            if (flag == 0) //国战进行中,更新tmp,期间累计
            {
                List <OrganizeAttr> organizeAttr = COrganizeCtrl.LoadOrganizeInfos(BaseForlder + "\\DataBase\\saves\\organize.dat", true);
                foreach (var it in organizeAttr)
                {
                    int stageId = it.StageId;
                    if (m_NoticeConstStage.Contains(stageId)) // 关注的城池
                    {
                        OrganizeConstRst organizeRst = new OrganizeConstRst();

                        organizeRst.stage  = stageId; //get stage name by stage id
                        organizeRst.legion = CFormat.GameStrToSimpleCN(it.OrganizeName);
                        organizeRst.leader = CFormat.GameStrToSimpleCN(it.OrganizeLeaderZh);

                        bool find = false;
                        //检测记录
                        for (int i = 0; i < m_NoticeTmpConstOrganizeRst.Count; i++)
                        {
                            if (m_NoticeTmpConstOrganizeRst[i].stage == organizeRst.stage)//如果已经找到该城池记录
                            {
                                find = true;

                                if (m_NoticeTmpConstOrganizeRst[i].legion == organizeRst.legion)//如果是同一个军团,则更新end time
                                {
                                    organizeRst       = m_NoticeTmpConstOrganizeRst[i];
                                    organizeRst.eTime = DateTime.Now.ToString();
                                    m_NoticeTmpConstOrganizeRst[i] = organizeRst;

                                    //判断是否达到条件
                                    if (IsConstStageReward(Convert.ToDateTime(organizeRst.bTime), Convert.ToDateTime(organizeRst.eTime), 2)) //达到
                                    {
                                        m_NoticeConstOrganizeRst.Add(m_NoticeTmpConstOrganizeRst[i]);

                                        organizeRst.bTime = DateTime.Now.ToString();
                                        organizeRst.eTime = DateTime.Now.ToString();
                                        m_NoticeTmpConstOrganizeRst[i] = organizeRst;
                                    }
                                }
                                else //如果不是同一个军团,则先判断上一个军团是否达到奖励条件,然后替换
                                {
                                    if (IsConstStageReward(Convert.ToDateTime(m_NoticeTmpConstOrganizeRst[i].bTime), DateTime.Now, 2))
                                    {//达到
                                        OrganizeConstRst _organizeRst = new OrganizeConstRst();
                                        _organizeRst       = m_NoticeTmpConstOrganizeRst[i];
                                        _organizeRst.eTime = DateTime.Now.ToString();
                                        m_NoticeConstOrganizeRst.Add(_organizeRst);

                                        organizeRst.bTime = DateTime.Now.ToString();
                                        organizeRst.eTime = DateTime.Now.ToString();
                                        m_NoticeTmpConstOrganizeRst[i] = organizeRst;
                                    }
                                    else
                                    {
                                        organizeRst.bTime = DateTime.Now.ToString();
                                        organizeRst.eTime = DateTime.Now.ToString();
                                        m_NoticeTmpConstOrganizeRst[i] = organizeRst;
                                    }
                                }
                            }
                        }

                        //否则添加记录
                        if (!find)
                        {
                            organizeRst.bTime = DateTime.Now.ToString();
                            organizeRst.eTime = DateTime.Now.ToString();
                            m_NoticeTmpConstOrganizeRst.Add(organizeRst);
                        }
                    }
                }
            }
            else if (flag == 1)//国战结束,全部计算
            {
                foreach (var it in m_NoticeTmpConstOrganizeRst)
                {
                    if (IsConstStageReward(Convert.ToDateTime(it.bTime), DateTime.Now, 2))//达到奖励条件
                    {
                        m_NoticeConstOrganizeRst.Add(it);
                    }
                }
                m_NoticeTmpConstOrganizeRst.Clear();
            }

            return(m_NoticeConstOrganizeRst);
        }