2018 ソフトウェア設計及び演習用の班Wiki

18::gr08::hiru.js

var ninzu; //自分も含めたプレイヤー数
var my_card;
var pname = []; 
var work;
var lod = [];
var users =0;
var timerId;
var jobimg = [	"aka.png" ,//あか
  		"pan.png" ,//ぱん
  		"esper.png" ,//えすぱー
  		"ghost.png" ,//ごーすと
  		"super.png" ,//スーパー
  		"psycho.png" ,//サイコ
  		"wolf.png"  //ウルフ
             ];

//自分の役職カード
my_card = sessionStorage.getItem("myjob")-1;

//プレイ人数・生死にあわせてカードを表示
function card(){
    if(lod[0] == 1){
	document.getElementById("img1").src = "dead.png";
    }
    if(lod[1] == 1){
	document.getElementById("img2").src = "dead.png";
    }
    if(lod[2] == 1){
	document.getElementById("img3").src = "dead.png";
    }
    if(lod[3] == 1){
	document.getElementById("img4").src = "dead.png";
    }
    if(lod[4] == 1){
	document.getElementById("img5").src = "dead.png";
    }
    if(lod[5] == 1){
	document.getElementById("img6").src = "dead.png";
    }
    if(lod[6] == 1){
	document.getElementById("img7").src = "dead.png";
    }
    if(lod[7] == 1){
	document.getElementById("img8").src = "dead.png";
    }
    if(lod[8] == 1){	
	document.getElementById("img9").src = "dead.png";
    }
    if(lod[9] == 1){
	document.getElementById("img10").src = "dead.png";
    }
    
    //各プレイヤー名を表示
    document.getElementById("text1").innerHTML=pname[0];
    document.getElementById("text2").innerHTML=pname[1];
    document.getElementById("text3").innerHTML=pname[2];
    document.getElementById("text4").innerHTML=pname[3];
    document.getElementById("text5").innerHTML=pname[4];
    document.getElementById("text6").innerHTML=pname[5];
    document.getElementById("text7").innerHTML=pname[6];
    document.getElementById("text8").innerHTML=pname[7];
    document.getElementById("text9").innerHTML=pname[8];
    document.getElementById("text10").innerHTML=pname[9];
    
    //余計なカードを消す
    switch(ninzu){
    case 4:
	document.getElementById("text5").innerHTML="";
	document.getElementById("img5").src = "about:blank";
    case 5:
	document.getElementById("text6").innerHTML="";
	document.getElementById("img6").src = "about:blank";
    case 6:
	document.getElementById("text7").innerHTML="";
	document.getElementById("img7").src = "about:blank";
    case 7:
	document.getElementById("text8").innerHTML="";
	document.getElementById("img8").src = "about:blank";

    case 8:
	document.getElementById("text9").innerHTML="";
	document.getElementById("img9").src = "about:blank";
    case 9:
	document.getElementById("text10").innerHTML="";
	document.getElementById("img10").src = "about:blank";
	break;

    default:
	break;
    }

    //自分のカードを表示
    document.getElementById("mycard").src = jobimg[my_card];
}

//パンが生きていた時
function showBox() {
    document.getElementById("alert_pan").style.display = "block";
    timerId = setTimeout(closeBox, 10000);
}
function closeBox() {
    document.getElementById("alert_pan").style.display = "none";
    clearTimeout(timerId);
}


最終更新日:2018/08/02 19:27:19