Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
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
hex
ygopro2
Commits
2bdbbbf3
Commit
2bdbbbf3
authored
Jul 19, 2025
by
hex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove HttpDldFile.cs
parent
19910d74
Pipeline
#39193
failed
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
203 deletions
+0
-203
Assets/SibylSystem/MyCard/MyCardHelper.cs
Assets/SibylSystem/MyCard/MyCardHelper.cs
+0
-22
Assets/SibylSystem/ResourceManagers/HttpDldFile.cs
Assets/SibylSystem/ResourceManagers/HttpDldFile.cs
+0
-114
Assets/SibylSystem/ResourceManagers/HttpDldFile.cs.meta
Assets/SibylSystem/ResourceManagers/HttpDldFile.cs.meta
+0
-12
Assets/SibylSystem/Room/Room.cs
Assets/SibylSystem/Room/Room.cs
+0
-55
No files found.
Assets/SibylSystem/MyCard/MyCardHelper.cs
View file @
2bdbbbf3
...
...
@@ -177,26 +177,4 @@ public class MyCardHelper {
onComplete
(
null
,
e
.
Message
);
}
}
public
static
string
DownloadFace
(
string
name
)
{
try
{
string
face
=
"textures/face/"
+
name
+
".png"
;
HttpDldFile
df
=
new
HttpDldFile
();
df
.
Download
(
"http://api.moestart.com/avatar/avatar/"
+
name
+
"/100/koishipro2.png"
,
face
);
if
(
File
.
Exists
(
face
))
{
Texture2D
Face
=
UIHelper
.
getTexture2D
(
face
);
UIHelper
.
faces
.
Remove
(
name
);
UIHelper
.
faces
.
Add
(
name
,
Face
);
return
null
;
}
return
"Not downloaded"
;
}
catch
(
Exception
e
)
{
return
e
.
Message
;
}
}
}
Assets/SibylSystem/ResourceManagers/HttpDldFile.cs
deleted
100644 → 0
View file @
19910d74
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.IO
;
using
System.Net
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Net.Security
;
using
UnityEngine
;
public
class
HttpDldFile
{
public
bool
Download
(
string
url
,
string
filename
)
{
bool
flag
=
false
;
try
{
if
(!
Directory
.
Exists
(
Path
.
GetDirectoryName
(
filename
)))
{
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
filename
));
}
if
(
File
.
Exists
(
filename
+
".tmp"
))
{
File
.
Delete
(
filename
+
".tmp"
);
}
using
(
var
client
=
new
TimeoutWebClient
())
{
ServicePointManager
.
ServerCertificateValidationCallback
=
MyRemoteCertificateValidationCallback
;
if
(
Path
.
GetExtension
(
filename
).
Contains
(
"png"
))
{
client
.
Timeout
=
6500
;
}
if
(
Path
.
GetExtension
(
filename
).
Contains
(
"jpg"
))
{
client
.
Timeout
=
6500
;
}
if
(
Path
.
GetExtension
(
filename
).
Contains
(
"cdb"
))
{
client
.
Timeout
=
30000
;
}
if
(
Path
.
GetExtension
(
filename
).
Contains
(
"conf"
))
{
client
.
Timeout
=
3000
;
}
client
.
DownloadFile
(
new
Uri
(
url
),
filename
+
".tmp"
);
}
flag
=
true
;
if
(
File
.
Exists
(
filename
))
{
File
.
Delete
(
filename
);
}
File
.
Move
(
filename
+
".tmp"
,
filename
);
}
catch
(
Exception
)
{
if
(
File
.
Exists
(
filename
+
".tmp"
))
{
File
.
Delete
(
filename
+
".tmp"
);
}
flag
=
false
;
}
return
flag
;
}
public
static
bool
MyRemoteCertificateValidationCallback
(
System
.
Object
sender
,
X509Certificate
certificate
,
X509Chain
chain
,
SslPolicyErrors
sslPolicyErrors
)
{
bool
isOk
=
true
;
// If there are errors in the certificate chain,
// look at each error to determine the cause.
if
(
sslPolicyErrors
!=
SslPolicyErrors
.
None
)
{
for
(
int
i
=
0
;
i
<
chain
.
ChainStatus
.
Length
;
i
++)
{
if
(
chain
.
ChainStatus
[
i
].
Status
==
X509ChainStatusFlags
.
RevocationStatusUnknown
)
{
continue
;
}
chain
.
ChainPolicy
.
RevocationFlag
=
X509RevocationFlag
.
EntireChain
;
chain
.
ChainPolicy
.
RevocationMode
=
X509RevocationMode
.
Online
;
chain
.
ChainPolicy
.
UrlRetrievalTimeout
=
new
TimeSpan
(
0
,
1
,
0
);
chain
.
ChainPolicy
.
VerificationFlags
=
X509VerificationFlags
.
AllFlags
;
bool
chainIsValid
=
chain
.
Build
((
X509Certificate2
)
certificate
);
if
(!
chainIsValid
)
{
isOk
=
false
;
break
;
}
}
}
return
isOk
;
}
}
public
class
TimeoutWebClient
:
WebClient
{
public
int
Timeout
{
get
;
set
;
}
public
TimeoutWebClient
()
{
Timeout
=
10000
;
}
public
TimeoutWebClient
(
int
timeout
)
{
Timeout
=
timeout
;
}
protected
override
WebRequest
GetWebRequest
(
Uri
address
)
{
WebRequest
request
=
base
.
GetWebRequest
(
address
);
request
.
Timeout
=
Timeout
;
return
request
;
}
}
Assets/SibylSystem/ResourceManagers/HttpDldFile.cs.meta
deleted
100644 → 0
View file @
19910d74
fileFormatVersion: 2
guid: df98823729c9cbf4ba006cb67248ce13
timeCreated: 1534496729
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/SibylSystem/Room/Room.cs
View file @
2bdbbbf3
...
...
@@ -166,66 +166,11 @@ public class Room : WindowServantSP
RoomPlayer
player
=
new
RoomPlayer
();
player
.
name
=
name
;
player
.
prep
=
false
;
// if (Program.I().mycard.isMatching && name != "********") // athletic match name mask
// {
// (
// new Thread(() =>
// {
// string errorMessage = MyCardHelper.DownloadFace(name);
// if (errorMessage != null)
// Program.PrintToChat(InterString.Get("头像加载失败: ") + errorMessage);
// else if (isShowed)
// realize();
// else if (Program.I().ocgcore.isShowed && Program.I().ocgcore.gameInfo)
// Program.I().ocgcore.gameInfo.realize();
// })
// ).Start();
// }
// roomPlayers[pos] = player;
// realize();
// First, add the player and do an initial UI refresh.
// This way, the player's name appears immediately in the UI.
roomPlayers
[
pos
]
=
player
;
realize
();
// 注释掉,不下载头像
// Now, if we need to download the face, start the non-blocking coroutine.
// if (Program.I().mycard.isMatching && name != "********")
// {
// // We start a Coroutine from a MonoBehaviour instance, like Program.I()
// Program.I().StartCoroutine(DownloadFaceAndUpdateUI(name));
// }
UIHelper
.
Flash
();
}
private
IEnumerator
DownloadFaceAndUpdateUI
(
string
playerName
)
{
// --- Step 1: Prepare for the background task ---
string
downloadErrorMessage
=
null
;
Thread
downloadThread
=
new
Thread
(()
=>
{
// This is the ONLY thing the background thread does: the blocking download.
downloadErrorMessage
=
MyCardHelper
.
DownloadFace
(
playerName
);
});
// --- Step 2: Start the background thread and wait for it to finish ---
downloadThread
.
Start
();
// 'yield return' here pauses the coroutine without freezing the game.
// The code will resume only after the downloadThread has completed.
yield
return
new
WaitUntil
(()
=>
!
downloadThread
.
IsAlive
);
// --- Step 3: We are now back on the MAIN THREAD ---
// It is now safe to use the result and call Unity APIs.
if
(
downloadErrorMessage
!=
null
)
{
Program
.
PrintToChat
(
InterString
.
Get
(
"头像加载失败: "
)
+
downloadErrorMessage
);
}
else
{
// The face has downloaded successfully. Now refresh the UI to show it.
if
(
isShowed
)
realize
();
else
if
(
Program
.
I
().
ocgcore
.
isShowed
&&
Program
.
I
().
ocgcore
.
gameInfo
!=
null
)
Program
.
I
().
ocgcore
.
gameInfo
.
realize
();
}
}
public
void
StocMessage_Chat
(
BinaryReader
r
)
{
int
player
=
r
.
ReadInt16
();
...
...
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