Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
MDPro3
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
SK
MDPro3
Commits
15bccc0f
Commit
15bccc0f
authored
Apr 19, 2024
by
SherryChaos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
special win animation & card rendering language setting
parent
8d29331c
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1029 additions
and
158 deletions
+1029
-158
Assets/Main.unity
Assets/Main.unity
+576
-21
Assets/Scripts/MDPro3/CardRenderer.cs
Assets/Scripts/MDPro3/CardRenderer.cs
+13
-13
Assets/Scripts/MDPro3/Duel/GameCard.cs
Assets/Scripts/MDPro3/Duel/GameCard.cs
+1
-1
Assets/Scripts/MDPro3/Duel/MDPro3.YGOSharp/Card.cs
Assets/Scripts/MDPro3/Duel/MDPro3.YGOSharp/Card.cs
+24
-25
Assets/Scripts/MDPro3/Duel/MDPro3.YGOSharp/CardsManager.cs
Assets/Scripts/MDPro3/Duel/MDPro3.YGOSharp/CardsManager.cs
+45
-8
Assets/Scripts/MDPro3/Helper/InterString.cs
Assets/Scripts/MDPro3/Helper/InterString.cs
+26
-11
Assets/Scripts/MDPro3/Helper/StringHelper.cs
Assets/Scripts/MDPro3/Helper/StringHelper.cs
+70
-21
Assets/Scripts/MDPro3/Managers/TextureManager.cs
Assets/Scripts/MDPro3/Managers/TextureManager.cs
+14
-0
Assets/Scripts/MDPro3/Servants/OcgCore.cs
Assets/Scripts/MDPro3/Servants/OcgCore.cs
+183
-45
Assets/Scripts/MDPro3/Servants/Setting.cs
Assets/Scripts/MDPro3/Servants/Setting.cs
+36
-0
Assets/Scripts/MasterDuel/YgomSystem/Effect/SpriteScaler.cs
Assets/Scripts/MasterDuel/YgomSystem/Effect/SpriteScaler.cs
+19
-11
Assets/Scripts/MasterDuel/YgomSystem/Timeline/EventPlayableAsset.cs
...ipts/MasterDuel/YgomSystem/Timeline/EventPlayableAsset.cs
+10
-1
Assets/Scripts/MasterDuel/YgomSystem/Timeline/EventPlayableBehaviour.cs
.../MasterDuel/YgomSystem/Timeline/EventPlayableBehaviour.cs
+12
-1
No files found.
Assets/Main.unity
View file @
15bccc0f
This diff is collapsed.
Click to expand it.
Assets/Scripts/MDPro3/CardRenderer.cs
View file @
15bccc0f
...
...
@@ -48,7 +48,7 @@ namespace MDPro3
//cardDescription
cardName
.
fontSize
=
50
;
cardName
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
200
,
80
);
var
language
=
Config
.
Get
(
"Language"
,
"zh-CN"
);
var
language
=
Config
.
Get
(
"
Card
Language"
,
"zh-CN"
);
if
(
language
==
"zh-CN"
)
{
var
handle
=
Addressables
.
LoadAssetAsync
<
Font
>(
"RenderFontChineseSimplified"
);
...
...
@@ -107,13 +107,13 @@ namespace MDPro3
public
void
RenderName
(
int
code
)
{
var
data
=
CardsManager
.
Get
(
code
);
var
data
=
CardsManager
.
Get
RenderCard
(
code
);
if
(
data
.
Id
==
0
)
return
;
cardName
.
GetComponent
<
RectTransform
>().
localScale
=
Vector3
.
one
;
cardNameTMP
.
GetComponent
<
RectTransform
>().
localScale
=
Vector3
.
one
;
if
(
Config
.
Get
(
"Language"
,
"zh-CN"
)
==
"en-US"
||
Config
.
Get
(
"Language"
,
"zh-CN"
)
==
"es-ES"
)
if
(
Config
.
Get
(
"
Card
Language"
,
"zh-CN"
)
==
"en-US"
||
Config
.
Get
(
"
Card
Language"
,
"zh-CN"
)
==
"es-ES"
)
{
cardName
.
text
=
string
.
Empty
;
cardNameTMP
.
text
=
data
.
Name
;
...
...
@@ -184,14 +184,14 @@ namespace MDPro3
public
void
RenderCard
(
int
code
,
Texture2D
art
)
{
var
data
=
CardsManager
.
Get
(
code
);
Card
data
=
CardsManager
.
GetRenderCard
(
code
);
if
(
data
.
Id
==
0
)
return
;
cardName
.
GetComponent
<
RectTransform
>().
localScale
=
Vector3
.
one
;
cardNameTMP
.
GetComponent
<
RectTransform
>().
localScale
=
Vector3
.
one
;
if
(
Config
.
Get
(
"Language"
,
"zh-CN"
)
==
"en-US"
||
Config
.
Get
(
"Language"
,
"zh-CN"
)
==
"es-ES"
)
if
(
Config
.
Get
(
"
Card
Language"
,
"zh-CN"
)
==
"en-US"
||
Config
.
Get
(
"
Card
Language"
,
"zh-CN"
)
==
"es-ES"
)
{
cardName
.
text
=
string
.
Empty
;
cardNameTMP
.
text
=
data
.
Name
;
...
...
@@ -259,7 +259,7 @@ namespace MDPro3
cardArtPendulum
.
texture
=
art
;
}
var
pendulumDescription
=
CardDescription
.
GetCardDescriptionSplit
(
data
.
Desc
);
cardDescription
.
text
=
StringHelper
.
GetType
(
data
).
Replace
(
Program
.
slash
,
bigSlash
)
+
"\r\n"
+
TextForRender
(
pendulumDescription
[
1
]);
cardDescription
.
text
=
StringHelper
.
GetType
(
data
,
true
).
Replace
(
Program
.
slash
,
bigSlash
)
+
"\r\n"
+
TextForRender
(
pendulumDescription
[
1
]);
cardDescriptionPendulum
.
text
=
TextForRender
(
pendulumDescription
[
0
]);
lScale
.
text
=
data
.
LScale
.
ToString
();
rScale
.
text
=
data
.
RScale
.
ToString
();
...
...
@@ -282,7 +282,7 @@ namespace MDPro3
cardArt
.
texture
=
art
;
var
description
=
""
;
if
((
data
.
Type
&
(
uint
)
CardType
.
Monster
)
>
0
)
description
=
StringHelper
.
GetType
(
data
).
Replace
(
Program
.
slash
,
bigSlash
)
+
"\r\n"
;
description
=
StringHelper
.
GetType
(
data
,
true
).
Replace
(
Program
.
slash
,
bigSlash
)
+
"\r\n"
;
description
+=
TextForRender
(
data
.
Desc
);
cardDescription
.
text
=
description
;
...
...
@@ -320,7 +320,7 @@ namespace MDPro3
var
bracketRight
=
"】"
;
var
spaces
=
" "
;
spellTypeIcon
.
GetComponent
<
RectTransform
>().
anchoredPosition
=
new
Vector2
(-
79f
,
364
);
switch
(
Config
.
Get
(
"Language"
,
"zh-CN"
))
switch
(
Config
.
Get
(
"
Card
Language"
,
"zh-CN"
))
{
case
"en-US"
:
bracketLeft
=
"["
;
...
...
@@ -350,7 +350,7 @@ namespace MDPro3
if
((
data
.
Type
&
(
uint
)
CardType
.
Spell
)
>
0
)
{
cardFrame
.
sprite
=
TextureManager
.
container
.
cardFrameSpellOF
;
var
type
=
bracketLeft
+
InterString
.
Get
(
"魔法卡"
)
+
spaces
+
bracketRight
;
var
type
=
bracketLeft
+
InterString
.
Get
(
"魔法卡"
,
true
)
+
spaces
+
bracketRight
;
if
((
data
.
Type
&
(
uint
)
CardType
.
Field
)
>
0
)
spellTypeIcon
.
sprite
=
TextureManager
.
container
.
typeField
;
else
if
((
data
.
Type
&
(
uint
)
CardType
.
Equip
)
>
0
)
...
...
@@ -368,7 +368,7 @@ namespace MDPro3
else
{
cardFrame
.
sprite
=
TextureManager
.
container
.
cardFrameTrapOF
;
var
type
=
bracketLeft
+
InterString
.
Get
(
"陷阱卡"
)
+
spaces
+
bracketRight
;
var
type
=
bracketLeft
+
InterString
.
Get
(
"陷阱卡"
,
true
)
+
spaces
+
bracketRight
;
if
((
data
.
Type
&
(
uint
)
CardType
.
Counter
)
>
0
)
spellTypeIcon
.
sprite
=
TextureManager
.
container
.
typeCounter
;
else
if
((
data
.
Type
&
(
uint
)
CardType
.
Continuous
)
>
0
)
...
...
@@ -490,7 +490,7 @@ namespace MDPro3
{
if
(
string
.
IsNullOrEmpty
(
description
))
return
string
.
Empty
;
var
language
=
Config
.
Get
(
"Language"
,
"zh-CN"
);
var
language
=
Config
.
Get
(
"
Card
Language"
,
"zh-CN"
);
if
(
language
==
"ja-JP"
)
{
...
...
Assets/Scripts/MDPro3/Duel/GameCard.cs
View file @
15bccc0f
...
...
@@ -11,7 +11,6 @@ using MDPro3.UI;
using
MDPro3.YGOSharp
;
using
MDPro3.YGOSharp.OCGWrapper.Enums
;
namespace
MDPro3
{
public
class
GPS
...
...
@@ -1736,6 +1735,7 @@ namespace MDPro3
sequence
.
Append
(
offset
.
DOLocalMove
(
new
Vector3
(
0
,
2
,
3
),
0.1f
).
OnStart
(()
=>
{
AudioManager
.
PlaySE
(
"SE_CARDVIEW_02"
);
Program
.
I
().
ocgcore
.
description
.
Show
(
this
,
null
);
}));
sequence
.
Join
(
turn
.
DOLocalRotate
(
Vector3
.
zero
,
0.1f
).
OnComplete
(()
=>
{
...
...
Assets/Scripts/MDPro3/Duel/MDPro3.YGOSharp/Card.cs
View file @
15bccc0f
...
...
@@ -120,40 +120,39 @@ namespace MDPro3.YGOSharp
internal
Card
(
IDataRecord
reader
)
{
this
.
Str
=
new
string
[
16
];
this
.
Id
=
(
int
)
reader
.
GetInt64
(
0
);
this
.
Ot
=
reader
.
GetInt32
(
1
);
this
.
Alias
=
(
int
)
reader
.
GetInt64
(
2
);
this
.
Setcode
=
reader
.
GetInt64
(
3
);
this
.
Type
=
(
int
)
reader
.
GetInt64
(
4
);
this
.
Attack
=
reader
.
GetInt32
(
5
);
this
.
Defense
=
reader
.
GetInt32
(
6
);
this
.
rAttack
=
this
.
Attack
;
this
.
rDefense
=
this
.
Defense
;
Str
=
new
string
[
16
];
Id
=
(
int
)
reader
.
GetInt64
(
0
);
Ot
=
reader
.
GetInt32
(
1
);
Alias
=
(
int
)
reader
.
GetInt64
(
2
);
Setcode
=
reader
.
GetInt64
(
3
);
Type
=
(
int
)
reader
.
GetInt64
(
4
);
Attack
=
reader
.
GetInt32
(
5
);
Defense
=
reader
.
GetInt32
(
6
);
rAttack
=
this
.
Attack
;
rDefense
=
this
.
Defense
;
long
Level_raw
=
reader
.
GetInt64
(
7
);
this
.
Level
=
(
int
)
Level_raw
&
0xff
;
this
.
LScale
=
(
int
)((
Level_raw
>>
0x18
)
&
0xff
);
this
.
RScale
=
(
int
)((
Level_raw
>>
0x10
)
&
0xff
);
this
.
LinkMarker
=
this
.
Defense
;
this
.
Race
=
reader
.
GetInt32
(
8
);
this
.
Attribute
=
reader
.
GetInt32
(
9
);
this
.
Category
=
reader
.
GetInt64
(
10
);
this
.
Name
=
reader
.
GetString
(
12
);
this
.
Desc
=
reader
.
GetString
(
13
);
Level
=
(
int
)
Level_raw
&
0xff
;
LScale
=
(
int
)((
Level_raw
>>
0x18
)
&
0xff
);
RScale
=
(
int
)((
Level_raw
>>
0x10
)
&
0xff
);
LinkMarker
=
this
.
Defense
;
Race
=
reader
.
GetInt32
(
8
);
Attribute
=
reader
.
GetInt32
(
9
);
Category
=
reader
.
GetInt64
(
10
);
Name
=
reader
.
GetString
(
12
);
Desc
=
reader
.
GetString
(
13
);
for
(
int
ii
=
0
;
ii
<
0x10
;
ii
++)
{
this
.
Str
[
ii
]
=
reader
.
GetString
(
14
+
ii
);
Str
[
ii
]
=
reader
.
GetString
(
14
+
ii
);
}
}
public
Card
()
{
this
.
Id
=
0
;
this
.
Str
=
new
string
[
16
];
this
.
Name
=
CardsManager
.
nullName
;
this
.
Desc
=
CardsManager
.
nullString
;
Id
=
0
;
Str
=
new
string
[
16
];
Name
=
CardsManager
.
nullName
;
Desc
=
CardsManager
.
nullString
;
}
}
}
\ No newline at end of file
Assets/Scripts/MDPro3/Duel/MDPro3.YGOSharp/CardsManager.cs
View file @
15bccc0f
...
...
@@ -6,7 +6,6 @@ using Mono.Data.Sqlite;
using
MDPro3.YGOSharp.OCGWrapper.Enums
;
using
System.IO
;
using
static
MDPro3
.
EditDeck
;
using
System.Text
;
using
Ionic.Zip
;
namespace
MDPro3.YGOSharp
...
...
@@ -14,7 +13,7 @@ namespace MDPro3.YGOSharp
internal
static
class
CardsManager
{
public
static
IDictionary
<
int
,
Card
>
_cards
=
new
Dictionary
<
int
,
Card
>();
public
static
IDictionary
<
int
,
Card
>
_cardsForRender
=
new
Dictionary
<
int
,
Card
>();
public
static
string
nullName
=
""
;
public
static
string
nullString
=
""
;
...
...
@@ -52,9 +51,36 @@ namespace MDPro3.YGOSharp
}
UpdateSetNames
();
PacksManager
.
Initialize
();
_cardsForRender
.
Clear
();
var
cardLanguage
=
Config
.
Get
(
"CardLanguage"
,
"zh-CN"
);
databaseFullPath
=
Program
.
localesPath
+
Program
.
slash
+
cardLanguage
+
"/cards.cdb"
;
if
(!
File
.
Exists
(
databaseFullPath
))
databaseFullPath
=
Program
.
localesPath
+
Program
.
slash
+
"zh-CN/cards.cdb"
;
LoadCDB
(
databaseFullPath
,
true
);
foreach
(
var
cdb
in
Directory
.
GetFiles
(
"Expansions"
,
"*.cdb"
))
LoadCDB
(
cdb
,
true
);
foreach
(
var
zip
in
ZipHelper
.
zips
)
{
if
(
zip
.
Name
.
ToLower
().
EndsWith
(
"script.zip"
))
continue
;
foreach
(
var
file
in
zip
.
EntryFileNames
)
{
if
(
file
.
ToLower
().
EndsWith
(
".cdb"
))
{
var
e
=
zip
[
file
];
if
(!
Directory
.
Exists
(
Program
.
tempFolder
))
Directory
.
CreateDirectory
(
Program
.
tempFolder
);
var
tempFile
=
Path
.
Combine
(
Path
.
GetFullPath
(
Program
.
tempFolder
),
file
);
e
.
Extract
(
Path
.
GetFullPath
(
Program
.
tempFolder
),
ExtractExistingFileAction
.
OverwriteSilently
);
LoadCDB
(
tempFile
,
true
);
File
.
Delete
(
tempFile
);
}
}
}
}
internal
static
void
LoadCDB
(
string
databaseFullPath
)
internal
static
void
LoadCDB
(
string
databaseFullPath
,
bool
render
=
false
)
{
using
(
SqliteConnection
connection
=
new
SqliteConnection
(
"Data Source="
+
databaseFullPath
))
{
...
...
@@ -67,7 +93,7 @@ namespace MDPro3.YGOSharp
{
while
(
reader
.
Read
())
{
LoadCard
(
reader
);
LoadCard
(
reader
,
render
);
}
}
}
...
...
@@ -89,7 +115,12 @@ namespace MDPro3.YGOSharp
return
_cards
[
id
].
Clone
();
return
null
;
}
internal
static
Card
GetRenderCard
(
int
id
)
{
if
(
_cardsForRender
.
ContainsKey
(
id
))
return
_cardsForRender
[
id
].
Clone
();
return
null
;
}
internal
static
Card
GetCardRaw
(
int
id
)
{
if
(
_cards
.
ContainsKey
(
id
))
...
...
@@ -120,12 +151,18 @@ namespace MDPro3.YGOSharp
return
returnValue
;
}
private
static
void
LoadCard
(
IDataRecord
reader
)
private
static
void
LoadCard
(
IDataRecord
reader
,
bool
render
=
false
)
{
Card
card
=
new
Card
(
reader
);
if
(!
_cards
.
ContainsKey
(
card
.
Id
))
if
(!
render
)
{
if
(!
_cards
.
ContainsKey
(
card
.
Id
))
_cards
.
Add
(
card
.
Id
,
card
);
}
else
{
_cards
.
Add
(
card
.
Id
,
card
);
if
(!
_cardsForRender
.
ContainsKey
(
card
.
Id
))
_cardsForRender
.
Add
(
card
.
Id
,
card
);
}
}
...
...
Assets/Scripts/MDPro3/Helper/InterString.cs
View file @
15bccc0f
...
...
@@ -8,18 +8,19 @@ namespace MDPro3
public
static
class
InterString
{
private
static
readonly
Dictionary
<
string
,
string
>
translations
=
new
Dictionary
<
string
,
string
>();
private
static
string
path
;
private
static
readonly
Dictionary
<
string
,
string
>
translationsForRender
=
new
Dictionary
<
string
,
string
>()
;
private
static
string
path
;
private
static
string
pathForRender
;
public
static
void
Initialize
()
{
string
language
=
Config
.
Get
(
"Language"
,
"zh-CN"
);
path
=
Program
.
localesPath
+
Program
.
slash
+
language
+
"/translation.conf"
;
translations
.
Clear
(
);
path
=
Program
.
localesPath
+
Program
.
slash
+
Config
.
Get
(
"Language"
,
"zh-CN"
)
+
"/translation.conf"
;
if
(!
File
.
Exists
(
path
))
File
.
Create
(
path
).
Close
();
var
txtString
=
File
.
ReadAllText
(
path
);
var
lines
=
txtString
.
Replace
(
"\r"
,
""
).
Split
(
'\n'
);
translations
.
Clear
();
for
(
var
i
=
0
;
i
<
lines
.
Length
;
i
++)
{
var
mats
=
Regex
.
Split
(
lines
[
i
],
"->"
);
...
...
@@ -27,34 +28,49 @@ namespace MDPro3
if
(!
translations
.
ContainsKey
(
mats
[
0
]))
translations
.
Add
(
mats
[
0
],
mats
[
1
]);
}
translationsForRender
.
Clear
();
pathForRender
=
Program
.
localesPath
+
Program
.
slash
+
Config
.
Get
(
"CardLanguage"
,
"zh-CN"
)
+
"/translation.conf"
;
if
(!
File
.
Exists
(
pathForRender
))
File
.
Create
(
pathForRender
).
Close
();
txtString
=
File
.
ReadAllText
(
pathForRender
);
lines
=
txtString
.
Replace
(
"\r"
,
""
).
Split
(
'\n'
);
for
(
var
i
=
0
;
i
<
lines
.
Length
;
i
++)
{
var
mats
=
Regex
.
Split
(
lines
[
i
],
"->"
);
if
(
mats
.
Length
==
2
)
if
(!
translationsForRender
.
ContainsKey
(
mats
[
0
]))
translationsForRender
.
Add
(
mats
[
0
],
mats
[
1
]);
}
}
public
static
string
Get
(
string
original
)
public
static
string
Get
(
string
original
,
bool
render
=
false
)
{
var
returnValue
=
original
;
if
(
translations
.
TryGetValue
(
original
,
out
returnValue
))
var
targetTranslations
=
render
?
translationsForRender
:
translations
;
if
(
targetTranslations
.
TryGetValue
(
original
,
out
returnValue
))
return
returnValue
.
Replace
(
"@n"
,
"\r\n"
).
Replace
(
"@ui"
,
""
);
if
(
original
!=
""
)
{
try
{
File
.
AppendAllText
(
path
,
original
+
"->"
+
original
+
"\r\n"
);
File
.
AppendAllText
(
render
?
pathForRender
:
path
,
original
+
"->"
+
original
+
"\r\n"
);
}
catch
{
Program
.
noAccess
=
true
;
}
translations
.
Add
(
original
,
original
);
t
argetT
ranslations
.
Add
(
original
,
original
);
return
original
.
Replace
(
"@n"
,
"\r\n"
).
Replace
(
"@ui"
,
""
);
}
return
original
;
}
public
static
string
Get
(
string
original
,
string
replace
)
public
static
string
Get
(
string
original
,
string
replace
,
bool
render
=
false
)
{
return
Get
(
original
).
Replace
(
"[?]"
,
replace
);
return
Get
(
original
,
render
).
Replace
(
"[?]"
,
replace
);
}
public
static
string
GetOriginal
(
string
value
)
{
...
...
@@ -69,6 +85,5 @@ namespace MDPro3
}
return
returnValue
;
}
}
}
Assets/Scripts/MDPro3/Helper/StringHelper.cs
View file @
15bccc0f
...
...
@@ -11,7 +11,7 @@ namespace MDPro3
public
static
class
StringHelper
{
public
static
List
<
HashedString
>
hashedStrings
=
new
List
<
HashedString
>();
public
static
List
<
HashedString
>
hashedStringsForRender
=
new
List
<
HashedString
>();
public
static
List
<
HashedString
>
setNames
=
new
List
<
HashedString
>();
public
static
int
StringToInt
(
string
str
)
...
...
@@ -53,10 +53,31 @@ namespace MDPro3
}
}
}
InitializeContent
(
text
);
language
=
Config
.
Get
(
"CardLanguage"
,
"zh-CN"
);
path
=
Program
.
localesPath
+
Program
.
slash
+
language
+
"/strings.conf"
;
string
textForRender
=
File
.
ReadAllText
(
path
);
foreach
(
var
conf
in
Directory
.
GetFiles
(
"Expansions"
,
"*.conf"
))
textForRender
+=
"\r\n"
+
File
.
ReadAllText
(
conf
);
foreach
(
var
zip
in
ZipHelper
.
zips
)
{
if
(
zip
.
Name
.
ToLower
().
EndsWith
(
"script.zip"
))
continue
;
foreach
(
var
file
in
zip
.
EntryFileNames
)
{
if
(
file
.
ToLower
().
EndsWith
(
".conf"
))
{
var
ms
=
new
MemoryStream
();
var
e
=
zip
[
file
];
e
.
Extract
(
ms
);
textForRender
+=
"\r\n"
+
Encoding
.
UTF8
.
GetString
(
ms
.
ToArray
());
}
}
}
InitializeContent
(
text
,
textForRender
);
}
public
static
void
InitializeContent
(
string
text
)
public
static
void
InitializeContent
(
string
text
,
string
textForRender
)
{
var
st
=
text
.
Replace
(
"\r"
,
""
);
var
lines
=
st
.
Split
(
new
[]
{
"\n"
},
StringSplitOptions
.
RemoveEmptyEntries
);
...
...
@@ -89,12 +110,40 @@ namespace MDPro3
}
}
}
hashedStringsForRender
.
Clear
();
st
=
textForRender
.
Replace
(
"\r"
,
""
);
lines
=
st
.
Split
(
new
[]
{
"\n"
},
StringSplitOptions
.
RemoveEmptyEntries
);
foreach
(
var
line
in
lines
)
if
(
line
.
Length
>
1
&&
line
.
Substring
(
0
,
1
)
==
"!"
)
{
var
mats
=
line
.
Substring
(
1
,
line
.
Length
-
1
).
Split
(
new
[]
{
" "
},
StringSplitOptions
.
RemoveEmptyEntries
);
if
(
mats
.
Length
>
2
)
{
var
a
=
new
HashedString
();
a
.
region
=
mats
[
0
];
try
{
a
.
hashCode
=
StringToInt
(
mats
[
1
]);
}
catch
(
Exception
e
)
{
MessageManager
.
Cast
(
e
.
ToString
());
}
a
.
content
=
""
;
for
(
var
i
=
2
;
i
<
mats
.
Length
;
i
++)
a
.
content
+=
mats
[
i
]
+
" "
;
a
.
content
=
a
.
content
.
Substring
(
0
,
a
.
content
.
Length
-
1
);
if
(
Get
(
a
.
region
,
a
.
hashCode
,
true
)
==
""
)
hashedStringsForRender
.
Add
(
a
);
}
}
}
public
static
string
Get
(
string
region
,
int
hashCode
)
public
static
string
Get
(
string
region
,
int
hashCode
,
bool
render
=
false
)
{
var
re
=
""
;
foreach
(
var
s
in
hashedStrings
)
foreach
(
var
s
in
render
?
hashedStringsForRender
:
hashedStrings
)
if
(
s
.
region
==
region
&&
s
.
hashCode
==
hashCode
)
{
re
=
s
.
content
;
...
...
@@ -103,10 +152,10 @@ namespace MDPro3
return
re
;
}
internal
static
string
GetUnsafe
(
int
hashCode
)
internal
static
string
GetUnsafe
(
int
hashCode
,
bool
render
=
false
)
{
var
re
=
""
;
foreach
(
var
s
in
hashedStrings
)
foreach
(
var
s
in
render
?
hashedStringsForRender
:
hashedStrings
)
if
(
s
.
region
==
"system"
&&
s
.
hashCode
==
hashCode
)
{
re
=
s
.
content
;
...
...
@@ -115,7 +164,6 @@ namespace MDPro3
return
re
;
}
internal
static
string
Get
(
int
description
)
{
var
a
=
""
;
...
...
@@ -185,7 +233,7 @@ namespace MDPro3
}
return
r
;
}
public
static
string
Race
(
long
race
)
public
static
string
Race
(
long
race
,
bool
render
=
false
)
{
var
r
=
""
;
var
passFirst
=
false
;
...
...
@@ -193,7 +241,7 @@ namespace MDPro3
if
((
race
&
(
1
<<
i
))
>
0
)
{
if
(
passFirst
)
r
+=
Program
.
slash
;
r
+=
GetUnsafe
(
1020
+
i
);
r
+=
GetUnsafe
(
1020
+
i
,
render
);
passFirst
=
true
;
}
return
r
;
...
...
@@ -254,7 +302,7 @@ namespace MDPro3
}
public
static
string
MainType
(
long
a
)
public
static
string
MainType
(
long
a
,
bool
render
=
false
)
{
var
r
=
""
;
var
passFirst
=
false
;
...
...
@@ -262,13 +310,13 @@ namespace MDPro3
if
((
a
&
(
1
<<
i
))
>
0
)
{
if
(
passFirst
)
r
+=
Program
.
slash
;
r
+=
GetUnsafe
(
1050
+
i
);
r
+=
GetUnsafe
(
1050
+
i
,
render
);
passFirst
=
true
;
}
return
r
;
}
public
static
string
SecondType
(
long
a
)
public
static
string
SecondType
(
long
a
,
bool
render
=
false
)
{
var
start
=
""
;
var
end
=
""
;
...
...
@@ -277,14 +325,14 @@ namespace MDPro3
for
(
var
i
=
4
;
i
<
27
;
i
++)
if
(((
a
&
0x68020C0
)
&
(
1
<<
i
))
>
0
)
{
start
+=
Program
.
slash
+
GetUnsafe
(
1050
+
i
);
start
+=
Program
.
slash
+
GetUnsafe
(
1050
+
i
,
render
);
break
;
}
a
-=
a
&
0x68020C0
;
}
if
((
a
&
(
long
)
CardType
.
Pendulum
)
>
0
)
{
start
+=
Program
.
slash
+
GetUnsafe
(
1074
);
start
+=
Program
.
slash
+
GetUnsafe
(
1074
,
render
);
a
-=
(
long
)
CardType
.
Pendulum
;
}
if
((
a
&
0x30
)
>
0
)
...
...
@@ -292,29 +340,29 @@ namespace MDPro3
for
(
var
i
=
4
;
i
<
6
;
i
++)
if
((
a
&
(
1
<<
i
))
>
0
)
{
end
+=
Program
.
slash
+
GetUnsafe
(
1050
+
i
);
end
+=
Program
.
slash
+
GetUnsafe
(
1050
+
i
,
render
);
break
;
}
a
-=
a
&
0x30
;
}
for
(
var
i
=
4
;
i
<
27
;
i
++)
if
((
a
&
(
1
<<
i
))
>
0
)
start
+=
Program
.
slash
+
GetUnsafe
(
1050
+
i
);
start
+=
Program
.
slash
+
GetUnsafe
(
1050
+
i
,
render
);
var
returnValue
=
start
+
end
;
if
(
returnValue
==
""
)
returnValue
=
GetUnsafe
(
1054
);
returnValue
=
GetUnsafe
(
1054
,
render
);
else
returnValue
=
returnValue
.
Substring
(
1
,
returnValue
.
Length
-
1
);
return
returnValue
;
}
public
static
string
GetType
(
Card
data
)
public
static
string
GetType
(
Card
data
,
bool
render
=
false
)
{
var
re
=
""
;
if
(
data
.
Id
==
0
)
return
re
;
var
origin
=
CardsManager
.
Get
(
data
.
Id
);
var
origin
=
render
?
CardsManager
.
GetRenderCard
(
data
.
Id
)
:
CardsManager
.
Get
(
data
.
Id
);
try
{
if
(
CardDescription
.
WhetherCardIsMonster
(
data
))
...
...
@@ -322,7 +370,7 @@ namespace MDPro3
if
(
data
.
Race
!=
origin
.
Race
)
re
=
"¡¾"
+
"<color=#FD3E08>"
+
InterString
.
Get
(
"[?]×å"
,
Race
(
data
.
Race
))
+
"</color>"
+
Program
.
slash
+
SecondType
(
data
.
Type
)
+
"¡¿"
;
else
re
=
""
+
InterString
.
Get
(
"[?]"
,
Race
(
data
.
Race
))
+
Program
.
slash
+
SecondType
(
data
.
Type
)
+
""
;
re
=
"¡¾"
+
InterString
.
Get
(
"[?]×å"
,
Race
(
data
.
Race
,
render
),
render
)
+
Program
.
slash
+
SecondType
(
data
.
Type
,
re
nder
)
+
"¡¿"
;
}
else
re
=
"¡¾"
+
MainType
(
data
.
Type
)
+
"¡¿"
;
...
...
@@ -331,6 +379,7 @@ namespace MDPro3
{
Debug
.
LogError
(
e
);
}
return
re
;
}
public
static
string
GetSetName
(
long
Setcode
,
bool
raw
=
false
)
{
var
setcodes
=
new
int
[
4
];
...
...
Assets/Scripts/MDPro3/Managers/TextureManager.cs
View file @
15bccc0f
...
...
@@ -124,6 +124,20 @@ namespace MDPro3
manager
.
gameObject
.
SetActive
(
true
);
}
public
IEnumerator
LoadDummyCardLoadingPic
(
ElementObjectManager
manager
,
int
code
,
bool
active
=
false
)
{
if
(
active
)
manager
.
gameObject
.
SetActive
(
false
);
var
ie
=
LoadCardAsync
(
code
,
true
);
while
(
ie
.
MoveNext
())
yield
return
null
;
manager
.
GetElement
<
Renderer
>(
"DummyCardModel_side"
).
material
=
cardMatSide
;
manager
.
GetElement
<
Renderer
>(
"DummyCardModel_front"
).
material
.
SetTexture
(
"_LoadingTex"
,
ie
.
Current
);
manager
.
GetElement
<
Renderer
>(
"DummyCardModel_front"
).
material
.
SetFloat
(
"_LoadingBlend"
,
1
);
if
(
active
)
manager
.
gameObject
.
SetActive
(
true
);
}
public
static
IEnumerator
<
Texture2D
>
LoadFromFileAsync
(
string
path
)
{
if
(!
File
.
Exists
(
path
))
...
...
Assets/Scripts/MDPro3/Servants/OcgCore.cs
View file @
15bccc0f
This diff is collapsed.
Click to expand it.
Assets/Scripts/MDPro3/Servants/Setting.cs
View file @
15bccc0f
...
...
@@ -48,6 +48,8 @@ namespace MDPro3
public
Text
autoRPSValue
;
public
Slider
uiScale
;
public
Text
uiScaleValue
;
public
Button
cardLanguage
;
public
Text
cardLanguageValue
;
public
Button
language
;
public
Text
languageValue
;
[
Header
(
"Duel"
)]
...
...
@@ -163,6 +165,7 @@ namespace MDPro3
showFPS
.
onClick
.
AddListener
(
OnShowFPSClicked
);
screen
.
onClick
.
AddListener
(
OnScreenModeChange
);
resolution
.
onClick
.
AddListener
(
OnResolutionChange
);
cardLanguage
.
onClick
.
AddListener
(
OnCardLanguageChange
);
language
.
onClick
.
AddListener
(
OnLanguageChange
);
confirm
.
onClick
.
AddListener
(
OnConfirmClicked
);
autoRPS
.
onClick
.
AddListener
(
OnAutoRPS
);
...
...
@@ -230,6 +233,7 @@ namespace MDPro3
InitializeScreenMode
();
InitializeResolution
();
InitializeConfirm
();
InitializeCardLanguage
();
InitializeLanguage
();
InitializeSwitches
();
}
...
...
@@ -278,6 +282,7 @@ namespace MDPro3
Config
.
Set
(
"ShowFPS"
,
SaveBool
(
showFPSValue
.
text
));
Config
.
Set
(
"ScreenMode"
,
SaveScreenMode
(
screenValue
.
text
));
Config
.
Set
(
"Resolution"
,
resolutionValue
.
text
);
Config
.
Set
(
"CardLanguage"
,
InterString
.
GetOriginal
(
cardLanguageValue
.
text
));
Config
.
Set
(
"Language"
,
InterString
.
GetOriginal
(
languageValue
.
text
));
Config
.
Set
(
"Confirm"
,
SaveBool
(
confirmValue
.
text
));
...
...
@@ -660,6 +665,36 @@ namespace MDPro3
Screen
.
SetResolution
(
int
.
Parse
(
Regex
.
Split
(
selected
,
" x "
)[
0
]),
int
.
Parse
(
Regex
.
Split
(
selected
,
" x "
)[
1
]),
Screen
.
fullScreen
);
resolutionValue
.
text
=
selected
;
}
public
void
InitializeCardLanguage
()
{
string
lan
=
Config
.
Get
(
"CardLanguage"
,
"zh-CN"
);
cardLanguageValue
.
text
=
InterString
.
Get
(
lan
);
}
public
void
OnCardLanguageChange
()
{
if
(
Program
.
I
().
ocgcore
.
isShowed
)
{
MessageManager
.
Cast
(
InterString
.
Get
(
"决斗中不能更改此选项。"
));
return
;
}
List
<
string
>
selections
=
new
List
<
string
>
{
InterString
.
Get
(
"卡图语言"
)
};
DirectoryInfo
[]
infos
=
new
DirectoryInfo
(
Program
.
localesPath
).
GetDirectories
();
foreach
(
DirectoryInfo
info
in
infos
)
selections
.
Add
(
InterString
.
Get
(
info
.
Name
));
UIManager
.
ShowPopupSelection
(
selections
,
OnCardLanguageSelection
);
}
public
void
OnCardLanguageSelection
()
{
string
selected
=
UnityEngine
.
EventSystems
.
EventSystem
.
current
.
currentSelectedGameObject
.
transform
.
GetChild
(
0
).
GetComponent
<
Text
>().
text
;
cardLanguageValue
.
text
=
selected
;
Config
.
Set
(
"CardLanguage"
,
InterString
.
GetOriginal
(
selected
));
UIManager
.
ChangeLanguage
();
}
public
void
InitializeLanguage
()
{
string
lan
=
Config
.
Get
(
"Language"
,
"zh-CN"
);
...
...
@@ -690,6 +725,7 @@ namespace MDPro3
Config
.
Set
(
"Language"
,
InterString
.
GetOriginal
(
selected
));
UIManager
.
ChangeLanguage
();
}
public
void
InitializeConfirm
()
{
string
value
=
Config
.
Get
(
"Confirm"
,
"1"
);
...
...
Assets/Scripts/MasterDuel/YgomSystem/Effect/SpriteScaler.cs
View file @
15bccc0f
...
...
@@ -146,33 +146,41 @@ namespace YgomSystem.Effect
{
var
widthScale
=
transform
.
localScale
.
x
;
var
heightScale
=
transform
.
localScale
.
y
;
if
(
fitMode
==
FitMode
.
FitWidth
)
var
z
=
transform
.
localScale
.
z
;
if
(
fitMode
==
FitMode
.
FitWidth
)
{
var
x
=
widthScale
*
(
Screen
.
width
*
9f
/
(
Screen
.
height
*
16f
));
transform
.
localScale
=
new
Vector
2
(
x
,
heightScale
);
transform
.
localScale
=
new
Vector
3
(
x
,
heightScale
,
z
);
}
else
if
(
fitMode
==
FitMode
.
FitHeight
)
{
var
y
=
heightScale
*
(
Screen
.
height
*
16f
/
(
Screen
.
width
*
9f
));
transform
.
localScale
=
new
Vector
2
(
widthScale
,
y
);
transform
.
localScale
=
new
Vector
3
(
widthScale
,
y
,
z
);
}
else
if
(
fitMode
==
FitMode
.
FitWidthMaintainAspectRatio
)
{
var
x
=
widthScale
*
(
Screen
.
width
*
9f
/
(
Screen
.
height
*
16f
));
transform
.
localScale
=
new
Vector2
(
x
,
heightScale
*
x
/
widthScale
);
if
(
name
==
"SpliteDummy"
||
name
==
"White"
)
{
var
x
=
widthScale
*
(
Screen
.
width
*
9f
/
(
Screen
.
height
*
16f
));
transform
.
localScale
=
new
Vector3
(
x
,
heightScale
*
x
/
widthScale
,
z
);
}
else
if
(
name
==
"Black"
)
{
widthScale
=
15f
*
(
Screen
.
width
*
9f
/
(
Screen
.
height
*
16f
));
transform
.
localScale
=
new
Vector3
(
widthScale
,
widthScale
,
z
);
}
}
else
if
(
fitMode
==
FitMode
.
FitHeightMaintainAspectRatio
)
{
var
y
=
heightScale
*
(
Screen
.
height
*
16f
/
(
Screen
.
width
*
9f
))
;
transform
.
localScale
=
new
Vector
2
(
widthScale
*
y
/
heightScale
,
y
);
heightScale
=
6f
;
transform
.
localScale
=
new
Vector
3
(
heightScale
,
heightScale
,
z
);
}
else
if
(
fitMode
==
FitMode
.
FitWidthHeight
)
{
var
x
=
heightScale
*
Screen
.
width
/
Screen
.
height
;
transform
.
localScale
=
new
Vector
2
(
x
*
1.1f
,
heightScale
);
if
(
transform
.
parent
.
name
.
StartsWith
(
"Ef04678"
))
transform
.
localScale
=
new
Vector
2
(
x
*
2f
,
heightScale
*
2f
);
transform
.
localScale
=
new
Vector
3
(
x
*
1.1f
,
heightScale
,
z
);
if
(
transform
.
parent
!=
null
&&
transform
.
parent
.
name
.
StartsWith
(
"Ef04678"
))
transform
.
localScale
=
new
Vector
3
(
x
*
2f
,
heightScale
*
2f
,
z
);
}
}
...
...
Assets/Scripts/MasterDuel/YgomSystem/Timeline/EventPlayableAsset.cs
View file @
15bccc0f
...
...
@@ -26,7 +26,16 @@ namespace YgomSystem.Timeline
var
playable
=
ScriptPlayable
<
EventPlayableBehaviour
>.
Create
(
graph
);
var
behaviour
=
playable
.
GetBehaviour
();
behaviour
.
label
=
label
;
behaviour
.
eventList
=
new
List
<
EventPlayableBehaviour
.
EventInfo
>();
foreach
(
var
info
in
eventList
)
{
behaviour
.
eventList
.
Add
(
new
EventPlayableBehaviour
.
EventInfo
()
{
label
=
info
.
label
,
time
=
info
.
time
,
isDone
=
false
});
}
return
playable
;
}
}
...
...
Assets/Scripts/MasterDuel/YgomSystem/Timeline/EventPlayableBehaviour.cs
View file @
15bccc0f
...
...
@@ -31,9 +31,20 @@ namespace YgomSystem.Timeline
public
override
void
OnBehaviourPlay
(
Playable
playable
,
FrameData
info
)
{
PlayContent
();
foreach
(
var
e
in
eventList
)
{
if
(
e
.
label
==
"WinStart"
&&
!
e
.
isDone
)
{
e
.
isDone
=
true
;
DOTween
.
To
(
v
=>
{
},
0
,
0
,
(
float
)
e
.
time
).
OnComplete
(()
=>
{
Program
.
I
().
ocgcore
.
endingAction
?.
Invoke
();
});
}
}
}
public
override
void
ProcessFrame
(
Playable
playable
,
FrameData
info
,
object
playerData
)
public
override
void
ProcessFrame
(
Playable
playable
,
FrameData
info
,
object
playerData
)
{
if
(
playable
.
GetPlayState
()
==
PlayState
.
Playing
)
PlayContent
();
...
...
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