Exemple #1
0
        public static int AskQuestion(UserLogicModel user, string question, string[] answers, GameCardGame cardGame)
        {
            cardGame.Emulating = false;
            if (cardGame.Answers.Count - 1 > cardGame.AnswerIndex) {
                cardGame.Emulating = true;
                return cardGame.Answers[cardGame.AnswerIndex++].Value; //todo .value
            }
            var m = new CardGameQuestion(user, question, answers, cardGame);

            var answer = Fiber<CardGameAnswer>.Yield(new FiberYieldResponse(FiberYieldResponseType.AskQuestion, m));
            cardGame.AnswerIndex++;
            return answer == null ? 0 : answer.Value;
        }
 //answerQuestion
 public FiberYieldResponse(FiberYieldResponseType type, CardGameQuestion question)
 {
     Type = type;
     Question = question;
 }
        private void askQuestion(CardGameQuestion answ, DebugGameRoom room)
        {
            var user = getPlayerByUsername(room, answ.User.UserName);
            myServerManager.SendAskQuestion(user, new DebugGameSendAnswerModel(answ.Question, answ.Answers));
            myServerManager.SendUpdateState(room);


            ServerLogger.LogDebug("Ask question   ", answ);
        }
 public DebugFiberYieldResponse(DebugFiberYieldResponseType type, CardGameQuestion question) //answerQuestion
 {
     Type = type;
     Question = question;
 }