Newer
Older
Skillsemi2023_WEB_Otaki_Nemoto / flask / testapp / static / javascript / resultScreen.js
function showQuestion(){
    fill("silver");
    setAlp(50);
    fRect(50, 50, 855, 100, "black");
    fText("Q.", 110, 100, 50, "white");
    fRect(45, 295, 865, 560, "white");
    fRect(50, 300, 400, 250, "black");
    fRect(500, 300, 400, 250, "black");
    fRect(50, 600, 400, 250, "black");
    fRect(500, 600, 400, 250, "black");

    sRect(45, 880, 865, 40, "black");
    fRect(45, 880, (timer/900)*865, 40, "red");
    setAlp(100);

    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[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");
    fText(question[round].choiceD, 725, 725, 25, "white");

    fText(int(timer/30), 900, 1100, 50, "red");

    setAlp(50);

    fText((round+1) + "回戦", 100, 1000, 50, "red");
    for(var i = 0; i < MAX_ROUND; i ++){
        if(player.points[i] == CORRECT){
            fText("O", 480 + 50*i, 1000, 50, "red");
        }
        else if(player.points[i] == WRONG) {
            fText("X", 480 + 50*i, 1000, 50, "blue");
        }
        else{
            fText("*", 480 + 50*i, 1000, 50, "black");
        }
    }
}

function showResult(){
    fill("silver");
    setAlp(50);
    fRect(50, 50, 855, 100, "black");
    fText("結果発表 ", 480, 100, 80, "white");

    fRect(45, 370, 865, 700, "white");
    fText("順位", 150, 410, 50, "black");
    fText("ユーザー名", 390, 410, 50, "black");
    fText("スコア", 730, 410, 50, "black");
    
    if(scene == RESULT_SCENE){
        fText(player.name+"さんのスコアは" + player.calcScore() + "点です!", 480, 200, 50, "gold");    
        // fTextN(orderTable, 500, 770, 600, 50, "silver");
    
        let splitOrder = orderTable.split("\n");
        for (var i = 0; i < splitOrder.length; i++){
            let arr = splitOrder[i].split(" "); // 空白で文字列を分割
            if(arr[0]=="1位"){
                fText(arr[0], 150, 480+60*i, 50, "gold");
            }
            else if(arr[0]=="2位"){
                fText(arr[0], 150, 480+60*i, 50, "silver");
            }
            else if(arr[0]=="3位"){
                fText(arr[0], 150, 480+60*i, 50, "#8c4841");
            }
            else{
                fText((i+1)+"位", 100, 480+60*i, 50, "black");
            }
            fText(arr[1], 390, 480+60*i, 50, "black");
            fText(arr[2], 730, 480+60*i, 50, "black");
        } 
    }
}

function inputName(){
    fill("silver");

    fRect(50, 50, 855, 100, "black");


    fText("美人投票ゲーム", 480, 100, 80, "white");
    setAlp(50);
    fText("あなたの名前を入力してください", 480, 200, 50, "black");

    fRect(200, 500, 560, 200, "black");
    sRect(200, 500, 560, 200, "blue");
    setAlp(100);
    fText("ゲーム開始!", 480, 600, 50, "white");
    
    setAlp(20);
    fRect(100, 800, 760, 300, "black");
    setAlp(100);
    fTextN("ルール1\nルール2\nルール3\nルール4", 480, 950, 200, 50, "white");


    if(tapC == 1){
        tapC ++;

        if(200 <= tapX && tapX <= 760 && 500 <= tapY && tapY <= 700){
            player.name = document.getElementById('textBox').value;
            document.getElementById('textBox').style.display = 'none';
            scene = WAIT_START;
            timer = 0;
            sendName();
        }
    }

}

// 他のプレイヤーが名前を書くのを待機(nemoto変更)
function WaitStart(){
    fill("silver");

    fRect(50, 50, 855, 100, "black");


    fText("美人投票ゲーム", 480, 100, 80, "white");
    setAlp(50);
    fText("あなたの名前を入力してください", 480, 200, 50, "black");

    setAlp(100);
    fText("参加予定者:" + max_player + "人", 480, 300, 50, "black");
    current_participants = int(player.number) + 1
    fText("現在の参加者:" + str(current_participants) + "人", 480, 400, 50, "black");
    fText("参加者が揃うまでお待ちください...", 480, 600, 50, "red");
    
    setAlp(20);
    fRect(100, 800, 760, 300, "black");
    setAlp(100);
    fTextN("ルール1\nルール2\nルール3\nルール4", 480, 950, 200, 50, "white");
}

// 他のプレイヤーの終わりを待つ画面(nemoto変更)
function WaitOthers(){
    fill("silver");
    setAlp(50);
    fRect(50, 50, 855, 100, "black");
    fText("Q.", 110, 100, 50, "white");
    fRect(45, 295, 865, 560, "white");
    fRect(50, 300, 400, 250, "black");
    fRect(500, 300, 400, 250, "black");
    fRect(50, 600, 400, 250, "black");
    fRect(500, 600, 400, 250, "black");

    sRect(45, 880, 865, 40, "black");
    fRect(45, 880, (timer/900)*865, 40, "red");
    setAlp(100);

    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[round].question, 480, 100, 30, "white");    
    //fText(question[round].choiceA, 275, 425, 25, "white");
    //fText(question[round].choiceB, 725, 425, 25, "white");
    fText("集計中...", 500, 500, 80, "black");
    //fText(question[round].choiceC, 275, 725, 25, "white");
    //fText(question[round].choiceD, 725, 725, 25, "white");
}