Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
苍蓝
ygopro
Commits
bddef3d5
Commit
bddef3d5
authored
Jul 23, 2017
by
mercury233
Committed by
GitHub
Jul 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ready button (#2021)
parent
2165f36f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
18 deletions
+78
-18
gframe/duelclient.cpp
gframe/duelclient.cpp
+35
-0
gframe/game.cpp
gframe/game.cpp
+4
-1
gframe/game.h
gframe/game.h
+4
-0
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+31
-16
gframe/single_duel.cpp
gframe/single_duel.cpp
+1
-0
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+1
-1
strings.conf
strings.conf
+2
-0
No files found.
gframe/duelclient.cpp
View file @
bddef3d5
...
...
@@ -360,6 +360,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
}
for
(
int
i
=
0
;
i
<
4
;
++
i
)
mainGame
->
chkHostPrepReady
[
i
]
->
setChecked
(
false
);
mainGame
->
btnHostPrepReady
->
setVisible
(
true
);
mainGame
->
btnHostPrepNotReady
->
setVisible
(
false
);
mainGame
->
dInfo
.
time_limit
=
pkt
->
info
.
time_limit
;
mainGame
->
dInfo
.
time_left
[
0
]
=
0
;
mainGame
->
dInfo
.
time_left
[
1
]
=
0
;
...
...
@@ -412,9 +414,18 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
chkHostPrepReady
[
selftype
]
->
setChecked
(
false
);
mainGame
->
btnHostPrepDuelist
->
setEnabled
(
false
);
mainGame
->
btnHostPrepOB
->
setEnabled
(
true
);
mainGame
->
btnHostPrepReady
->
setVisible
(
true
);
mainGame
->
btnHostPrepNotReady
->
setVisible
(
false
);
}
else
{
mainGame
->
btnHostPrepDuelist
->
setEnabled
(
true
);
mainGame
->
btnHostPrepOB
->
setEnabled
(
false
);
mainGame
->
btnHostPrepReady
->
setVisible
(
false
);
mainGame
->
btnHostPrepNotReady
->
setVisible
(
false
);
}
if
(
mainGame
->
chkHostPrepReady
[
0
]
->
isChecked
()
&&
mainGame
->
chkHostPrepReady
[
1
]
->
isChecked
())
{
mainGame
->
btnHostPrepStart
->
setEnabled
(
true
);
}
else
{
mainGame
->
btnHostPrepStart
->
setEnabled
(
false
);
}
}
else
{
if
(
selftype
<
4
)
{
...
...
@@ -436,8 +447,18 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
if
(
selftype
<
4
)
{
mainGame
->
chkHostPrepReady
[
selftype
]
->
setEnabled
(
true
);
mainGame
->
btnHostPrepOB
->
setEnabled
(
true
);
mainGame
->
btnHostPrepReady
->
setVisible
(
true
);
mainGame
->
btnHostPrepNotReady
->
setVisible
(
false
);
}
else
{
mainGame
->
btnHostPrepOB
->
setEnabled
(
false
);
mainGame
->
btnHostPrepReady
->
setVisible
(
false
);
mainGame
->
btnHostPrepNotReady
->
setVisible
(
false
);
}
if
(
mainGame
->
chkHostPrepReady
[
0
]
->
isChecked
()
&&
mainGame
->
chkHostPrepReady
[
1
]
->
isChecked
()
&&
mainGame
->
chkHostPrepReady
[
2
]
->
isChecked
()
&&
mainGame
->
chkHostPrepReady
[
3
]
->
isChecked
())
{
mainGame
->
btnHostPrepStart
->
setEnabled
(
true
);
}
else
{
mainGame
->
btnHostPrepStart
->
setEnabled
(
false
);
}
}
mainGame
->
dInfo
.
player_type
=
selftype
;
...
...
@@ -675,8 +696,16 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
BufferIO
::
CopyWStr
(
prename
,
mainGame
->
dInfo
.
clientname_tag
,
20
);
}
else
if
(
state
==
PLAYERCHANGE_READY
)
{
mainGame
->
chkHostPrepReady
[
pos
]
->
setChecked
(
true
);
if
(
pos
==
selftype
)
{
mainGame
->
btnHostPrepReady
->
setVisible
(
false
);
mainGame
->
btnHostPrepNotReady
->
setVisible
(
true
);
}
}
else
if
(
state
==
PLAYERCHANGE_NOTREADY
)
{
mainGame
->
chkHostPrepReady
[
pos
]
->
setChecked
(
false
);
if
(
pos
==
selftype
)
{
mainGame
->
btnHostPrepReady
->
setVisible
(
true
);
mainGame
->
btnHostPrepNotReady
->
setVisible
(
false
);
}
}
else
if
(
state
==
PLAYERCHANGE_LEAVE
)
{
mainGame
->
stHostPrepDuelist
[
pos
]
->
setText
(
L""
);
mainGame
->
chkHostPrepReady
[
pos
]
->
setChecked
(
false
);
...
...
@@ -688,6 +717,12 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
chkHostPrepReady
[
pos
]
->
setChecked
(
false
);
mainGame
->
stHostPrepOB
->
setText
(
watchbuf
);
}
if
(
mainGame
->
chkHostPrepReady
[
0
]
->
isChecked
()
&&
mainGame
->
chkHostPrepReady
[
1
]
->
isChecked
()
&&
(
!
mainGame
->
dInfo
.
isTag
||
(
mainGame
->
chkHostPrepReady
[
2
]
->
isChecked
()
&&
mainGame
->
chkHostPrepReady
[
3
]
->
isChecked
())))
{
mainGame
->
btnHostPrepStart
->
setEnabled
(
true
);
}
else
{
mainGame
->
btnHostPrepStart
->
setEnabled
(
false
);
}
mainGame
->
gMutex
.
Unlock
();
break
;
}
...
...
gframe/game.cpp
View file @
bddef3d5
...
...
@@ -191,8 +191,11 @@ bool Game::Initialize() {
env
->
addStaticText
(
dataManager
.
GetSysString
(
1254
),
rect
<
s32
>
(
10
,
235
,
110
,
255
),
false
,
false
,
wHostPrepare
);
cbDeckSelect
=
env
->
addComboBox
(
rect
<
s32
>
(
120
,
230
,
270
,
255
),
wHostPrepare
);
cbDeckSelect
->
setMaxSelectionRows
(
10
);
btnHostPrepReady
=
env
->
addButton
(
rect
<
s32
>
(
170
,
180
,
270
,
205
),
wHostPrepare
,
BUTTON_HP_READY
,
dataManager
.
GetSysString
(
1218
));
btnHostPrepNotReady
=
env
->
addButton
(
rect
<
s32
>
(
170
,
180
,
270
,
205
),
wHostPrepare
,
BUTTON_HP_NOTREADY
,
dataManager
.
GetSysString
(
1219
));
btnHostPrepNotReady
->
setVisible
(
false
);
btnHostPrepStart
=
env
->
addButton
(
rect
<
s32
>
(
230
,
280
,
340
,
305
),
wHostPrepare
,
BUTTON_HP_START
,
dataManager
.
GetSysString
(
1215
));
btnHostPrepCancel
=
env
->
addButton
(
rect
<
s32
>
(
350
,
280
,
460
,
305
),
wHostPrepare
,
BUTTON_HP_CANCEL
,
dataManager
.
GetSysString
(
121
2
));
btnHostPrepCancel
=
env
->
addButton
(
rect
<
s32
>
(
350
,
280
,
460
,
305
),
wHostPrepare
,
BUTTON_HP_CANCEL
,
dataManager
.
GetSysString
(
121
0
));
//img
wCardImg
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
1
,
1
,
199
,
273
),
true
,
false
,
0
,
-
1
,
true
);
wCardImg
->
setBackgroundColor
(
0xc0c0c0c0
);
...
...
gframe/game.h
View file @
bddef3d5
...
...
@@ -262,6 +262,8 @@ public:
irr
::
gui
::
IGUIComboBox
*
cbDeckSelect
;
irr
::
gui
::
IGUIStaticText
*
stHostPrepRule
;
irr
::
gui
::
IGUIStaticText
*
stHostPrepOB
;
irr
::
gui
::
IGUIButton
*
btnHostPrepReady
;
irr
::
gui
::
IGUIButton
*
btnHostPrepNotReady
;
irr
::
gui
::
IGUIButton
*
btnHostPrepStart
;
irr
::
gui
::
IGUIButton
*
btnHostPrepCancel
;
//replay
...
...
@@ -462,6 +464,8 @@ extern Game* mainGame;
#define BUTTON_HP_CANCEL 123
#define BUTTON_HP_KICK 124
#define CHECKBOX_HP_READY 125
#define BUTTON_HP_READY 126
#define BUTTON_HP_NOTREADY 127
#define LISTBOX_REPLAY_LIST 130
#define BUTTON_LOAD_REPLAY 131
#define BUTTON_CANCEL_REPLAY 132
...
...
gframe/menu_handler.cpp
View file @
bddef3d5
...
...
@@ -10,6 +10,21 @@
namespace
ygo
{
void
UpdateDeck
()
{
BufferIO
::
CopyWStr
(
mainGame
->
cbDeckSelect
->
getItem
(
mainGame
->
cbDeckSelect
->
getSelected
()),
mainGame
->
gameConf
.
lastdeck
,
64
);
char
deckbuf
[
1024
];
char
*
pdeck
=
deckbuf
;
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
main
.
size
();
++
i
)
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
[
i
]
->
first
);
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
extra
.
size
();
++
i
)
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
extra
[
i
]
->
first
);
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
side
.
size
();
++
i
)
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
side
[
i
]
->
first
);
DuelClient
::
SendBufferToServer
(
CTOS_UPDATE_DECK
,
deckbuf
,
pdeck
-
deckbuf
);
}
bool
MenuHandler
::
OnEvent
(
const
irr
::
SEvent
&
event
)
{
switch
(
event
.
EventType
)
{
case
irr
:
:
EET_GUI_EVENT
:
{
...
...
@@ -128,10 +143,22 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
DuelClient
::
SendPacketToServer
(
CTOS_HS_KICK
,
csk
);
break
;
}
case
BUTTON_HP_
START
:
{
if
(
!
mainGame
->
chkHostPrepReady
[
0
]
->
isChecked
()
||
!
mainGame
->
chkHostPrepReady
[
1
]
->
isChecked
())
case
BUTTON_HP_
READY
:
{
if
(
mainGame
->
cbDeckSelect
->
getSelected
()
==
-
1
||
!
deckManager
.
LoadDeck
(
mainGame
->
cbDeckSelect
->
getItem
(
mainGame
->
cbDeckSelect
->
getSelected
())))
{
break
;
}
UpdateDeck
();
DuelClient
::
SendPacketToServer
(
CTOS_HS_READY
);
mainGame
->
cbDeckSelect
->
setEnabled
(
false
);
break
;
}
case
BUTTON_HP_NOTREADY
:
{
DuelClient
::
SendPacketToServer
(
CTOS_HS_NOTREADY
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
break
;
}
case
BUTTON_HP_START
:
{
DuelClient
::
SendPacketToServer
(
CTOS_HS_START
);
break
;
}
...
...
@@ -308,19 +335,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
static_cast
<
irr
::
gui
::
IGUICheckBox
*>
(
caller
)
->
setChecked
(
false
);
break
;
}
BufferIO
::
CopyWStr
(
mainGame
->
cbDeckSelect
->
getItem
(
mainGame
->
cbDeckSelect
->
getSelected
()),
mainGame
->
gameConf
.
lastdeck
,
64
);
char
deckbuf
[
1024
];
char
*
pdeck
=
deckbuf
;
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
main
.
size
();
++
i
)
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
[
i
]
->
first
);
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
extra
.
size
();
++
i
)
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
extra
[
i
]
->
first
);
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
side
.
size
();
++
i
)
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
side
[
i
]
->
first
);
DuelClient
::
SendBufferToServer
(
CTOS_UPDATE_DECK
,
deckbuf
,
pdeck
-
deckbuf
);
UpdateDeck
();
DuelClient
::
SendPacketToServer
(
CTOS_HS_READY
);
mainGame
->
cbDeckSelect
->
setEnabled
(
false
);
}
else
{
...
...
gframe/single_duel.cpp
View file @
bddef3d5
...
...
@@ -269,6 +269,7 @@ void SingleDuel::PlayerReady(DuelPlayer* dp, bool is_ready) {
ready
[
dp
->
type
]
=
is_ready
;
STOC_HS_PlayerChange
scpc
;
scpc
.
status
=
(
dp
->
type
<<
4
)
|
(
is_ready
?
PLAYERCHANGE_READY
:
PLAYERCHANGE_NOTREADY
);
NetServer
::
SendPacketToPlayer
(
players
[
dp
->
type
],
STOC_HS_PLAYER_CHANGE
,
scpc
);
if
(
players
[
1
-
dp
->
type
])
NetServer
::
SendPacketToPlayer
(
players
[
1
-
dp
->
type
],
STOC_HS_PLAYER_CHANGE
,
scpc
);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
...
...
gframe/tag_duel.cpp
View file @
bddef3d5
...
...
@@ -240,7 +240,7 @@ void TagDuel::PlayerReady(DuelPlayer* dp, bool is_ready) {
STOC_HS_PlayerChange
scpc
;
scpc
.
status
=
(
dp
->
type
<<
4
)
|
(
is_ready
?
PLAYERCHANGE_READY
:
PLAYERCHANGE_NOTREADY
);
for
(
int
i
=
0
;
i
<
4
;
++
i
)
if
(
players
[
i
]
&&
players
[
i
]
!=
dp
)
if
(
players
[
i
])
NetServer
::
SendPacketToPlayer
(
players
[
i
],
STOC_HS_PLAYER_CHANGE
,
scpc
);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
SendPacketToPlayer
(
*
pit
,
STOC_HS_PLAYER_CHANGE
,
scpc
);
...
...
strings.conf
View file @
bddef3d5
...
...
@@ -249,6 +249,8 @@
!
system
1215
开始
!
system
1216
消息
!
system
1217
刷新主机
!
system
1218
准备
!
system
1219
取消准备
!
system
1220
昵称:
!
system
1221
主机信息:
!
system
1222
主机密码:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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