Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOProUnity_V2
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
赤子奈落
YGOProUnity_V2
Commits
f18ec3e5
Commit
f18ec3e5
authored
Aug 21, 2020
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for zip and ypk files
parent
65d6c7e3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
207 additions
and
21 deletions
+207
-21
.gitignore
.gitignore
+3
-0
Assets/Plugins/Ionic.Zip.Unity.dll
Assets/Plugins/Ionic.Zip.Unity.dll
+0
-0
Assets/Plugins/Ionic.Zip.Unity.dll.meta
Assets/Plugins/Ionic.Zip.Unity.dll.meta
+34
-0
Assets/SibylSystem/Ocgcore/OCGobjects/gameField.cs
Assets/SibylSystem/Ocgcore/OCGobjects/gameField.cs
+27
-2
Assets/SibylSystem/Program.cs
Assets/SibylSystem/Program.cs
+51
-1
Assets/SibylSystem/ResourceManagers/GameStringManager.cs
Assets/SibylSystem/ResourceManagers/GameStringManager.cs
+5
-0
Assets/SibylSystem/ResourceManagers/GameTextureManager.cs
Assets/SibylSystem/ResourceManagers/GameTextureManager.cs
+36
-8
Assets/SibylSystem/ResourceManagers/GameZipManager.cs
Assets/SibylSystem/ResourceManagers/GameZipManager.cs
+8
-0
Assets/SibylSystem/ResourceManagers/GameZipManager.cs.meta
Assets/SibylSystem/ResourceManagers/GameZipManager.cs.meta
+12
-0
Assets/SibylSystem/precy.cs
Assets/SibylSystem/precy.cs
+31
-10
No files found.
.gitignore
View file @
f18ec3e5
...
...
@@ -37,7 +37,9 @@ sysinfo.txt
# ygopro
ai/
cdb/
data/
deck/
expansions/
pack/
picture/
puzzle/
...
...
@@ -54,3 +56,4 @@ AI_core_vs2017solution/System.Servicemodel.Faltexception.dll
[Ll]ibrary_/
AI_core_vs2017solution/.vs
commamd.shell
Windbot/
Assets/Plugins/Ionic.Zip.Unity.dll
0 → 100644
View file @
f18ec3e5
File added
Assets/Plugins/Ionic.Zip.Unity.dll.meta
0 → 100644
View file @
f18ec3e5
fileFormatVersion: 2
guid: 27773076e82c4f9499f47df8b04c85d8
timeCreated: 1597969331
licenseType: Pro
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Any:
second:
enabled: 1
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
data:
first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
Assets/SibylSystem/Ocgcore/OCGobjects/gameField.cs
View file @
f18ec3e5
using
System
;
using
Ionic.Zip
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
UnityEngine
;
...
...
@@ -428,10 +429,34 @@ public class GameField : OCGobject
{
tex
=
UIHelper
.
getTexture2D
(
"picture/field/"
+
code
.
ToString
()
+
".png"
);
}
else
else
if
(
File
.
Exists
(
"picture/field/"
+
code
.
ToString
()
+
".jpg"
))
{
tex
=
UIHelper
.
getTexture2D
(
"picture/field/"
+
code
.
ToString
()
+
".jpg"
);
}
else
{
tex
=
null
;
bool
found
=
false
;
foreach
(
ZipFile
zip
in
GameZipManager
.
Zips
)
{
foreach
(
string
file
in
zip
.
EntryFileNames
)
{
string
file1
=
file
.
ToLower
();
if
(
file1
.
EndsWith
(
code
.
ToString
()
+
".jpg"
)
&&
file1
.
Contains
(
"field"
))
{
MemoryStream
ms
=
new
MemoryStream
();
ZipEntry
e
=
zip
[
file
];
e
.
Extract
(
ms
);
tex
=
new
Texture2D
(
1024
,
600
);
tex
.
LoadImage
(
ms
.
ToArray
());
found
=
true
;
break
;
}
}
if
(
found
)
break
;
}
}
if
(
tex
!=
null
)
{
UIHelper
.
getByName
<
UITexture
>(
gameObject
,
"field_"
+
player
.
ToString
()).
mainTexture
=
tex
;
...
...
Assets/SibylSystem/Program.cs
View file @
f18ec3e5
...
...
@@ -3,6 +3,8 @@ using System.Collections;
using
System.Collections.Generic
;
using
System.IO
;
using
System
;
using
Ionic.Zip
;
using
System.Text
;
public
class
Program
:
MonoBehaviour
{
...
...
@@ -286,8 +288,55 @@ public class Program : MonoBehaviour
go
(
300
,
()
=>
{
InterString
.
initialize
(
"config/translation.conf"
);
var
fileInfos
=
(
new
DirectoryInfo
(
"data"
)).
GetFiles
();
for
(
int
i
=
0
;
i
<
fileInfos
.
Length
;
i
++)
{
if
(
fileInfos
[
i
].
Name
.
Length
>
4
)
{
if
(
fileInfos
[
i
].
Name
.
Substring
(
fileInfos
[
i
].
Name
.
Length
-
4
,
4
)
==
".zip"
)
{
GameZipManager
.
Zips
.
Add
(
new
Ionic
.
Zip
.
ZipFile
(
"data/"
+
fileInfos
[
i
].
Name
));
}
}
}
fileInfos
=
(
new
DirectoryInfo
(
"expansions"
)).
GetFiles
();
for
(
int
i
=
0
;
i
<
fileInfos
.
Length
;
i
++)
{
if
(
fileInfos
[
i
].
Name
.
Length
>
4
)
{
if
(
fileInfos
[
i
].
Name
.
Substring
(
fileInfos
[
i
].
Name
.
Length
-
4
,
4
)
==
".ypk"
)
{
GameZipManager
.
Zips
.
Add
(
new
Ionic
.
Zip
.
ZipFile
(
"expansions/"
+
fileInfos
[
i
].
Name
));
}
}
}
GameTextureManager
.
initialize
();
Config
.
initialize
(
"config/config.conf"
);
foreach
(
ZipFile
zip
in
GameZipManager
.
Zips
)
{
foreach
(
string
file
in
zip
.
EntryFileNames
)
{
if
(
file
.
EndsWith
(
".conf"
))
{
MemoryStream
ms
=
new
MemoryStream
();
ZipEntry
e
=
zip
[
file
];
e
.
Extract
(
ms
);
GameStringManager
.
initializeContent
(
Encoding
.
UTF8
.
GetString
(
ms
.
ToArray
()));
}
if
(
file
.
EndsWith
(
".cdb"
))
{
ZipEntry
e
=
zip
[
file
];
string
tempfile
=
Path
.
Combine
(
Path
.
GetTempPath
(),
file
);
e
.
Extract
(
Path
.
GetTempPath
(),
ExtractExistingFileAction
.
OverwriteSilently
);
YGOSharp
.
CardsManager
.
initialize
(
tempfile
);
File
.
Delete
(
tempfile
);
}
}
}
GameStringManager
.
initialize
(
"config/strings.conf"
);
if
(
File
.
Exists
(
"cdb/strings.conf"
))
{
...
...
@@ -297,9 +346,10 @@ public class Program : MonoBehaviour
{
GameStringManager
.
initialize
(
"diy/strings.conf"
);
}
YGOSharp
.
BanlistManager
.
initialize
(
"config/lflist.conf"
);
var
fileInfos
=
(
new
DirectoryInfo
(
"cdb"
)).
GetFiles
();
fileInfos
=
(
new
DirectoryInfo
(
"cdb"
)).
GetFiles
();
for
(
int
i
=
0
;
i
<
fileInfos
.
Length
;
i
++)
{
if
(
fileInfos
[
i
].
Name
.
Length
>
4
)
...
...
Assets/SibylSystem/ResourceManagers/GameStringManager.cs
View file @
f18ec3e5
...
...
@@ -37,6 +37,11 @@ public static class GameStringManager
public
static
void
initialize
(
string
path
)
{
string
text
=
System
.
IO
.
File
.
ReadAllText
(
path
);
initializeContent
(
text
);
}
public
static
void
initializeContent
(
string
text
)
{
string
st
=
text
.
Replace
(
"\r"
,
""
);
string
[]
lines
=
st
.
Split
(
new
string
[]
{
"\n"
},
StringSplitOptions
.
RemoveEmptyEntries
);
foreach
(
string
line
in
lines
)
...
...
Assets/SibylSystem/ResourceManagers/GameTextureManager.cs
View file @
f18ec3e5
...
...
@@ -6,6 +6,8 @@ using System.IO;
using
System.Threading
;
using
UnityEngine
;
using
YGOSharp.OCGWrapper.Enums
;
using
Ionic.Zip
;
using
System.Text
;
public
enum
GameTextureType
{
...
...
@@ -718,17 +720,43 @@ public class GameTextureManager
}
if
(!
File
.
Exists
(
path
))
{
if
(
pic
.
code
>
0
)
bool
found
=
false
;
foreach
(
ZipFile
zip
in
GameZipManager
.
Zips
)
{
pic
.
u_data
=
unknown
;
}
else
{
pic
.
u_data
=
myBack
;
foreach
(
string
file
in
zip
.
EntryFileNames
)
{
string
file1
=
file
.
ToLower
();
if
(
file1
.
EndsWith
(
pic
.
code
.
ToString
()
+
".jpg"
)
&&
!
file1
.
Contains
(
"field"
))
{
MemoryStream
ms
=
new
MemoryStream
();
ZipEntry
e
=
zip
[
file
];
e
.
Extract
(
ms
);
pic
.
data
=
ms
.
ToArray
();
if
(!
loadedList
.
ContainsKey
(
hashPic
(
pic
.
code
,
pic
.
type
)))
{
loadedList
.
Add
(
hashPic
(
pic
.
code
,
pic
.
type
),
pic
);
}
found
=
true
;
break
;
}
}
if
(
found
)
break
;
}
if
(!
loadedList
.
ContainsKey
(
hashPic
(
pic
.
code
,
pic
.
type
))
)
if
(!
found
)
{
loadedList
.
Add
(
hashPic
(
pic
.
code
,
pic
.
type
),
pic
);
if
(
pic
.
code
>
0
)
{
pic
.
u_data
=
unknown
;
}
else
{
pic
.
u_data
=
myBack
;
}
if
(!
loadedList
.
ContainsKey
(
hashPic
(
pic
.
code
,
pic
.
type
)))
{
loadedList
.
Add
(
hashPic
(
pic
.
code
,
pic
.
type
),
pic
);
}
}
}
else
...
...
Assets/SibylSystem/ResourceManagers/GameZipManager.cs
0 → 100644
View file @
f18ec3e5
using
System
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
Ionic.Zip
;
public
static
class
GameZipManager
{
public
static
List
<
ZipFile
>
Zips
=
new
List
<
ZipFile
>();
}
Assets/SibylSystem/ResourceManagers/GameZipManager.cs.meta
0 → 100644
View file @
f18ec3e5
fileFormatVersion: 2
guid: 5f783f2dae416714a9502d270be4c84b
timeCreated: 1597976268
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/SibylSystem/precy.cs
View file @
f18ec3e5
using
System
;
using
Ionic.Zip
;
using
System
;
using
System.IO
;
using
System.Runtime.InteropServices
;
using
System.Threading
;
...
...
@@ -129,20 +130,40 @@ public class PrecyOcg
return
retuvalue
;
}
Percy
.
ScriptData
scriptHandler
(
S
tring
filename
)
Percy
.
ScriptData
scriptHandler
(
s
tring
filename
)
{
//string filename = GetScriptFilename(scriptName);
byte
[]
content
;
Percy
.
ScriptData
ret
;
if
(!
File
.
Exists
(
filename
))
ret
.
buffer
=
IntPtr
.
Zero
;
ret
.
len
=
0
;
bool
found
=
false
;
string
filename2
=
filename
.
TrimStart
(
'.'
,
'/'
);
foreach
(
ZipFile
zip
in
GameZipManager
.
Zips
)
{
ret
.
buffer
=
IntPtr
.
Zero
;
ret
.
len
=
0
;
return
ret
;
if
(
zip
.
ContainsEntry
(
filename2
))
{
MemoryStream
ms
=
new
MemoryStream
();
ZipEntry
e
=
zip
[
filename2
];
e
.
Extract
(
ms
);
content
=
ms
.
ToArray
();
Marshal
.
Copy
(
content
,
0
,
_buffer
,
content
.
Length
);
ret
.
buffer
=
_buffer
;
ret
.
len
=
content
.
Length
;
found
=
true
;
break
;
}
}
if
(!
found
)
{
if
(
File
.
Exists
(
filename
))
{
content
=
File
.
ReadAllBytes
(
filename
);
Marshal
.
Copy
(
content
,
0
,
_buffer
,
content
.
Length
);
ret
.
buffer
=
_buffer
;
ret
.
len
=
content
.
Length
;
}
}
byte
[]
content
=
File
.
ReadAllBytes
(
filename
);
Marshal
.
Copy
(
content
,
0
,
_buffer
,
content
.
Length
);
ret
.
buffer
=
_buffer
;
ret
.
len
=
content
.
Length
;
return
ret
;
}
...
...
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