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
b4e0f075
Commit
b4e0f075
authored
Apr 05, 2020
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor refactor
parent
f90aabe8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
19 deletions
+23
-19
DataManager.cs
DataManager.cs
+23
-19
No files found.
DataManager.cs
View file @
b4e0f075
...
@@ -38,11 +38,6 @@ namespace ImgGen
...
@@ -38,11 +38,6 @@ namespace ImgGen
private
static
StringFormat
justifyFormat
;
private
static
StringFormat
justifyFormat
;
private
static
StringFormat
rightAlignFormat
;
private
static
StringFormat
rightAlignFormat
;
private
static
string
regex_monster
=
@"[果|介|述|報]】\n([\S\s]*)"
;
private
static
string
regex_pendulum
=
@"】[\s\S]*?\n([\S\s]*?)\n【"
;
private
static
string
non_start_chars
=
@"。;:,、”」)·× "
;
private
static
string
non_end_chars
=
@"“「(●"
;
private
static
string
xyzString
=
"超量"
;
private
static
string
xyzString
=
"超量"
;
private
static
string
fontName
=
"文泉驿微米黑"
;
private
static
string
fontName
=
"文泉驿微米黑"
;
private
static
string
numfontName
=
"MatrixBoldSmallCaps"
;
private
static
string
numfontName
=
"MatrixBoldSmallCaps"
;
...
@@ -227,16 +222,6 @@ namespace ImgGen
...
@@ -227,16 +222,6 @@ namespace ImgGen
return
r
.
Replace
(
'\
x00b7
'
,
'・'
);
// another middle dot
return
r
.
Replace
(
'\
x00b7
'
,
'・'
);
// another middle dot
}
}
private
static
string
GetMonsterDesc
(
string
desc
,
string
regex
)
{
// 拆分灵摆卡的灵摆效果和怪兽效果
Regex
r
=
new
Regex
(
regex
,
RegexOptions
.
Multiline
);
Match
match
=
r
.
Match
(
desc
);
if
(
match
.
Success
)
return
(
match
.
Groups
.
Count
>
1
)
?
match
.
Groups
[
1
].
Value
:
match
.
Groups
[
0
].
Value
;
return
""
;
}
private
static
void
DrawPicture
(
Graphics
graphics
,
Data
data
)
private
static
void
DrawPicture
(
Graphics
graphics
,
Data
data
)
{
{
Bitmap
image
;
Bitmap
image
;
...
@@ -501,9 +486,26 @@ namespace ImgGen
...
@@ -501,9 +486,26 @@ namespace ImgGen
DrawJustifiedText
(
graphics
,
text
,
33
,
453
,
335
,
75
);
DrawJustifiedText
(
graphics
,
text
,
33
,
453
,
335
,
75
);
}
}
private
static
void
DrawPendulumEffect
(
Graphics
graphics
,
string
text
)
private
static
void
DrawPendulumEffect
(
Graphics
graphics
,
string
desc
)
{
{
DrawJustifiedText
(
graphics
,
text
,
65
,
369
,
272
,
58
);
const
string
regex_pendulum
=
@"】[\s\S]*?\n([\S\s]*?)\n【"
;
const
string
regex_monster
=
@"[果|介|述|報]】\n([\S\s]*)"
;
string
pText
=
""
;
string
mText
=
""
;
Regex
regex
=
new
Regex
(
regex_pendulum
,
RegexOptions
.
Multiline
);
Match
match
=
regex
.
Match
(
desc
);
if
(
match
.
Success
)
pText
=
match
.
Groups
[
match
.
Groups
.
Count
-
1
].
Value
;
regex
=
new
Regex
(
regex_monster
,
RegexOptions
.
Multiline
);
match
=
regex
.
Match
(
desc
);
if
(
match
.
Success
)
mText
=
match
.
Groups
[
match
.
Groups
.
Count
-
1
].
Value
;
DrawJustifiedText
(
graphics
,
pText
,
65
,
369
,
272
,
58
);
DrawMonsterEffect
(
graphics
,
mText
);
}
}
private
static
void
DrawSpellTrapEffect
(
Graphics
graphics
,
string
text
)
private
static
void
DrawSpellTrapEffect
(
Graphics
graphics
,
string
text
)
...
@@ -597,8 +599,7 @@ namespace ImgGen
...
@@ -597,8 +599,7 @@ namespace ImgGen
if
(
data
.
isType
(
Type
.
TYPE_PENDULUM
))
if
(
data
.
isType
(
Type
.
TYPE_PENDULUM
))
{
{
DrawScales
(
graphics
,
data
);
DrawScales
(
graphics
,
data
);
DrawPendulumEffect
(
graphics
,
GetMonsterDesc
(
desc
,
regex_pendulum
));
DrawPendulumEffect
(
graphics
,
desc
);
DrawMonsterEffect
(
graphics
,
GetMonsterDesc
(
desc
,
regex_monster
));
}
}
else
else
{
{
...
@@ -631,6 +632,9 @@ namespace ImgGen
...
@@ -631,6 +632,9 @@ namespace ImgGen
private
static
void
DrawJustifiedText
(
Graphics
graphics
,
string
text
,
float
areaX
,
float
areaY
,
float
areaWidth
,
float
areaHeight
)
private
static
void
DrawJustifiedText
(
Graphics
graphics
,
string
text
,
float
areaX
,
float
areaY
,
float
areaWidth
,
float
areaHeight
)
{
{
const
string
non_start_chars
=
@"。;:,、”」)·× "
;
const
string
non_end_chars
=
@"“「(●"
;
float
size
=
txtFont
.
Size
;
float
size
=
txtFont
.
Size
;
var
font
=
new
Font
(
txtFont
.
Name
,
size
,
txtFont
.
Style
,
txtFont
.
Unit
);
var
font
=
new
Font
(
txtFont
.
Name
,
size
,
txtFont
.
Style
,
txtFont
.
Unit
);
List
<
string
>
lines
=
new
List
<
string
>
{
};
List
<
string
>
lines
=
new
List
<
string
>
{
};
...
...
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