Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
05f63bb6
Commit
05f63bb6
authored
Aug 19, 2009
by
Max-Wilhelm Bruker
Browse files
phases + small message log fix
parent
5f110af5
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/game.cpp
View file @
05f63bb6
...
...
@@ -14,7 +14,7 @@
#include
"counter.h"
Game
::
Game
(
CardDatabase
*
_db
,
Client
*
_client
,
QGraphicsScene
*
_scene
,
QMenu
*
_actionsMenu
,
QMenu
*
_cardMenu
,
int
playerId
,
const
QString
&
playerName
,
QObject
*
parent
)
:
QObject
(
parent
),
actionsMenu
(
_actionsMenu
),
cardMenu
(
_cardMenu
),
db
(
_db
),
client
(
_client
),
scene
(
_scene
),
started
(
false
)
:
QObject
(
parent
),
actionsMenu
(
_actionsMenu
),
cardMenu
(
_cardMenu
),
db
(
_db
),
client
(
_client
),
scene
(
_scene
),
started
(
false
)
,
currentPhase
(
-
1
)
{
QRectF
sr
=
scene
->
sceneRect
();
localPlayer
=
addPlayer
(
playerId
,
playerName
,
QPointF
(
0
,
sr
.
y
()
+
sr
.
height
()
/
2
+
2
),
true
);
...
...
@@ -53,6 +53,16 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a
aCreateToken
->
setShortcut
(
tr
(
"Ctrl+T"
));
connect
(
aCreateToken
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actCreateToken
()));
aNextPhase
=
new
QAction
(
tr
(
"Next &phase"
),
this
);
aNextPhase
->
setShortcut
(
tr
(
"Ctrl+Space"
));
connect
(
aNextPhase
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actNextPhase
()));
aNextTurn
=
new
QAction
(
tr
(
"Next &turn"
),
this
);
aNextTurn
->
setShortcut
(
tr
(
"Ctrl+Enter"
));
connect
(
aNextTurn
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actNextTurn
()));
actionsMenu
->
addAction
(
aNextPhase
);
actionsMenu
->
addAction
(
aNextTurn
);
actionsMenu
->
addSeparator
();
actionsMenu
->
addAction
(
aUntapAll
);
actionsMenu
->
addSeparator
();
actionsMenu
->
addAction
(
aDecLife
);
...
...
@@ -240,6 +250,7 @@ void Game::gameEvent(const ServerEventData &msg)
case
eventSetActivePhase
:
{
QStringList
data
=
msg
.
getEventData
();
int
phase
=
data
[
0
].
toInt
();
currentPhase
=
phase
;
emit
setActivePhase
(
phase
);
break
;
}
...
...
@@ -284,6 +295,19 @@ void Game::gameEvent(const ServerEventData &msg)
}
}
void
Game
::
actNextPhase
()
{
int
phase
=
currentPhase
;
if
(
++
phase
>=
phaseCount
)
phase
=
0
;
client
->
setActivePhase
(
phase
);
}
void
Game
::
actNextTurn
()
{
client
->
nextTurn
();
}
void
Game
::
actUntapAll
()
{
client
->
setCardAttr
(
"table"
,
-
1
,
"tapped"
,
"false"
);
...
...
cockatrice/src/game.h
View file @
05f63bb6
...
...
@@ -15,9 +15,11 @@ class CardItem;
class
Game
:
public
QObject
{
Q_OBJECT
private:
static
const
int
phaseCount
=
11
;
QMenu
*
actionsMenu
,
*
sayMenu
,
*
cardMenu
;
QAction
*
aTap
,
*
aUntap
,
*
aDoesntUntap
,
*
aFlip
,
*
aAddCounter
,
*
aRemoveCounter
,
*
aSetCounters
,
*
aUntapAll
,
*
aDecLife
,
*
aIncLife
,
*
aSetLife
,
*
aShuffle
,
*
aDraw
,
*
aDrawCards
,
*
aRollDice
,
*
aCreateToken
;
*
aNextPhase
,
*
aNextTurn
,
*
aUntapAll
,
*
aDecLife
,
*
aIncLife
,
*
aSetLife
,
*
aShuffle
,
*
aDraw
,
*
aDrawCards
,
*
aRollDice
,
*
aCreateToken
;
DlgStartGame
*
dlgStartGame
;
CardDatabase
*
db
;
...
...
@@ -26,9 +28,12 @@ private:
PlayerList
players
;
Player
*
localPlayer
;
bool
started
;
int
currentPhase
;
Player
*
addPlayer
(
int
playerId
,
const
QString
&
playerName
,
QPointF
base
,
bool
local
);
void
initSayMenu
();
private
slots
:
void
actNextPhase
();
void
actNextTurn
();
void
actUntapAll
();
void
actIncLife
();
void
actDecLife
();
...
...
cockatrice/src/messagelogwidget.cpp
View file @
05f63bb6
...
...
@@ -97,9 +97,6 @@ void MessageLogWidget::logDraw(Player *player, int number)
void
MessageLogWidget
::
logMoveCard
(
Player
*
player
,
QString
cardName
,
CardZone
*
startZone
,
int
oldX
,
CardZone
*
targetZone
,
int
newX
)
{
if
(
cardName
.
isEmpty
())
cardName
=
tr
(
"a card"
);
QString
startName
=
startZone
->
getName
();
QString
targetName
=
targetZone
->
getName
();
if
(((
startName
==
"table"
)
&&
(
targetName
==
"table"
))
||
((
startName
==
"hand"
)
&&
(
targetName
==
"hand"
)))
...
...
@@ -144,7 +141,7 @@ void MessageLogWidget::logMoveCard(Player *player, QString cardName, CardZone *s
}
else
if
(
targetName
==
"sb"
)
finalStr
=
tr
(
"%1 moves %2 %3 to sideboard"
);
append
(
finalStr
.
arg
(
sanitizeHtml
(
player
->
getName
())).
arg
(
QString
(
"<font color=
\"
blue
\"
>%1</font>"
).
arg
(
sanitizeHtml
(
cardName
))).
arg
(
fromStr
).
arg
(
newX
));
append
(
finalStr
.
arg
(
sanitizeHtml
(
player
->
getName
())).
arg
(
cardName
.
isEmpty
()
?
tr
(
"a card"
)
:
QString
(
"<font color=
\"
blue
\"
>%1</font>"
).
arg
(
sanitizeHtml
(
cardName
))).
arg
(
fromStr
).
arg
(
newX
));
}
void
MessageLogWidget
::
logCreateToken
(
Player
*
player
,
QString
cardName
)
...
...
cockatrice/src/phasestoolbar.cpp
View file @
05f63bb6
...
...
@@ -7,7 +7,7 @@
PhaseButton
::
PhaseButton
(
QIcon
icon
)
:
QPushButton
(
icon
,
QString
()),
active
(
false
)
{
setFixedSize
(
50
,
50
);
}
void
PhaseButton
::
update
()
...
...
@@ -23,18 +23,16 @@ void PhaseButton::paintEvent(QPaintEvent *event)
int
height
=
size
().
height
();
int
width
=
size
().
width
();
QPen
pen
;
pen
.
setColor
(
QColor
::
fromRgb
(
180
,
0
,
0
,
200
));
painter
.
setPen
(
pen
);
painter
.
setPen
(
QPen
(
Qt
::
transparent
));
QRadialGradient
grad
(
QPointF
(
0.5
,
0.5
),
0.5
);
grad
.
setCoordinateMode
(
QGradient
::
ObjectBoundingMode
);
grad
.
setColorAt
(
0
,
QColor
(
180
,
0
,
0
,
0
));
grad
.
setColorAt
(
0.8
,
QColor
(
180
,
0
,
0
,
0
));
grad
.
setColorAt
(
1
,
QColor
(
180
,
0
,
0
,
2
00
));
grad
.
setColorAt
(
1
,
QColor
(
180
,
0
,
0
,
2
55
));
painter
.
setBrush
(
QBrush
(
grad
));
painter
.
drawRect
(
3
,
3
,
width
-
7
,
height
-
7
);
painter
.
drawRect
(
2
,
2
,
width
-
4
,
height
-
4
);
}
}
...
...
@@ -70,6 +68,7 @@ PhasesToolbar::PhasesToolbar(QWidget *parent)
QPushButton
*
nextTurnButton
=
new
QPushButton
(
QIcon
(
":/resources/icon_nextturn.svg"
),
QString
());
nextTurnButton
->
setIconSize
(
QSize
(
36
,
36
));
nextTurnButton
->
setFixedSize
(
50
,
50
);
connect
(
nextTurnButton
,
SIGNAL
(
clicked
()),
this
,
SIGNAL
(
signalNextTurn
()));
QVBoxLayout
*
layout
=
new
QVBoxLayout
;
...
...
cockatrice/translations/cockatrice_de.ts
View file @
05f63bb6
This diff is collapsed.
Click to expand it.
cockatrice/translations/cockatrice_en.ts
View file @
05f63bb6
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment