-
Notifications
You must be signed in to change notification settings - Fork 1
/
Referee
76 lines (76 loc) · 3.23 KB
/
Referee
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
76
{
"id": "ExtBox1-ext-gen5883",
"type": "controller",
"reference": {
"name": "items",
"type": "array"
},
"codeClass": null,
"userConfig": {
"designer|init": "",
"designer|userClassName": "Referee"
},
"customConfigs": [],
"designerId": "40d38f98-1840-43d0-a2b9-d42b955bddcb",
"$viewOrder": 2,
"expanded": true,
"cn": [
{
"id": "ExtBox1-ext-gen11282",
"type": "basicfunction",
"reference": {
"name": "items",
"type": "array"
},
"codeClass": null,
"userConfig": {
"fn": "incrementScore",
"designer|params": [
"isPlayer"
],
"implHandler": "MyApp.app.stopGame();\n\nif (!this.scoreCPU) { this.scoreCPU = 0; }\nif (!this.scorePlayer) { this.scorePlayer = 0; }\n\nif (isPlayer) {\n Ext.ComponentQuery.query('#scorePlayer')[0].setHtml('Player: ' + ++this.scorePlayer);\n\n MyApp.app.dispatch({\n controller : 'Audio',\n action : 'playWin'\n });\n}\nelse {\n Ext.ComponentQuery.query('#scoreCPU')[0].setHtml('CPU: ' + ++this.scoreCPU);\n\n MyApp.app.dispatch({\n controller : 'Audio',\n action : 'playLose'\n });\n}\n\nvar box = MyApp.app.surface.getBox();\n\n//center the ball\nMyApp.app.ball.element.setXY(\n[ Math.floor(box.width / 2), Math.floor( box.height / 2) ]\n);\n\nif (this.scoreCPU >= 10 && this.scoreCPU > this.scorePlayer) {\n Ext.Msg.alert('Your Lose!', 'You Lose!');\n Ext.ComponentQuery.query('#playpause')[0].disable();\n}\nelse {\n MyApp.app.startGame();\n}",
"designer|userClassName": "incrementScore"
},
"customConfigs": [],
"expanded": true
},
{
"id": "ExtBox1-ext-gen50611",
"type": "controlleraction",
"reference": {
"name": "listeners",
"type": "array"
},
"codeClass": null,
"userConfig": {
"fn": "playPause",
"implHandler": " if (MyApp.intervalID) { MyApp.app.stopGame(); }\n else { MyApp.app.startGame(); }",
"name": "tap",
"designer|targetType": "Ext.Button",
"designer|controlQuery": "button#playpause",
"designer|userClassName": "playPause"
},
"customConfigs": [],
"expanded": true
},
{
"id": "ExtBox1-ext-gen57670",
"type": "controlleraction",
"reference": {
"name": "listeners",
"type": "array"
},
"codeClass": null,
"userConfig": {
"fn": "setDifficulty",
"implHandler": " constants.difficulty = slider.getValue()[0];\n Ball.speed += constants.difficulty - 1;",
"name": "change",
"designer|targetType": "Ext.field.Slider",
"designer|controlQuery": "sliderfield",
"designer|userClassName": "setDifficulty"
},
"customConfigs": [],
"expanded": true
}
]
}