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
REIKAI
ygopro
Commits
19fbe73c
Commit
19fbe73c
authored
Aug 08, 2018
by
mercury233
Committed by
GitHub
Aug 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new style of select option (#2126)
parent
a6c2edba
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
111 additions
and
39 deletions
+111
-39
gframe/client_field.cpp
gframe/client_field.cpp
+49
-0
gframe/client_field.h
gframe/client_field.h
+2
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+1
-14
gframe/event_handler.cpp
gframe/event_handler.cpp
+49
-24
gframe/game.cpp
gframe/game.cpp
+4
-1
gframe/game.h
gframe/game.h
+6
-0
No files found.
gframe/client_field.cpp
View file @
19fbe73c
...
@@ -590,6 +590,55 @@ void ClientField::ShowLocationCard() {
...
@@ -590,6 +590,55 @@ void ClientField::ShowLocationCard() {
mainGame
->
btnDisplayOK
->
setVisible
(
true
);
mainGame
->
btnDisplayOK
->
setVisible
(
true
);
mainGame
->
PopupElement
(
mainGame
->
wCardDisplay
);
mainGame
->
PopupElement
(
mainGame
->
wCardDisplay
);
}
}
void
ClientField
::
ShowSelectOption
(
int
select_hint
)
{
selected_option
=
0
;
wchar_t
textBuffer
[
256
];
int
count
=
select_options
.
size
();
bool
quickmode
=
(
count
<=
5
);
mainGame
->
gMutex
.
Lock
();
for
(
int
i
=
0
;
(
i
<
count
)
&&
quickmode
;
i
++
)
{
const
wchar_t
*
option
=
dataManager
.
GetDesc
(
select_options
[
i
]);
irr
::
core
::
dimension2d
<
unsigned
int
>
dtxt
=
mainGame
->
guiFont
->
getDimension
(
option
);
if
(
dtxt
.
Width
>
310
)
{
quickmode
=
false
;
break
;
}
mainGame
->
btnOption
[
i
]
->
setText
(
option
);
}
if
(
quickmode
)
{
mainGame
->
stOptions
->
setVisible
(
false
);
mainGame
->
btnOptionp
->
setVisible
(
false
);
mainGame
->
btnOptionn
->
setVisible
(
false
);
mainGame
->
btnOptionOK
->
setVisible
(
false
);
for
(
int
i
=
0
;
i
<
5
;
i
++
)
mainGame
->
btnOption
[
i
]
->
setVisible
(
i
<
count
);
recti
pos
=
mainGame
->
wOptions
->
getRelativePosition
();
int
newheight
=
30
+
40
*
count
;
int
oldheight
=
pos
.
LowerRightCorner
.
Y
-
pos
.
UpperLeftCorner
.
Y
;
pos
.
UpperLeftCorner
.
Y
=
pos
.
UpperLeftCorner
.
Y
+
(
oldheight
-
newheight
)
/
2
;
pos
.
LowerRightCorner
.
Y
=
pos
.
UpperLeftCorner
.
Y
+
newheight
;
mainGame
->
wOptions
->
setRelativePosition
(
pos
);
}
else
{
mainGame
->
SetStaticText
(
mainGame
->
stOptions
,
310
,
mainGame
->
guiFont
,
(
wchar_t
*
)
dataManager
.
GetDesc
(
select_options
[
0
]));
mainGame
->
stOptions
->
setVisible
(
true
);
mainGame
->
btnOptionp
->
setVisible
(
false
);
mainGame
->
btnOptionn
->
setVisible
(
count
>
1
);
mainGame
->
btnOptionOK
->
setVisible
(
true
);
for
(
int
i
=
0
;
i
<
5
;
i
++
)
mainGame
->
btnOption
[
i
]
->
setVisible
(
false
);
recti
pos
=
mainGame
->
wOptions
->
getRelativePosition
();
pos
.
LowerRightCorner
.
Y
=
pos
.
UpperLeftCorner
.
Y
+
140
;
mainGame
->
wOptions
->
setRelativePosition
(
pos
);
}
if
(
select_hint
)
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_hint
));
else
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
555
));
mainGame
->
wOptions
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wOptions
);
mainGame
->
gMutex
.
Unlock
();
}
void
ClientField
::
ReplaySwap
()
{
void
ClientField
::
ReplaySwap
()
{
std
::
swap
(
deck
[
0
],
deck
[
1
]);
std
::
swap
(
deck
[
0
],
deck
[
1
]);
std
::
swap
(
hand
[
0
],
hand
[
1
]);
std
::
swap
(
hand
[
0
],
hand
[
1
]);
...
...
gframe/client_field.h
View file @
19fbe73c
...
@@ -97,6 +97,7 @@ public:
...
@@ -97,6 +97,7 @@ public:
void
ShowSelectCard
(
bool
buttonok
=
false
,
bool
chain
=
false
);
void
ShowSelectCard
(
bool
buttonok
=
false
,
bool
chain
=
false
);
void
ShowChainCard
();
void
ShowChainCard
();
void
ShowLocationCard
();
void
ShowLocationCard
();
void
ShowSelectOption
(
int
select_hint
=
0
);
void
ReplaySwap
();
void
ReplaySwap
();
void
RefreshAllCards
();
void
RefreshAllCards
();
...
@@ -138,6 +139,7 @@ public:
...
@@ -138,6 +139,7 @@ public:
void
ShowCancelOrFinishButton
(
int
buttonOp
);
void
ShowCancelOrFinishButton
(
int
buttonOp
);
void
SetShowMark
(
ClientCard
*
pcard
,
bool
enable
);
void
SetShowMark
(
ClientCard
*
pcard
,
bool
enable
);
void
SetResponseSelectedCards
()
const
;
void
SetResponseSelectedCards
()
const
;
void
SetResponseSelectedOption
()
const
;
void
CancelOrFinish
();
void
CancelOrFinish
();
};
};
...
...
gframe/duelclient.cpp
View file @
19fbe73c
...
@@ -1323,21 +1323,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1323,21 +1323,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dField
.
select_options
.
clear
();
mainGame
->
dField
.
select_options
.
clear
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
for
(
int
i
=
0
;
i
<
count
;
++
i
)
mainGame
->
dField
.
select_options
.
push_back
(
BufferIO
::
ReadInt32
(
pbuf
));
mainGame
->
dField
.
select_options
.
push_back
(
BufferIO
::
ReadInt32
(
pbuf
));
mainGame
->
gMutex
.
Lock
();
mainGame
->
dField
.
ShowSelectOption
(
select_hint
);
mainGame
->
SetStaticText
(
mainGame
->
stOptions
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetDesc
(
mainGame
->
dField
.
select_options
[
0
]));
mainGame
->
btnOptionp
->
setVisible
(
false
);
if
(
count
>
1
)
mainGame
->
btnOptionn
->
setVisible
(
true
);
else
mainGame
->
btnOptionn
->
setVisible
(
false
);
mainGame
->
dField
.
selected_option
=
0
;
if
(
select_hint
)
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_hint
));
else
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
555
));
select_hint
=
0
;
select_hint
=
0
;
mainGame
->
wOptions
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wOptions
);
mainGame
->
gMutex
.
Unlock
();
return
false
;
return
false
;
}
}
case
MSG_SELECT_CARD
:
{
case
MSG_SELECT_CARD
:
{
...
...
gframe/event_handler.cpp
View file @
19fbe73c
...
@@ -291,22 +291,39 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -291,22 +291,39 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
SetStaticText
(
mainGame
->
stOptions
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetDesc
(
select_options
[
selected_option
]));
mainGame
->
SetStaticText
(
mainGame
->
stOptions
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetDesc
(
select_options
[
selected_option
]));
break
;
break
;
}
}
case
BUTTON_OPTION_0
:
{
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
selected_option
=
0
;
SetResponseSelectedOption
();
break
;
}
case
BUTTON_OPTION_1
:
{
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
selected_option
=
1
;
SetResponseSelectedOption
();
break
;
}
case
BUTTON_OPTION_2
:
{
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
selected_option
=
2
;
SetResponseSelectedOption
();
break
;
}
case
BUTTON_OPTION_3
:
{
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
selected_option
=
3
;
SetResponseSelectedOption
();
break
;
}
case
BUTTON_OPTION_4
:
{
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
selected_option
=
4
;
SetResponseSelectedOption
();
break
;
}
case
BUTTON_OPTION_OK
:
{
case
BUTTON_OPTION_OK
:
{
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_OPTION
)
{
SetResponseSelectedOption
();
DuelClient
::
SetResponseI
(
selected_option
);
}
else
{
int
index
=
0
;
while
(
activatable_cards
[
index
]
!=
command_card
||
activatable_descs
[
index
].
first
!=
select_options
[
selected_option
])
index
++
;
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_IDLECMD
)
{
DuelClient
::
SetResponseI
((
index
<<
16
)
+
5
);
}
else
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_BATTLECMD
)
{
DuelClient
::
SetResponseI
(
index
<<
16
);
}
else
{
DuelClient
::
SetResponseI
(
index
);
}
}
mainGame
->
HideElement
(
mainGame
->
wOptions
,
true
);
break
;
break
;
}
}
case
BUTTON_ANNUMBER_OK
:
{
case
BUTTON_ANNUMBER_OK
:
{
...
@@ -360,12 +377,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -360,12 +377,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
}
DuelClient
::
SendResponse
();
DuelClient
::
SendResponse
();
}
else
{
}
else
{
mainGame
->
SetStaticText
(
mainGame
->
stOptions
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetDesc
(
select_options
[
0
]));
selected_option
=
0
;
command_card
=
clicked_card
;
command_card
=
clicked_card
;
mainGame
->
btnOptionp
->
setVisible
(
false
);
ShowSelectOption
();
mainGame
->
btnOptionn
->
setVisible
(
true
);
mainGame
->
ShowElement
(
mainGame
->
wOptions
);
}
}
}
else
{
}
else
{
selectable_cards
.
clear
();
selectable_cards
.
clear
();
...
@@ -645,12 +658,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -645,12 +658,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
}
mainGame
->
HideElement
(
mainGame
->
wCardSelect
,
true
);
mainGame
->
HideElement
(
mainGame
->
wCardSelect
,
true
);
}
else
{
}
else
{
mainGame
->
SetStaticText
(
mainGame
->
stOptions
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetDesc
(
select_options
[
0
]));
selected_option
=
0
;
mainGame
->
btnOptionp
->
setVisible
(
false
);
mainGame
->
btnOptionn
->
setVisible
(
true
);
mainGame
->
wCardSelect
->
setVisible
(
false
);
mainGame
->
wCardSelect
->
setVisible
(
false
);
mainGame
->
ShowElement
(
mainGame
->
wOptions
);
ShowSelectOption
(
);
}
}
break
;
break
;
}
}
...
@@ -2213,6 +2222,22 @@ void ClientField::SetResponseSelectedCards() const {
...
@@ -2213,6 +2222,22 @@ void ClientField::SetResponseSelectedCards() const {
respbuf
[
i
+
1
]
=
selected_cards
[
i
]
->
select_seq
;
respbuf
[
i
+
1
]
=
selected_cards
[
i
]
->
select_seq
;
DuelClient
::
SetResponseB
(
respbuf
,
selected_cards
.
size
()
+
1
);
DuelClient
::
SetResponseB
(
respbuf
,
selected_cards
.
size
()
+
1
);
}
}
void
ClientField
::
SetResponseSelectedOption
()
const
{
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_OPTION
)
{
DuelClient
::
SetResponseI
(
selected_option
);
}
else
{
int
index
=
0
;
while
(
activatable_cards
[
index
]
!=
command_card
||
activatable_descs
[
index
].
first
!=
select_options
[
selected_option
])
index
++
;
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_IDLECMD
)
{
DuelClient
::
SetResponseI
((
index
<<
16
)
+
5
);
}
else
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_BATTLECMD
)
{
DuelClient
::
SetResponseI
(
index
<<
16
);
}
else
{
DuelClient
::
SetResponseI
(
index
);
}
}
mainGame
->
HideElement
(
mainGame
->
wOptions
,
true
);
}
void
ClientField
::
CancelOrFinish
()
{
void
ClientField
::
CancelOrFinish
()
{
switch
(
mainGame
->
dInfo
.
curMsg
)
{
switch
(
mainGame
->
dInfo
.
curMsg
)
{
case
MSG_WAITING
:
{
case
MSG_WAITING
:
{
...
...
gframe/game.cpp
View file @
19fbe73c
...
@@ -353,11 +353,14 @@ bool Game::Initialize() {
...
@@ -353,11 +353,14 @@ bool Game::Initialize() {
wOptions
=
env
->
addWindow
(
rect
<
s32
>
(
490
,
200
,
840
,
340
),
false
,
L""
);
wOptions
=
env
->
addWindow
(
rect
<
s32
>
(
490
,
200
,
840
,
340
),
false
,
L""
);
wOptions
->
getCloseButton
()
->
setVisible
(
false
);
wOptions
->
getCloseButton
()
->
setVisible
(
false
);
wOptions
->
setVisible
(
false
);
wOptions
->
setVisible
(
false
);
stOptions
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
20
,
20
,
350
,
100
),
false
,
true
,
wOptions
,
-
1
,
false
);
stOptions
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
20
,
20
,
350
,
100
),
false
,
true
,
wOptions
,
-
1
,
false
);
stOptions
->
setTextAlignment
(
irr
::
gui
::
EGUIA_UPPERLEFT
,
irr
::
gui
::
EGUIA_CENTER
);
stOptions
->
setTextAlignment
(
irr
::
gui
::
EGUIA_UPPERLEFT
,
irr
::
gui
::
EGUIA_CENTER
);
btnOptionOK
=
env
->
addButton
(
rect
<
s32
>
(
130
,
105
,
220
,
130
),
wOptions
,
BUTTON_OPTION_OK
,
dataManager
.
GetSysString
(
1211
));
btnOptionOK
=
env
->
addButton
(
rect
<
s32
>
(
130
,
105
,
220
,
130
),
wOptions
,
BUTTON_OPTION_OK
,
dataManager
.
GetSysString
(
1211
));
btnOptionp
=
env
->
addButton
(
rect
<
s32
>
(
20
,
105
,
60
,
130
),
wOptions
,
BUTTON_OPTION_PREV
,
L"<<<"
);
btnOptionp
=
env
->
addButton
(
rect
<
s32
>
(
20
,
105
,
60
,
130
),
wOptions
,
BUTTON_OPTION_PREV
,
L"<<<"
);
btnOptionn
=
env
->
addButton
(
rect
<
s32
>
(
290
,
105
,
330
,
130
),
wOptions
,
BUTTON_OPTION_NEXT
,
L">>>"
);
btnOptionn
=
env
->
addButton
(
rect
<
s32
>
(
290
,
105
,
330
,
130
),
wOptions
,
BUTTON_OPTION_NEXT
,
L">>>"
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
btnOption
[
i
]
=
env
->
addButton
(
rect
<
s32
>
(
10
,
30
+
40
*
i
,
340
,
60
+
40
*
i
),
wOptions
,
BUTTON_OPTION_0
+
i
,
L""
);
}
//pos select
//pos select
wPosSelect
=
env
->
addWindow
(
rect
<
s32
>
(
340
,
200
,
935
,
410
),
false
,
dataManager
.
GetSysString
(
561
));
wPosSelect
=
env
->
addWindow
(
rect
<
s32
>
(
340
,
200
,
935
,
410
),
false
,
dataManager
.
GetSysString
(
561
));
wPosSelect
->
getCloseButton
()
->
setVisible
(
false
);
wPosSelect
->
getCloseButton
()
->
setVisible
(
false
);
...
...
gframe/game.h
View file @
19fbe73c
...
@@ -345,6 +345,7 @@ public:
...
@@ -345,6 +345,7 @@ public:
irr
::
gui
::
IGUIButton
*
btnOptionp
;
irr
::
gui
::
IGUIButton
*
btnOptionp
;
irr
::
gui
::
IGUIButton
*
btnOptionn
;
irr
::
gui
::
IGUIButton
*
btnOptionn
;
irr
::
gui
::
IGUIButton
*
btnOptionOK
;
irr
::
gui
::
IGUIButton
*
btnOptionOK
;
irr
::
gui
::
IGUIButton
*
btnOption
[
5
];
//pos selection
//pos selection
irr
::
gui
::
IGUIWindow
*
wPosSelect
;
irr
::
gui
::
IGUIWindow
*
wPosSelect
;
irr
::
gui
::
CGUIImageButton
*
btnPSAU
;
irr
::
gui
::
CGUIImageButton
*
btnPSAU
;
...
@@ -536,6 +537,11 @@ extern Game* mainGame;
...
@@ -536,6 +537,11 @@ extern Game* mainGame;
#define BUTTON_OPTION_PREV 220
#define BUTTON_OPTION_PREV 220
#define BUTTON_OPTION_NEXT 221
#define BUTTON_OPTION_NEXT 221
#define BUTTON_OPTION_OK 222
#define BUTTON_OPTION_OK 222
#define BUTTON_OPTION_0 223
#define BUTTON_OPTION_1 224
#define BUTTON_OPTION_2 225
#define BUTTON_OPTION_3 226
#define BUTTON_OPTION_4 227
#define BUTTON_CARD_0 230
#define BUTTON_CARD_0 230
#define BUTTON_CARD_1 231
#define BUTTON_CARD_1 231
#define BUTTON_CARD_2 232
#define BUTTON_CARD_2 232
...
...
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