-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.js
75 lines (70 loc) · 2.64 KB
/
game.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import React from 'react';
import { colorGamma } from './variables/colors';
import { HTML } from './variables/tegs';
export class Game extends React.Component {
componentDidMount () {
return (console.log(HTML.body, ' i am DenisMount'));
}
focus() {
HTML.body.style.transition = '1s';
HTML.btn.style.backgroundColor= colorGamma.teal;
HTML.number.innerHTML = {/*String*/}(HTML.numbers[Math
.floor(Math.random() * HTML.numbers.length)])/*+','*/;
if (HTML.number.innerHTML == 10) {
HTML.rate.innerHTML = 'WELL DONE';
HTML.body.style.animation = 'none';
HTML.app.style.background = `url(${HTML.win_url}) 100% 100% no-repeat`;
HTML.app.style.backgroundSize = 'cover';
HTML.app.style.boxSizing = 'border-box';
HTML.app.style.backgroundPosition = '50% 50%';
HTML.body.style.backgroundColor = colorGamma.light_blue;
HTML.btn.style.display = 'none';
{/* ui.style.display = 'block';*/}
}
else if (HTML.number.innerHTML >= 6){
HTML.btn.style.backgroundColor = colorGamma.green;
HTML.rate.innerHTML = 'GOOD!'
}
else if (HTML.number.innerHTML >= 4) {
HTML.btn.style.backgroundColor = colorGamma.yellow;
HTML.rate.innerHTML = 'NORMAL'
}
else if (HTML.number.innerHTML == 1) {
HTML.btn.style.display = 'none';
HTML.body.style.animation = 'none';
HTML.body.style.background = `url(${HTML.defeat_url}) 100% no-repeat`;
HTML.body.style.backgroundColor = '#000';
HTML.body.style.boxSizing = 'border-box';
HTML.body.style.backgroundSize = 'cover';
HTML.rate.style.color = '#fff';
HTML.rate.innerHTML = 'GAME OVER';
console.log('ITS 1!!!!!!!!!!');
}
else{
HTML.btn.style.backgroundColor = colorGamma.red;
HTML.rate.innerHTML = 'PFFFF'
}
//number.value += grade_list;
HTML.grade_list += HTML.number.innerHTML;
// console.log(grade_list);
// var ready_grade_list = grade_list.split(',').map(function(item){return parseInt(item,10)});
console.log(HTML.grade_list);
// var super_ready_grade_list = ready_grade_list.reduce(sum,0);
// function sum(a, b) {
// return a+b;
// }
//console.log(/*eval(*/super_ready_grade_list/*).join('+')*/);
}
render () {
return (
<div className="app">
<div className="game">
<button className="btn" onClick={this.focus}><span >Random</span></button>
<div className="integer"></div>
<div className="rate"></div>
<div className="statistics">EJJ</div>
</div>
</div>
);
}
}