private void askPlayerQuestion(DebugGameRoom room, DebugFiberYieldResponse answer) { gameData.TotalQuestionsAnswered++; var answ = answer.Question; if (answ == null) { ServerLogger.LogDebug("game question over", room); myServerManager.SendGameOver(room); room.Fiber.Run<DebugFiberYieldResponse>(); // profiler.takeSnapshot('game over ' + room.roomID); return; } askQuestion(answ, room); //ServerLogger.Log(gameData.toString()); var dt = new DateTime(); var then = dt.GetMilliseconds(); //ServerLogger.Log(then - now + " Milliseconds"); // ServerLogger.Log(gameData.TotalQuestionsAnswered / ((dt.GetTime() - startTime.GetTime()) / 1000d) + " Answers per seconds", LogLevel.DebugInformation); }
private void logGameConsoleLine(DebugGameRoom room, DebugFiberYieldResponse answer) { var answ2 = room.Fiber.Run<DebugFiberYieldResponse>(); processGameResponse(room, answ2); if (!room.Game.CardGame.Emulating) { myServerManager.SendDebugLog(room, new DebugGameLogModel(answer.Contents)); } }
private void didPlayersLeave(DebugGameRoom room, DebugFiberYieldResponse response) { room.Fiber.Run<DebugFiberYieldResponse>(room.PlayersLeft); room.PlayersLeft.Clear(); }
private void breakGameExecution(DebugGameRoom room, DebugFiberYieldResponse response) { var ganswer = new DebugGameBreakModel(response.LineNumber, response.Value); myServerManager.SendDebugBreak(room, ganswer); }
private void processGameResponse(DebugGameRoom room, DebugFiberYieldResponse response) { if (response == null) { ServerLogger.LogDebug("game request over", room); myServerManager.SendGameOver(room); room.Fiber.Run<DebugFiberYieldResponse>(); rooms.Remove(room); room.Unwind(room.Players); return; } switch (response.Type) { case DebugFiberYieldResponseType.AskQuestion: askPlayerQuestion(room, response); break; case DebugFiberYieldResponseType.PlayersLeft: didPlayersLeave(room, response); break; case DebugFiberYieldResponseType.GameOver: gameOver(room); break; case DebugFiberYieldResponseType.Log: logGameConsoleLine(room, response); break; case DebugFiberYieldResponseType.VariableLookup: Console.WriteLine("vlook " + Json.Stringify(response)); breakGameExecution(room, response); break; case DebugFiberYieldResponseType.Break: Console.WriteLine("broke " + Json.Stringify(response)); breakGameExecution(room, response); break; } }