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
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
Commits
fc43ebb3
Commit
fc43ebb3
authored
Nov 29, 2015
by
woodee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1514 from DailyShana/setname
display and search setname
parents
84597221
aa825400
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
368 additions
and
9 deletions
+368
-9
gframe/data_manager.cpp
gframe/data_manager.cpp
+34
-0
gframe/data_manager.h
gframe/data_manager.h
+5
-0
gframe/deck_con.cpp
gframe/deck_con.cpp
+21
-3
gframe/event_handler.cpp
gframe/event_handler.cpp
+3
-0
gframe/game.cpp
gframe/game.cpp
+23
-6
gframe/game.h
gframe/game.h
+1
-0
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+1
-0
gframe/single_mode.cpp
gframe/single_mode.cpp
+1
-0
strings.conf
strings.conf
+279
-0
No files found.
gframe/data_manager.cpp
View file @
fc43ebb3
...
...
@@ -102,6 +102,12 @@ bool DataManager::LoadStrings(const char* file) {
wchar_t
*
pbuf
=
new
wchar_t
[
len
+
1
];
wcscpy
(
pbuf
,
strBuffer
);
_counterStrings
[
value
]
=
pbuf
;
}
else
if
(
!
strcmp
(
strbuf
,
"setname"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\t
^
\n
]"
,
&
value
,
strbuf
);
//using tab for comment
int
len
=
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
wchar_t
*
pbuf
=
new
wchar_t
[
len
+
1
];
wcscpy
(
pbuf
,
strBuffer
);
_setnameStrings
[
value
]
=
pbuf
;
}
}
fclose
(
fp
);
...
...
@@ -182,6 +188,18 @@ const wchar_t* DataManager::GetCounterName(int code) {
return
unknown_string
;
return
csit
->
second
;
}
const
wchar_t
*
DataManager
::
GetSetName
(
int
code
)
{
auto
csit
=
_setnameStrings
.
find
(
code
);
if
(
csit
==
_setnameStrings
.
end
())
return
L""
;
return
csit
->
second
;
}
unsigned
int
DataManager
::
GetSetCode
(
const
wchar_t
*
setname
)
{
for
(
auto
csit
=
_setnameStrings
.
begin
();
csit
!=
_setnameStrings
.
end
();
csit
++
)
if
(
wcscmp
(
csit
->
second
,
setname
)
==
0
)
return
csit
->
first
;
return
0
;
}
const
wchar_t
*
DataManager
::
GetNumString
(
int
num
,
bool
bracket
)
{
if
(
!
bracket
)
return
numStrings
[
num
];
...
...
@@ -259,6 +277,22 @@ const wchar_t* DataManager::FormatType(int type) {
return
unknown_string
;
return
tpBuffer
;
}
const
wchar_t
*
DataManager
::
FormatSetName
(
unsigned
long
long
setcode
)
{
wchar_t
*
p
=
scBuffer
;
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
const
wchar_t
*
setname
=
GetSetName
((
setcode
>>
i
*
16
)
&
0xffff
);
if
(
setname
!=
L""
)
{
BufferIO
::
CopyWStrRef
(
setname
,
p
,
16
);
*
p
=
L'|'
;
*++
p
=
0
;
}
}
if
(
p
!=
scBuffer
)
*
(
p
-
1
)
=
0
;
else
return
unknown_string
;
return
scBuffer
;
}
int
DataManager
::
CardReader
(
int
code
,
void
*
pData
)
{
if
(
!
dataManager
.
GetData
(
code
,
(
CardData
*
)
pData
))
memset
(
pData
,
0
,
sizeof
(
CardData
));
...
...
gframe/data_manager.h
View file @
fc43ebb3
...
...
@@ -23,16 +23,20 @@ public:
const
wchar_t
*
GetSysString
(
int
code
);
const
wchar_t
*
GetVictoryString
(
int
code
);
const
wchar_t
*
GetCounterName
(
int
code
);
const
wchar_t
*
GetSetName
(
int
code
);
unsigned
int
GetSetCode
(
const
wchar_t
*
setname
);
const
wchar_t
*
GetNumString
(
int
num
,
bool
bracket
=
false
);
const
wchar_t
*
FormatLocation
(
int
location
,
int
sequence
);
const
wchar_t
*
FormatAttribute
(
int
attribute
);
const
wchar_t
*
FormatRace
(
int
race
);
const
wchar_t
*
FormatType
(
int
type
);
const
wchar_t
*
FormatSetName
(
unsigned
long
long
setcode
);
std
::
unordered_map
<
unsigned
int
,
CardDataC
>
_datas
;
std
::
unordered_map
<
unsigned
int
,
CardString
>
_strings
;
std
::
unordered_map
<
unsigned
int
,
wchar_t
*>
_counterStrings
;
std
::
unordered_map
<
unsigned
int
,
wchar_t
*>
_victoryStrings
;
std
::
unordered_map
<
unsigned
int
,
wchar_t
*>
_setnameStrings
;
wchar_t
*
_sysStrings
[
2048
];
wchar_t
numStrings
[
256
][
4
];
...
...
@@ -40,6 +44,7 @@ public:
wchar_t
attBuffer
[
128
];
wchar_t
racBuffer
[
128
];
wchar_t
tpBuffer
[
128
];
wchar_t
scBuffer
[
128
];
static
wchar_t
strBuffer
[
2048
];
static
const
wchar_t
*
unknown_string
;
...
...
gframe/deck_con.cpp
View file @
fc43ebb3
...
...
@@ -657,7 +657,10 @@ void DeckBuilder::FilterCards() {
myswprintf
(
result_string
,
L"%d"
,
results
.
size
());
return
;
}
if
(
pstr
[
0
]
==
0
||
(
pstr
[
0
]
==
L'$'
&&
pstr
[
1
]
==
0
))
unsigned
int
set_code
=
0
;
if
(
pstr
[
0
]
==
L'#'
)
set_code
=
dataManager
.
GetSetCode
(
&
pstr
[
1
]);
if
(
pstr
[
0
]
==
0
||
(
pstr
[
0
]
==
L'$'
&&
pstr
[
1
]
==
0
)
||
(
pstr
[
0
]
==
L'#'
&&
pstr
[
1
]
==
0
))
pstr
=
0
;
auto
strpointer
=
dataManager
.
_strings
.
begin
();
for
(
code_pointer
ptr
=
dataManager
.
_datas
.
begin
();
ptr
!=
dataManager
.
_datas
.
end
();
++
ptr
,
++
strpointer
)
{
...
...
@@ -723,8 +726,23 @@ void DeckBuilder::FilterCards() {
if
(
pstr
[
0
]
==
L'$'
)
{
if
(
wcsstr
(
text
.
name
,
&
pstr
[
1
])
==
0
)
continue
;
}
else
{
}
else
if
(
pstr
[
0
]
==
L'#'
&&
set_code
)
{
unsigned
long
long
sc
=
data
.
setcode
;
if
(
data
.
alias
)
{
auto
aptr
=
dataManager
.
_datas
.
find
(
data
.
alias
);
if
(
aptr
!=
dataManager
.
_datas
.
end
())
sc
=
aptr
->
second
.
setcode
;
}
bool
res
=
false
;
int
settype
=
set_code
&
0xfff
;
int
setsubtype
=
set_code
&
0xf000
;
while
(
sc
)
{
if
((
sc
&
0xfff
)
==
settype
&&
(
sc
&
0xf000
&
setsubtype
)
==
setsubtype
)
res
=
true
;
sc
=
sc
>>
16
;
}
if
(
!
res
)
continue
;
}
else
{
if
(
wcsstr
(
text
.
name
,
pstr
)
==
0
&&
wcsstr
(
text
.
text
,
pstr
)
==
0
)
continue
;
}
...
...
gframe/event_handler.cpp
View file @
fc43ebb3
...
...
@@ -917,6 +917,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
stName
->
setText
(
L""
);
mainGame
->
stInfo
->
setText
(
L""
);
mainGame
->
stDataInfo
->
setText
(
L""
);
mainGame
->
stSetName
->
setText
(
L""
);
mainGame
->
stText
->
setText
(
L""
);
mainGame
->
scrCardText
->
setVisible
(
false
);
}
...
...
@@ -931,6 +932,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
stName
->
setText
(
L""
);
mainGame
->
stInfo
->
setText
(
L""
);
mainGame
->
stDataInfo
->
setText
(
L""
);
mainGame
->
stSetName
->
setText
(
L""
);
mainGame
->
stText
->
setText
(
L""
);
mainGame
->
scrCardText
->
setVisible
(
false
);
}
...
...
@@ -1603,6 +1605,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
stName
->
setText
(
L""
);
mainGame
->
stInfo
->
setText
(
L""
);
mainGame
->
stDataInfo
->
setText
(
L""
);
mainGame
->
stSetName
->
setText
(
L""
);
mainGame
->
stText
->
setText
(
L""
);
mainGame
->
scrCardText
->
setVisible
(
false
);
}
...
...
gframe/game.cpp
View file @
fc43ebb3
...
...
@@ -244,8 +244,10 @@ bool Game::Initialize() {
stInfo
->
setOverrideColor
(
SColor
(
255
,
0
,
0
,
255
));
stDataInfo
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
15
,
60
,
296
,
83
),
false
,
true
,
tabInfo
,
-
1
,
false
);
stDataInfo
->
setOverrideColor
(
SColor
(
255
,
0
,
0
,
255
));
stText
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
15
,
83
,
287
,
324
),
false
,
true
,
tabInfo
,
-
1
,
false
);
scrCardText
=
env
->
addScrollBar
(
false
,
rect
<
s32
>
(
267
,
83
,
287
,
324
),
tabInfo
,
SCROLL_CARDTEXT
);
stSetName
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
15
,
83
,
296
,
106
),
false
,
true
,
tabInfo
,
-
1
,
false
);
stSetName
->
setOverrideColor
(
SColor
(
255
,
0
,
0
,
255
));
stText
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
15
,
106
,
287
,
324
),
false
,
true
,
tabInfo
,
-
1
,
false
);
scrCardText
=
env
->
addScrollBar
(
false
,
rect
<
s32
>
(
267
,
106
,
287
,
324
),
tabInfo
,
SCROLL_CARDTEXT
);
scrCardText
->
setLargeStep
(
1
);
scrCardText
->
setSmallStep
(
1
);
scrCardText
->
setVisible
(
false
);
...
...
@@ -885,6 +887,19 @@ void Game::ShowCardInfo(int code) {
myswprintf
(
formatBuffer
,
L"%ls[%08d]"
,
dataManager
.
GetName
(
cd
.
alias
),
cd
.
alias
);
else
myswprintf
(
formatBuffer
,
L"%ls[%08d]"
,
dataManager
.
GetName
(
code
),
code
);
stName
->
setText
(
formatBuffer
);
int
offset
=
0
;
unsigned
long
long
sc
=
cd
.
setcode
;
if
(
cd
.
alias
)
{
auto
aptr
=
dataManager
.
_datas
.
find
(
cd
.
alias
);
if
(
aptr
!=
dataManager
.
_datas
.
end
())
sc
=
aptr
->
second
.
setcode
;
}
if
(
sc
)
{
offset
=
23
;
myswprintf
(
formatBuffer
,
L"%ls%ls"
,
dataManager
.
GetSysString
(
1329
),
dataManager
.
FormatSetName
(
sc
));
stSetName
->
setText
(
formatBuffer
);
}
else
stSetName
->
setText
(
L""
);
if
(
cd
.
type
&
TYPE_MONSTER
)
{
myswprintf
(
formatBuffer
,
L"[%ls] %ls/%ls"
,
dataManager
.
FormatType
(
cd
.
type
),
dataManager
.
FormatRace
(
cd
.
race
),
dataManager
.
FormatAttribute
(
cd
.
attribute
));
stInfo
->
setText
(
formatBuffer
);
...
...
@@ -907,14 +922,16 @@ void Game::ShowCardInfo(int code) {
wcscat
(
formatBuffer
,
scaleBuffer
);
}
stDataInfo
->
setText
(
formatBuffer
);
stText
->
setRelativePosition
(
rect
<
s32
>
(
15
,
83
,
287
,
324
));
scrCardText
->
setRelativePosition
(
rect
<
s32
>
(
267
,
83
,
287
,
324
));
stSetName
->
setRelativePosition
(
rect
<
s32
>
(
15
,
83
,
296
,
106
));
stText
->
setRelativePosition
(
rect
<
s32
>
(
15
,
83
+
offset
,
287
,
324
));
scrCardText
->
setRelativePosition
(
rect
<
s32
>
(
267
,
83
+
offset
,
287
,
324
));
}
else
{
myswprintf
(
formatBuffer
,
L"[%ls]"
,
dataManager
.
FormatType
(
cd
.
type
));
stInfo
->
setText
(
formatBuffer
);
stDataInfo
->
setText
(
L""
);
stText
->
setRelativePosition
(
rect
<
s32
>
(
15
,
60
,
287
,
324
));
scrCardText
->
setRelativePosition
(
rect
<
s32
>
(
267
,
60
,
287
,
324
));
stSetName
->
setRelativePosition
(
rect
<
s32
>
(
15
,
60
,
296
,
83
));
stText
->
setRelativePosition
(
rect
<
s32
>
(
15
,
60
+
offset
,
287
,
324
));
scrCardText
->
setRelativePosition
(
rect
<
s32
>
(
267
,
60
+
offset
,
287
,
324
));
}
showingtext
=
dataManager
.
GetText
(
code
);
const
auto
&
tsize
=
stText
->
getRelativePosition
();
...
...
gframe/game.h
View file @
fc43ebb3
...
...
@@ -172,6 +172,7 @@ public:
irr
::
gui
::
IGUIStaticText
*
stName
;
irr
::
gui
::
IGUIStaticText
*
stInfo
;
irr
::
gui
::
IGUIStaticText
*
stDataInfo
;
irr
::
gui
::
IGUIStaticText
*
stSetName
;
irr
::
gui
::
IGUIStaticText
*
stText
;
irr
::
gui
::
IGUIScrollBar
*
scrCardText
;
irr
::
gui
::
IGUICheckBox
*
chkAutoPos
;
...
...
gframe/menu_handler.cpp
View file @
fc43ebb3
...
...
@@ -171,6 +171,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
stName
->
setText
(
L""
);
mainGame
->
stInfo
->
setText
(
L""
);
mainGame
->
stDataInfo
->
setText
(
L""
);
mainGame
->
stSetName
->
setText
(
L""
);
mainGame
->
stText
->
setText
(
L""
);
mainGame
->
scrCardText
->
setVisible
(
false
);
mainGame
->
wReplayControl
->
setVisible
(
true
);
...
...
gframe/single_mode.cpp
View file @
fc43ebb3
...
...
@@ -62,6 +62,7 @@ int SingleMode::SinglePlayThread(void* param) {
mainGame
->
stName
->
setText
(
L""
);
mainGame
->
stInfo
->
setText
(
L""
);
mainGame
->
stDataInfo
->
setText
(
L""
);
mainGame
->
stSetName
->
setText
(
L""
);
mainGame
->
stText
->
setText
(
L""
);
mainGame
->
scrCardText
->
setVisible
(
false
);
mainGame
->
wPhase
->
setVisible
(
true
);
...
...
strings.conf
View file @
fc43ebb3
This diff is collapsed.
Click to expand it.
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