-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClanMessage.cs
More file actions
119 lines (102 loc) · 2.43 KB
/
ClanMessage.cs
File metadata and controls
119 lines (102 loc) · 2.43 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
public class ClanMessage : IActionListener
{
public int id;
public int type;
public int playerId;
public string playerName;
public long time;
public int headId;
public string[] chat;
public sbyte color;
public sbyte role;
private int timeAgo;
public int recieve;
public int maxCap;
public string[] option;
public static MyVector vMessage = new MyVector();
public static void addMessage(ClanMessage cm, int index, bool upToTop)
{
for (int i = 0; i < vMessage.size(); i++)
{
ClanMessage clanMessage = (ClanMessage)vMessage.elementAt(i);
if (clanMessage.id == cm.id)
{
vMessage.removeElement(clanMessage);
if (!upToTop)
{
vMessage.insertElementAt(cm, i);
}
else
{
vMessage.insertElementAt(cm, 0);
}
return;
}
if (clanMessage.maxCap != 0 && clanMessage.recieve == clanMessage.maxCap)
{
vMessage.removeElement(clanMessage);
}
}
if (index == -1)
{
vMessage.addElement(cm);
}
else
{
vMessage.insertElementAt(cm, 0);
}
if (vMessage.size() > 20)
{
vMessage.removeElementAt(vMessage.size() - 1);
}
}
public void paint(mGraphics g, int x, int y)
{
mFont mFont2 = mFont.tahoma_7b_dark;
if (role == 0)
{
mFont2 = mFont.tahoma_7b_red;
}
else if (role == 1)
{
mFont2 = mFont.tahoma_7b_green;
}
else if (role == 2)
{
mFont2 = mFont.tahoma_7b_green2;
}
if (type == 0)
{
mFont2.drawString(g, playerName, x + 3, y + 1, 0);
if (color == 0)
{
mFont.tahoma_7_grey.drawString(g, chat[0] + ((chat.Length <= 1) ? string.Empty : "..."), x + 3, y + 11, 0);
}
else
{
mFont.tahoma_7_red.drawString(g, chat[0] + ((chat.Length <= 1) ? string.Empty : "..."), x + 3, y + 11, 0);
}
mFont.tahoma_7_grey.drawString(g, NinjaUtil.getTimeAgo(timeAgo) + " " + mResources.ago, x + GameCanvas.panel.wScroll - 3, y + 1, mFont.RIGHT);
}
if (type == 1)
{
mFont2.drawString(g, playerName + " (" + recieve + "/" + maxCap + ")", x + 3, y + 1, 0);
mFont.tahoma_7_blue.drawString(g, mResources.request_pea + " " + NinjaUtil.getTimeAgo(timeAgo) + " " + mResources.ago, x + 3, y + 11, 0);
}
if (type == 2)
{
mFont2.drawString(g, playerName, x + 3, y + 1, 0);
mFont.tahoma_7_blue.drawString(g, mResources.request_join_clan, x + 3, y + 11, 0);
}
}
public void perform(int idAction, object p)
{
}
public void update()
{
if (time != 0)
{
timeAgo = (int)(mSystem.currentTimeMillis() / 1000 - time);
}
}
}