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
baichixing
ygopro
Commits
77b65772
Commit
77b65772
authored
May 20, 2020
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temp
parent
7bab7fd2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
88 additions
and
3 deletions
+88
-3
gframe/deck_con.cpp
gframe/deck_con.cpp
+1
-0
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+28
-0
gframe/deck_manager.h
gframe/deck_manager.h
+3
-1
gframe/drawing.cpp
gframe/drawing.cpp
+52
-1
gframe/game.h
gframe/game.h
+4
-1
No files found.
gframe/deck_con.cpp
View file @
77b65772
...
...
@@ -1034,6 +1034,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
deckManager
.
GetCategoryPath
(
catepath
,
mainGame
->
lstCategories
->
getSelected
(),
mainGame
->
lstCategories
->
getListItem
(
mainGame
->
lstCategories
->
getSelected
()));
myswprintf
(
filepath
,
L"%ls/%ls.ydk"
,
catepath
,
mainGame
->
lstDecks
->
getListItem
(
decksel
));
deckManager
.
LoadDeck
(
filepath
);
deckManager
.
LoadPack
(
filepath
);
prev_deck
=
decksel
;
break
;
}
...
...
gframe/deck_manager.cpp
View file @
77b65772
...
...
@@ -271,6 +271,34 @@ bool DeckManager::LoadDeck(const wchar_t* file) {
LoadDeck
(
current_deck
,
cardlist
,
mainc
,
sidec
);
return
true
;
}
bool
DeckManager
::
LoadPack
(
const
wchar_t
*
file
)
{
pack
.
clear
();
//for(int i=1;i<=80;i++)
//pack.push_back(dataManager.GetCodePointer(102380));
int
code
;
FILE
*
fp
=
OpenDeckFile
(
file
,
"r"
);
if
(
!
fp
)
{
wchar_t
localfile
[
64
];
myswprintf
(
localfile
,
L"./deck/%ls.ydk"
,
file
);
fp
=
OpenDeckFile
(
localfile
,
"r"
);
}
if
(
!
fp
)
return
false
;
char
linebuf
[
256
];
while
(
fgets
(
linebuf
,
256
,
fp
))
{
if
(
linebuf
[
0
]
==
'!'
)
{
continue
;
}
if
(
linebuf
[
0
]
<
'0'
||
linebuf
[
0
]
>
'9'
)
continue
;
code
=
atoi
(
linebuf
);
pack
.
push_back
(
dataManager
.
GetCodePointer
(
code
));
//pack.push_back(dataManager.GetCodePointer(code));
}
fclose
(
fp
);
return
true
;
}
bool
DeckManager
::
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
file
)
{
if
(
!
FileSystem
::
IsDirExists
(
L"./deck"
)
&&
!
FileSystem
::
MakeDir
(
L"./deck"
))
return
false
;
...
...
gframe/deck_manager.h
View file @
77b65772
...
...
@@ -34,6 +34,7 @@ class DeckManager {
public:
Deck
current_deck
;
std
::
vector
<
LFList
>
_lfList
;
std
::
vector
<
code_pointer
>
pack
;
void
LoadLFListSingle
(
const
char
*
path
);
void
LoadLFList
();
...
...
@@ -46,7 +47,8 @@ public:
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
LoadDeck
(
const
wchar_t
*
file
);
bool
LoadPack
(
const
wchar_t
*
file
);
bool
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
file
);
bool
DeleteDeck
(
const
wchar_t
*
file
);
bool
CreateCategory
(
const
wchar_t
*
name
);
...
...
gframe/drawing.cpp
View file @
77b65772
...
...
@@ -1093,7 +1093,7 @@ void Game::DrawThumb(code_pointer cp, position2di pos, const std::unordered_map<
}
}
}
void
Game
::
DrawDeck
Bd
()
{
void
Game
::
DrawDeck
()
{
wchar_t
textBuffer
[
64
];
//main deck
driver
->
draw2DRectangle
(
Resize
(
310
,
137
,
410
,
157
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
...
...
@@ -1146,6 +1146,50 @@ void Game::DrawDeckBd() {
if
(
deckBuilder
.
hovered_pos
==
3
&&
deckBuilder
.
hovered_seq
==
(
int
)
i
)
driver
->
draw2DRectangleOutline
(
Resize
(
313
+
i
*
dx
,
563
,
359
+
i
*
dx
,
629
));
}
}
void
Game
::
DrawPack
()
{
wchar_t
textBuffer
[
64
];
//show pack
driver
->
draw2DRectangle
(
Resize
(
310
,
137
,
410
,
157
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
309
,
136
,
410
,
157
));
DrawShadowText
(
textFont
,
dataManager
.
GetSysString
(
1330
),
Resize
(
315
,
137
,
410
,
157
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
DrawShadowText
(
numFont
,
dataManager
.
numStrings
[
deckManager
.
pack
.
size
()],
Resize
(
380
,
138
,
440
,
158
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
//driver->draw2DRectangle(Resize(310, 160, 797, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
//driver->draw2DRectangleOutline(Resize(309, 159, 797, 630));
driver
->
draw2DRectangle
(
Resize
(
310
,
160
,
797
,
436
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
309
,
159
,
797
,
436
));
int
lx
;
float
dx
;
if
(
deckManager
.
pack
.
size
()
<=
40
)
{
dx
=
436.0
f
/
9
;
lx
=
10
;
}
else
{
lx
=
(
deckManager
.
pack
.
size
()
-
41
)
/
4
+
11
;
dx
=
436.0
f
/
(
lx
-
1
);
}
for
(
size_t
i
=
0
;
i
<
deckManager
.
pack
.
size
();
++
i
)
{
DrawThumb
(
deckManager
.
pack
[
i
],
position2di
(
314
+
(
i
%
lx
)
*
dx
,
164
+
(
i
/
lx
)
*
68
),
deckBuilder
.
filterList
);
if
(
deckBuilder
.
hovered_pos
==
1
&&
deckBuilder
.
hovered_seq
==
(
int
)
i
)
driver
->
draw2DRectangleOutline
(
Resize
(
313
+
(
i
%
lx
)
*
dx
,
163
+
(
i
/
lx
)
*
68
,
359
+
(
i
%
lx
)
*
dx
,
228
+
(
i
/
lx
)
*
68
));
}
//extra deck
driver
->
draw2DRectangle
(
Resize
(
310
,
440
,
410
,
460
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
309
,
439
,
410
,
460
));
DrawShadowText
(
textFont
,
dataManager
.
GetSysString
(
1331
),
Resize
(
315
,
440
,
410
,
460
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
DrawShadowText
(
numFont
,
dataManager
.
numStrings
[
deckManager
.
current_deck
.
extra
.
size
()],
Resize
(
380
,
441
,
440
,
461
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
driver
->
draw2DRectangle
(
Resize
(
310
,
463
,
797
,
533
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
309
,
462
,
797
,
533
));
//side deck
driver
->
draw2DRectangle
(
Resize
(
310
,
537
,
410
,
557
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
309
,
536
,
410
,
557
));
DrawShadowText
(
textFont
,
dataManager
.
GetSysString
(
1332
),
Resize
(
315
,
537
,
410
,
557
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
DrawShadowText
(
numFont
,
dataManager
.
numStrings
[
deckManager
.
current_deck
.
side
.
size
()],
Resize
(
380
,
538
,
440
,
558
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
driver
->
draw2DRectangle
(
Resize
(
310
,
560
,
797
,
630
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
309
,
559
,
797
,
630
));
}
void
Game
::
DrawSearchResults
()
{
wchar_t
textBuffer
[
64
];
//search result
driver
->
draw2DRectangle
(
Resize
(
805
,
137
,
926
,
157
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
804
,
136
,
926
,
157
));
...
...
@@ -1207,6 +1251,13 @@ void Game::DrawDeckBd() {
DrawShadowText
(
textFont
,
textBuffer
,
Resize
(
860
,
209
+
i
*
66
,
955
,
229
+
i
*
66
),
Resize
(
1
,
1
,
0
,
0
));
}
}
}
void
Game
::
DrawDeckBd
()
{
if
(
deckManager
.
pack
.
empty
())
DrawDeck
();
else
DrawPack
();
DrawSearchResults
();
if
(
deckBuilder
.
is_draging
)
{
DrawThumb
(
deckBuilder
.
draging_pointer
,
position2di
(
deckBuilder
.
dragx
-
CARD_THUMB_WIDTH
/
2
*
mainGame
->
xScale
,
deckBuilder
.
dragy
-
CARD_THUMB_HEIGHT
/
2
*
mainGame
->
yScale
),
deckBuilder
.
filterList
,
true
);
}
...
...
gframe/game.h
View file @
77b65772
...
...
@@ -140,7 +140,10 @@ public:
void
HideElement
(
irr
::
gui
::
IGUIElement
*
element
,
bool
set_action
=
false
);
void
PopupElement
(
irr
::
gui
::
IGUIElement
*
element
,
int
hideframe
=
0
);
void
WaitFrameSignal
(
int
frame
);
void
DrawThumb
(
code_pointer
cp
,
position2di
pos
,
const
std
::
unordered_map
<
int
,
int
>*
lflist
,
bool
drag
=
false
);
void
DrawThumb
(
code_pointer
cp
,
position2di
pos
,
const
std
::
unordered_map
<
int
,
int
>*
lflist
,
bool
drag
=
false
);
void
DrawDeck
();
void
DrawPack
();
void
DrawSearchResults
();
void
DrawDeckBd
();
void
LoadConfig
();
void
SaveConfig
();
...
...
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