Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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
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
MyCard
ygopro-2pick
Commits
f5600dc0
Commit
f5600dc0
authored
Nov 21, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bot list
parent
856b9985
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
6 deletions
+67
-6
gframe/game.cpp
gframe/game.cpp
+40
-3
gframe/game.h
gframe/game.h
+11
-1
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+16
-2
No files found.
gframe/game.cpp
View file @
f5600dc0
...
...
@@ -557,16 +557,16 @@ bool Game::Initialize() {
wSinglePlay
->
setVisible
(
false
);
irr
::
gui
::
IGUITabControl
*
wSingle
=
env
->
addTabControl
(
rect
<
s32
>
(
0
,
20
,
579
,
419
),
wSinglePlay
,
true
);
irr
::
gui
::
IGUITab
*
tabBot
=
wSingle
->
addTab
(
dataManager
.
GetSysString
(
1380
));
lstBotList
=
env
->
addListBox
(
rect
<
s32
>
(
10
,
10
,
350
,
350
),
tabBot
,
LISTBOX_SINGLEPLAY_LIST
,
true
);
lstBotList
=
env
->
addListBox
(
rect
<
s32
>
(
10
,
10
,
350
,
350
),
tabBot
,
LISTBOX_BOT_LIST
,
true
);
lstBotList
->
setItemHeight
(
18
);
btnStartBot
=
env
->
addButton
(
rect
<
s32
>
(
459
,
301
,
569
,
326
),
tabBot
,
BUTTON_BOT_START
,
dataManager
.
GetSysString
(
1211
));
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
,
5
5
0
,
160
),
false
,
true
,
tabBot
);
stBotInfo
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
360
,
40
,
5
6
0
,
160
),
false
,
true
,
tabBot
);
chkBotOldRule
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
360
,
170
,
560
,
190
),
tabBot
,
CHECKBOX_BOT_OLD_RULE
,
dataManager
.
GetSysString
(
1383
));
chkBotHand
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
360
,
200
,
560
,
220
),
tabBot
,
-
1
,
dataManager
.
GetSysString
(
1384
));
chkBotNoCheckDeck
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
360
,
230
,
560
,
250
),
tabBot
,
-
1
,
dataManager
.
GetSysString
(
1229
));
chkBotNoShuffleDeck
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
360
,
260
,
560
,
280
),
tabBot
,
-
1
,
dataManager
.
GetSysString
(
1230
));
irr
::
gui
::
IGUITab
*
tabSingle
=
wSingle
->
addTab
(
dataManager
.
GetSysString
(
1381
));
lstSinglePlayList
=
env
->
addListBox
(
rect
<
s32
>
(
10
,
10
,
350
,
350
),
tabSingle
,
LISTBOX_SINGLEPLAY_LIST
,
true
);
lstSinglePlayList
->
setItemHeight
(
18
);
...
...
@@ -913,6 +913,43 @@ void Game::RefreshSingleplay() {
closedir
(
dir
);
#endif
}
void
Game
::
RefreshBot
()
{
botInfo
.
clear
();
FILE
*
fp
=
fopen
(
"bot.conf"
,
"r"
);
char
linebuf
[
256
];
char
strbuf
[
256
];
if
(
fp
)
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
if
(
linebuf
[
0
]
==
'#'
)
continue
;
if
(
linebuf
[
0
]
==
'!'
)
{
BotInfo
newinfo
;
sscanf
(
linebuf
,
"!%s[^
\n
]"
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
internalname
);
fgets
(
linebuf
,
256
,
fp
);
sscanf
(
linebuf
,
"%s[^
\n
]"
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
name
);
fgets
(
linebuf
,
256
,
fp
);
sscanf
(
linebuf
,
"%s[^
\n
]"
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
desc
);
fgets
(
linebuf
,
256
,
fp
);
sscanf
(
linebuf
,
"%d"
,
&
newinfo
.
flag
);
if
((
chkBotOldRule
->
isChecked
()
&&
(
newinfo
.
flag
&
0x1
))
||
(
!
chkBotOldRule
->
isChecked
()
&&
(
newinfo
.
flag
&
0x2
)))
botInfo
.
push_back
(
newinfo
);
continue
;
}
}
fclose
(
fp
);
}
lstBotList
->
clear
();
stBotInfo
->
setText
(
L""
);
for
(
unsigned
int
i
=
0
;
i
<
botInfo
.
size
();
++
i
)
{
lstBotList
->
addItem
(
botInfo
[
i
].
name
);
}
if
(
botInfo
.
size
()
==
0
)
stBotInfo
->
setText
(
dataManager
.
GetSysString
(
1385
));
}
void
Game
::
LoadConfig
()
{
FILE
*
fp
=
fopen
(
"system.conf"
,
"r"
);
if
(
!
fp
)
...
...
gframe/game.h
View file @
f5600dc0
...
...
@@ -68,6 +68,13 @@ struct DuelInfo {
unsigned
short
time_left
[
2
];
};
struct
BotInfo
{
wchar_t
internalname
[
32
];
wchar_t
name
[
32
];
wchar_t
desc
[
32
];
int
flag
;
};
struct
FadingUnit
{
bool
signalAction
;
bool
isFadein
;
...
...
@@ -92,6 +99,7 @@ public:
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshReplay
();
void
RefreshSingleplay
();
void
RefreshBot
();
void
DrawSelectionLine
(
irr
::
video
::
S3DVertex
*
vec
,
bool
strip
,
int
width
,
float
*
cv
);
void
DrawBackGround
();
void
DrawLinkedZones
(
ClientCard
*
pcard
);
...
...
@@ -142,6 +150,7 @@ public:
std
::
list
<
FadingUnit
>
fadingList
;
std
::
vector
<
int
>
logParam
;
std
::
wstring
chatMsg
[
8
];
std
::
vector
<
BotInfo
>
botInfo
;
int
hideChatTimer
;
bool
hideChat
;
...
...
@@ -574,7 +583,8 @@ extern Game* mainGame;
#define BUTTON_REPLAY_SAVE 330
#define BUTTON_REPLAY_CANCEL 331
#define BUTTON_BOT_START 340
#define CHECKBOX_BOT_OLD_RULE 341
#define LISTBOX_BOT_LIST 341
#define CHECKBOX_BOT_OLD_RULE 342
#define LISTBOX_SINGLEPLAY_LIST 350
#define BUTTON_LOAD_SINGLEPLAY 351
#define BUTTON_CANCEL_SINGLEPLAY 352
...
...
gframe/menu_handler.cpp
View file @
f5600dc0
...
...
@@ -192,6 +192,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
HideElement
(
mainGame
->
wMainMenu
);
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
mainGame
->
RefreshSingleplay
();
mainGame
->
RefreshBot
();
break
;
}
case
BUTTON_LOAD_REPLAY
:
{
...
...
@@ -235,6 +236,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_BOT_START
:
{
int
sel
=
mainGame
->
lstBotList
->
getSelected
();
if
(
sel
==
-
1
)
break
;
bot_mode
=
true
;
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
break
;
...
...
@@ -249,7 +253,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
si
.
cb
=
sizeof
(
si
);
ZeroMemory
(
&
pi
,
sizeof
(
pi
));
LPTSTR
cmd
=
new
TCHAR
[
MAX_PATH
];
myswprintf
(
cmd
,
L"Bot.exe %
s"
,
L"1"
);
myswprintf
(
cmd
,
L"Bot.exe %
d
\"
%s
\"
"
,
(
mainGame
->
chkBotHand
->
isChecked
()
?
1
:
0
),
mainGame
->
botInfo
[
sel
].
internalname
);
if
(
!
CreateProcess
(
NULL
,
cmd
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
))
{
NetServer
::
StopServer
();
...
...
@@ -259,7 +263,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
btnStartBot
->
setEnabled
(
false
);
mainGame
->
btnBotCancel
->
setEnabled
(
false
);
break
;
}
case
BUTTON_LOAD_SINGLEPLAY
:
{
if
(
!
open_file
&&
mainGame
->
lstSinglePlayList
->
getSelected
()
==
-
1
)
...
...
@@ -351,6 +354,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
SetStaticText
(
mainGame
->
stReplayInfo
,
180
,
mainGame
->
guiFont
,
(
wchar_t
*
)
repinfo
.
c_str
());
break
;
}
case
LISTBOX_BOT_LIST
:
{
int
sel
=
mainGame
->
lstBotList
->
getSelected
();
if
(
sel
==
-
1
)
break
;
mainGame
->
SetStaticText
(
mainGame
->
stBotInfo
,
200
,
mainGame
->
guiFont
,
mainGame
->
botInfo
[
sel
].
desc
);
break
;
}
}
break
;
}
...
...
@@ -375,6 +385,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
break
;
}
case
CHECKBOX_BOT_OLD_RULE
:
{
mainGame
->
RefreshBot
();
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