-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChooseCharScr.cs
More file actions
151 lines (137 loc) · 4.11 KB
/
ChooseCharScr.cs
File metadata and controls
151 lines (137 loc) · 4.11 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
using System;
public class ChooseCharScr : mScreen, IActionListener
{
public Command[] vc_players;
public static PlayerData[] playerData;
private int cf;
private int[] cx = new int[2]
{
GameCanvas.w / 2 - 100,
GameCanvas.w / 2 - 100
};
private int focus;
private int[] cy = new int[2];
private int[] rectPanel = new int[4]
{
GameCanvas.w / 2 - 150,
GameCanvas.h / 2 - 100,
300,
200
};
private int offsetY = -35;
private int offsetX = -35;
public override void switchToMe()
{
ServerListScreen.isWait = false;
Char.isLoadingMap = false;
LoginScr.isContinueToLogin = false;
ServerListScreen.waitToLogin = false;
GameScr.gI().initSelectChar();
base.switchToMe();
}
public override void update()
{
if (GameCanvas.gameTick % 10 > 2)
{
cf = 1;
}
else
{
cf = 0;
}
for (int i = 0; i < vc_players.Length; i++)
{
if (vc_players[i].isPointerPressInside())
{
vc_players[i].performAction();
}
}
for (int j = 0; j < cx.Length; j++)
{
if (GameCanvas.isPointerHoldIn(cx[j] + offsetX, cy[j] + offsetY, rectPanel[2], 60))
{
if (GameCanvas.isPointerDown)
{
focus = j;
break;
}
if (GameCanvas.isPointerJustRelease && !GameCanvas.isPointerClick)
{
}
}
}
base.update();
}
public override void paint(mGraphics g)
{
GameCanvas.paintBGGameScr(g);
try
{
PopUp.paintPopUp(g, rectPanel[0] - 10, rectPanel[1], rectPanel[2] + 20, rectPanel[3], 16777215, isButton: true);
if (vc_players != null)
{
for (int i = 0; i < vc_players.Length; i++)
{
vc_players[i].paint(g);
}
}
if (playerData != null)
{
for (int j = 0; j < playerData.Length; j++)
{
PopUp.paintPopUp(g, cx[j] - 20, cy[j] + offsetY, rectPanel[2], 60, 16777215, isButton: false);
Part part = GameScr.parts[playerData[j].head];
Part part2 = GameScr.parts[playerData[j].leg];
Part part3 = GameScr.parts[playerData[j].body];
SmallImage.drawSmallImage(g, part.pi[Char.CharInfo[cf][0][0]].id, cx[j] + Char.CharInfo[cf][0][1] + part.pi[Char.CharInfo[cf][0][0]].dx, cy[j] - Char.CharInfo[cf][0][2] + part.pi[Char.CharInfo[cf][0][0]].dy, 0, 0);
SmallImage.drawSmallImage(g, part2.pi[Char.CharInfo[cf][1][0]].id, cx[j] + Char.CharInfo[cf][1][1] + part2.pi[Char.CharInfo[cf][1][0]].dx, cy[j] - Char.CharInfo[cf][1][2] + part2.pi[Char.CharInfo[cf][1][0]].dy, 0, 0);
SmallImage.drawSmallImage(g, part3.pi[Char.CharInfo[cf][2][0]].id, cx[j] + Char.CharInfo[cf][2][1] + part3.pi[Char.CharInfo[cf][2][0]].dx, cy[j] - Char.CharInfo[cf][2][2] + part3.pi[Char.CharInfo[cf][2][0]].dy, 0, 0);
if (focus == j)
{
mFont.tahoma_7b_yellow.drawString(g, playerData[j].name, cx[j] + rectPanel[2] - 25, cy[j] + offsetY, 1);
mFont.tahoma_7b_yellow.drawString(g, mResources.power_point + " " + Res.formatNumber2(playerData[j].powpoint), cx[j] + rectPanel[2] - 25, cy[j] + offsetY + mFont.tahoma_7b_yellow.getHeight(), 1);
}
else
{
mFont.tahoma_7b_dark.drawString(g, playerData[j].name, cx[j] + rectPanel[2] - 25, cy[j] + offsetY, 1);
mFont.tahoma_7b_dark.drawString(g, mResources.power_point + " " + Res.formatNumber2(playerData[j].powpoint), cx[j] + rectPanel[2] - 25, cy[j] + offsetY + mFont.tahoma_7b_dark.getHeight(), 1);
}
}
}
}
catch (Exception ex)
{
Res.outz(ex.StackTrace);
}
base.paint(g);
}
internal void updateChooseCharacter(byte len)
{
cx = new int[len];
cy = new int[len];
for (int i = 0; i < len; i++)
{
cx[i] = rectPanel[0] + 20;
cy[i] = i * 70 + rectPanel[1] + 50;
}
vc_players = new Command[2];
vc_players[1] = new Command("Vào game", this, 1, null, rectPanel[0] + rectPanel[2] - 80 - 80, rectPanel[1] + rectPanel[3] - 30);
vc_players[0] = new Command("Trờ ra", this, 2, null, rectPanel[0] + rectPanel[2] - 80, rectPanel[1] + rectPanel[3] - 30);
}
public void perform(int idAction, object p)
{
switch (idAction)
{
case 1:
if (focus != -1)
{
GameCanvas.startWaitDlg();
Service.gI().finishUpdate(playerData[focus].playerID);
}
break;
case 2:
GameCanvas.instance.doResetToLoginScr(GameCanvas.serverScreen);
break;
}
}
}