-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUI.js
65 lines (61 loc) · 1.68 KB
/
UI.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
/*
* UI.js -- deal with user interface
*
* Codes from Jack Works([email protected])
* And idea is from Scott Shen([email protected])
*
* Vola Studio 2014.
*
* most of ui event based on event.js
*/
/* Points update */
Event.on("points changed", function (e) {
var now = Math.round(e.now);
var type = e.type;// add minus* clear
var value = e.value;//changed value
e.type != "clear" && dom.game.tile.score.html(now);
if (type == "add" && value >= 1.5) {
gameBoardTileTips("Critical!");
}
});
Event.on("points new high", function(v){
});
/* Game Start & Over */
dom.game.tile.start.click(function (){
ani();
});
Event.on("result lose",function (){
gameBoardTileTips("Game over");
});
/* Menu activity */
function menuAnimation() {
var list = [dom.menu.about.get(0), dom.menu.inf.get(0), dom.menu.classic.get(0), dom.menu.settings.get(0)];
var thisIndex = list.indexOf(this);
var css = [[2, 1, 0, 0], [1, 2, 1, 0], [0, 1, 2, 1], [0, 0, 1, 2]][thisIndex];
function SUB_setClass(d, n) {
d.className = "menu " + ["","dis1","active"][n];
}
for (var i in list) {
SUB_setClass(list[i], css[i]);
}
}
$(".menu").mouseover(menuAnimation);
dom.menu.about.click(function () {
$(".stage").hide();
$(".game_stage_about").show();
});
dom.menu.inf.click(function () {
$(".stage").hide();
$(".game_stage_gaming").show();
});
$(".backToMenu").click(function () {
$(".stage").hide();
$(".game_stage_menu").show();
});
function gameBoardTileTips(text) {
$(".game_board_tile.tips").html(text)
.animate({ "zoom": 1.25 },250)
.animate({ "zoom": 1 }, 250, function () {
this.innerHTML = 'In'
});
}