-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDialog.cs
114 lines (107 loc) · 2.47 KB
/
Dialog.cs
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
public abstract class Dialog
{
public Command left;
public Command center;
public Command right;
private int lenCaption;
public virtual void paint(mGraphics g)
{
g.translate(-g.getTranslateX(), -g.getTranslateY());
g.setClip(0, 0, GameCanvas.w, GameCanvas.h);
GameCanvas.paintz.paintCmdBar(g, left, center, right);
}
public virtual void keyPress(int keyCode)
{
switch (keyCode)
{
case -38:
case -1:
GameCanvas.keyHold[2] = true;
GameCanvas.keyPressedz[2] = true;
break;
case -39:
case -2:
GameCanvas.keyHold[8] = true;
GameCanvas.keyPressedz[8] = true;
break;
case -21:
case -6:
GameCanvas.keyHold[12] = true;
GameCanvas.keyPressedz[12] = true;
break;
case -22:
case -7:
GameCanvas.keyHold[13] = true;
GameCanvas.keyPressedz[13] = true;
break;
case -5:
case 10:
GameCanvas.keyHold[5] = true;
GameCanvas.keyPressedz[5] = true;
break;
case 119:
GameCanvas.keyHold[16] = true;
GameCanvas.keyPressedz[16] = true;
break;
case 115:
GameCanvas.keyHold[17] = true;
GameCanvas.keyPressedz[17] = true;
break;
case 97:
GameCanvas.keyHold[18] = true;
GameCanvas.keyPressedz[18] = true;
break;
case 100:
GameCanvas.keyHold[19] = true;
GameCanvas.keyPressedz[19] = true;
break;
}
}
public virtual void update()
{
if (center != null && (GameCanvas.keyPressedz[5] || mScreen.getCmdPointerLast(center)))
{
GameCanvas.keyPressedz[5] = false;
GameCanvas.isPointerClick = false;
mScreen.keyTouch = -1;
GameCanvas.isPointerJustRelease = false;
if (center != null)
{
center.performAction();
}
mScreen.keyTouch = -1;
Sound.play(Sound.MBClick, 0.5f);
}
if (left != null && (GameCanvas.keyPressedz[12] || mScreen.getCmdPointerLast(left)))
{
GameCanvas.keyPressedz[12] = false;
GameCanvas.isPointerClick = false;
mScreen.keyTouch = -1;
GameCanvas.isPointerJustRelease = false;
if (left != null)
{
left.performAction();
}
mScreen.keyTouch = -1;
Sound.play(Sound.MBClick, 0.5f);
}
if (right != null && (GameCanvas.keyPressedz[13] || mScreen.getCmdPointerLast(right)))
{
GameCanvas.keyPressedz[13] = false;
GameCanvas.isPointerClick = false;
GameCanvas.isPointerJustRelease = false;
mScreen.keyTouch = -1;
if (right != null)
{
right.performAction();
}
mScreen.keyTouch = -1;
Sound.play(Sound.MBClick, 0.5f);
}
GameCanvas.clearKeyPressed();
GameCanvas.clearKeyHold();
}
public virtual void show()
{
}
}