author | koda |
Sun, 07 Nov 2010 20:27:05 +0100 | |
changeset 4197 | dad127904958 |
parent 4192 | 67e1a683e9b3 |
child 4217 | 721bfa5f4f31 |
permissions | -rw-r--r-- |
1621 | 1 |
/* |
2 |
* Hedgewars, a free turn based strategy game |
|
3236
4ab3917d7d44
Update (c) lines to 2010 as unc0rr requested - they all had varying values so I just took the first year mentioned, then tacked on -2010
nemo
parents:
2948
diff
changeset
|
3 |
* Copyright (c) 2010 Andrey Korotaev <unC0Rr@gmail.com> |
1621 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#include <QLabel> |
|
20 |
#include <QGridLayout> |
|
1625 | 21 |
#include <QGraphicsScene> |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
22 |
#include <QGroupBox> |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
23 |
#include <QSizePolicy> |
1621 | 24 |
#include "statsPage.h" |
3381 | 25 |
#include "team.h" |
1621 | 26 |
|
1636 | 27 |
FitGraphicsView::FitGraphicsView(QWidget* parent) : QGraphicsView(parent) |
28 |
{ |
|
29 |
||
30 |
} |
|
31 |
||
32 |
void FitGraphicsView::resizeEvent(QResizeEvent * event) |
|
33 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
34 |
fitInView(sceneRect()); |
1636 | 35 |
} |
36 |
||
1621 | 37 |
PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent) |
38 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
39 |
QGridLayout * pageLayout = new QGridLayout(this); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
40 |
pageLayout->setSpacing(20); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
41 |
pageLayout->setColumnStretch(0, 1); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
42 |
pageLayout->setColumnStretch(1, 1); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
43 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
44 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
45 |
BtnBack->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1621 | 46 |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
47 |
QGroupBox * gb = new QGroupBox(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
48 |
QVBoxLayout * gbl = new QVBoxLayout; |
1621 | 49 |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
50 |
// details |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
51 |
labelGameStats = new QLabel(this); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
52 |
QLabel * l = new QLabel(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
53 |
l->setTextFormat(Qt::RichText); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
54 |
l->setText("<h1><img src=\":/res/StatsD.png\"> " + PageGameStats::tr("Details") + "</h1>"); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
55 |
l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
56 |
labelGameStats->setTextFormat(Qt::RichText); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
57 |
labelGameStats->setAlignment(Qt::AlignTop); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
58 |
gbl->addWidget(l); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
59 |
gbl->addWidget(labelGameStats); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
60 |
gb->setLayout(gbl); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
61 |
pageLayout->addWidget(gb, 1, 1); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
62 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
63 |
// graph |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
64 |
graphic = new FitGraphicsView(gb); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
65 |
l = new QLabel(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
66 |
l->setTextFormat(Qt::RichText); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
67 |
l->setText("<br><h1><img src=\":/res/StatsH.png\"> " + PageGameStats::tr("Health graph") + "</h1>"); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
68 |
l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
69 |
gbl->addWidget(l); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
70 |
gbl->addWidget(graphic); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
71 |
graphic->scale(1.0, -1.0); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
72 |
graphic->setBackgroundBrush(QBrush(Qt::black)); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
73 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
74 |
labelGameWin = new QLabel(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
75 |
labelGameWin->setTextFormat(Qt::RichText); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
76 |
pageLayout->addWidget(labelGameWin, 0, 0, 1, 2); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
77 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
78 |
// ranking box |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
79 |
gb = new QGroupBox(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
80 |
gbl = new QVBoxLayout; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
81 |
labelGameRank = new QLabel(gb); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
82 |
l = new QLabel(this); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
83 |
l->setTextFormat(Qt::RichText); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
84 |
l->setText("<h1><img src=\":/res/StatsR.png\"> " + PageGameStats::tr("Ranking") + "</h1>"); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
85 |
l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
86 |
gbl->addWidget(l); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
87 |
gbl->addWidget(labelGameRank); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
88 |
gb->setLayout(gbl); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
89 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
90 |
labelGameRank->setTextFormat(Qt::RichText); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
91 |
labelGameRank->setAlignment(Qt::AlignTop); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
92 |
pageLayout->addWidget(gb, 1, 0); |
1621 | 93 |
} |
1622 | 94 |
|
95 |
void PageGameStats::AddStatText(const QString & msg) |
|
96 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
97 |
labelGameStats->setText(labelGameStats->text() + msg); |
1622 | 98 |
} |
99 |
||
100 |
void PageGameStats::clear() |
|
101 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
102 |
labelGameStats->setText(""); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
103 |
healthPoints.clear(); |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
104 |
labelGameRank->setText(""); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
105 |
playerPosition = 0; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
106 |
lastColor = 0; |
1625 | 107 |
} |
108 |
||
109 |
void PageGameStats::renderStats() |
|
110 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
111 |
QGraphicsScene * scene = new QGraphicsScene(); |
1625 | 112 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
113 |
QMap<quint32, QVector<quint32> >::const_iterator i = healthPoints.constBegin(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
114 |
while (i != healthPoints.constEnd()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
115 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
116 |
quint32 c = i.key(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
117 |
QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
118 |
QVector<quint32> hps = i.value(); |
1625 | 119 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
120 |
QPainterPath path; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
121 |
if (hps.size()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
122 |
path.moveTo(0, hps[0]); |
2377 | 123 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
124 |
for(int t = 1; t < hps.size(); ++t) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
125 |
path.lineTo(t, hps[t]); |
1625 | 126 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
127 |
scene->addPath(path, QPen(c)); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
128 |
++i; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
129 |
} |
1625 | 130 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
131 |
graphic->setScene(scene); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
132 |
graphic->fitInView(graphic->sceneRect()); |
1622 | 133 |
} |
134 |
||
135 |
void PageGameStats::GameStats(char type, const QString & info) |
|
136 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
137 |
switch(type) { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
138 |
case 'r' : { |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
139 |
labelGameWin->setText(QString("<h1 align=\"center\">%1</h1>").arg(info)); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
140 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
141 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
142 |
case 'D' : { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
143 |
int i = info.indexOf(' '); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
144 |
QString message = "<p><img src=\":/res/StatsBestShot.png\"> " + PageGameStats::tr("The best shot award was won by <b>%1</b> with <b>%2</b> pts.").arg(info.mid(i + 1), info.left(i)) + "</p>"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
145 |
AddStatText(message); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
146 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
147 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
148 |
case 'k' : { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
149 |
int i = info.indexOf(' '); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
150 |
int num = info.left(i).toInt(); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
151 |
QString message = "<p><img src=\":/res/StatsBestKiller.png\"> " + PageGameStats::tr("The best killer is <b>%1</b> with <b>%2</b> kills in a turn.", "", num).arg(info.mid(i + 1), info.left(i)) + "</p>"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
152 |
AddStatText(message); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
153 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
154 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
155 |
case 'K' : { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
156 |
int num = info.toInt(); |
3815
8754f7874395
Frontend: improve statsPage (clean up translation strings)
TheXception
parents:
3788
diff
changeset
|
157 |
QString message = "<p><img src=\":/res/StatsHedgehogsKilled.png\"> " + PageGameStats::tr("A total of <b>%1</b> hedgehog(s) were killed during this round.", "", num).arg(num) + "</p>"; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
158 |
AddStatText(message); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
159 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
160 |
} |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
161 |
case 'H' : { |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
162 |
int i = info.indexOf(' '); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
163 |
quint32 clan = info.left(i).toInt(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
164 |
quint32 hp = info.mid(i + 1).toUInt(); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
165 |
healthPoints[clan].append(hp); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
166 |
break; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
167 |
} |
3381 | 168 |
case 'T': { // local team stats |
169 |
//AddStatText("<p>local team: " + info + "</p>"); |
|
170 |
QStringList infol = info.split(":"); |
|
171 |
HWTeam team(infol[0]); |
|
172 |
if(team.FileExists()) // do some better test to avoid influence from scripted/predefined teams? |
|
173 |
{ |
|
174 |
team.LoadFromFile(); |
|
175 |
team.Rounds++; |
|
176 |
if(infol[1].toInt() > 0) // might require some better test for winning condition (or changed flag) ... WIP! |
|
177 |
team.Wins++; // should draws count as wins? |
|
178 |
//team.SaveToFile(); // don't save yet |
|
179 |
} |
|
4176 | 180 |
break; |
181 |
} |
|
182 |
||
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
183 |
case 'P' : { |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
184 |
int i = info.indexOf(' '); |
4176 | 185 |
playerPosition++; |
186 |
QString color = info.left(i); |
|
187 |
quint32 c = color.toInt(); |
|
188 |
QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255)); |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
189 |
|
4176 | 190 |
QString playerinfo = info.mid(i + 1); |
191 |
||
192 |
i = playerinfo.indexOf(' '); |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
193 |
|
4176 | 194 |
int kills = playerinfo.left(i).toInt(); |
195 |
QString playername = playerinfo.mid(i + 1); |
|
196 |
QString image; |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
197 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
198 |
if (lastColor == c && playerPosition <= 2) playerPosition = 1; |
4176 | 199 |
lastColor = c; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
200 |
|
4176 | 201 |
switch (playerPosition) |
202 |
{ |
|
203 |
case 1: |
|
204 |
image = "<img src=\":/res/StatsMedal1.png\">"; |
|
205 |
break; |
|
206 |
case 2: |
|
207 |
image = "<img src=\":/res/StatsMedal2.png\">"; |
|
208 |
break; |
|
209 |
case 3: |
|
210 |
image = "<img src=\":/res/StatsMedal3.png\">"; |
|
211 |
break; |
|
212 |
default: |
|
213 |
image = "<img src=\":/res/StatsMedal4.png\">"; |
|
214 |
break; |
|
215 |
} |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
216 |
|
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
217 |
QString message; |
4176 | 218 |
QString killstring = PageGameStats::tr("(%1 kill)", "", kills).arg(kills); |
219 |
||
220 |
message = QString("<p><h2>%1 %2. <font color=\"%4\">%3</font> ").arg(image, QString::number(playerPosition), playername, clanColor.name()) + killstring + "</h2></p>"; |
|
221 |
||
222 |
labelGameRank->setText(labelGameRank->text() + message); |
|
223 |
break; |
|
224 |
} |
|
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
225 |
case 's' : { |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
226 |
int i = info.indexOf(' '); |
4177 | 227 |
int num = info.left(i).toInt(); |
4192 | 228 |
QString message = "<p><img src=\":/res/StatsMostSelfDamage.png\"> " + PageGameStats::tr("<b>%1</b> thought it's good to shoot his own hedgehogs with <b>%2</b> pts.", "", num).arg(info.mid(i + 1)).arg(num) + "</p>"; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
229 |
AddStatText(message); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
230 |
break; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
231 |
} |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
232 |
case 'S' : { |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
233 |
int i = info.indexOf(' '); |
4177 | 234 |
int num = info.left(i).toInt(); |
4192 | 235 |
QString message = "<p><img src=\":/res/StatsSelfKilled.png\"> " + PageGameStats::tr("<b>%1</b> killed <b>%2</b> of his own hedgehogs.", "", num).arg(info.mid(i + 1)).arg(num) + "</p>"; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
236 |
AddStatText(message); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
237 |
break; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
238 |
} |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
239 |
case 'B' : { |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
240 |
int i = info.indexOf(' '); |
4177 | 241 |
int num = info.left(i).toInt(); |
4192 | 242 |
QString message = "<p><img src=\":/res/StatsSkipped.png\"> " + PageGameStats::tr("<b>%1</b> was scared and skipped turn <b>%2</b> times.", "", num).arg(info.mid(i + 1)).arg(num) + "</p>"; |
3788
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
243 |
AddStatText(message); |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
244 |
break; |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
245 |
} |
9aa8a832e296
adds prettier after-game statistics page with more stats
TheXception
parents:
3381
diff
changeset
|
246 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2377
diff
changeset
|
247 |
} |
1622 | 248 |
} |