Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
I
ImgGen
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
MyCard
ImgGen
Commits
048c08ef
Commit
048c08ef
authored
Apr 01, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
370000ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
93 deletions
+39
-93
DataManager.cs
DataManager.cs
+39
-93
No files found.
DataManager.cs
View file @
048c08ef
...
...
@@ -34,54 +34,7 @@ namespace ImgGen
private
static
string
regex_monster
=
@"[果|介|述|報]】\n([\S\s]*)"
;
private
static
string
regex_pendulum
=
@"】[\s\S]*?\n([\S\s]*?)\n【"
;
private
static
string
xyzString
=
"超量"
;
public
static
Data
GetCardData
(
int
code
)
{
if
(!
cardDatas
.
ContainsKey
(
code
))
{
LoadCard
(
code
);
}
return
cardDatas
[
code
];
}
public
static
string
GetCardDescription
(
int
code
)
{
if
(!
cardTexts
.
ContainsKey
(
code
))
{
LoadCard
(
code
);
}
return
cardTexts
[
code
].
text
;
}
public
static
string
GetCardName
(
int
code
)
{
if
(!
cardTexts
.
ContainsKey
(
code
))
{
LoadCard
(
code
);
}
return
cardTexts
[
code
].
name
;
}
public
static
string
GetCardString
(
int
desc
)
{
int
key
=
(
desc
>>
4
)
&
0xfffffff
;
int
index
=
desc
&
15
;
if
(!
cardTexts
.
ContainsKey
(
key
))
{
LoadCard
(
key
);
}
return
cardTexts
[
key
].
desc
[
index
];
}
public
static
string
GetCounterName
(
int
code
)
{
if
(
ctStrings
.
ContainsKey
(
code
))
{
return
ctStrings
[
code
];
}
return
""
;
}
private
static
string
xyzString
;
public
static
Bitmap
GetImage
(
int
code
)
{
...
...
@@ -92,15 +45,6 @@ namespace ImgGen
return
cardImages
[
code
];
}
public
static
string
GetSystemString
(
int
code
)
{
if
(
sysStrings
.
ContainsKey
(
code
))
{
return
sysStrings
[
code
];
}
return
""
;
}
private
static
string
GetTypeString
(
Data
data
)
{
string
str
=
"【"
;
...
...
@@ -195,6 +139,39 @@ namespace ImgGen
return
(
str
+
"】"
);
}
private
static
string
GetStandardText
(
string
r
)
{
char
[]
chArray
=
r
.
ToCharArray
();
for
(
int
i
=
0
;
i
<
chArray
.
Length
;
i
++)
{
if
((
chArray
[
i
]
>
' '
)
&&
(
chArray
[
i
]
<
'\
x007f
'
))
{
chArray
[
i
]
=
(
char
)(
chArray
[
i
]
+
0xfee0
);
}
if
(
chArray
[
i
]
==
'\
x00b7
'
)
{
chArray
[
i
]
=
'・'
;
}
}
string
desc
=
new
string
(
chArray
);
desc
=
desc
.
Replace
(
Environment
.
NewLine
,
"\n"
);
desc
=
Regex
.
Replace
(
desc
,
@"(?<=。)([\n\s]+)(?=[①②③④⑤⑥⑦⑧⑨⑩●])"
,
""
);
return
desc
;
}
private
static
string
GetPendulumDesc
(
string
cdesc
,
string
regx
)
{
string
desc
=
cdesc
;
desc
=
desc
.
Replace
(
Environment
.
NewLine
,
"\n"
);
Regex
regex
=
new
Regex
(
regx
,
RegexOptions
.
Multiline
);
Match
mc
=
regex
.
Match
(
desc
);
if
(
mc
.
Success
)
return
((
mc
.
Groups
.
Count
>
1
)
?
mc
.
Groups
[
1
].
Value
:
mc
.
Groups
[
0
].
Value
);
//.Trim('\n').Replace("\n", "\n\t\t");
return
""
;
}
public
static
void
InitialDatas
(
string
dbPath
=
"../cards.cdb"
,
string
xyz
=
"超量"
)
{
xyzString
=
xyz
;
...
...
@@ -390,7 +367,7 @@ namespace ImgGen
}
}
Graphics
graphics
=
Graphics
.
FromImage
(
bitmap
);
text
.
text
=
tosbc
(
text
.
text
);
text
.
text
=
GetStandardText
(
text
.
text
);
if
(
data
.
isType
(
Type
.
TYPE_MONSTER
))
{
int
x
=
144
;
...
...
@@ -553,8 +530,8 @@ namespace ImgGen
graphics
.
ScaleTransform
(
sx1
,
1f
);
graphics
.
DrawString
(
type_string
,
typeFont
,
typeBrush
,
12f
,
192f
);
graphics
.
ResetTransform
();
string
monster_effect
=
GetDesc
(
text
.
text
,
regex_monster
);
string
pendulum_effect
=
GetDesc
(
text
.
text
,
regex_pendulum
);
string
monster_effect
=
Get
Pendulum
Desc
(
text
.
text
,
regex_monster
);
string
pendulum_effect
=
Get
Pendulum
Desc
(
text
.
text
,
regex_pendulum
);
int
lscale
=
(
data
.
level
>>
0x18
)
&
0xff
;
int
rscale
=
(
data
.
level
>>
0x10
)
&
0xff
;
if
(
lscale
>
9
)
...
...
@@ -718,8 +695,9 @@ namespace ImgGen
graphics
.
DrawImage
(
image
,
24
,
51
,
128
,
128
);
}
}
catch
catch
(
Exception
e
)
{
Console
.
WriteLine
(
"Error prasing {0} {1}"
,
data
.
code
,
e
);
}
if
(
data
.
isType
(
Type
.
TYPE_LINK
))
{
...
...
@@ -790,38 +768,6 @@ namespace ImgGen
}
}
private
static
string
tosbc
(
string
r
)
{
char
[]
chArray
=
r
.
ToCharArray
();
for
(
int
i
=
0
;
i
<
chArray
.
Length
;
i
++)
{
if
((
chArray
[
i
]
>
' '
)
&&
(
chArray
[
i
]
<
'\
x007f
'
))
{
chArray
[
i
]
=
(
char
)(
chArray
[
i
]
+
0xfee0
);
}
if
(
chArray
[
i
]
==
'\
x00b7
'
)
{
chArray
[
i
]
=
'・'
;
}
}
string
desc
=
new
string
(
chArray
);
desc
=
desc
.
Replace
(
Environment
.
NewLine
,
"\n"
);
desc
=
Regex
.
Replace
(
desc
,
@"(?<=。)([\n\s]+)(?=[①②③④⑤⑥⑦⑧⑨⑩●])"
,
""
);
return
desc
;
}
private
static
string
GetDesc
(
string
cdesc
,
string
regx
)
{
string
desc
=
cdesc
;
desc
=
desc
.
Replace
(
Environment
.
NewLine
,
"\n"
);
Regex
regex
=
new
Regex
(
regx
,
RegexOptions
.
Multiline
);
Match
mc
=
regex
.
Match
(
desc
);
if
(
mc
.
Success
)
return
((
mc
.
Groups
.
Count
>
1
)
?
mc
.
Groups
[
1
].
Value
:
mc
.
Groups
[
0
].
Value
);
//.Trim('\n').Replace("\n", "\n\t\t");
return
""
;
}
public
static
Bitmap
Zoom
(
Bitmap
sourceBitmap
,
int
newWidth
,
int
newHeight
)
{
if
(
sourceBitmap
!=
null
)
...
...
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