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
21c130be
Commit
21c130be
authored
Jan 01, 2026
by
hex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加检查超先行卡更新的逻辑
parent
ba1f7611
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
782 additions
and
130 deletions
+782
-130
Assets/SibylSystem/Menu/Menu.cs
Assets/SibylSystem/Menu/Menu.cs
+239
-2
Assets/SibylSystem/ResourceManagers/UnityFileDownloader.cs
Assets/SibylSystem/ResourceManagers/UnityFileDownloader.cs
+54
-0
Assets/main.unity
Assets/main.unity
+236
-0
UserSettings/Layouts/default-2021.dwlt
UserSettings/Layouts/default-2021.dwlt
+253
-128
No files found.
Assets/SibylSystem/Menu/Menu.cs
View file @
21c130be
This diff is collapsed.
Click to expand it.
Assets/SibylSystem/ResourceManagers/UnityFileDownloader.cs
View file @
21c130be
...
@@ -86,6 +86,60 @@ public class UnityFileDownloader
...
@@ -86,6 +86,60 @@ public class UnityFileDownloader
}
}
}
}
/// <summary>
/// 仅检查资源是否有更新,不执行下载。
/// 通过比较本地 ETag 和服务器 ETag 来判断。
/// </summary>
/// <param name="url">资源 URL</param>
/// <param name="localFilePath">本地文件路径(用于定位 .etag 文件)</param>
/// <param name="onComplete">回调:true = 有更新可用,false = 已是最新或检查失败</param>
public
static
IEnumerator
CheckForUpdateAsync
(
string
url
,
string
localFilePath
,
Action
<
bool
>
onComplete
)
{
string
etagFilePath
=
localFilePath
+
".etag"
;
string
localEtag
=
null
;
bool
localFileExists
=
File
.
Exists
(
localFilePath
);
// 1. 读取本地ETag(如果存在)
if
(
File
.
Exists
(
etagFilePath
))
{
try
{
localEtag
=
File
.
ReadAllText
(
etagFilePath
);
}
catch
(
Exception
)
{
localEtag
=
null
;
// 读取失败则当做不存在
}
}
// 2. 发送HEAD请求获取服务器ETag
UnityWebRequest
headRequest
=
UnityWebRequest
.
Head
(
url
);
headRequest
.
timeout
=
10
;
// 设置较短的超时时间
yield
return
headRequest
.
SendWebRequest
();
if
(
headRequest
.
isNetworkError
||
headRequest
.
isHttpError
)
{
// 网络错误,无法判断是否有更新
if
(
onComplete
!=
null
)
onComplete
.
Invoke
(
false
);
yield
break
;
}
string
serverEtag
=
headRequest
.
GetResponseHeader
(
"ETag"
);
if
(
string
.
IsNullOrEmpty
(
serverEtag
))
{
// 服务器未提供ETag,无法判断
if
(
onComplete
!=
null
)
onComplete
.
Invoke
(
false
);
yield
break
;
}
// 3. 比较ETag,判断是否有更新
bool
hasUpdate
=
!
localFileExists
||
string
.
IsNullOrEmpty
(
localEtag
)
||
!
localEtag
.
Equals
(
serverEtag
);
if
(
onComplete
!=
null
)
onComplete
.
Invoke
(
hasUpdate
);
}
/// <summary>
/// <summary>
/// 检查文件版本,如果不是最新则下载。
/// 检查文件版本,如果不是最新则下载。
/// 最终结果统一为成功(true)或失败(false)。
/// 最终结果统一为成功(true)或失败(false)。
...
...
Assets/main.unity
View file @
21c130be
...
@@ -344,6 +344,124 @@ Transform:
...
@@ -344,6 +344,124 @@ Transform:
m_Father
:
{
fileID
:
0
}
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
1
m_RootOrder
:
1
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!1
&315439888
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
315439892
}
-
component
:
{
fileID
:
315439891
}
-
component
:
{
fileID
:
315439890
}
-
component
:
{
fileID
:
315439889
}
m_Layer
:
5
m_Name
:
UI Root
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!54
&315439889
Rigidbody
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
315439888
}
serializedVersion
:
2
m_Mass
:
1
m_Drag
:
0
m_AngularDrag
:
0.05
m_UseGravity
:
0
m_IsKinematic
:
1
m_Interpolate
:
0
m_Constraints
:
0
m_CollisionDetection
:
0
---
!u!114
&315439890
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
315439888
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
ae942c9068183dc40a9d01f648273726
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
leftAnchor
:
target
:
{
fileID
:
0
}
relative
:
0
absolute
:
0
rightAnchor
:
target
:
{
fileID
:
0
}
relative
:
1
absolute
:
0
bottomAnchor
:
target
:
{
fileID
:
0
}
relative
:
0
absolute
:
0
topAnchor
:
target
:
{
fileID
:
0
}
relative
:
1
absolute
:
0
updateAnchors
:
1
showInPanelTool
:
1
generateNormals
:
0
widgetsAreStatic
:
0
cullWhileDragging
:
1
alwaysOnScreen
:
0
anchorOffset
:
0
softBorderPadding
:
1
renderQueue
:
0
startingRenderQueue
:
3000
mClipTexture
:
{
fileID
:
0
}
mAlpha
:
1
mClipping
:
0
mClipRange
:
{
x
:
0
,
y
:
0
,
z
:
300
,
w
:
200
}
mClipSoftness
:
{
x
:
4
,
y
:
4
}
mDepth
:
0
mSortingOrder
:
0
mClipOffset
:
{
x
:
0
,
y
:
0
}
---
!u!114
&315439891
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
315439888
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
2c5ecb5660b11414fb042fb826e03b73
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
scalingStyle
:
0
manualWidth
:
1280
manualHeight
:
720
minimumHeight
:
320
maximumHeight
:
1536
fitWidth
:
0
fitHeight
:
1
adjustByDPI
:
0
shrinkPortraitUI
:
0
---
!u!4
&315439892
Transform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
315439888
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
0.0015576323
,
y
:
0.0015576323
,
z
:
0.0015576323
}
m_ConstrainProportionsScale
:
0
m_Children
:
-
{
fileID
:
1236511216
}
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
4
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!850595691
&1086003614
---
!u!850595691
&1086003614
LightingSettings
:
LightingSettings
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
@@ -406,6 +524,124 @@ LightingSettings:
...
@@ -406,6 +524,124 @@ LightingSettings:
m_PVRFilteringAtrousPositionSigmaIndirect
:
2
m_PVRFilteringAtrousPositionSigmaIndirect
:
2
m_PVRFilteringAtrousPositionSigmaAO
:
1
m_PVRFilteringAtrousPositionSigmaAO
:
1
m_PVRTiledBaking
:
0
m_PVRTiledBaking
:
0
---
!u!1
&1236511215
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
1236511216
}
-
component
:
{
fileID
:
1236511218
}
-
component
:
{
fileID
:
1236511217
}
m_Layer
:
5
m_Name
:
Camera
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!4
&1236511216
Transform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1236511215
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_ConstrainProportionsScale
:
0
m_Children
:
[]
m_Father
:
{
fileID
:
315439892
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&1236511217
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1236511215
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
2a92b5d748695fd44aac9feef17ba415
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
eventType
:
1
eventsGoToColliders
:
0
eventReceiverMask
:
serializedVersion
:
2
m_Bits
:
4294967295
debug
:
0
useMouse
:
1
useTouch
:
1
allowMultiTouch
:
1
useKeyboard
:
1
useController
:
0
stickyTooltip
:
1
tooltipDelay
:
1
longPressTooltip
:
0
mouseDragThreshold
:
4
mouseClickThreshold
:
10
touchDragThreshold
:
40
touchClickThreshold
:
40
rangeDistance
:
-1
horizontalAxisName
:
Horizontal
verticalAxisName
:
Vertical
horizontalPanAxisName
:
verticalPanAxisName
:
scrollAxisName
:
Mouse ScrollWheel
commandClick
:
1
submitKey0
:
13
submitKey1
:
330
cancelKey0
:
27
cancelKey1
:
331
autoHideCursor
:
1
---
!u!20
&1236511218
Camera
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1236511215
}
m_Enabled
:
1
serializedVersion
:
2
m_ClearFlags
:
3
m_BackGroundColor
:
{
r
:
0.5
,
g
:
0.5
,
b
:
0.5
,
a
:
1
}
m_projectionMatrixMode
:
1
m_GateFitMode
:
2
m_FOVAxisMode
:
0
m_SensorSize
:
{
x
:
36
,
y
:
24
}
m_LensShift
:
{
x
:
0
,
y
:
0
}
m_FocalLength
:
50
m_NormalizedViewPortRect
:
serializedVersion
:
2
x
:
0
y
:
0
width
:
1
height
:
1
near clip plane
:
-10
far clip plane
:
10
field of view
:
60
orthographic
:
1
orthographic size
:
1
m_Depth
:
0
m_CullingMask
:
serializedVersion
:
2
m_Bits
:
32
m_RenderingPath
:
-1
m_TargetTexture
:
{
fileID
:
0
}
m_TargetDisplay
:
0
m_TargetEye
:
3
m_HDR
:
1
m_AllowMSAA
:
1
m_AllowDynamicResolution
:
0
m_ForceIntoRT
:
0
m_OcclusionCulling
:
1
m_StereoConvergence
:
10
m_StereoSeparation
:
0.022
---
!u!1001
&1237806114
---
!u!1001
&1237806114
PrefabInstance
:
PrefabInstance
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
...
UserSettings/Layouts/default-2021.dwlt
View file @
21c130be
This diff is collapsed.
Click to expand it.
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