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
1cac2d9f
Commit
1cac2d9f
authored
Apr 07, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add rename deck
parent
f24fe048
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
0 deletions
+81
-0
gframe/deck_con.cpp
gframe/deck_con.cpp
+40
-0
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+17
-0
gframe/deck_manager.h
gframe/deck_manager.h
+1
-0
gframe/game.cpp
gframe/game.cpp
+10
-0
gframe/game.h
gframe/game.h
+10
-0
strings.conf
strings.conf
+3
-0
No files found.
gframe/deck_con.cpp
View file @
1cac2d9f
...
...
@@ -176,6 +176,46 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
break
;
}
case
BUTTON_RENAME_DECK
:
{
int
sel
=
mainGame
->
cbDBDecks
->
getSelected
();
if
(
sel
==
-
1
)
break
;
mainGame
->
gMutex
.
Lock
();
mainGame
->
wRenameDeck
->
setText
(
dataManager
.
GetSysString
(
1367
));
mainGame
->
ebREName
->
setText
(
mainGame
->
cbDBDecks
->
getItem
(
sel
));
mainGame
->
PopupElement
(
mainGame
->
wRenameDeck
);
mainGame
->
gMutex
.
Unlock
();
prev_operation
=
id
;
prev_sel
=
sel
;
break
;
}
case
BUTTON_RENAME_DECK_SAVE
:
{
mainGame
->
HideElement
(
mainGame
->
wRenameDeck
);
if
(
prev_operation
==
BUTTON_RENAME_DECK
)
{
wchar_t
newname
[
256
];
BufferIO
::
CopyWStr
(
mainGame
->
ebREName
->
getText
(),
newname
,
256
);
if
(
mywcsncasecmp
(
newname
+
wcslen
(
newname
)
-
4
,
L""
,
4
))
{
myswprintf
(
newname
,
L"%ls"
,
mainGame
->
ebREName
->
getText
());
}
if
(
DeckManager
::
RenameDeck
(
mainGame
->
cbDBDecks
->
getItem
(
prev_sel
),
newname
))
{
mainGame
->
RefreshDeck
(
mainGame
->
cbDBDecks
);
mainGame
->
cbDBDecks
->
setSelected
(
prev_sel
);
mainGame
->
stACMessage
->
setText
(
dataManager
.
GetSysString
(
1366
));
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
}
else
{
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1365
));
}
}
prev_operation
=
0
;
prev_sel
=
-
1
;
break
;
}
case
BUTTON_RENAME_DECK_CANCEL
:
{
mainGame
->
HideElement
(
mainGame
->
wRenameDeck
);
prev_operation
=
0
;
prev_sel
=
-
1
;
break
;
}
case
BUTTON_DELETE_DECK
:
{
int
sel
=
mainGame
->
cbDBDecks
->
getSelected
();
if
(
sel
==
-
1
)
...
...
gframe/deck_manager.cpp
View file @
1cac2d9f
...
...
@@ -54,6 +54,23 @@ void DeckManager::LoadLFList() {
nolimit
.
content
=
new
std
::
unordered_map
<
int
,
int
>
;
_lfList
.
push_back
(
nolimit
);
}
bool
DeckManager
::
RenameDeck
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
)
{
wchar_t
oldfname
[
256
];
wchar_t
newfname
[
256
];
myswprintf
(
oldfname
,
L"./deck/%ls.ydk"
,
oldname
);
myswprintf
(
newfname
,
L"./deck/%ls.ydk"
,
newname
);
#ifdef WIN32
BOOL
result
=
MoveFileW
(
oldfname
,
newfname
);
return
!!
result
;
#else
char
oldfilefn
[
256
];
char
newfilefn
[
256
];
BufferIO
::
EncodeUTF8
(
oldfname
,
oldfilefn
);
BufferIO
::
EncodeUTF8
(
newfname
,
newfilefn
);
int
result
=
rename
(
oldfilefn
,
newfilefn
);
return
result
==
0
;
#endif
}
wchar_t
*
DeckManager
::
GetLFListName
(
int
lfhash
)
{
for
(
size_t
i
=
0
;
i
<
_lfList
.
size
();
++
i
)
{
if
(
_lfList
[
i
].
hash
==
(
unsigned
int
)
lfhash
)
{
...
...
gframe/deck_manager.h
View file @
1cac2d9f
...
...
@@ -44,6 +44,7 @@ public:
bool
LoadDeck
(
const
wchar_t
*
file
);
bool
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
name
);
bool
DeleteDeck
(
Deck
&
deck
,
const
wchar_t
*
name
);
static
bool
RenameDeck
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
);
};
extern
DeckManager
deckManager
;
...
...
gframe/game.cpp
View file @
1cac2d9f
...
...
@@ -470,11 +470,21 @@ bool Game::Initialize() {
btnSideSort
->
setVisible
(
false
);
btnSideReload
=
env
->
addButton
(
rect
<
s32
>
(
440
,
100
,
500
,
130
),
0
,
BUTTON_SIDE_RELOAD
,
dataManager
.
GetSysString
(
1309
));
btnSideReload
->
setVisible
(
false
);
btnRenameDeck
=
env
->
addButton
(
rect
<
s32
>
(
170
,
99
,
220
,
120
),
wDeckEdit
,
BUTTON_RENAME_DECK
,
dataManager
.
GetSysString
(
1362
));
//
scrFilter
=
env
->
addScrollBar
(
false
,
recti
(
999
,
161
,
1019
,
629
),
0
,
SCROLL_FILTER
);
scrFilter
->
setLargeStep
(
10
);
scrFilter
->
setSmallStep
(
1
);
scrFilter
->
setVisible
(
false
);
//rename deck
wRenameDeck
=
env
->
addWindow
(
rect
<
s32
>
(
510
,
200
,
820
,
320
),
false
,
dataManager
.
GetSysString
(
1367
));
wRenameDeck
->
getCloseButton
()
->
setVisible
(
false
);
wRenameDeck
->
setVisible
(
false
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1368
),
rect
<
s32
>
(
20
,
25
,
290
,
45
),
false
,
false
,
wRenameDeck
);
ebREName
=
env
->
addEditBox
(
L""
,
rect
<
s32
>
(
20
,
50
,
290
,
70
),
true
,
wRenameDeck
,
-
1
);
ebREName
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
btnREYes
=
env
->
addButton
(
rect
<
s32
>
(
70
,
80
,
140
,
105
),
wRenameDeck
,
BUTTON_RENAME_DECK_SAVE
,
dataManager
.
GetSysString
(
1341
));
btnRENo
=
env
->
addButton
(
rect
<
s32
>
(
170
,
80
,
240
,
105
),
wRenameDeck
,
BUTTON_RENAME_DECK_CANCEL
,
dataManager
.
GetSysString
(
1212
));
//sort type
wSort
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
930
,
132
,
1020
,
156
),
true
,
false
,
0
,
-
1
,
true
);
cbSortType
=
env
->
addComboBox
(
rect
<
s32
>
(
10
,
2
,
85
,
22
),
wSort
,
COMBOBOX_SORTTYPE
);
...
...
gframe/game.h
View file @
1cac2d9f
...
...
@@ -415,6 +415,12 @@ public:
irr
::
gui
::
IGUIButton
*
btnSideSort
;
irr
::
gui
::
IGUIButton
*
btnSideReload
;
irr
::
gui
::
IGUIEditBox
*
ebDeckname
;
irr
::
gui
::
IGUIButton
*
btnRenameDeck
;
//deck rename
irr
::
gui
::
IGUIWindow
*
wRenameDeck
;
irr
::
gui
::
IGUIEditBox
*
ebREName
;
irr
::
gui
::
IGUIButton
*
btnREYes
;
irr
::
gui
::
IGUIButton
*
btnRENo
;
//filter
irr
::
gui
::
IGUIStaticText
*
wFilter
;
irr
::
gui
::
IGUIScrollBar
*
scrFilter
;
...
...
@@ -620,5 +626,9 @@ extern Game* mainGame;
#define BUTTON_MARKS_FILTER 380
#define BUTTON_MARKERS_OK 381
#define BUTTON_RENAME_DECK 386
#define BUTTON_RENAME_DECK_SAVE 387
#define BUTTON_RENAME_DECK_CANCEL 388
#define DEFAULT_DUEL_RULE 4
#endif // GAME_H
strings.conf
View file @
1cac2d9f
...
...
@@ -377,6 +377,9 @@
!
system
1363
是否删除这个录像?
!
system
1364
重命名录像
!
system
1365
重命名失败,可能存在同名文件
!
system
1366
重命名成功
!
system
1367
重命名卡组
!
system
1368
卡组文件:
!
system
1370
星数↑
!
system
1371
攻击↑
!
system
1372
守备↑
...
...
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