Beispiel #1
0
        public List <CRW_Question> GetCRW_QuestionByList(CRW_Level level)
        {
            List <CRW_Question> r = new List <CRW_Question>();

            var list = TiKu.InitList();

            Random random = new Random();

            for (int index = 0; index < level.QuestionCount; index++)
            {
                int randomIndex = random.Next(TiKu.ListCount);
                var randTiKu    = list[randomIndex];

                CRW_Question toAdd = new CRW_Question();

                toAdd.CRWTypeID = level.CRWTypeID;

                toAdd.No           = index + 1;
                toAdd.Left         = randTiKu.Left;
                toAdd.Symbol       = randTiKu.Symbol;
                toAdd.Right        = randTiKu.Right;
                toAdd.EqualsSymbol = randTiKu.EqualsSymbol;
                toAdd.Result       = randTiKu.Result;
                toAdd.TTSMsg       = "{0}{1}{2}".FormatWith(ToChineseNumber(toAdd.Left),
                                                            ToChineseSymbol(toAdd.Symbol),
                                                            ToChineseNumber(toAdd.Right));


                toAdd.ChangeStatus(CRW_Question_Status.Remember);

                r.Add(toAdd);
            }

            return(r);
        }
Beispiel #2
0
        public Tuple <int, CRW_Question, CRW_Question> ReadNextQuestion(int?currentIndex, CRW_Level level, List <CRW_Question> questionList)
        {
            int index = 0;

            if (currentIndex.HasValue == false)
            {
                currentIndex = 0;
            }

            index = currentIndex.Value;

            CRW_Question toRemember = null;
            CRW_Question toAnswer   = null;

            if (index <= level.RememberEndIndex)
            {
                toRemember = questionList[index];
                toRemember.ChangeStatus(CRW_Question_Status.Remember);
            }

            if (index >= level.AnswerStartIndex && index <= level.MaxIndex)
            {
                toAnswer = questionList[index - level.SuDa];
                toAnswer.ChangeStatus(CRW_Question_Status.Answer);
            }

            return(new Tuple <int, CRW_Question, CRW_Question>
                   (
                       index + 1,
                       toRemember,
                       toAnswer
                   ));
        }
Beispiel #3
0
        public static List <CRW_Question> InitJianFaList()
        {
            if (sJianFaList == null)
            {
                sJianFaList = new List <CRW_Question>();

                var query = TiKu_JianFa
                            .Split('\r', '\n')
                            .Where(i => i.IsNullOrWhiteSpace() == false);

                foreach (string item in query)
                {
                    var qArr = item.Split(',')
                               .Where(i => i.IsNullOrWhiteSpace() == false)
                               .Select(i => i.TrimAdv())
                               .ToArray();

                    if (qArr.Length != 4)
                    {
                        continue;
                    }

                    CRW_Question toAdd = new CRW_Question();

                    toAdd.Left         = int.Parse(qArr[0]);
                    toAdd.Symbol       = qArr[1];
                    toAdd.Right        = int.Parse(qArr[2]);
                    toAdd.EqualsSymbol = "=";
                    toAdd.Result       = int.Parse(qArr[3]);

                    sJianFaList.Add(toAdd);
                }
            }

            return(sJianFaList);
        }