diff --git a/flask/testapp/static/javascript/beautyVote.js b/flask/testapp/static/javascript/beautyVote.js index 2059d5c..d3d867f 100644 --- a/flask/testapp/static/javascript/beautyVote.js +++ b/flask/testapp/static/javascript/beautyVote.js @@ -195,14 +195,6 @@ console.log(xhr.responseText); scene = CAPASITY_ERROR } - else{ - var get_players_information = xhr.responseText - var get_split_players_information = get_players_information.split(" "); - sent_player = get_split_players_information[0] - round_player = get_split_players_information[1] - console.log("送った人数" + sent_player); - console.log("現在のラウンドの全プレイヤー" + round_player) - } } } } @@ -275,26 +267,31 @@ xhr.send('checkothers=' + "check"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { - if(xhr.responseText=="WAIT"){ - console.log(xhr.responseText); + console.log(xhr.responseText); + answerTable = xhr.responseText + var splitAnswer = answerTable.split("\n"); + // 送信した人数の進捗の把握 + if((splitAnswer.length)!=CHOICE_NUMBER) + { + sent_player = splitAnswer[0]; + round_player = splitAnswer[1]; + console.log(sent_player) + console.log(round_player) } - //正解選択肢を取得(選択が多い順に表示) else{ - console.log(xhr.responseText); - answerTable = xhr.responseText - var splitAnswer = answerTable.split("\n"); for(var i = 0; i < CHOICE_NUMBER; i ++){ // i番目に多かった答えと人数 var arr_answer = splitAnswer[i].split(" "); question[round].answer[i] = arr_answer[0]; question[round].people[i] = arr_answer[1]; - } + } + sent_player = " "; + round_player = " "; //正解判定 checkAnswer(); timer = 0; scene = ROUND_RESULT; } - } } } @@ -345,11 +342,11 @@ var round = 0; //変更 var MAX_ROUND = 10; var CHOICE_NUMBER = 5; -var max_player = 0; // 最大のplayer数(変更不要) -var current_player = 0; +var max_player = " "; // 最大のplayer数(変更不要) +var current_player = " "; -var sent_player = 0; // 各ラウンドで、答えを送信した人数 -var round_player = 0; // 各ラウンドでの参加人数 +var sent_player = " "; // 各ラウンドで、答えを送信した人数 +var round_player = " "; // 各ラウンドでの参加人数 var timer = 0; var TIME_LIMIT = 900; diff --git a/flask/testapp/static/javascript/resultScreen.js b/flask/testapp/static/javascript/resultScreen.js index b14970e..820085b 100644 --- a/flask/testapp/static/javascript/resultScreen.js +++ b/flask/testapp/static/javascript/resultScreen.js @@ -25,14 +25,14 @@ } setAlp(100); - fText("Q.", 90, 100, 40, "white"); + fText("Q.", 110, 100, 40, "white"); - fText("A.", 95, 425, 40, "white"); - fText("B.", 545, 425, 40, "white"); - fText("C.", 95, 725, 40, "white"); - fText("D.", 545, 725, 40, "white"); + fText("A.", 100, 425, 40, "white"); + fText("B.", 550, 425, 40, "white"); + fText("C.", 100, 725, 40, "white"); + fText("D.", 550, 725, 40, "white"); - fTextN(question[round].question, 480, 100, 50, 30, "white"); + fText(question[round].question, 480, 100, 30, "white"); fText(question[round].choiceA, 275, 425, 25, "white"); fText(question[round].choiceB, 725, 425, 25, "white"); fText(question[round].choiceC, 275, 725, 25, "white"); @@ -93,7 +93,7 @@ } else{ fText("Counting..." , 500, 540, 50, "white"); - fText(sent_player + "of" + round_player + "sent", 500, 610, 50, "white"); + fText(sent_player + " "+ "of" + " " + round_player + " " + "sent", 500, 610, 50, "white"); } } } @@ -115,7 +115,7 @@ fText("Beauty Vote", 480, 100, 80, "white"); fTextN("Rule Explanation\n\n・Please choose your favorite option\n・If the chosen option is the majority,\nyou get high points!\n・The time limit is 30 seconds\n・No mid-term participation or withdrawal", 480, 950, 230, 35, "black"); } - + if(scene == START_SCENE){ fRect(200, 500, 560, 200, "black"); sRect(200, 500, 560, 200, "blue"); @@ -213,12 +213,12 @@ setAlp(100); - fText("Q.", 90, 100, 40, "white"); + fText("Q.", 110, 100, 40, "white"); - fText("A.", 95, 425, 40, "white"); - fText("B.", 545, 425, 40, "white"); - fText("C.", 95, 725, 40, "white"); - fText("D.", 545, 725, 40, "white"); + fText("A.", 100, 425, 40, "white"); + fText("B.", 550, 425, 40, "white"); + fText("C.", 100, 725, 40, "white"); + fText("D.", 550, 725, 40, "white"); fText(question[show_click_round].question, 480, 100, 30, "white"); fText(question[show_click_round].choiceA, 275, 425, 25, "white"); diff --git a/flask/testapp/views.py b/flask/testapp/views.py index a8e04c3..64d39d7 100644 --- a/flask/testapp/views.py +++ b/flask/testapp/views.py @@ -107,7 +107,6 @@ if int(request.form.get("round")) == current_round: choices.append(request.form.get("choice")) print(f"Received choice:{choices} Round:{current_round+1}") - return str(len(choices)) + " " + str(current_player) else: return "FAILED" @@ -120,8 +119,8 @@ current_player = len(choices) print(f"現在の参加人数:{current_player}") return calculate_majority(choices) - else: - return "WAIT" + else: # 進捗を送信 + return str(len(choices)) + "\n" + str(current_player) # ゲーム終了時,識別番号とスコアを受け取る if request.form.get("number") and request.form.get("score"):