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
50bc82ef
Commit
50bc82ef
authored
Apr 26, 2024
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
为P2bot设置选择卡组按钮
parent
0346d28f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
75 deletions
+14
-75
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+1
-0
Classes/gframe/game.h
Classes/gframe/game.h
+2
-0
Classes/gframe/menu_handler.cpp
Classes/gframe/menu_handler.cpp
+11
-75
No files found.
Classes/gframe/game.cpp
View file @
50bc82ef
...
@@ -1145,6 +1145,7 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
...
@@ -1145,6 +1145,7 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
cbBotDeckCategory
->
setVisible
(
false
);
cbBotDeckCategory
->
setVisible
(
false
);
cbBotDeck
=
CAndroidGUIComboBox
::
addAndroidComboBox
(
env
,
rect
<
s32
>
(
310
*
xScale
,
130
*
yScale
,
530
*
xScale
,
160
*
yScale
),
tabBot
);
cbBotDeck
=
CAndroidGUIComboBox
::
addAndroidComboBox
(
env
,
rect
<
s32
>
(
310
*
xScale
,
130
*
yScale
,
530
*
xScale
,
160
*
yScale
),
tabBot
);
cbBotDeck
->
setVisible
(
false
);
cbBotDeck
->
setVisible
(
false
);
btnBotDeckSelect
=
env
->
addButton
(
rect
<
s32
>
(
310
*
xScale
,
40
*
yScale
,
530
*
xScale
,
80
*
yScale
),
tabBot
,
BUTTON_BOT_DECK_SELECT
,
L""
);
cbBotRule
=
CAndroidGUIComboBox
::
addAndroidComboBox
(
env
,
rect
<
s32
>
(
310
*
xScale
,
170
*
yScale
,
530
*
xScale
,
200
*
yScale
),
tabBot
,
COMBOBOX_BOT_RULE
);
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
));
...
...
Classes/gframe/game.h
View file @
50bc82ef
...
@@ -420,6 +420,7 @@ public:
...
@@ -420,6 +420,7 @@ public:
irr
::
gui
::
IGUIButton
*
btnBotCancel
;
irr
::
gui
::
IGUIButton
*
btnBotCancel
;
irr
::
gui
::
IGUIComboBox
*
cbBotDeckCategory
;
irr
::
gui
::
IGUIComboBox
*
cbBotDeckCategory
;
irr
::
gui
::
IGUIComboBox
*
cbBotDeck
;
irr
::
gui
::
IGUIComboBox
*
cbBotDeck
;
irr
::
gui
::
IGUIButton
*
btnBotDeckSelect
;
irr
::
gui
::
IGUIComboBox
*
cbBotRule
;
irr
::
gui
::
IGUIComboBox
*
cbBotRule
;
irr
::
gui
::
IGUICheckBox
*
chkBotHand
;
irr
::
gui
::
IGUICheckBox
*
chkBotHand
;
irr
::
gui
::
IGUICheckBox
*
chkBotNoCheckDeck
;
irr
::
gui
::
IGUICheckBox
*
chkBotNoCheckDeck
;
...
@@ -776,6 +777,7 @@ extern Game* mainGame;
...
@@ -776,6 +777,7 @@ extern Game* mainGame;
#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 COMBOBOX_BOT_DECKCATEGORY 156
#define BUTTON_BOT_DECK_SELECT 157
#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 @
50bc82ef
...
@@ -34,11 +34,11 @@ void UpdateDeck() {
...
@@ -34,11 +34,11 @@ void UpdateDeck() {
DuelClient
::
SendBufferToServer
(
CTOS_UPDATE_DECK
,
deckbuf
,
pdeck
-
deckbuf
);
DuelClient
::
SendBufferToServer
(
CTOS_UPDATE_DECK
,
deckbuf
,
pdeck
-
deckbuf
);
}
}
void
ShowHostPrepareDeckManage
()
{
void
ShowHostPrepareDeckManage
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDecks
)
{
mainGame
->
RefreshCategoryDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
,
false
);
mainGame
->
RefreshCategoryDeck
(
cbCategory
,
cbDecks
,
false
);
mainGame
->
cbCategorySelect
->
setSelected
(
mainGame
->
deckBuilder
.
prev_category
);
cbCategory
->
setSelected
(
mainGame
->
deckBuilder
.
prev_category
);
mainGame
->
RefreshDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
);
mainGame
->
RefreshDeck
(
cbCategory
,
cbDecks
);
mainGame
->
cbDeckSelect
->
setSelected
(
mainGame
->
deckBuilder
.
prev_deck
);
cbDecks
->
setSelected
(
mainGame
->
deckBuilder
.
prev_deck
);
irr
::
gui
::
IGUIListBox
*
lstCategories
=
mainGame
->
lstCategories
;
irr
::
gui
::
IGUIListBox
*
lstCategories
=
mainGame
->
lstCategories
;
lstCategories
->
clear
();
lstCategories
->
clear
();
lstCategories
->
addItem
(
dataManager
.
GetSysString
(
1451
));
lstCategories
->
addItem
(
dataManager
.
GetSysString
(
1451
));
...
@@ -114,7 +114,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -114,7 +114,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
switch
(
id
)
{
switch
(
id
)
{
case
BUTTON_HP_DECK_SELECT
:
{
case
BUTTON_HP_DECK_SELECT
:
{
if
(
!
mainGame
->
wQuery
->
isVisible
())
{
if
(
!
mainGame
->
wQuery
->
isVisible
())
{
ShowHostPrepareDeckManage
();
ShowHostPrepareDeckManage
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
);
}
}
break
;
break
;
}
}
...
@@ -434,46 +434,16 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -434,46 +434,16 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
break
;
break
;
}
}
case
BUTTON_BOT_DECK_SELECT
:
{
ShowHostPrepareDeckManage
(
mainGame
->
cbBotDeckCategory
,
mainGame
->
cbBotDeck
);
break
;
}
case
BUTTON_BOT_START
:
{
case
BUTTON_BOT_START
:
{
int
sel
=
mainGame
->
lstBotList
->
getSelected
();
int
sel
=
mainGame
->
lstBotList
->
getSelected
();
if
(
sel
==
-
1
)
if
(
sel
==
-
1
)
break
;
break
;
bot_mode
=
true
;
bot_mode
=
true
;
#ifdef _WIN32
#ifdef _IRR_ANDROID_PLATFORM_
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
{
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
break
;
}
if
(
!
DuelClient
::
StartClient
(
0x7f000001
,
mainGame
->
gameConf
.
serverport
))
{
NetServer
::
StopServer
();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
break
;
}
STARTUPINFOW
si
;
PROCESS_INFORMATION
pi
;
ZeroMemory
(
&
si
,
sizeof
(
si
));
si
.
cb
=
sizeof
(
si
);
ZeroMemory
(
&
pi
,
sizeof
(
pi
));
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
;
flag
+=
(
mainGame
->
chkBotHand
->
isChecked
()
?
0x1
:
0
);
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
))
{
NetServer
::
StopServer
();
break
;
}
#elif defined(_IRR_ANDROID_PLATFORM_)
char
args
[
512
];
char
args
[
512
];
wchar_t
warg1
[
512
];
wchar_t
warg1
[
512
];
if
(
mainGame
->
botInfo
[
sel
].
select_deckfile
)
{
if
(
mainGame
->
botInfo
[
sel
].
select_deckfile
)
{
...
@@ -504,40 +474,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -504,40 +474,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
break
;
break
;
}
}
#else
if
(
fork
()
==
0
)
{
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
];
BufferIO
::
EncodeUTF8
(
warg1
,
arg1
);
int
flag
=
0
;
flag
+=
(
mainGame
->
chkBotHand
->
isChecked
()
?
0x1
:
0
);
char
arg2
[
8
];
sprintf
(
arg2
,
"%d"
,
flag
);
char
arg3
[
8
];
sprintf
(
arg3
,
"%d"
,
mainGame
->
gameConf
.
serverport
);
execl
(
"./bot"
,
"bot"
,
arg1
,
arg2
,
arg3
,
NULL
);
exit
(
0
);
}
else
{
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
{
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
break
;
}
if
(
!
DuelClient
::
StartClient
(
0x7f000001
,
mainGame
->
gameConf
.
serverport
))
{
NetServer
::
StopServer
();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
break
;
}
}
#endif
#endif
mainGame
->
btnStartBot
->
setEnabled
(
false
);
mainGame
->
btnStartBot
->
setEnabled
(
false
);
mainGame
->
btnBotCancel
->
setEnabled
(
false
);
mainGame
->
btnBotCancel
->
setEnabled
(
false
);
...
...
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