Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
fallenstardust
YGOMobile
Commits
f101dc1b
Commit
f101dc1b
authored
Mar 19, 2021
by
fallenstardust
Committed by
GitHub
Mar 19, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #47 from mercury233/patch-bot-deck
add select bot deck
parents
dd58b547
035f9eab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
8 deletions
+60
-8
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+15
-5
Classes/gframe/game.h
Classes/gframe/game.h
+4
-0
Classes/gframe/menu_handler.cpp
Classes/gframe/menu_handler.cpp
+41
-3
No files found.
Classes/gframe/game.cpp
View file @
f101dc1b
...
@@ -1019,14 +1019,18 @@ bool Game::Initialize(ANDROID_APP app) {
...
@@ -1019,14 +1019,18 @@ bool Game::Initialize(ANDROID_APP app) {
ChangeToIGUIImageButton
(
btnBotCancel
,
imageManager
.
tButton_S
,
imageManager
.
tButton_S_pressed
);
ChangeToIGUIImageButton
(
btnBotCancel
,
imageManager
.
tButton_S
,
imageManager
.
tButton_S_pressed
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1382
),
rect
<
s32
>
(
310
*
xScale
,
10
*
yScale
,
500
*
xScale
,
30
*
yScale
),
false
,
true
,
tabBot
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1382
),
rect
<
s32
>
(
310
*
xScale
,
10
*
yScale
,
500
*
xScale
,
30
*
yScale
),
false
,
true
,
tabBot
);
stBotInfo
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
310
*
xScale
,
40
*
yScale
,
560
*
xScale
,
80
*
yScale
),
false
,
true
,
tabBot
);
stBotInfo
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
310
*
xScale
,
40
*
yScale
,
560
*
xScale
,
80
*
yScale
),
false
,
true
,
tabBot
);
cbBotRule
=
CAndroidGUIComboBox
::
addAndroidComboBox
(
env
,
rect
<
s32
>
(
310
*
xScale
,
90
*
yScale
,
530
*
xScale
,
120
*
yScale
),
tabBot
,
COMBOBOX_BOT_RULE
);
cbBotDeckCategory
=
CAndroidGUIComboBox
::
addAndroidComboBox
(
env
,
rect
<
s32
>
(
310
*
xScale
,
90
*
yScale
,
530
*
xScale
,
120
*
yScale
),
tabBot
,
COMBOBOX_BOT_DECKCATEGORY
);
cbBotDeckCategory
->
setVisible
(
false
);
cbBotDeck
=
CAndroidGUIComboBox
::
addAndroidComboBox
(
env
,
rect
<
s32
>
(
310
*
xScale
,
130
*
yScale
,
530
*
xScale
,
160
*
yScale
),
tabBot
);
cbBotDeck
->
setVisible
(
false
);
cbBotRule
=
CAndroidGUIComboBox
::
addAndroidComboBox
(
env
,
rect
<
s32
>
(
310
*
xScale
,
170
*
yScale
,
530
*
xScale
,
200
*
yScale
),
tabBot
,
COMBOBOX_BOT_RULE
);
cbBotRule
->
addItem
(
dataManager
.
GetSysString
(
1262
));
cbBotRule
->
addItem
(
dataManager
.
GetSysString
(
1262
));
cbBotRule
->
addItem
(
dataManager
.
GetSysString
(
1263
));
cbBotRule
->
addItem
(
dataManager
.
GetSysString
(
1263
));
cbBotRule
->
addItem
(
dataManager
.
GetSysString
(
1264
));
cbBotRule
->
addItem
(
dataManager
.
GetSysString
(
1264
));
cbBotRule
->
setSelected
(
gameConf
.
default_rule
-
3
);
cbBotRule
->
setSelected
(
gameConf
.
default_rule
-
3
);
chkBotHand
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
310
*
xScale
,
130
*
yScale
,
500
*
xScale
,
16
0
*
yScale
),
tabBot
,
-
1
,
dataManager
.
GetSysString
(
1384
));
chkBotHand
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
310
*
xScale
,
210
*
yScale
,
410
*
xScale
,
24
0
*
yScale
),
tabBot
,
-
1
,
dataManager
.
GetSysString
(
1384
));
chkBotNoCheckDeck
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
310
*
xScale
,
170
*
yScale
,
500
*
xScale
,
20
0
*
yScale
),
tabBot
,
-
1
,
dataManager
.
GetSysString
(
1229
));
chkBotNoCheckDeck
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
310
*
xScale
,
250
*
yScale
,
410
*
xScale
,
28
0
*
yScale
),
tabBot
,
-
1
,
dataManager
.
GetSysString
(
1229
));
chkBotNoShuffleDeck
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
310
*
xScale
,
2
10
*
yScale
,
500
*
xScale
,
24
0
*
yScale
),
tabBot
,
-
1
,
dataManager
.
GetSysString
(
1230
));
chkBotNoShuffleDeck
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
310
*
xScale
,
2
90
*
yScale
,
410
*
xScale
,
32
0
*
yScale
),
tabBot
,
-
1
,
dataManager
.
GetSysString
(
1230
));
}
else
{
// avoid null object reference
}
else
{
// avoid null object reference
btnStartBot
=
env
->
addButton
(
rect
<
s32
>
(
0
,
0
,
0
,
0
),
wSinglePlay
);
btnStartBot
=
env
->
addButton
(
rect
<
s32
>
(
0
,
0
,
0
,
0
),
wSinglePlay
);
btnBotCancel
=
env
->
addButton
(
rect
<
s32
>
(
0
,
0
,
0
,
0
),
wSinglePlay
);
btnBotCancel
=
env
->
addButton
(
rect
<
s32
>
(
0
,
0
,
0
,
0
),
wSinglePlay
);
...
@@ -1601,6 +1605,7 @@ void Game::RefreshBot() {
...
@@ -1601,6 +1605,7 @@ void Game::RefreshBot() {
newinfo
.
support_master_rule_3
=
!!
strstr
(
linebuf
,
"SUPPORT_MASTER_RULE_3"
);
newinfo
.
support_master_rule_3
=
!!
strstr
(
linebuf
,
"SUPPORT_MASTER_RULE_3"
);
newinfo
.
support_new_master_rule
=
!!
strstr
(
linebuf
,
"SUPPORT_NEW_MASTER_RULE"
);
newinfo
.
support_new_master_rule
=
!!
strstr
(
linebuf
,
"SUPPORT_NEW_MASTER_RULE"
);
newinfo
.
support_master_rule_2020
=
!!
strstr
(
linebuf
,
"SUPPORT_MASTER_RULE_2020"
);
newinfo
.
support_master_rule_2020
=
!!
strstr
(
linebuf
,
"SUPPORT_MASTER_RULE_2020"
);
newinfo
.
select_deckfile
=
!!
strstr
(
linebuf
,
"SELECT_DECKFILE"
);
int
rule
=
cbBotRule
->
getSelected
()
+
3
;
int
rule
=
cbBotRule
->
getSelected
()
+
3
;
if
((
rule
==
3
&&
newinfo
.
support_master_rule_3
)
if
((
rule
==
3
&&
newinfo
.
support_master_rule_3
)
||
(
rule
==
4
&&
newinfo
.
support_new_master_rule
)
||
(
rule
==
4
&&
newinfo
.
support_new_master_rule
)
...
@@ -1613,11 +1618,16 @@ void Game::RefreshBot() {
...
@@ -1613,11 +1618,16 @@ void Game::RefreshBot() {
}
}
lstBotList
->
clear
();
lstBotList
->
clear
();
stBotInfo
->
setText
(
L""
);
stBotInfo
->
setText
(
L""
);
cbBotDeckCategory
->
setVisible
(
false
);
cbBotDeck
->
setVisible
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
botInfo
.
size
();
++
i
)
{
for
(
unsigned
int
i
=
0
;
i
<
botInfo
.
size
();
++
i
)
{
lstBotList
->
addItem
(
botInfo
[
i
].
name
);
lstBotList
->
addItem
(
botInfo
[
i
].
name
);
}
}
if
(
botInfo
.
size
()
==
0
)
if
(
botInfo
.
size
()
==
0
)
{
SetStaticText
(
stBotInfo
,
200
,
guiFont
,
dataManager
.
GetSysString
(
1385
));
SetStaticText
(
stBotInfo
,
200
,
guiFont
,
dataManager
.
GetSysString
(
1385
));
}
else
{
RefreshCategoryDeck
(
cbBotDeckCategory
,
cbBotDeck
);
}
}
}
void
Game
::
LoadConfig
()
{
void
Game
::
LoadConfig
()
{
wchar_t
wstr
[
256
];
wchar_t
wstr
[
256
];
...
...
Classes/gframe/game.h
View file @
f101dc1b
...
@@ -102,6 +102,7 @@ struct BotInfo {
...
@@ -102,6 +102,7 @@ struct BotInfo {
bool
support_master_rule_3
;
bool
support_master_rule_3
;
bool
support_new_master_rule
;
bool
support_new_master_rule
;
bool
support_master_rule_2020
;
bool
support_master_rule_2020
;
bool
select_deckfile
;
};
};
struct
FadingUnit
{
struct
FadingUnit
{
...
@@ -389,6 +390,8 @@ public:
...
@@ -389,6 +390,8 @@ public:
irr
::
gui
::
IGUIStaticText
*
stBotInfo
;
irr
::
gui
::
IGUIStaticText
*
stBotInfo
;
irr
::
gui
::
IGUIButton
*
btnStartBot
;
//
irr
::
gui
::
IGUIButton
*
btnStartBot
;
//
irr
::
gui
::
IGUIButton
*
btnBotCancel
;
//
irr
::
gui
::
IGUIButton
*
btnBotCancel
;
//
irr
::
gui
::
IGUIComboBox
*
cbBotDeckCategory
;
irr
::
gui
::
IGUIComboBox
*
cbBotDeck
;
irr
::
gui
::
IGUIComboBox
*
cbBotRule
;
irr
::
gui
::
IGUIComboBox
*
cbBotRule
;
irr
::
gui
::
IGUICheckBox
*
chkBotHand
;
irr
::
gui
::
IGUICheckBox
*
chkBotHand
;
irr
::
gui
::
IGUICheckBox
*
chkBotNoCheckDeck
;
irr
::
gui
::
IGUICheckBox
*
chkBotNoCheckDeck
;
...
@@ -735,6 +738,7 @@ private:
...
@@ -735,6 +738,7 @@ private:
#define LISTBOX_BOT_LIST 153
#define LISTBOX_BOT_LIST 153
#define BUTTON_BOT_START 154
#define BUTTON_BOT_START 154
#define COMBOBOX_BOT_RULE 155
#define COMBOBOX_BOT_RULE 155
#define COMBOBOX_BOT_DECKCATEGORY 156
#define EDITBOX_CHAT 199
#define EDITBOX_CHAT 199
#define BUTTON_MSG_OK 200
#define BUTTON_MSG_OK 200
...
...
Classes/gframe/menu_handler.cpp
View file @
f101dc1b
...
@@ -345,9 +345,17 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -345,9 +345,17 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
si
.
cb
=
sizeof
(
si
);
si
.
cb
=
sizeof
(
si
);
ZeroMemory
(
&
pi
,
sizeof
(
pi
));
ZeroMemory
(
&
pi
,
sizeof
(
pi
));
wchar_t
cmd
[
MAX_PATH
];
wchar_t
cmd
[
MAX_PATH
];
wchar_t
arg1
[
512
];
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
;
int
flag
=
0
;
flag
+=
(
mainGame
->
chkBotHand
->
isChecked
()
?
0x1
:
0
);
flag
+=
(
mainGame
->
chkBotHand
->
isChecked
()
?
0x1
:
0
);
myswprintf
(
cmd
,
L"Bot.exe
\"
%ls
\"
%d %d"
,
mainGame
->
botInfo
[
sel
].
command
,
flag
,
mainGame
->
gameConf
.
serverport
);
myswprintf
(
cmd
,
L"Bot.exe
\"
%ls
\"
%d %d"
,
arg1
,
flag
,
mainGame
->
gameConf
.
serverport
);
if
(
!
CreateProcessW
(
NULL
,
cmd
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
))
if
(
!
CreateProcessW
(
NULL
,
cmd
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
))
{
{
NetServer
::
StopServer
();
NetServer
::
StopServer
();
...
@@ -355,8 +363,16 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -355,8 +363,16 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
}
#elif defined(_IRR_ANDROID_PLATFORM_)
#elif defined(_IRR_ANDROID_PLATFORM_)
char
args
[
512
];
char
args
[
512
];
wchar_t
warg1
[
512
];
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
];
char
arg1
[
512
];
BufferIO
::
EncodeUTF8
(
mainGame
->
botInfo
[
sel
].
command
,
arg1
);
BufferIO
::
EncodeUTF8
(
warg1
,
arg1
);
char
arg2
[
32
];
char
arg2
[
32
];
arg2
[
0
]
=
0
;
arg2
[
0
]
=
0
;
if
(
mainGame
->
chkBotHand
->
isChecked
())
if
(
mainGame
->
chkBotHand
->
isChecked
())
...
@@ -374,8 +390,16 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -374,8 +390,16 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
#else
#else
if
(
fork
()
==
0
)
{
if
(
fork
()
==
0
)
{
usleep
(
100000
);
usleep
(
100000
);
wchar_t
warg1
[
512
];
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
];
char
arg1
[
512
];
BufferIO
::
EncodeUTF8
(
mainGame
->
botInfo
[
sel
].
command
,
arg1
);
BufferIO
::
EncodeUTF8
(
warg1
,
arg1
);
int
flag
=
0
;
int
flag
=
0
;
flag
+=
(
mainGame
->
chkBotHand
->
isChecked
()
?
0x1
:
0
);
flag
+=
(
mainGame
->
chkBotHand
->
isChecked
()
?
0x1
:
0
);
char
arg2
[
8
];
char
arg2
[
8
];
...
@@ -573,6 +597,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -573,6 +597,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
if
(
sel
==
-
1
)
if
(
sel
==
-
1
)
break
;
break
;
mainGame
->
SetStaticText
(
mainGame
->
stBotInfo
,
200
*
mainGame
->
xScale
,
mainGame
->
guiFont
,
mainGame
->
botInfo
[
sel
].
desc
);
mainGame
->
SetStaticText
(
mainGame
->
stBotInfo
,
200
*
mainGame
->
xScale
,
mainGame
->
guiFont
,
mainGame
->
botInfo
[
sel
].
desc
);
mainGame
->
cbBotDeckCategory
->
setVisible
(
mainGame
->
botInfo
[
sel
].
select_deckfile
);
mainGame
->
cbBotDeck
->
setVisible
(
mainGame
->
botInfo
[
sel
].
select_deckfile
);
break
;
break
;
}
}
}
}
...
@@ -596,6 +622,18 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -596,6 +622,18 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
}
break
;
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
;
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