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
wyykak
ygopro
Commits
53994c1c
Commit
53994c1c
authored
Apr 19, 2019
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add deck category and draft of deck manage
parent
b6de0621
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
302 additions
and
61 deletions
+302
-61
gframe/deck_con.cpp
gframe/deck_con.cpp
+101
-22
gframe/deck_con.h
gframe/deck_con.h
+2
-0
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+37
-10
gframe/deck_manager.h
gframe/deck_manager.h
+5
-2
gframe/duelclient.cpp
gframe/duelclient.cpp
+3
-1
gframe/game.cpp
gframe/game.cpp
+81
-14
gframe/game.h
gframe/game.h
+39
-4
gframe/gframe.cpp
gframe/gframe.cpp
+1
-0
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+31
-7
gframe/myfilesystem.h
gframe/myfilesystem.h
+2
-1
No files found.
gframe/deck_con.cpp
View file @
53994c1c
This diff is collapsed.
Click to expand it.
gframe/deck_con.h
View file @
53994c1c
...
...
@@ -60,10 +60,12 @@ public:
size_t
pre_extrac
;
size_t
pre_sidec
;
code_pointer
draging_pointer
;
int
prev_category
;
int
prev_deck
;
s32
prev_operation
;
int
prev_sel
;
bool
is_modified
;
bool
readonly
;
std
::
unordered_map
<
int
,
int
>*
filterList
;
std
::
vector
<
code_pointer
>
results
;
...
...
gframe/deck_manager.cpp
View file @
53994c1c
...
...
@@ -191,6 +191,37 @@ bool DeckManager::LoadSide(Deck& deck, int* dbuf, int mainc, int sidec) {
deck
=
ndeck
;
return
true
;
}
void
DeckManager
::
GetCategoryPath
(
wchar_t
*
ret
,
irr
::
gui
::
IGUIComboBox
*
cbCategory
)
{
wchar_t
catepath
[
256
];
switch
(
cbCategory
->
getSelected
())
{
case
0
:
myswprintf
(
catepath
,
L"./pack"
);
break
;
case
1
:
myswprintf
(
catepath
,
mainGame
->
gameConf
.
bot_deck_path
);
break
;
case
-
1
:
case
2
:
case
3
:
myswprintf
(
catepath
,
L"./deck"
);
break
;
default:
myswprintf
(
catepath
,
L"./deck/%ls"
,
cbCategory
->
getItem
(
cbCategory
->
getSelected
()));
}
BufferIO
::
CopyWStr
(
catepath
,
ret
,
256
);
}
void
DeckManager
::
GetDeckFile
(
wchar_t
*
ret
,
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
wchar_t
filepath
[
256
];
wchar_t
catepath
[
256
];
GetCategoryPath
(
catepath
,
cbCategory
);
myswprintf
(
filepath
,
L"%ls/%ls.ydk"
,
catepath
,
cbDeck
->
getItem
(
cbDeck
->
getSelected
()));
BufferIO
::
CopyWStr
(
filepath
,
ret
,
256
);
}
bool
DeckManager
::
LoadDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
wchar_t
filepath
[
256
];
GetDeckFile
(
filepath
,
cbCategory
,
cbDeck
);
return
LoadDeck
(
filepath
);
}
FILE
*
DeckManager
::
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
)
{
#ifdef WIN32
FILE
*
fp
=
_wfopen
(
file
,
(
wchar_t
*
)
mode
);
...
...
@@ -203,11 +234,11 @@ FILE* DeckManager::OpenDeckFile(const wchar_t* file, const char* mode) {
}
bool
DeckManager
::
LoadDeck
(
const
wchar_t
*
file
)
{
int
sp
=
0
,
ct
=
0
,
mainc
=
0
,
sidec
=
0
,
code
;
wchar_t
localfile
[
64
];
myswprintf
(
localfile
,
L"./deck/%ls.ydk"
,
file
);
FILE
*
fp
=
OpenDeckFile
(
localfile
,
"r"
);
FILE
*
fp
=
OpenDeckFile
(
file
,
"r"
);
if
(
!
fp
)
{
fp
=
OpenDeckFile
(
file
,
"r"
);
wchar_t
localfile
[
64
];
myswprintf
(
localfile
,
L"./deck/%ls.ydk"
,
file
);
fp
=
OpenDeckFile
(
localfile
,
"r"
);
}
if
(
!
fp
)
return
false
;
...
...
@@ -233,11 +264,9 @@ bool DeckManager::LoadDeck(const wchar_t* file) {
LoadDeck
(
current_deck
,
cardlist
,
mainc
,
sidec
);
return
true
;
}
bool
DeckManager
::
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
nam
e
)
{
bool
DeckManager
::
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
fil
e
)
{
if
(
!
FileSystem
::
IsDirExists
(
L"./deck"
)
&&
!
FileSystem
::
MakeDir
(
L"./deck"
))
return
false
;
wchar_t
file
[
64
];
myswprintf
(
file
,
L"./deck/%ls.ydk"
,
name
);
FILE
*
fp
=
OpenDeckFile
(
file
,
"w"
);
if
(
!
fp
)
return
false
;
...
...
@@ -253,9 +282,7 @@ bool DeckManager::SaveDeck(Deck& deck, const wchar_t* name) {
fclose
(
fp
);
return
true
;
}
bool
DeckManager
::
DeleteDeck
(
Deck
&
deck
,
const
wchar_t
*
name
)
{
wchar_t
file
[
64
];
myswprintf
(
file
,
L"./deck/%ls.ydk"
,
name
);
bool
DeckManager
::
DeleteDeck
(
const
wchar_t
*
file
)
{
#ifdef WIN32
BOOL
result
=
DeleteFileW
(
file
);
return
!!
result
;
...
...
gframe/deck_manager.h
View file @
53994c1c
...
...
@@ -41,10 +41,13 @@ public:
int
CheckDeck
(
Deck
&
deck
,
int
lfhash
,
bool
allow_ocg
,
bool
allow_tcg
);
int
LoadDeck
(
Deck
&
deck
,
int
*
dbuf
,
int
mainc
,
int
sidec
);
bool
LoadSide
(
Deck
&
deck
,
int
*
dbuf
,
int
mainc
,
int
sidec
);
void
GetCategoryPath
(
wchar_t
*
ret
,
irr
::
gui
::
IGUIComboBox
*
cbCategory
);
void
GetDeckFile
(
wchar_t
*
ret
,
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
bool
LoadDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
FILE
*
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
);
bool
LoadDeck
(
const
wchar_t
*
file
);
bool
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
nam
e
);
bool
DeleteDeck
(
Deck
&
deck
,
const
wchar_t
*
nam
e
);
bool
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
fil
e
);
bool
DeleteDeck
(
const
wchar_t
*
fil
e
);
};
extern
DeckManager
deckManager
;
...
...
gframe/duelclient.cpp
View file @
53994c1c
...
...
@@ -308,6 +308,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
}
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
msgbuf
);
mainGame
->
cbCategorySelect
->
setEnabled
(
true
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
mainGame
->
gMutex
.
Unlock
();
break
;
...
...
@@ -471,7 +472,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
stHostPrepDuelist
[
3
]
->
setText
(
L""
);
mainGame
->
stHostPrepOB
->
setText
(
L""
);
mainGame
->
SetStaticText
(
mainGame
->
stHostPrepRule
,
180
,
mainGame
->
guiFont
,
str
.
c_str
());
mainGame
->
RefreshDeck
(
mainGame
->
cbDeckSelect
);
mainGame
->
RefreshCategoryDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
);
mainGame
->
cbCategorySelect
->
setEnabled
(
true
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
if
(
mainGame
->
wCreateHost
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wCreateHost
);
...
...
gframe/game.cpp
View file @
53994c1c
...
...
@@ -199,8 +199,10 @@ bool Game::Initialize() {
myswprintf
(
dataManager
.
strBuffer
,
L"%ls%d"
,
dataManager
.
GetSysString
(
1253
),
0
);
stHostPrepOB
=
env
->
addStaticText
(
dataManager
.
strBuffer
,
rect
<
s32
>
(
10
,
210
,
270
,
230
),
false
,
false
,
wHostPrepare
);
stHostPrepRule
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
280
,
30
,
460
,
230
),
false
,
true
,
wHostPrepare
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1254
),
rect
<
s32
>
(
10
,
235
,
110
,
255
),
false
,
false
,
wHostPrepare
);
cbDeckSelect
=
env
->
addComboBox
(
rect
<
s32
>
(
120
,
230
,
270
,
255
),
wHostPrepare
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1254
),
rect
<
s32
>
(
10
,
210
,
110
,
230
),
false
,
false
,
wHostPrepare
);
cbCategorySelect
=
env
->
addComboBox
(
rect
<
s32
>
(
10
,
230
,
138
,
255
),
wHostPrepare
,
COMBOBOX_HP_CATEGORY
);
cbCategorySelect
->
setMaxSelectionRows
(
10
);
cbDeckSelect
=
env
->
addComboBox
(
rect
<
s32
>
(
142
,
230
,
340
,
255
),
wHostPrepare
);
cbDeckSelect
->
setMaxSelectionRows
(
10
);
btnHostPrepReady
=
env
->
addButton
(
rect
<
s32
>
(
170
,
180
,
270
,
205
),
wHostPrepare
,
BUTTON_HP_READY
,
dataManager
.
GetSysString
(
1218
));
btnHostPrepNotReady
=
env
->
addButton
(
rect
<
s32
>
(
170
,
180
,
270
,
205
),
wHostPrepare
,
BUTTON_HP_NOTREADY
,
dataManager
.
GetSysString
(
1219
));
...
...
@@ -495,9 +497,35 @@ bool Game::Initialize() {
//deck edit
wDeckEdit
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
309
,
5
,
605
,
130
),
true
,
false
,
0
,
-
1
,
true
);
wDeckEdit
->
setVisible
(
false
);
stBanlist
=
env
->
addStaticText
(
dataManager
.
GetSysString
(
1300
),
rect
<
s32
>
(
10
,
9
,
100
,
29
),
false
,
false
,
wDeckEdit
);
cbDBLFList
=
env
->
addComboBox
(
rect
<
s32
>
(
80
,
5
,
220
,
30
),
wDeckEdit
,
COMBOBOX_DBLFLIST
);
btnManageDeck
=
env
->
addButton
(
rect
<
s32
>
(
225
,
5
,
290
,
30
),
wDeckEdit
,
BUTTON_MANAGE_DECK
,
L"管理"
);
wManageDeck
=
env
->
addWindow
(
rect
<
s32
>
(
310
,
135
,
800
,
465
),
false
,
L"管理卡组"
,
0
,
WINDOW_MANAGE_DECK
);
wManageDeck
->
setVisible
(
false
);
lstCategories
=
env
->
addListBox
(
rect
<
s32
>
(
10
,
30
,
170
,
320
),
wManageDeck
,
LISTBOX_CATEGORIES
,
true
);
lstDecks
=
env
->
addListBox
(
rect
<
s32
>
(
180
,
30
,
340
,
320
),
wManageDeck
,
LISTBOX_CATEGORY_DECKS
,
true
);
posY
=
30
;
btnNewCategory
=
env
->
addButton
(
rect
<
s32
>
(
350
,
posY
,
480
,
posY
+
25
),
wManageDeck
,
BUTTON_NEW_CATEGORY
,
L"新建分类"
);
posY
+=
30
;
btnRenameCategory
=
env
->
addButton
(
rect
<
s32
>
(
350
,
posY
,
480
,
posY
+
25
),
wManageDeck
,
BUTTON_RENAME_CATEGORY
,
L"重命名分类"
);
posY
+=
30
;
btnDeleteCategory
=
env
->
addButton
(
rect
<
s32
>
(
350
,
posY
,
480
,
posY
+
25
),
wManageDeck
,
BUTTON_DELETE_CATEGORY
,
L"删除分类"
);
posY
+=
30
;
btnNewDeck
=
env
->
addButton
(
rect
<
s32
>
(
350
,
posY
,
480
,
posY
+
25
),
wManageDeck
,
BUTTON_NEW_DECK
,
L"新建卡组"
);
posY
+=
30
;
btnRenameDeck
=
env
->
addButton
(
rect
<
s32
>
(
350
,
posY
,
480
,
posY
+
25
),
wManageDeck
,
BUTTON_RENAME_DECK
,
L"重命名卡组"
);
posY
+=
30
;
btnManageDeleteDeck
=
env
->
addButton
(
rect
<
s32
>
(
350
,
posY
,
480
,
posY
+
25
),
wManageDeck
,
BUTTON_DELETE_DECK_MANAGE
,
L"删除卡组"
);
posY
+=
30
;
btnMoveDeck
=
env
->
addButton
(
rect
<
s32
>
(
350
,
posY
,
480
,
posY
+
25
),
wManageDeck
,
BUTTON_MOVE_DECK
,
L"移动到分类"
);
posY
+=
30
;
btnCopyDeck
=
env
->
addButton
(
rect
<
s32
>
(
350
,
posY
,
480
,
posY
+
25
),
wManageDeck
,
BUTTON_COPY_DECK
,
L"复制到分类"
);
posY
+=
55
;
//env->addStaticText(dataManager.GetSysString(1300), rect<s32>(350, posY, 440, posY + 25), false, false, wManageDeck);
cbDBLFList
=
env
->
addComboBox
(
rect
<
s32
>
(
350
,
posY
,
480
,
posY
+
25
),
wManageDeck
,
COMBOBOX_DBLFLIST
);
cbDBLFList
->
setMaxSelectionRows
(
10
);
stDBCategory
=
env
->
addStaticText
(
dataManager
.
GetSysString
(
1300
),
rect
<
s32
>
(
10
,
9
,
100
,
29
),
false
,
false
,
wDeckEdit
);
cbDBCategory
=
env
->
addComboBox
(
rect
<
s32
>
(
80
,
5
,
220
,
30
),
wDeckEdit
,
COMBOBOX_DBCATEGORY
);
cbDBCategory
->
setMaxSelectionRows
(
10
);
stDeck
=
env
->
addStaticText
(
dataManager
.
GetSysString
(
1301
),
rect
<
s32
>
(
10
,
39
,
100
,
59
),
false
,
false
,
wDeckEdit
);
cbDBDecks
=
env
->
addComboBox
(
rect
<
s32
>
(
80
,
35
,
220
,
60
),
wDeckEdit
,
COMBOBOX_DBDECKS
);
cbDBDecks
->
setMaxSelectionRows
(
15
);
...
...
@@ -953,9 +981,40 @@ void Game::LoadExpansions() {
}
}
}
void
Game
::
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
void
Game
::
RefreshCategoryDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
cbCategory
->
clear
();
cbCategory
->
addItem
(
dataManager
.
GetSysString
(
1450
));
cbCategory
->
addItem
(
dataManager
.
GetSysString
(
1451
));
cbCategory
->
addItem
(
dataManager
.
GetSysString
(
1452
));
cbCategory
->
addItem
(
dataManager
.
GetSysString
(
1453
));
FileSystem
::
TraversalDir
(
L"./deck"
,
[
cbCategory
](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
isdir
)
{
cbCategory
->
addItem
(
name
);
}
});
cbCategory
->
setSelected
(
2
);
for
(
size_t
i
=
0
;
i
<
cbCategory
->
getItemCount
();
++
i
)
{
if
(
!
wcscmp
(
cbCategory
->
getItem
(
i
),
gameConf
.
lastcategory
))
{
cbCategory
->
setSelected
(
i
);
break
;
}
}
RefreshDeck
(
cbCategory
,
cbDeck
);
}
void
Game
::
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
wchar_t
catepath
[
256
];
deckManager
.
GetCategoryPath
(
catepath
,
cbCategory
);
RefreshDeck
(
catepath
,
cbDeck
);
for
(
size_t
i
=
0
;
i
<
cbDeck
->
getItemCount
();
++
i
)
{
if
(
!
wcscmp
(
cbDeck
->
getItem
(
i
),
gameConf
.
lastdeck
))
{
cbDeck
->
setSelected
(
i
);
break
;
}
}
}
void
Game
::
RefreshDeck
(
const
wchar_t
*
deckpath
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
cbDeck
->
clear
();
FileSystem
::
TraversalDir
(
L"./deck"
,
[
cbDeck
](
const
wchar_t
*
name
,
bool
isdir
)
{
FileSystem
::
TraversalDir
(
deckpath
,
[
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
];
...
...
@@ -964,12 +1023,6 @@ void Game::RefreshDeck(irr::gui::IGUIComboBox* cbDeck) {
cbDeck
->
addItem
(
deckname
);
}
});
for
(
size_t
i
=
0
;
i
<
cbDeck
->
getItemCount
();
++
i
)
{
if
(
!
wcscmp
(
cbDeck
->
getItem
(
i
),
gameConf
.
lastdeck
))
{
cbDeck
->
setSelected
(
i
);
break
;
}
}
}
void
Game
::
RefreshReplay
()
{
lstReplayList
->
clear
();
...
...
@@ -1041,6 +1094,8 @@ void Game::LoadConfig() {
gameConf
.
textfontsize
=
12
;
gameConf
.
nickname
[
0
]
=
0
;
gameConf
.
gamename
[
0
]
=
0
;
gameConf
.
bot_deck_path
[
0
]
=
0
;
gameConf
.
lastcategory
[
0
]
=
0
;
gameConf
.
lastdeck
[
0
]
=
0
;
gameConf
.
numfont
[
0
]
=
0
;
gameConf
.
textfont
[
0
]
=
0
;
...
...
@@ -1176,6 +1231,12 @@ void Game::LoadConfig() {
}
else
if
(
!
strcmp
(
strbuf
,
"gamename"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
gamename
,
20
);
}
else
if
(
!
strcmp
(
strbuf
,
"bot_deck_path"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
bot_deck_path
,
64
);
}
else
if
(
!
strcmp
(
strbuf
,
"lastcategory"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
lastcategory
,
64
);
}
else
if
(
!
strcmp
(
strbuf
,
"lastdeck"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
lastdeck
,
64
);
...
...
@@ -1197,6 +1258,8 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"nickname = %s
\n
"
,
linebuf
);
BufferIO
::
EncodeUTF8
(
gameConf
.
gamename
,
linebuf
);
fprintf
(
fp
,
"gamename = %s
\n
"
,
linebuf
);
BufferIO
::
EncodeUTF8
(
gameConf
.
lastcategory
,
linebuf
);
fprintf
(
fp
,
"lastcategory = %s
\n
"
,
linebuf
);
BufferIO
::
EncodeUTF8
(
gameConf
.
lastdeck
,
linebuf
);
fprintf
(
fp
,
"lastdeck = %s
\n
"
,
linebuf
);
BufferIO
::
EncodeUTF8
(
gameConf
.
textfont
,
linebuf
);
...
...
@@ -1229,6 +1292,8 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"ignore_deck_changes = %d
\n
"
,
(
chkIgnoreDeckChanges
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"default_ot = %d
\n
"
,
gameConf
.
defaultOT
);
fprintf
(
fp
,
"enable_bot_mode = %d
\n
"
,
gameConf
.
enable_bot_mode
);
BufferIO
::
EncodeUTF8
(
gameConf
.
bot_deck_path
,
linebuf
);
fprintf
(
fp
,
"bot_deck_path = %s
\n
"
,
linebuf
);
fprintf
(
fp
,
"quick_animation = %d
\n
"
,
gameConf
.
quick_animation
);
fprintf
(
fp
,
"auto_save_replay = %d
\n
"
,
(
chkAutoSaveReplay
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"prefer_expansion_script = %d
\n
"
,
gameConf
.
prefer_expansion_script
);
...
...
@@ -1516,7 +1581,6 @@ void Game::OnResize() {
wMainMenu
->
setRelativePosition
(
ResizeWin
(
370
,
200
,
650
,
415
));
wDeckEdit
->
setRelativePosition
(
Resize
(
309
,
5
,
605
,
130
));
cbDBLFList
->
setRelativePosition
(
Resize
(
80
,
5
,
220
,
30
));
cbDBDecks
->
setRelativePosition
(
Resize
(
80
,
35
,
220
,
60
));
btnClearDeck
->
setRelativePosition
(
Resize
(
115
,
99
,
165
,
120
));
btnSortDeck
->
setRelativePosition
(
Resize
(
60
,
99
,
110
,
120
));
...
...
@@ -1524,6 +1588,9 @@ void Game::OnResize() {
btnSaveDeck
->
setRelativePosition
(
Resize
(
225
,
35
,
290
,
60
));
btnSaveDeckAs
->
setRelativePosition
(
Resize
(
225
,
65
,
290
,
90
));
ebDeckname
->
setRelativePosition
(
Resize
(
80
,
65
,
220
,
90
));
cbDBCategory
->
setRelativePosition
(
Resize
(
80
,
5
,
220
,
30
));
btnManageDeck
->
setRelativePosition
(
Resize
(
225
,
5
,
290
,
30
));
wManageDeck
->
setRelativePosition
(
ResizeWin
(
310
,
135
,
800
,
465
));
wSort
->
setRelativePosition
(
Resize
(
930
,
132
,
1020
,
156
));
cbSortType
->
setRelativePosition
(
Resize
(
10
,
2
,
85
,
22
));
...
...
@@ -1553,7 +1620,7 @@ void Game::OnResize() {
btncatepos
.
LowerRightCorner
.
Y
-
btncatepos
.
getHeight
()
/
2
+
245
));
wLinkMarks
->
setRelativePosition
(
ResizeWin
(
700
,
30
,
820
,
150
));
st
Banlist
->
setRelativePosition
(
Resize
(
10
,
9
,
100
,
29
));
st
DBCategory
->
setRelativePosition
(
Resize
(
10
,
9
,
100
,
29
));
stDeck
->
setRelativePosition
(
Resize
(
10
,
39
,
100
,
59
));
stCategory
->
setRelativePosition
(
Resize
(
10
,
2
+
25
/
6
,
70
,
22
+
25
/
6
));
stLimit
->
setRelativePosition
(
Resize
(
205
,
2
+
25
/
6
,
280
,
22
+
25
/
6
));
...
...
gframe/game.h
View file @
53994c1c
...
...
@@ -21,10 +21,12 @@ struct Config {
wchar_t
lastport
[
10
];
wchar_t
nickname
[
20
];
wchar_t
gamename
[
20
];
wchar_t
lastcategory
[
64
];
wchar_t
lastdeck
[
64
];
wchar_t
textfont
[
256
];
wchar_t
numfont
[
256
];
wchar_t
roompass
[
20
];
wchar_t
bot_deck_path
[
64
];
//settings
int
chkMAutoPos
;
int
chkSTAutoPos
;
...
...
@@ -113,7 +115,9 @@ public:
void
InitStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
u32
cHeight
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
);
void
SetStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
,
u32
pos
=
0
);
void
LoadExpansions
();
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshCategoryDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshDeck
(
const
wchar_t
*
deckpath
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshReplay
();
void
RefreshSingleplay
();
void
RefreshBot
();
...
...
@@ -332,6 +336,7 @@ public:
irr
::
gui
::
IGUIStaticText
*
stHostPrepDuelist
[
4
];
irr
::
gui
::
IGUICheckBox
*
chkHostPrepReady
[
4
];
irr
::
gui
::
IGUIButton
*
btnHostPrepKick
[
4
];
irr
::
gui
::
IGUIComboBox
*
cbCategorySelect
;
irr
::
gui
::
IGUIComboBox
*
cbDeckSelect
;
irr
::
gui
::
IGUIStaticText
*
stHostPrepRule
;
irr
::
gui
::
IGUIStaticText
*
stHostPrepOB
;
...
...
@@ -449,8 +454,9 @@ public:
irr
::
gui
::
IGUIButton
*
btnEP
;
//deck edit
irr
::
gui
::
IGUIStaticText
*
wDeckEdit
;
irr
::
gui
::
IGUIComboBox
*
cbDB
LFList
;
irr
::
gui
::
IGUIComboBox
*
cbDB
Category
;
irr
::
gui
::
IGUIComboBox
*
cbDBDecks
;
irr
::
gui
::
IGUIButton
*
btnManageDeck
;
irr
::
gui
::
IGUIButton
*
btnClearDeck
;
irr
::
gui
::
IGUIButton
*
btnSortDeck
;
irr
::
gui
::
IGUIButton
*
btnShuffleDeck
;
...
...
@@ -462,7 +468,7 @@ public:
irr
::
gui
::
IGUIButton
*
btnSideSort
;
irr
::
gui
::
IGUIButton
*
btnSideReload
;
irr
::
gui
::
IGUIEditBox
*
ebDeckname
;
irr
::
gui
::
IGUIStaticText
*
st
Banlist
;
irr
::
gui
::
IGUIStaticText
*
st
DBCategory
;
irr
::
gui
::
IGUIStaticText
*
stDeck
;
irr
::
gui
::
IGUIStaticText
*
stCategory
;
irr
::
gui
::
IGUIStaticText
*
stLimit
;
...
...
@@ -473,6 +479,19 @@ public:
irr
::
gui
::
IGUIStaticText
*
stStar
;
irr
::
gui
::
IGUIStaticText
*
stSearch
;
irr
::
gui
::
IGUIStaticText
*
stScale
;
//deck manage
irr
::
gui
::
IGUIWindow
*
wManageDeck
;
irr
::
gui
::
IGUIListBox
*
lstCategories
;
irr
::
gui
::
IGUIListBox
*
lstDecks
;
irr
::
gui
::
IGUIComboBox
*
cbDBLFList
;
irr
::
gui
::
IGUIButton
*
btnNewCategory
;
irr
::
gui
::
IGUIButton
*
btnRenameCategory
;
irr
::
gui
::
IGUIButton
*
btnDeleteCategory
;
irr
::
gui
::
IGUIButton
*
btnNewDeck
;
irr
::
gui
::
IGUIButton
*
btnRenameDeck
;
irr
::
gui
::
IGUIButton
*
btnManageDeleteDeck
;
irr
::
gui
::
IGUIButton
*
btnMoveDeck
;
irr
::
gui
::
IGUIButton
*
btnCopyDeck
;
//filter
irr
::
gui
::
IGUIStaticText
*
wFilter
;
irr
::
gui
::
IGUIScrollBar
*
scrFilter
;
...
...
@@ -570,6 +589,7 @@ extern Game* mainGame;
#define CHECKBOX_HP_READY 125
#define BUTTON_HP_READY 126
#define BUTTON_HP_NOTREADY 127
#define COMBOBOX_HP_CATEGORY 128
#define LISTBOX_REPLAY_LIST 130
#define BUTTON_LOAD_REPLAY 131
#define BUTTON_CANCEL_REPLAY 132
...
...
@@ -656,7 +676,8 @@ extern Game* mainGame;
#define SCROLL_CARD_DISPLAY 295
#define BUTTON_CARD_DISP_OK 296
#define COMBOBOX_DBLFLIST 301
#define BUTTON_MANAGE_DECK 300
#define COMBOBOX_DBCATEGORY 301
#define COMBOBOX_DBDECKS 302
#define BUTTON_CLEAR_DECK 303
#define BUTTON_SAVE_DECK 304
...
...
@@ -680,6 +701,20 @@ extern Game* mainGame;
#define BUTTON_MARKS_FILTER 322
#define BUTTON_MARKERS_OK 323
#define COMBOBOX_SORTTYPE 324
#define WINDOW_MANAGE_DECK 330
#define BUTTON_NEW_CATEGORY 331
#define BUTTON_RENAME_CATEGORY 332
#define BUTTON_DELETE_CATEGORY 333
#define BUTTON_NEW_DECK 334
#define BUTTON_RENAME_DECK 335
#define BUTTON_DELETE_DECK_MANAGE 336
#define BUTTON_MOVE_DECK 337
#define BUTTON_COPY_DECK 338
#define COMBOBOX_DBLFLIST 339
#define LISTBOX_CATEGORIES 340
#define LISTBOX_CATEGORY_DECKS 341
#define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_ENABLE_SOUND 361
#define CHECKBOX_ENABLE_MUSIC 362
...
...
gframe/gframe.cpp
View file @
53994c1c
...
...
@@ -112,6 +112,7 @@ int main(int argc, char* argv[]) {
}
else
if
(
!
wcscmp
(
wargv
[
i
],
L"-d"
))
{
// Deck
++
i
;
if
(
i
+
1
<
wargc
)
{
// select deck
ygo
::
mainGame
->
gameConf
.
lastcategory
[
0
]
=
0
;
wcscpy
(
ygo
::
mainGame
->
gameConf
.
lastdeck
,
wargv
[
i
]);
continue
;
}
else
{
// open deck
...
...
gframe/menu_handler.cpp
View file @
53994c1c
...
...
@@ -12,6 +12,8 @@
namespace
ygo
{
void
UpdateDeck
()
{
BufferIO
::
CopyWStr
(
mainGame
->
cbCategorySelect
->
getItem
(
mainGame
->
cbCategorySelect
->
getSelected
()),
mainGame
->
gameConf
.
lastcategory
,
64
);
BufferIO
::
CopyWStr
(
mainGame
->
cbDeckSelect
->
getItem
(
mainGame
->
cbDeckSelect
->
getSelected
()),
mainGame
->
gameConf
.
lastdeck
,
64
);
char
deckbuf
[
1024
];
...
...
@@ -141,6 +143,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_HP_DUELIST
:
{
mainGame
->
cbCategorySelect
->
setEnabled
(
true
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
DuelClient
::
SendPacketToServer
(
CTOS_HS_TODUELIST
);
break
;
...
...
@@ -162,17 +165,19 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_HP_READY
:
{
if
(
mainGame
->
cbDeckSelect
->
getSelected
()
==
-
1
||
!
deckManager
.
LoadDeck
(
mainGame
->
cb
DeckSelect
->
getItem
(
mainGame
->
cbDeckSelect
->
getSelected
())
))
{
if
(
mainGame
->
cb
CategorySelect
->
getSelected
()
==
-
1
||
mainGame
->
cb
DeckSelect
->
getSelected
()
==
-
1
||
!
deckManager
.
LoadDeck
(
mainGame
->
cb
CategorySelect
,
mainGame
->
cbDeckSelect
))
{
break
;
}
UpdateDeck
();
DuelClient
::
SendPacketToServer
(
CTOS_HS_READY
);
mainGame
->
cbCategorySelect
->
setEnabled
(
false
);
mainGame
->
cbDeckSelect
->
setEnabled
(
false
);
break
;
}
case
BUTTON_HP_NOTREADY
:
{
DuelClient
::
SendPacketToServer
(
CTOS_HS_NOTREADY
);
mainGame
->
cbCategorySelect
->
setEnabled
(
true
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
break
;
}
...
...
@@ -338,7 +343,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_DECK_EDIT
:
{
mainGame
->
Refresh
Deck
(
mainGame
->
cbDBDecks
);
mainGame
->
Refresh
CategoryDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
if
(
open_file
&&
deckManager
.
LoadDeck
(
open_file_name
))
{
#ifdef WIN32
wchar_t
*
dash
=
wcsrchr
(
open_file_name
,
L'\\'
);
...
...
@@ -361,8 +366,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
}
open_file
=
false
;
}
else
if
(
mainGame
->
cbDBDecks
->
getSelected
()
!=
-
1
)
{
deckManager
.
LoadDeck
(
mainGame
->
cbDB
Decks
->
getItem
(
mainGame
->
cbDBDecks
->
getSelected
())
);
}
else
if
(
mainGame
->
cbDB
Category
->
getSelected
()
!=
-
1
&&
mainGame
->
cbDB
Decks
->
getSelected
()
!=
-
1
)
{
deckManager
.
LoadDeck
(
mainGame
->
cbDB
Category
,
mainGame
->
cbDBDecks
);
mainGame
->
ebDeckname
->
setText
(
L""
);
}
mainGame
->
HideElement
(
mainGame
->
wMainMenu
);
...
...
@@ -517,6 +522,23 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
break
;
}
case
irr
:
:
gui
::
EGET_COMBO_BOX_CHANGED
:
{
switch
(
id
)
{
case
COMBOBOX_HP_CATEGORY
:
{
int
catesel
=
mainGame
->
cbCategorySelect
->
getSelected
();
if
(
catesel
==
3
)
{
catesel
=
2
;
mainGame
->
cbCategorySelect
->
setSelected
(
2
);
}
if
(
catesel
>=
0
)
{
mainGame
->
RefreshDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
);
mainGame
->
cbDeckSelect
->
setSelected
(
0
);
}
break
;
}
}
break
;
}
case
irr
:
:
gui
::
EGET_CHECKBOX_CHANGED
:
{
switch
(
id
)
{
case
CHECKBOX_HP_READY
:
{
...
...
@@ -524,16 +546,18 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
mainGame
->
env
->
setFocus
(
mainGame
->
wHostPrepare
);
if
(
static_cast
<
irr
::
gui
::
IGUICheckBox
*>
(
caller
)
->
isChecked
())
{
if
(
mainGame
->
cbDeckSelect
->
getSelected
()
==
-
1
||
!
deckManager
.
LoadDeck
(
mainGame
->
cbDeckSelect
->
getItem
(
mainGame
->
cbDeckSelect
->
getSelected
())
))
{
if
(
mainGame
->
cb
CategorySelect
->
getSelected
()
==
-
1
||
mainGame
->
cb
DeckSelect
->
getSelected
()
==
-
1
||
!
deckManager
.
LoadDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
))
{
static_cast
<
irr
::
gui
::
IGUICheckBox
*>
(
caller
)
->
setChecked
(
false
);
break
;
}
UpdateDeck
();
DuelClient
::
SendPacketToServer
(
CTOS_HS_READY
);
mainGame
->
cbCategorySelect
->
setEnabled
(
false
);
mainGame
->
cbDeckSelect
->
setEnabled
(
false
);
}
else
{
DuelClient
::
SendPacketToServer
(
CTOS_HS_NOTREADY
);
mainGame
->
cbCategorySelect
->
setEnabled
(
true
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
}
break
;
...
...
gframe/myfilesystem.h
View file @
53994c1c
...
...
@@ -59,7 +59,8 @@ public:
if
(
fh
==
INVALID_HANDLE_VALUE
)
return
;
do
{
cb
(
fdataw
.
cFileName
,
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
));
if
(
mywcsncasecmp
(
fdataw
.
cFileName
,
L"."
,
1
)
&&
mywcsncasecmp
(
fdataw
.
cFileName
,
L".."
,
2
))
cb
(
fdataw
.
cFileName
,
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
));
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
...
...
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