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); }
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 )); }