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-520DIY
ygopro
Commits
3c0fd4ad
Commit
3c0fd4ad
authored
Mar 18, 2021
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update bot deck category
parent
2f55033d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
16 deletions
+31
-16
gframe/game.cpp
gframe/game.cpp
+6
-12
gframe/game.h
gframe/game.h
+2
-0
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+23
-4
No files found.
gframe/game.cpp
View file @
3c0fd4ad
...
...
@@ -766,6 +766,9 @@ bool Game::Initialize() {
btnBotCancel
=
env
->
addButton
(
rect
<
s32
>
(
459
,
331
,
569
,
356
),
tabBot
,
BUTTON_CANCEL_SINGLEPLAY
,
dataManager
.
GetSysString
(
1210
));
env
->
addStaticText
(
dataManager
.
GetSysString
(
1382
),
rect
<
s32
>
(
360
,
10
,
550
,
30
),
false
,
true
,
tabBot
);
stBotInfo
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
360
,
40
,
560
,
160
),
false
,
true
,
tabBot
);
cbBotDeckCategory
=
env
->
addComboBox
(
rect
<
s32
>
(
360
,
95
,
560
,
120
),
tabBot
,
COMBOBOX_BOT_DECKCATEGORY
);
cbBotDeckCategory
->
setMaxSelectionRows
(
6
);
cbBotDeckCategory
->
setVisible
(
false
);
cbBotDeck
=
env
->
addComboBox
(
rect
<
s32
>
(
360
,
130
,
560
,
155
),
tabBot
);
cbBotDeck
->
setMaxSelectionRows
(
6
);
cbBotDeck
->
setVisible
(
false
);
...
...
@@ -1194,6 +1197,8 @@ void Game::RefreshBot() {
}
lstBotList
->
clear
();
stBotInfo
->
setText
(
L""
);
cbBotDeckCategory
->
setVisible
(
false
);
cbBotDeck
->
setVisible
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
botInfo
.
size
();
++
i
)
{
lstBotList
->
addItem
(
botInfo
[
i
].
name
);
}
...
...
@@ -1201,18 +1206,7 @@ void Game::RefreshBot() {
SetStaticText
(
stBotInfo
,
200
,
guiFont
,
dataManager
.
GetSysString
(
1385
));
}
else
{
cbBotDeck
->
clear
();
cbBotDeck
->
setVisible
(
false
);
irr
::
gui
::
IGUIComboBox
*
cbDeck
=
cbBotDeck
;
FileSystem
::
TraversalDir
(
gameConf
.
bot_deck_path
,
[
cbDeck
](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
!
isdir
&&
wcsrchr
(
name
,
'.'
)
&&
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".ydk"
,
4
))
{
size_t
len
=
wcslen
(
name
);
wchar_t
deckname
[
256
];
wcsncpy
(
deckname
,
name
,
len
-
4
);
deckname
[
len
-
4
]
=
0
;
cbDeck
->
addItem
(
deckname
);
}
});
RefreshCategoryDeck
(
cbBotDeckCategory
,
cbBotDeck
);
}
}
void
Game
::
LoadConfig
()
{
...
...
gframe/game.h
View file @
3c0fd4ad
...
...
@@ -375,6 +375,7 @@ public:
irr
::
gui
::
IGUIStaticText
*
stBotInfo
;
irr
::
gui
::
IGUIButton
*
btnStartBot
;
irr
::
gui
::
IGUIButton
*
btnBotCancel
;
irr
::
gui
::
IGUIComboBox
*
cbBotDeckCategory
;
irr
::
gui
::
IGUIComboBox
*
cbBotDeck
;
irr
::
gui
::
IGUIComboBox
*
cbBotRule
;
irr
::
gui
::
IGUICheckBox
*
chkBotHand
;
...
...
@@ -646,6 +647,7 @@ extern Game* mainGame;
#define LISTBOX_BOT_LIST 153
#define BUTTON_BOT_START 154
#define COMBOBOX_BOT_RULE 155
#define COMBOBOX_BOT_DECKCATEGORY 156
#define EDITBOX_CHAT 199
#define BUTTON_MSG_OK 200
...
...
gframe/menu_handler.cpp
View file @
3c0fd4ad
...
...
@@ -299,8 +299,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
ZeroMemory
(
&
pi
,
sizeof
(
pi
));
wchar_t
cmd
[
MAX_PATH
];
wchar_t
arg1
[
512
];
if
(
mainGame
->
botInfo
[
sel
].
select_deckfile
)
myswprintf
(
arg1
,
L"%ls DeckFile='%ls'"
,
mainGame
->
botInfo
[
sel
].
command
,
mainGame
->
cbBotDeck
->
getItem
(
mainGame
->
cbBotDeck
->
getSelected
()));
if
(
mainGame
->
botInfo
[
sel
].
select_deckfile
)
{
wchar_t
botdeck
[
256
];
deckManager
.
GetDeckFile
(
botdeck
,
mainGame
->
cbBotDeckCategory
,
mainGame
->
cbBotDeck
);
myswprintf
(
arg1
,
L"%ls DeckFile='%ls'"
,
mainGame
->
botInfo
[
sel
].
command
,
botdeck
);
}
else
myswprintf
(
arg1
,
L"%ls"
,
mainGame
->
botInfo
[
sel
].
command
);
int
flag
=
0
;
...
...
@@ -315,8 +318,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
if
(
fork
()
==
0
)
{
usleep
(
100000
);
wchar_t
warg1
[
512
];
if
(
mainGame
->
botInfo
[
sel
].
select_deckfile
)
myswprintf
(
warg1
,
L"%ls DeckFile='%ls'"
,
mainGame
->
botInfo
[
sel
].
command
,
mainGame
->
cbBotDeck
->
getItem
(
mainGame
->
cbBotDeck
->
getSelected
()));
if
(
mainGame
->
botInfo
[
sel
].
select_deckfile
)
{
wchar_t
botdeck
[
256
];
deckManager
.
GetDeckFile
(
botdeck
,
mainGame
->
cbBotDeckCategory
,
mainGame
->
cbBotDeck
);
myswprintf
(
warg1
,
L"%ls DeckFile='%ls'"
,
mainGame
->
botInfo
[
sel
].
command
,
botdeck
);
}
else
myswprintf
(
warg1
,
L"%ls"
,
mainGame
->
botInfo
[
sel
].
command
);
char
arg1
[
512
];
...
...
@@ -529,6 +535,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
if
(
sel
==
-
1
)
break
;
mainGame
->
SetStaticText
(
mainGame
->
stBotInfo
,
200
,
mainGame
->
guiFont
,
mainGame
->
botInfo
[
sel
].
desc
);
mainGame
->
cbBotDeckCategory
->
setVisible
(
mainGame
->
botInfo
[
sel
].
select_deckfile
);
mainGame
->
cbBotDeck
->
setVisible
(
mainGame
->
botInfo
[
sel
].
select_deckfile
);
break
;
}
...
...
@@ -579,6 +586,18 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
break
;
}
case
COMBOBOX_BOT_DECKCATEGORY
:
{
int
catesel
=
mainGame
->
cbBotDeckCategory
->
getSelected
();
if
(
catesel
==
3
)
{
catesel
=
2
;
mainGame
->
cbBotDeckCategory
->
setSelected
(
2
);
}
if
(
catesel
>=
0
)
{
mainGame
->
RefreshDeck
(
mainGame
->
cbBotDeckCategory
,
mainGame
->
cbBotDeck
);
mainGame
->
cbBotDeck
->
setSelected
(
0
);
}
break
;
}
}
break
;
}
...
...
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