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
perfectdicky
YGOProUnity_V2
Commits
2c590715
Commit
2c590715
authored
May 05, 2022
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add GetTexture2DFromZip
parent
74e1072e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
Assets/SibylSystem/MonoHelpers/UIHelper.cs
Assets/SibylSystem/MonoHelpers/UIHelper.cs
+13
-1
Assets/SibylSystem/ResourceManagers/GameTextureManager.cs
Assets/SibylSystem/ResourceManagers/GameTextureManager.cs
+22
-1
No files found.
Assets/SibylSystem/MonoHelpers/UIHelper.cs
View file @
2c590715
using
System
;
using
Ionic.Zip
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Diagnostics
;
using
System.Globalization
;
using
System.Globalization
;
...
@@ -752,6 +753,17 @@ public static class UIHelper
...
@@ -752,6 +753,17 @@ public static class UIHelper
return
pic
;
return
pic
;
}
}
public
static
async
Task
<
Texture2D
>
GetTexture2DFromZipAsync
(
ZipFile
zip
,
string
file
)
{
var
pic
=
new
Texture2D
(
0
,
0
);
MemoryStream
stream
=
new
MemoryStream
();
ZipEntry
entry
=
zip
[
file
];
entry
.
Extract
(
stream
);
//await Task.Run(() => { entry.Extract(stream); });
pic
.
LoadImage
(
stream
.
ToArray
());
return
pic
;
}
internal
static
void
shiftButton
(
UIButton
btn
,
bool
enabled
)
internal
static
void
shiftButton
(
UIButton
btn
,
bool
enabled
)
{
{
if
(
enabled
)
if
(
enabled
)
...
...
Assets/SibylSystem/ResourceManagers/GameTextureManager.cs
View file @
2c590715
using
System.Collections.Generic
;
using
Ionic.Zip
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
UnityEngine
;
using
UnityEngine
;
...
@@ -88,6 +89,26 @@ public class GameTextureManager
...
@@ -88,6 +89,26 @@ public class GameTextureManager
{
{
if
(
code
==
0
)
return
zero
;
if
(
code
==
0
)
return
zero
;
if
(
loadedPicture
.
TryGetValue
(
code
,
out
var
cached
))
return
await
cached
;
if
(
loadedPicture
.
TryGetValue
(
code
,
out
var
cached
))
return
await
cached
;
foreach
(
ZipFile
zip
in
GameZipManager
.
Zips
)
{
if
(
zip
.
Name
.
ToLower
().
EndsWith
(
"script.zip"
))
continue
;
foreach
(
string
file
in
zip
.
EntryFileNames
)
{
foreach
(
var
extname
in
new
[]
{
".png"
,
".jpg"
})
{
var
path
=
$"pics/
{
code
}{
extname
}
"
;
if
(
file
.
ToLower
()
==
path
)
{
var
result
=
UIHelper
.
GetTexture2DFromZipAsync
(
zip
,
file
);
loadedPicture
.
Add
(
code
,
result
);
return
await
result
;
}
}
}
}
foreach
(
var
extname
in
new
[]
{
".png"
,
".jpg"
})
foreach
(
var
extname
in
new
[]
{
".png"
,
".jpg"
})
{
{
var
path
=
$"picture/card/
{
code
}{
extname
}
"
;
var
path
=
$"picture/card/
{
code
}{
extname
}
"
;
...
...
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