Upload files to 'run-offline/sasaaageyooo/html'
This commit is contained in:
parent
30b5cd3c39
commit
03e7b7eda8
4 changed files with 127 additions and 0 deletions
BIN
run-offline/sasaaageyooo/html/armored_titan.jpeg
Normal file
BIN
run-offline/sasaaageyooo/html/armored_titan.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
BIN
run-offline/sasaaageyooo/html/colossal_long.jpeg
Normal file
BIN
run-offline/sasaaageyooo/html/colossal_long.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
BIN
run-offline/sasaaageyooo/html/gg.jpeg
Normal file
BIN
run-offline/sasaaageyooo/html/gg.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 738 KiB |
127
run-offline/sasaaageyooo/html/index.html
Normal file
127
run-offline/sasaaageyooo/html/index.html
Normal file
|
@ -0,0 +1,127 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='UTF-8'>
|
||||
<script>
|
||||
|
||||
state=[]
|
||||
train=true
|
||||
ws=new WebSocket('wss://'+document.location.host+'/train')
|
||||
function new_game(train_loc){
|
||||
train=train_loc;
|
||||
if(train) {
|
||||
ws=new WebSocket('wss://'+document.location.host+'/train')
|
||||
} else {
|
||||
ws=new WebSocket('wss://'+document.location.host+'/get-flag')
|
||||
}
|
||||
ws.onopen=function(e){
|
||||
ws.send('init');
|
||||
//console.log('opened');
|
||||
}
|
||||
ws.onmessage = function(e) {
|
||||
msg=JSON.parse(e.data);
|
||||
if(msg['msg']!=undefined) {
|
||||
alert(msg['msg']);
|
||||
}
|
||||
if(msg['state']!=undefined) {
|
||||
state=msg['state'];
|
||||
//console.log('state given');
|
||||
update_state();
|
||||
}
|
||||
if(msg['index']!=undefined) {
|
||||
console.log('received: '+e.data);
|
||||
del_from_heap(msg['index'],msg['value']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function update_state() {
|
||||
body=document.getElementsByTagName('body')[0]
|
||||
body.innerHTML='';
|
||||
//console.log(body);
|
||||
//console.log('body cleared');
|
||||
main_container=document.createElement('div');
|
||||
main_container.style.width='98vw';
|
||||
main_container.style.display='table';
|
||||
|
||||
arm=document.createElement('div');
|
||||
armi=document.createElement('img');
|
||||
arm.style.width='15%';
|
||||
armi.style.width='100%';
|
||||
armi.src='/armored_titan.jpeg';
|
||||
arm.appendChild(armi);
|
||||
arm.style.display='table-cell';
|
||||
|
||||
gg=document.createElement('div');
|
||||
ggi=document.createElement('img');
|
||||
gg.style.width='15%';
|
||||
ggi.style.width='100%';
|
||||
ggi.src='/gg.jpeg';
|
||||
gg.appendChild(ggi);
|
||||
gg.style.display='table-cell';
|
||||
|
||||
titan_container=document.createElement('div');
|
||||
titan_container.style.width='70%';
|
||||
main_container.appendChild(gg);
|
||||
main_container.appendChild(titan_container);
|
||||
main_container.appendChild(arm);
|
||||
body.appendChild(main_container);
|
||||
man=document.createElement('div');
|
||||
man.innerHTML='Нажатие на титана убирает его и всех последующих из кучки (строки)';
|
||||
man.style='font-size:20px;color:red'
|
||||
body.appendChild(man);
|
||||
|
||||
//damn html!!!!!!!!!!!!!!!!!
|
||||
|
||||
for(var i=0;i<state.length;i++) {
|
||||
heap_container=document.createElement('div');
|
||||
titan_container.appendChild(heap_container);
|
||||
for(var j=0;j<state[i];j++) {
|
||||
titan=document.createElement('button');
|
||||
titan.type='button';
|
||||
titan.id=i.toString()+';'+(state[i]-j).toString();
|
||||
titan.style.backgroundImage='url("/colossal_long.jpeg")';
|
||||
if(train) {
|
||||
titan.style.width='6vw';
|
||||
titan.style.height='30vh';
|
||||
} else {
|
||||
titan.style.width='1vw';
|
||||
titan.style.height='3vh';
|
||||
}
|
||||
titan.style.backgroundSize=titan.style.width+' '+titan.style.height
|
||||
titan.onclick=function(e) {
|
||||
id=e.target.id
|
||||
index=Number(id.split(';')[0]);
|
||||
value=Number(id.split(';')[1]);
|
||||
ws.send(JSON.stringify({'index':index,'value':value}));
|
||||
console.log('sended: '+JSON.stringify({'index':index,'value':value}));
|
||||
del_from_heap(index,value);
|
||||
}
|
||||
heap_container.appendChild(titan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function del_from_heap(index,value) {
|
||||
state[index]-=value;
|
||||
heap=titan_container.children[index];
|
||||
for(var i=0;i<value;i++) {
|
||||
heap.children[0].remove();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div style='font-color:red'>
|
||||
Сасагеёёё!<br>
|
||||
Сасагеёёё!<br>
|
||||
Щинзоу во сасагеёёё!!!!!!!!<br>
|
||||
<div>
|
||||
А вообще, сыграй в игру:<br>
|
||||
Дано несколько кучек из титанов. Играете вы и бронированный титан (вы ходите первым). За ход каждый может взять сколько угодно титанов, но только из одной кучки. Проигрывает тот, кто ходить не может. Выиграйте бронированного - и забирайте флаг.<br>
|
||||
<button onclick='new_game(true)'> Тренировка </button><br>
|
||||
<button onclick='new_game(false)'> Босс-файт(долго грузится) </button><br>
|
||||
<a href='https://www.youtube.com/watch?v=5dO7SvUz_Dw'>сасагеё</a><br>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue