Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
DataEditorX
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
2
Issues
2
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
nanahira
DataEditorX
Commits
3d359917
Commit
3d359917
authored
Dec 30, 2014
by
keyongyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mse
parent
346dfc10
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1158 additions
and
967 deletions
+1158
-967
DataEditorX/Config/DataConfig.cs
DataEditorX/Config/DataConfig.cs
+8
-4
DataEditorX/Config/DataManager.cs
DataEditorX/Config/DataManager.cs
+3
-2
DataEditorX/Config/MSEConfig.cs
DataEditorX/Config/MSEConfig.cs
+90
-47
DataEditorX/Core/MSE.cs
DataEditorX/Core/MSE.cs
+220
-14
DataEditorX/Core/TaskHelper.cs
DataEditorX/Core/TaskHelper.cs
+2
-4
DataEditorX/Core/YGOUtil.cs
DataEditorX/Core/YGOUtil.cs
+3
-190
DataEditorX/DataEditForm.cs
DataEditorX/DataEditForm.cs
+1
-3
DataEditorX/MainForm.cs
DataEditorX/MainForm.cs
+2
-1
DataEditorX/chinese/card-info.txt
DataEditorX/chinese/card-info.txt
+334
-334
DataEditorX/chinese/mse-config.txt
DataEditorX/chinese/mse-config.txt
+52
-1
win32/DataEditorX.exe
win32/DataEditorX.exe
+0
-0
win32/chinese/card-info.txt
win32/chinese/card-info.txt
+334
-334
win32/chinese/mse-config.txt
win32/chinese/mse-config.txt
+52
-1
win32/chinese/mse-head.txt
win32/chinese/mse-head.txt
+0
-8
win32/chinese/mse-monster.txt
win32/chinese/mse-monster.txt
+0
-15
win32/chinese/mse-spelltrap.txt
win32/chinese/mse-spelltrap.txt
+0
-9
win32/chinese/mse-template.txt
win32/chinese/mse-template.txt
+57
-0
No files found.
DataEditorX/Config/DataConfig.cs
View file @
3d359917
...
...
@@ -24,16 +24,20 @@ public class DataConfig
public
const
string
TAG_CATEGORY
=
"category"
;
public
const
string
TAG_TYPE
=
"type"
;
public
const
string
TAG_SETNAME
=
"setname"
;
public
MSEConfig
msecfg
;
public
DataConfig
()
{
InitMember
(
MyPath
.
Combine
(
Application
.
StartupPath
,
FILE_INFO
));
InitMember
(
MyPath
.
Combine
(
Application
.
StartupPath
,
FILE_INFO
)
,
Application
.
StartupPath
);
}
public
DataConfig
(
string
conf
)
public
DataConfig
(
string
conf
,
string
datapath
)
{
InitMember
(
conf
);
InitMember
(
conf
,
datapath
);
}
public
void
InitMember
(
string
conf
)
public
void
InitMember
(
string
conf
,
string
datapath
)
{
msecfg
=
new
MSEConfig
(
datapath
);
//conf = MyPath.Combine(datapath, MyConfig.FILE_INFO);
if
(!
File
.
Exists
(
conf
))
{
...
...
DataEditorX/Config/DataManager.cs
View file @
3d359917
...
...
@@ -18,6 +18,7 @@ public class DataManager
{
public
const
string
TAG_START
=
"##"
;
public
const
string
TAG_END
=
"#"
;
public
const
string
SEP_LINE
=
" "
;
#
region
根据
tag
获取内容
static
string
reReturn
(
string
content
)
...
...
@@ -84,11 +85,11 @@ public static string subString(string content, string tag)
{
if
(
line
.
StartsWith
(
"#"
))
continue
;
if
((
l
=
line
.
IndexOf
(
" "
))
<
0
)
if
((
l
=
line
.
IndexOf
(
SEP_LINE
))
<
0
)
continue
;
strkey
=
line
.
Substring
(
0
,
l
).
Replace
(
"0x"
,
""
);
strword
=
line
.
Substring
(
l
+
1
);
int
t
=
strword
.
IndexOf
(
'\t'
);
int
t
=
strword
.
IndexOf
(
SEP_LINE
);
if
(
t
>
0
)
strword
=
strword
.
Substring
(
0
,
t
);
if
(
line
.
StartsWith
(
"0x"
))
...
...
DataEditorX/Config/MSEConfig.cs
View file @
3d359917
...
...
@@ -11,6 +11,7 @@
using
System.IO
;
using
System.Text
;
using
DataEditorX.Language
;
using
System.Globalization
;
namespace
DataEditorX.Config
{
...
...
@@ -39,12 +40,17 @@ public class MSEConfig
public
const
string
TAG_SPELL_TRAP
=
"spelltrap"
;
public
const
string
FILE_CONFIG
=
"mse-config.txt"
;
public
const
string
FILE_TEMPLATE
=
"mse-template.txt"
;
public
const
string
SEP_LINE
=
" "
;
public
MSEConfig
(
string
path
)
{
Iscn2tw
=
false
;
regx_monster
=
"(\\s\\S*?)"
;
regx_pendulum
=
"(\\s\\S*?)"
;
init
(
path
);
}
public
void
init
(
string
path
)
{
Iscn2tw
=
false
;
regx_monster
=
"(\\s\\S*?)"
;
regx_pendulum
=
"(\\s\\S*?)"
;
string
file
=
MyPath
.
Combine
(
path
,
FILE_TEMPLATE
);
if
(
File
.
Exists
(
file
))
...
...
@@ -58,49 +64,75 @@ public MSEConfig(string path)
string
tmp
=
MyPath
.
Combine
(
path
,
FILE_CONFIG
);
replaces
=
new
List
<
RegStr
>();
replaces
=
new
List
<
RegStr
>();
if
(
File
.
Exists
(
tmp
))
typeDic
=
new
Dictionary
<
long
,
string
>();
raceDic
=
new
Dictionary
<
long
,
string
>();
//读取配置
if
(
File
.
Exists
(
tmp
))
{
string
[]
lines
=
File
.
ReadAllLines
(
tmp
,
Encoding
.
UTF8
);
foreach
(
string
line
in
lines
)
string
[]
lines
=
File
.
ReadAllLines
(
tmp
,
Encoding
.
UTF8
);
foreach
(
string
line
in
lines
)
{
if
(
string
.
IsNullOrEmpty
(
line
)
||
line
.
StartsWith
(
"#"
))
if
(
string
.
IsNullOrEmpty
(
line
)
||
line
.
StartsWith
(
"#"
))
continue
;
if
(
line
.
StartsWith
(
"cn2tw"
))
Iscn2tw
=(
getValue
(
line
).
ToLower
()==
"true"
)?
true
:
false
;
else
if
(
line
.
StartsWith
(
"spell"
))
str_spell
=
getValue
(
line
);
else
if
(
line
.
StartsWith
(
"trap"
))
str_trap
=
getValue
(
line
);
else
if
(
line
.
StartsWith
(
"pendulum-text"
))
regx_pendulum
=
getRegex
(
getValue
(
line
));
else
if
(
line
.
StartsWith
(
"monster-text"
))
regx_monster
=
getRegex
(
getValue
(
line
));
else
if
(
line
.
StartsWith
(
"maxcount"
))
int
.
TryParse
(
getValue
(
line
),
out
maxcount
);
else
if
(
line
.
StartsWith
(
"imagepath"
))
if
(
line
.
StartsWith
(
"cn2tw"
))
Iscn2tw
=
(
getValue
(
line
).
ToLower
()
==
"true"
)
?
true
:
false
;
else
if
(
line
.
StartsWith
(
"spell"
))
str_spell
=
getValue
(
line
);
else
if
(
line
.
StartsWith
(
"trap"
))
str_trap
=
getValue
(
line
);
else
if
(
line
.
StartsWith
(
"pendulum-text"
))
regx_pendulum
=
getRegex
(
getValue
(
line
));
else
if
(
line
.
StartsWith
(
"monster-text"
))
regx_monster
=
getRegex
(
getValue
(
line
));
else
if
(
line
.
StartsWith
(
"maxcount"
))
int
.
TryParse
(
getValue
(
line
),
out
maxcount
);
else
if
(
line
.
StartsWith
(
"imagepath"
))
imagepath
=
MyPath
.
CheckDir
(
getValue
(
line
),
MyPath
.
Combine
(
path
,
"Images"
));
else
if
(
line
.
StartsWith
(
"replace"
)){
string
word
=
getValue
(
line
);
int
t
=
word
.
IndexOf
(
" "
);
if
(
t
>
0
){
string
p
=
word
.
Substring
(
0
,
t
);
string
r
=
word
.
Substring
(
t
+
1
);
if
(!
string
.
IsNullOrEmpty
(
p
))
else
if
(
line
.
StartsWith
(
"replace"
))
{
string
word
=
getValue
(
line
);
int
t
=
word
.
IndexOf
(
" "
);
if
(
t
>
0
)
{
string
p
=
word
.
Substring
(
0
,
t
);
string
r
=
word
.
Substring
(
t
+
1
);
if
(!
string
.
IsNullOrEmpty
(
p
))
replaces
.
Add
(
new
RegStr
(
p
,
r
));
}
}
else
if
(
line
.
StartsWith
(
"race"
))
{
DicAdd
(
raceDic
,
line
);
}
if
(
str_spell
==
"%%"
&&
str_trap
==
"%%"
)
st_is_symbol
=
true
;
else
if
(
line
.
StartsWith
(
"type"
))
{
DicAdd
(
typeDic
,
line
);
}
}
if
(
str_spell
==
"%%"
&&
str_trap
==
"%%"
)
st_is_symbol
=
true
;
else
st_is_symbol
=
false
;
st_is_symbol
=
false
;
}
else
{
Iscn2tw
=
false
;
Iscn2tw
=
false
;
}
}
void
DicAdd
(
Dictionary
<
long
,
string
>
dic
,
string
line
)
{
int
i
=
line
.
IndexOf
(
"0x"
);
int
j
=
(
i
>
0
)?
line
.
IndexOf
(
SEP_LINE
,
i
+
1
):-
1
;
if
(
j
>
0
)
{
string
strkey
=
line
.
Substring
(
i
+
2
,
j
-
i
-
1
);
string
strval
=
line
.
Substring
(
j
+
1
);
long
key
;
long
.
TryParse
(
strkey
,
NumberStyles
.
HexNumber
,
null
,
out
key
);
if
(!
dic
.
ContainsKey
(
key
))
dic
.
Add
(
key
,
strval
.
Trim
());
}
}
string
getRegex
(
string
word
)
...
...
@@ -114,18 +146,29 @@ string getValue(string line)
return
line
.
Substring
(
t
+
1
).
Trim
();
return
""
;
}
//每个存档最大数
public
int
maxcount
;
//图片路径
public
string
imagepath
;
//标志是符号
public
bool
st_is_symbol
;
//魔法标志
public
string
str_spell
;
//陷阱标志
public
string
str_trap
;
//简体转繁体?
public
bool
Iscn2tw
;
//特数字替换
public
List
<
RegStr
>
replaces
;
//效果文正则提取
public
string
regx_pendulum
;
public
string
regx_monster
;
//模版
public
string
head
;
public
string
monster
;
public
string
pendulum
;
public
string
spelltrap
;
public
Dictionary
<
long
,
string
>
typeDic
;
public
Dictionary
<
long
,
string
>
raceDic
;
}
}
DataEditorX/Core/MSE.cs
View file @
3d359917
...
...
@@ -38,12 +38,11 @@ public string ImagePath
get
{
return
cfg
.
imagepath
;}
}
public
MSE
(
string
path
,
Dictionary
<
long
,
string
>
typedic
,
Dictionary
<
long
,
string
>
racedic
)
public
MSE
(
MSEConfig
mcfg
)
{
cfg
=
new
MSEConfig
(
path
)
;
cfg
=
mcfg
;
}
//特殊字
public
string
reItalic
(
string
str
)
{
str
=
cn2tw
(
str
);
...
...
@@ -53,6 +52,7 @@ public string reItalic(string str)
}
return
str
;
}
//简体转繁体
public
string
cn2tw
(
string
str
)
{
if
(
cfg
.
Iscn2tw
)
...
...
@@ -62,6 +62,7 @@ public string cn2tw(string str)
}
return
str
;
}
//调整换行符
public
string
ReDesc
(
string
desc
)
{
desc
=
cn2tw
(
desc
);
...
...
@@ -72,6 +73,7 @@ public string ReDesc(string desc)
sb
.
Replace
(
"\n"
,
"\n\t\t"
);
return
sb
.
ToString
();
}
//获取魔法陷阱的类型符号
public
string
GetST
(
Card
c
,
bool
isSpell
)
{
string
level
;
...
...
@@ -98,6 +100,209 @@ public string GetST(Card c, bool isSpell)
level
=
cfg
.
str_trap
.
Replace
(
"%%"
,
level
);
return
level
;
}
public
static
string
GetCardImagePath
(
string
picpath
,
Card
c
)
{
string
jpg
=
MyPath
.
Combine
(
picpath
,
c
.
id
+
".jpg"
);
string
jpg2
=
MyPath
.
Combine
(
picpath
,
c
.
idString
+
".jpg"
);
string
jpg3
=
MyPath
.
Combine
(
picpath
,
c
.
name
+
".jpg"
);
string
png
=
MyPath
.
Combine
(
picpath
,
c
.
id
+
".png"
);
string
png2
=
MyPath
.
Combine
(
picpath
,
c
.
idString
+
".png"
);
string
png3
=
MyPath
.
Combine
(
picpath
,
c
.
name
+
".png"
);
if
(
File
.
Exists
(
jpg
))
{
return
jpg
;
}
else
if
(
File
.
Exists
(
jpg2
))
{
return
jpg2
;
}
else
if
(
File
.
Exists
(
jpg3
))
{
File
.
Copy
(
jpg3
,
jpg
,
true
);
if
(
File
.
Exists
(
jpg
))
{
//复制失败
return
jpg
;
}
}
else
if
(
File
.
Exists
(
png
))
{
return
png
;
}
else
if
(
File
.
Exists
(
png2
))
{
return
png2
;
}
else
if
(
File
.
Exists
(
png3
))
{
File
.
Copy
(
png3
,
png
,
true
);
if
(
File
.
Exists
(
png
))
{
//复制失败
return
png
;
}
}
return
""
;
}
public
static
string
GetAttribute
(
int
attr
)
{
CardAttribute
cattr
=
(
CardAttribute
)
attr
;
string
sattr
=
"none"
;
switch
(
cattr
)
{
case
CardAttribute
.
ATTRIBUTE_DARK
:
sattr
=
"dark"
;
break
;
case
CardAttribute
.
ATTRIBUTE_DEVINE
:
sattr
=
"divine"
;
break
;
case
CardAttribute
.
ATTRIBUTE_EARTH
:
sattr
=
"earth"
;
break
;
case
CardAttribute
.
ATTRIBUTE_FIRE
:
sattr
=
"fire"
;
break
;
case
CardAttribute
.
ATTRIBUTE_LIGHT
:
sattr
=
"light"
;
break
;
case
CardAttribute
.
ATTRIBUTE_WATER
:
sattr
=
"water"
;
break
;
case
CardAttribute
.
ATTRIBUTE_WIND
:
sattr
=
"wind"
;
break
;
}
return
sattr
;
}
public
static
string
GetDesc
(
string
desc
,
string
regx
)
{
desc
=
desc
.
Replace
(
Environment
.
NewLine
,
"\n"
);
Regex
regex
=
new
Regex
(
regx
);
Match
mc
=
regex
.
Match
(
desc
);
if
(
mc
.
Success
)
return
(
mc
.
Groups
.
Count
>
1
)
?
mc
.
Groups
[
1
].
Value
:
mc
.
Groups
[
0
].
Value
;
return
""
;
}
public
static
string
GetStar
(
long
level
)
{
long
j
=
level
&
0xff
;
string
star
=
""
;
for
(
int
i
=
0
;
i
<
j
;
i
++)
{
star
+=
"*"
;
}
return
star
;
}
public
string
GetRace
(
long
race
)
{
if
(
cfg
.
raceDic
.
ContainsKey
(
race
))
return
cfg
.
raceDic
[
race
].
Trim
();
return
race
.
ToString
(
"x"
);
}
public
string
GetType
(
CardType
ctype
)
{
long
type
=
(
long
)
ctype
;
if
(
cfg
.
typeDic
.
ContainsKey
(
type
))
return
cfg
.
typeDic
[
type
].
Trim
();
return
type
.
ToString
(
"x"
);
}
public
string
[]
GetTypes
(
Card
c
)
{
string
[]
types
=
new
string
[]
{
"normal monster"
,
""
,
""
,
""
};
if
(
c
.
IsType
(
CardType
.
TYPE_MONSTER
))
{
//卡片类型和第1效果
if
(
c
.
IsType
(
CardType
.
TYPE_XYZ
))
{
types
[
0
]
=
"xyz monster"
;
types
[
1
]
=
GetType
(
CardType
.
TYPE_XYZ
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_TOKEN
))
{
types
[
0
]
=
(
c
.
race
==
0
)
?
"token card"
:
"token monster"
;
types
[
1
]
=
GetType
(
CardType
.
TYPE_TOKEN
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_RITUAL
))
{
types
[
0
]
=
"ritual monster"
;
types
[
1
]
=
GetType
(
CardType
.
TYPE_RITUAL
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_FUSION
))
{
types
[
0
]
=
"fusion monster"
;
types
[
1
]
=
GetType
(
CardType
.
TYPE_FUSION
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_SYNCHRO
))
{
types
[
0
]
=
"synchro monster"
;
types
[
1
]
=
GetType
(
CardType
.
TYPE_SYNCHRO
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_EFFECT
))
{
types
[
0
]
=
"effect monster"
;
}
else
types
[
0
]
=
"normal monster"
;
//同调
if
(
types
[
0
]
==
"synchro monster"
||
types
[
0
]
==
"token monster"
)
{
if
(
c
.
IsType
(
CardType
.
TYPE_TUNER
)
&&
c
.
IsType
(
CardType
.
TYPE_EFFECT
))
{
//调整效果
types
[
2
]
=
GetType
(
CardType
.
TYPE_TUNER
);
types
[
3
]
=
GetType
(
CardType
.
TYPE_EFFECT
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_TUNER
))
{
types
[
2
]
=
GetType
(
CardType
.
TYPE_TUNER
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_EFFECT
))
{
types
[
2
]
=
GetType
(
CardType
.
TYPE_EFFECT
);
}
}
else
if
(
types
[
0
]
==
"normal monster"
)
{
if
(
c
.
IsType
(
CardType
.
TYPE_PENDULUM
))
//灵摆
types
[
1
]
=
GetType
(
CardType
.
TYPE_PENDULUM
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_TUNER
))
//调整
types
[
1
]
=
GetType
(
CardType
.
TYPE_TUNER
);
}
else
if
(
types
[
0
]
!=
"effect monster"
)
{
//效果
if
(
c
.
IsType
(
CardType
.
TYPE_EFFECT
))
types
[
2
]
=
GetType
(
CardType
.
TYPE_EFFECT
);
}
else
{
//效果怪兽
types
[
2
]
=
GetType
(
CardType
.
TYPE_EFFECT
);
if
(
c
.
IsType
(
CardType
.
TYPE_PENDULUM
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_PENDULUM
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_TUNER
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_TUNER
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_SPIRIT
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_SPIRIT
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_TOON
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_TOON
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_UNION
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_UNION
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_DUAL
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_DUAL
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_FLIP
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_FLIP
);
else
{
types
[
1
]
=
GetType
(
CardType
.
TYPE_EFFECT
);
types
[
2
]
=
""
;
}
}
}
if
(
c
.
race
==
0
)
{
types
[
1
]
=
""
;
types
[
2
]
=
""
;
}
return
types
;
}
public
string
[]
WriteSet
(
string
file
,
Card
[]
cards
)
{
List
<
string
>
list
=
new
List
<
string
>();
...
...
@@ -109,7 +314,7 @@ public string[] WriteSet(string file,Card[] cards)
sw
.
WriteLine
(
cfg
.
head
);
foreach
(
Card
c
in
cards
)
{
string
jpg
=
YGOUtil
.
GetCardImagePath
(
pic
,
c
);
string
jpg
=
GetCardImagePath
(
pic
,
c
);
if
(!
string
.
IsNullOrEmpty
(
jpg
))
{
list
.
Add
(
jpg
);
...
...
@@ -125,7 +330,7 @@ public string[] WriteSet(string file,Card[] cards)
return
list
.
ToArray
();
}
//pendulum怪兽
string
getMonster
(
Card
c
,
string
img
,
bool
isPendulum
)
{
StringBuilder
sb
=
new
StringBuilder
();
...
...
@@ -134,26 +339,26 @@ string getMonster(Card c,string img,bool isPendulum)
else
sb
.
Append
(
cfg
.
monster
);
string
[]
types
=
YGOUtil
.
GetTypes
(
c
);
string
race
=
YGOUtil
.
GetRace
(
c
.
race
);
string
[]
types
=
GetTypes
(
c
);
string
race
=
GetRace
(
c
.
race
);
sb
.
Replace
(
"%type%"
,
types
[
0
]);
sb
.
Replace
(
"%name%"
,
reItalic
(
c
.
name
));
sb
.
Replace
(
"%attribute%"
,
YGOUtil
.
GetAttribute
(
c
.
attribute
));
sb
.
Replace
(
"%level%"
,
YGOUtil
.
GetStar
(
c
.
level
));
sb
.
Replace
(
"%attribute%"
,
GetAttribute
(
c
.
attribute
));
sb
.
Replace
(
"%level%"
,
GetStar
(
c
.
level
));
sb
.
Replace
(
"%image%"
,
img
);
sb
.
Replace
(
"%race%"
,
cn2tw
(
race
));
sb
.
Replace
(
"%type1%"
,
cn2tw
(
types
[
1
]));
sb
.
Replace
(
"%type2%"
,
cn2tw
(
types
[
2
]));
sb
.
Replace
(
"%type3%"
,
cn2tw
(
types
[
3
]));
if
(
isPendulum
){
string
text
=
YGOUtil
.
GetDesc
(
c
.
desc
,
cfg
.
regx_monster
);
string
text
=
GetDesc
(
c
.
desc
,
cfg
.
regx_monster
);
if
(
string
.
IsNullOrEmpty
(
text
))
text
=
c
.
desc
;
sb
.
Replace
(
"%desc%"
,
ReDesc
(
text
));
sb
.
Replace
(
"%pl%"
,
((
c
.
level
>>
0x18
)
&
0xff
).
ToString
());
sb
.
Replace
(
"%pr%"
,
((
c
.
level
>>
0x10
)
&
0xff
).
ToString
());
sb
.
Replace
(
"%pdesc%"
,
ReDesc
(
YGOUtil
.
GetDesc
(
c
.
desc
,
cfg
.
regx_pendulum
)));
GetDesc
(
c
.
desc
,
cfg
.
regx_pendulum
)));
}
else
sb
.
Replace
(
"%desc%"
,
ReDesc
(
c
.
desc
));
...
...
@@ -163,6 +368,7 @@ string getMonster(Card c,string img,bool isPendulum)
sb
.
Replace
(
"%code%"
,
c
.
idString
);
return
sb
.
ToString
();
}
//魔法陷阱
string
getSpellTrap
(
Card
c
,
string
img
,
bool
isSpell
)
{
StringBuilder
sb
=
new
StringBuilder
(
cfg
.
spelltrap
);
...
...
DataEditorX/Core/TaskHelper.cs
View file @
3d359917
...
...
@@ -46,12 +46,10 @@ public class TaskHelper
private
bool
isRun
=
false
;
private
BackgroundWorker
worker
;
public
TaskHelper
(
string
datapath
,
BackgroundWorker
worker
,
Dictionary
<
long
,
string
>
typedic
,
Dictionary
<
long
,
string
>
racedic
)
public
TaskHelper
(
string
datapath
,
BackgroundWorker
worker
,
MSEConfig
mcfg
)
{
this
.
worker
=
worker
;
mseHelper
=
new
MSE
(
datapath
,
typedic
,
racedic
);
mseHelper
=
new
MSE
(
mcfg
);
imgSet
.
Init
();
}
public
bool
IsRuning
()
...
...
DataEditorX/Core/YGOUtil.cs
View file @
3d359917
...
...
@@ -33,197 +33,19 @@ public static bool isDataBase(string file)
return
true
;
return
false
;
}
public
static
string
GetCardImagePath
(
string
picpath
,
Card
c
)
{
string
jpg
=
MyPath
.
Combine
(
picpath
,
c
.
id
+
".jpg"
);
string
jpg2
=
MyPath
.
Combine
(
picpath
,
c
.
idString
+
".jpg"
);
string
jpg3
=
MyPath
.
Combine
(
picpath
,
c
.
name
+
".jpg"
);
string
png
=
MyPath
.
Combine
(
picpath
,
c
.
id
+
".png"
);
string
png2
=
MyPath
.
Combine
(
picpath
,
c
.
idString
+
".png"
);
string
png3
=
MyPath
.
Combine
(
picpath
,
c
.
name
+
".png"
);
if
(
File
.
Exists
(
jpg
))
{
return
jpg
;
}
else
if
(
File
.
Exists
(
jpg2
))
{
return
jpg2
;
}
else
if
(
File
.
Exists
(
jpg3
))
{
File
.
Copy
(
jpg3
,
jpg
,
true
);
if
(
File
.
Exists
(
jpg
))
{
//复制失败
return
jpg
;
}
}
else
if
(
File
.
Exists
(
png
))
{
return
png
;
}
else
if
(
File
.
Exists
(
png2
))
{
return
png2
;
}
else
if
(
File
.
Exists
(
png3
))
{
File
.
Copy
(
png3
,
png
,
true
);
if
(
File
.
Exists
(
png
))
{
//复制失败
return
png
;
}
}
return
""
;
}
public
static
string
GetStar
(
long
level
)
{
long
j
=
level
&
0xff
;
string
star
=
""
;
for
(
int
i
=
0
;
i
<
j
;
i
++)
{
star
+=
"*"
;
}
return
star
;
}
public
static
string
GetAttributeString
(
int
attr
)
{
return
DataManager
.
GetValue
(
datacfg
.
dicCardAttributes
,
attr
);
}
public
static
string
GetAttribute
(
int
attr
)
{
CardAttribute
cattr
=
(
CardAttribute
)
attr
;
string
sattr
=
"none"
;
switch
(
cattr
)
{
case
CardAttribute
.
ATTRIBUTE_DARK
:
sattr
=
"dark"
;
break
;
case
CardAttribute
.
ATTRIBUTE_DEVINE
:
sattr
=
"divine"
;
break
;
case
CardAttribute
.
ATTRIBUTE_EARTH
:
sattr
=
"earth"
;
break
;
case
CardAttribute
.
ATTRIBUTE_FIRE
:
sattr
=
"fire"
;
break
;
case
CardAttribute
.
ATTRIBUTE_LIGHT
:
sattr
=
"light"
;
break
;
case
CardAttribute
.
ATTRIBUTE_WATER
:
sattr
=
"water"
;
break
;
case
CardAttribute
.
ATTRIBUTE_WIND
:
sattr
=
"wind"
;
break
;
}
return
sattr
;
}
public
static
string
GetRace
(
long
race
)
{
return
DataManager
.
GetValue
(
datacfg
.
dicCardRaces
,
race
);
}
public
static
string
[]
GetTypes
(
Card
c
)
{
string
[]
types
=
new
string
[]
{
"normal monster"
,
""
,
""
,
""
};
if
(
c
.
IsType
(
CardType
.
TYPE_MONSTER
))
{
//卡片类型和第1效果
if
(
c
.
IsType
(
CardType
.
TYPE_XYZ
))
{
types
[
0
]
=
"xyz monster"
;
types
[
1
]
=
GetType
(
CardType
.
TYPE_XYZ
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_TOKEN
))
{
types
[
0
]
=
(
c
.
race
==
0
)?
"token card"
:
"token monster"
;
types
[
1
]
=
GetType
(
CardType
.
TYPE_TOKEN
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_RITUAL
))
{
types
[
0
]
=
"ritual monster"
;
types
[
1
]
=
GetType
(
CardType
.
TYPE_RITUAL
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_FUSION
))
{
types
[
0
]
=
"fusion monster"
;
types
[
1
]
=
GetType
(
CardType
.
TYPE_FUSION
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_SYNCHRO
))
{
types
[
0
]
=
"synchro monster"
;
types
[
1
]
=
GetType
(
CardType
.
TYPE_SYNCHRO
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_EFFECT
))
{
types
[
0
]
=
"effect monster"
;
}
else
types
[
0
]
=
"normal monster"
;
//同调
if
(
types
[
0
]
==
"synchro monster"
||
types
[
0
]
==
"token monster"
)
{
if
(
c
.
IsType
(
CardType
.
TYPE_TUNER
)
&&
c
.
IsType
(
CardType
.
TYPE_EFFECT
))
{
//调整效果
types
[
2
]
=
GetType
(
CardType
.
TYPE_TUNER
);
types
[
3
]
=
GetType
(
CardType
.
TYPE_EFFECT
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_TUNER
))
{
types
[
2
]
=
GetType
(
CardType
.
TYPE_TUNER
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_EFFECT
))
{
types
[
2
]
=
GetType
(
CardType
.
TYPE_EFFECT
);
}
}
else
if
(
types
[
0
]
==
"normal monster"
)
{
if
(
c
.
IsType
(
CardType
.
TYPE_PENDULUM
))
//灵摆
types
[
1
]
=
GetType
(
CardType
.
TYPE_PENDULUM
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_TUNER
))
//调整
types
[
1
]
=
GetType
(
CardType
.
TYPE_TUNER
);
}
else
if
(
types
[
0
]
!=
"effect monster"
)
{
//效果
if
(
c
.
IsType
(
CardType
.
TYPE_EFFECT
))
types
[
2
]
=
GetType
(
CardType
.
TYPE_EFFECT
);
}
else
{
//效果怪兽
types
[
2
]
=
GetType
(
CardType
.
TYPE_EFFECT
);
if
(
c
.
IsType
(
CardType
.
TYPE_PENDULUM
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_PENDULUM
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_TUNER
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_TUNER
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_SPIRIT
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_SPIRIT
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_TOON
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_TOON
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_UNION
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_UNION
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_DUAL
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_DUAL
);
else
if
(
c
.
IsType
(
CardType
.
TYPE_FLIP
))
types
[
1
]
=
GetType
(
CardType
.
TYPE_FLIP
);
else
{
types
[
1
]
=
GetType
(
CardType
.
TYPE_EFFECT
);
types
[
2
]
=
""
;
}
}
}
if
(
c
.
race
==
0
)
{
types
[
1
]
=
""
;
types
[
2
]
=
""
;
}
return
types
;
}
public
static
string
GetCardType
(
Card
c
)
{
...
...
@@ -311,16 +133,7 @@ public static string GetSetNameString(long type)
return
""
;
}
public
static
string
GetDesc
(
string
desc
,
string
regx
)
{
desc
=
desc
.
Replace
(
Environment
.
NewLine
,
"\n"
);
Regex
regex
=
new
Regex
(
regx
);
Match
mc
=
regex
.
Match
(
desc
);
if
(
mc
.
Success
)
return
(
mc
.
Groups
.
Count
>
1
)
?
mc
.
Groups
[
1
].
Value
:
mc
.
Groups
[
0
].
Value
;
return
""
;
}
#
region
根据文件读取数据库
/// <summary>
...
...
DataEditorX/DataEditForm.cs
View file @
3d359917
...
...
@@ -113,9 +113,7 @@ void DataEditFormLoad(object sender, EventArgs e)
{
datacfg
=
new
DataConfig
();
}
tasker
=
new
TaskHelper
(
datapath
,
bgWorker1
,
datacfg
.
dicCardTypes
,
datacfg
.
dicCardRaces
);
tasker
=
new
TaskHelper
(
datapath
,
bgWorker1
,
datacfg
.
msecfg
);
//设置空白卡片
oldCard
=
new
Card
(
0
);
SetCard
(
oldCard
);
...
...
DataEditorX/MainForm.cs
View file @
3d359917
...
...
@@ -53,7 +53,8 @@ public void SetLanguage(string language)
//文件路径
conflang
=
MyPath
.
Combine
(
datapath
,
MyConfig
.
FILE_LANGUAGE
);
//游戏数据
datacfg
=
new
DataConfig
(
MyPath
.
Combine
(
datapath
,
DataConfig
.
FILE_INFO
));
datacfg
=
new
DataConfig
(
MyPath
.
Combine
(
datapath
,
DataConfig
.
FILE_INFO
)
,
datapath
);
//初始化YGOUtil的数据
YGOUtil
.
SetConfig
(
datacfg
);
...
...
DataEditorX/chinese/card-info.txt
View file @
3d359917
DataEditorX/chinese/mse-config.txt
View file @
3d359917
...
...
@@ -23,3 +23,54 @@ monster-text = [果|介|述|報]】\n([\S\s]*)
replace = ([鮟|鱇|・|·]) <i>$1</i>
#replace = \s <sym-auto>^</sym-auto>
#replace = ([A-Z]) <i>$1</i>
##race
race 0x1 战士族
race 0x2 魔法师族
race 0x4 天使族
race 0x8 恶魔族
race 0x10 不死族
race 0x20 机械族
race 0x40 水族
race 0x80 炎族
race 0x100 岩石族
race 0x200 鸟兽族
race 0x400 植物族
race 0x800 昆虫族
race 0x1000 雷族
race 0x2000 龙族
race 0x4000 兽族
race 0x8000 兽战士族
race 0x10000 恐龙族
race 0x20000 鱼族
race 0x40000 海龙族
race 0x80000 爬虫类族
race 0x100000 念动力族
race 0x200000 幻神兽族
race 0x400000 创造神族
race 0x800000 幻龙族
##type
type 0x1 怪兽
type 0x2 魔法
type 0x4 陷阱
type 0x8 N/A
type 0x10 通常
type 0x20 效果
type 0x40 融合
type 0x80 仪式
type 0x100 N/A
type 0x200 灵魂
type 0x400 同盟
type 0x800 二重
type 0x1000 调整
type 0x2000 同调
type 0x4000 衍生物
type 0x8000 N/A
type 0x10000 速攻
type 0x20000 永续
type 0x40000 装备
type 0x80000 场地
type 0x100000 反击
type 0x200000 反转
type 0x400000 卡通
type 0x800000 超量
type 0x1000000 灵摆
\ No newline at end of file
win32/DataEditorX.exe
View file @
3d359917
No preview for this file type
win32/chinese/card-info.txt
View file @
3d359917
win32/chinese/mse-config.txt
View file @
3d359917
...
...
@@ -23,3 +23,54 @@ monster-text = [果|介|述|報]】\n([\S\s]*)
replace = ([鮟|鱇|・|·]) <i>$1</i>
#replace = \s <sym-auto>^</sym-auto>
#replace = ([A-Z]) <i>$1</i>
##race
race 0x1 战士族
race 0x2 魔法师族
race 0x4 天使族
race 0x8 恶魔族
race 0x10 不死族
race 0x20 机械族
race 0x40 水族
race 0x80 炎族
race 0x100 岩石族
race 0x200 鸟兽族
race 0x400 植物族
race 0x800 昆虫族
race 0x1000 雷族
race 0x2000 龙族
race 0x4000 兽族
race 0x8000 兽战士族
race 0x10000 恐龙族
race 0x20000 鱼族
race 0x40000 海龙族
race 0x80000 爬虫类族
race 0x100000 念动力族
race 0x200000 幻神兽族
race 0x400000 创造神族
race 0x800000 幻龙族
##type
type 0x1 怪兽
type 0x2 魔法
type 0x4 陷阱
type 0x8 N/A
type 0x10 通常
type 0x20 效果
type 0x40 融合
type 0x80 仪式
type 0x100 N/A
type 0x200 灵魂
type 0x400 同盟
type 0x800 二重
type 0x1000 调整
type 0x2000 同调
type 0x4000 衍生物
type 0x8000 N/A
type 0x10000 速攻
type 0x20000 永续
type 0x40000 装备
type 0x80000 场地
type 0x100000 反击
type 0x200000 反转
type 0x400000 卡通
type 0x800000 超量
type 0x1000000 灵摆
\ No newline at end of file
win32/chinese/mse-head.txt
deleted
100644 → 0
View file @
346dfc10
mse version: 0.3.8
game: yugioh
stylesheet: standard
set info:
language: TW
edition:
ST mark is text: no
pendulum image is small: yes
\ No newline at end of file
win32/chinese/mse-monster.txt
deleted
100644 → 0
View file @
346dfc10
card:
card type: %type%
name: %name%
attribute: %attribute%
level: %level%
image: %image%
type 1: %race%
type 2: %type1%
type 3: %type2%
type 4: %type3%
rule text:
%desc%
attack: %atk%
defense: %def%
gamecode: %code%
\ No newline at end of file
win32/chinese/mse-spelltrap.txt
deleted
100644 → 0
View file @
346dfc10
card:
card type: %type%
name: %name%
attribute: %attribute%
level: %level%
image: %image%
rule text:
%desc%
gamecode: %code%
\ No newline at end of file
win32/chinese/mse-
pendulum
.txt
→
win32/chinese/mse-
template
.txt
View file @
3d359917
card:
##head
mse version: 0.3.8
game: yugioh
stylesheet: standard
set info:
language: TW
edition:
ST mark is text: no
pendulum image is small: yes
##monster
card:
card type: %type%
name: %name%
attribute: %attribute%
level: %level%
image: %image%
type 1: %race%
type 2: %type1%
type 3: %type2%
type 4: %type3%
rule text:
%desc%
attack: %atk%
defense: %def%
gamecode: %code%
##pendulum
card:
card type: %type%
name: %name%
attribute: %attribute%
...
...
@@ -18,3 +44,14 @@
pendulum text:
%pdesc%
gamecode: %code%
##spelltrap
card:
card type: %type%
name: %name%
attribute: %attribute%
level: %level%
image: %image%
rule text:
%desc%
gamecode: %code%
#end
\ No newline at end of file
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