public bool QuizAnswer(string Answer, int index, out string message) { IdiomQuizValue value = Quizzes.ElementAt(index) as IdiomQuizValue; //value.answers -> 0: 사자성어 1: 첫번쨰 글자 2:두번쨰 글자 3:노말난이도일때 첫번쨰 글자+ 두번쨰 글자 if (!value.answers.Contains(Answer)) { message = "틀렸습니다."; Answertemp = null; return(false); } if (LEVEL == Level.NOMAL) { if (Answer.Length < 2) { if (Answertemp != Answer && Answertemp != null) { message = value.answers[0] + Environment.NewLine + "정답입니다!"; Answertemp = null; return(true); } if (value.answers[1].Equals(Answer)) { char[] idiomchar = value.answers[0].ToArray(); idiomchar[value.index[1]] = 'O'; message = string.Concat(idiomchar) + Environment.NewLine + "정답입니다! 나머지 한글자까지 맞춰보세요"; Answertemp = Answer; return(true); } else if (value.answers[2].Equals(Answer)) { char[] idiomchar = value.answers[0].ToArray(); idiomchar[value.index[0]] = 'O'; message = string.Concat(idiomchar) + Environment.NewLine + "정답입니다! 나머지 한글자까지 맞춰보세요"; Answertemp = Answer; return(true); } } } message = value.answers[0] + Environment.NewLine + "정답입니다!"; return(true); }
public IMessageActivity QuizMessage(IDialogContext context, int index, out string strMessage) { Message = context.MakeMessage(); string strdata = ""; var actions = new List <CardAction>(); IdiomQuizValue value = Quizzes.ElementAt(index) as IdiomQuizValue; if (LEVEL == Level.EASY) { char[] idiomchar = value.answers[0].ToArray(); idiomchar[value.index[0]] = 'O'; strdata = "\"" + value.meaning + "\"라는 뜻을 가진 사자성어의 빈칸을 채우시오." + Environment.NewLine + "사자성어 : " + string.Concat(idiomchar); actions.Add(new CardAction() { Title = "1. " + value.example[0], Value = value.example[0], Type = ActionTypes.ImBack }); actions.Add(new CardAction() { Title = "2. " + value.example[1], Value = value.example[1], Type = ActionTypes.ImBack }); actions.Add(new CardAction() { Title = "3. " + value.example[2], Value = value.example[2], Type = ActionTypes.ImBack }); actions.Add(new CardAction() { Title = "4. " + value.example[3], Value = value.example[3], Type = ActionTypes.ImBack }); actions.Add(new CardAction() { Title = "5. " + value.example[4], Value = value.example[4], Type = ActionTypes.ImBack }); Message.Attachments.Add(new HeroCard { Title = "다음 보기중 고르시오", Buttons = actions }.ToAttachment()); } else if (LEVEL == Level.NOMAL) { char[] idiomchar = value.answers[0].ToArray(); idiomchar[value.index[0]] = 'O'; idiomchar[value.index[1]] = 'O'; strdata = "\"" + value.meaning + "\"라는 뜻을 가진 사자성어의 빈칸을 채우시오." + Environment.NewLine + "사자성어 : " + string.Concat(idiomchar); actions.Add(new CardAction() { Title = "1. " + value.example[0], Value = value.example[0], Type = ActionTypes.ImBack }); actions.Add(new CardAction() { Title = "2. " + value.example[1], Value = value.example[1], Type = ActionTypes.ImBack }); actions.Add(new CardAction() { Title = "3. " + value.example[2], Value = value.example[2], Type = ActionTypes.ImBack }); actions.Add(new CardAction() { Title = "4. " + value.example[3], Value = value.example[3], Type = ActionTypes.ImBack }); actions.Add(new CardAction() { Title = "5. " + value.example[4], Value = value.example[4], Type = ActionTypes.ImBack }); Message.Attachments.Add(new HeroCard { Title = "다음 보기중 고르시오", Buttons = actions }.ToAttachment()); } else { strdata = "\"" + value.meaning + "\"라는 뜻을 가진 사자성어는?"; Message.Attachments.Add(new HeroCard { Title = "주관식 입니다." }.ToAttachment()); } strMessage = strdata; return(Message); }