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
0d5bb492
Commit
0d5bb492
authored
Jul 25, 2025
by
hex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove safeGO
parent
83c2db9b
Pipeline
#39483
failed
Changes
5
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
371 additions
and
342 deletions
+371
-342
Assets/SibylSystem/Ocgcore/Ocgcore.cs
Assets/SibylSystem/Ocgcore/Ocgcore.cs
+19
-19
Assets/SibylSystem/Program.cs
Assets/SibylSystem/Program.cs
+75
-45
Assets/SibylSystem/Servant.cs
Assets/SibylSystem/Servant.cs
+3
-18
Assets/SibylSystem/deckManager/DeckManager.cs
Assets/SibylSystem/deckManager/DeckManager.cs
+145
-98
UserSettings/Layouts/default-2021.dwlt
UserSettings/Layouts/default-2021.dwlt
+129
-162
No files found.
Assets/SibylSystem/Ocgcore/Ocgcore.cs
View file @
0d5bb492
Assets/SibylSystem/Program.cs
View file @
0d5bb492
...
@@ -1242,6 +1242,63 @@ public class Program : MonoBehaviour
...
@@ -1242,6 +1242,63 @@ public class Program : MonoBehaviour
}
}
if
(
GameTextureManager
.
IsInitialized
)
if
(
GameTextureManager
.
IsInitialized
)
{
ProcessTextureManagerUpdates
();
}
fixALLcamerasPreFrame
();
HandleUnifiedInput
();
UpdateRaycast
();
for
(
int
i
=
0
;
i
<
servants
.
Count
;
i
++)
{
servants
[
i
].
Update
();
}
TcpHelper
.
preFrameFunction
();
ProcessDelayedTasks
();
}
private
void
UpdateRaycast
()
{
pointedGameObject
=
null
;
pointedCollider
=
null
;
Vector3
inputPosition
=
Input
.
mousePosition
;
Ray
line
=
Camera
.
main
.
ScreenPointToRay
(
inputPosition
);
RaycastHit
hit
;
if
(
Physics
.
Raycast
(
line
,
out
hit
,
1000f
,
rayFilter
))
{
pointedGameObject
=
hit
.
collider
.
gameObject
;
pointedCollider
=
hit
.
collider
;
}
GameObject
hoverobject
=
UICamera
.
Raycast
(
inputPosition
)
?
UICamera
.
lastHit
.
collider
.
gameObject
:
null
;
if
(
hoverobject
!=
null
)
{
if
(
hoverobject
.
layer
==
11
||
pointedGameObject
==
null
)
{
pointedGameObject
=
hoverobject
;
pointedCollider
=
UICamera
.
lastHit
.
collider
;
}
}
}
private
void
HandleUnifiedInput
()
{
wheelValue
=
UICamera
.
GetAxis
(
"Mouse ScrollWheel"
)
*
50
;
InputGetMouseButtonDown_0
=
Input
.
GetMouseButtonDown
(
0
);
InputGetMouseButtonUp_0
=
Input
.
GetMouseButtonUp
(
0
);
InputGetMouseButtonDown_1
=
Input
.
GetMouseButtonDown
(
1
);
InputGetMouseButtonUp_1
=
Input
.
GetMouseButtonUp
(
1
);
InputEnterDown
=
Input
.
GetKeyDown
(
KeyCode
.
Return
);
InputGetMouseButton_0
=
Input
.
GetMouseButton
(
0
);
}
private
void
ProcessTextureManagerUpdates
()
{
{
// 1. 实现下载限流
// 1. 实现下载限流
// 只要当前活跃的下载数小于最大限制,并且队列里有待下载的任务,就启动新的下载。
// 只要当前活跃的下载数小于最大限制,并且队列里有待下载的任务,就启动新的下载。
...
@@ -1278,56 +1335,29 @@ public class Program : MonoBehaviour
...
@@ -1278,56 +1335,29 @@ public class Program : MonoBehaviour
}
}
}
}
fixALLcamerasPreFrame
();
private
void
ProcessDelayedTasks
()
wheelValue
=
UICamera
.
GetAxis
(
"Mouse ScrollWheel"
)
*
50
;
pointedGameObject
=
null
;
pointedCollider
=
null
;
Ray
line
=
Camera
.
main
.
ScreenPointToRay
(
Input
.
mousePosition
);
RaycastHit
hit
;
if
(
Physics
.
Raycast
(
line
,
out
hit
,
(
float
)
1000
,
rayFilter
))
{
pointedGameObject
=
hit
.
collider
.
gameObject
;
pointedCollider
=
hit
.
collider
;
}
GameObject
hoverobject
=
UICamera
.
Raycast
(
Input
.
mousePosition
)
?
UICamera
.
lastHit
.
collider
.
gameObject
:
null
;
if
(
hoverobject
!=
null
)
{
if
(
hoverobject
.
layer
==
11
||
pointedGameObject
==
null
)
{
{
pointedGameObject
=
hoverobject
;
pointedCollider
=
UICamera
.
lastHit
.
collider
;
}
}
InputGetMouseButtonDown_0
=
Input
.
GetMouseButtonDown
(
0
);
InputGetMouseButtonUp_0
=
Input
.
GetMouseButtonUp
(
0
);
InputGetMouseButtonDown_1
=
Input
.
GetMouseButtonDown
(
1
);
InputGetMouseButtonUp_1
=
Input
.
GetMouseButtonUp
(
1
);
InputEnterDown
=
Input
.
GetKeyDown
(
KeyCode
.
Return
);
InputGetMouseButton_0
=
Input
.
GetMouseButton
(
0
);
for
(
int
i
=
0
;
i
<
servants
.
Count
;
i
++)
{
servants
[
i
].
Update
();
}
TcpHelper
.
preFrameFunction
();
delayedTask
remove
=
null
;
delayedTask
remove
=
null
;
while
(
true
)
int
maxTasksPerFrame
=
5
;
// 限制每帧处理的延迟任务数量
int
processedTasks
=
0
;
while
(
processedTasks
<
maxTasksPerFrame
)
{
{
remove
=
null
;
remove
=
null
;
for
(
int
i
=
0
;
i
<
delayedTasks
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
delayedTasks
.
Count
;
i
++)
{
{
if
(
Program
.
TimePassed
()
>
delayedTasks
[
i
].
timeToBeDone
)
if
(
TimePassed
()
>
delayedTasks
[
i
].
timeToBeDone
)
{
{
remove
=
delayedTasks
[
i
];
remove
=
delayedTasks
[
i
];
try
try
{
{
remove
.
act
();
remove
.
act
();
}
}
catch
(
System
.
Exception
e
)
catch
(
Exception
e
)
{
{
UnityEngine
.
Debug
.
Log
(
e
);
Debug
.
Log
(
e
);
}
}
processedTasks
++;
break
;
break
;
}
}
}
}
...
...
Assets/SibylSystem/Servant.cs
View file @
0d5bb492
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
DG.Tweening
;
using
UnityEngine
;
using
UnityEngine
;
using
YGOSharp.OCGWrapper.Enums
;
using
YGOSharp.OCGWrapper.Enums
;
using
DG.Tweening
;
public
class
Servant
public
class
Servant
...
@@ -57,11 +57,6 @@ public class Servant
...
@@ -57,11 +57,6 @@ public class Servant
}
}
allGameObjects
.
Clear
();
allGameObjects
.
Clear
();
updateActions_s
.
Clear
();
updateActions_s
.
Clear
();
for
(
int
i
=
0
;
i
<
delayedTasks
.
Count
;
i
++)
{
Program
.
notGo
(
delayedTasks
[
i
].
act
);
}
delayedTasks
.
Clear
();
}
}
public
virtual
void
fixScreenProblem
()
public
virtual
void
fixScreenProblem
()
...
@@ -312,16 +307,6 @@ public class Servant
...
@@ -312,16 +307,6 @@ public class Servant
}
}
}
}
List
<
Program
.
delayedTask
>
delayedTasks
=
new
List
<
Program
.
delayedTask
>();
public
void
safeGogo
(
int
delay_
,
Action
act_
)
{
Program
.
go
(
delay_
,
act_
);
delayedTasks
.
Add
(
new
Program
.
delayedTask
{
act
=
act_
,
timeToBeDone
=
delay_
+
Program
.
TimePassed
()
}
);
}
#
region
remasterMessageSystem
#
region
remasterMessageSystem
public
Vector3
centre
(
bool
fix
=
false
)
public
Vector3
centre
(
bool
fix
=
false
)
...
...
Assets/SibylSystem/deckManager/DeckManager.cs
View file @
0d5bb492
...
@@ -3,9 +3,9 @@ using System.Collections.Generic;
...
@@ -3,9 +3,9 @@ using System.Collections.Generic;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
DG.Tweening
;
using
UnityEngine
;
using
UnityEngine
;
using
YGOSharp.OCGWrapper.Enums
;
using
YGOSharp.OCGWrapper.Enums
;
using
DG.Tweening
;
public
class
DeckManager
:
ServantWithCardDescription
public
class
DeckManager
:
ServantWithCardDescription
...
@@ -23,6 +23,10 @@ public class DeckManager : ServantWithCardDescription
...
@@ -23,6 +23,10 @@ public class DeckManager : ServantWithCardDescription
private
bool
isContinuouslyAdding
=
false
;
// 是否已进入持续添加模式
private
bool
isContinuouslyAdding
=
false
;
// 是否已进入持续添加模式
private
float
nextAddCardTime
=
0f
;
// 下一次可以添加卡片的时间点
private
float
nextAddCardTime
=
0f
;
// 下一次可以添加卡片的时间点
private
Sequence
deckLoadSequence
;
private
enum
CardZone
{
Main
,
Extra
,
Side
}
public
enum
Condition
public
enum
Condition
{
{
editDeck
=
1
,
editDeck
=
1
,
...
@@ -1406,6 +1410,11 @@ public class DeckManager : ServantWithCardDescription
...
@@ -1406,6 +1410,11 @@ public class DeckManager : ServantWithCardDescription
public
override
void
hide
()
public
override
void
hide
()
{
{
if
(
deckLoadSequence
!=
null
&&
deckLoadSequence
.
IsActive
())
{
deckLoadSequence
.
Kill
();
}
if
(
isShowed
)
if
(
isShowed
)
{
{
hideDetail
();
hideDetail
();
...
@@ -2082,86 +2091,124 @@ public class DeckManager : ServantWithCardDescription
...
@@ -2082,86 +2091,124 @@ public class DeckManager : ServantWithCardDescription
bool
canSave
=
false
;
bool
canSave
=
false
;
public
void
FormCodedDeckToObjectDeck
()
/// <summary>
/// 将指定卡组的创建和入场动画添加到DOTween序列中。
/// </summary>
/// <param name="seq">要添加动画的目标序列。</param>
/// <param name="startTime">这组动画在序列时间线上的起始时间。</param>
/// <param name="cardIds">要创建的卡片的ID列表。</param>
/// <param name="objectList">用于存储创建出的MonoCardInDeckManager对象的列表。</param>
/// <param name="zone">卡片所属的区域(主卡组、额外、副卡组)。</param>
/// <returns>这组动画完成后的序列时间点。</returns>
private
float
AppendCardAnimations
(
Sequence
seq
,
float
startTime
,
IList
<
int
>
cardIds
,
IList
<
MonoCardInDeckManager
>
objectList
,
CardZone
zone
)
{
{
canSave
=
false
;
if
(
cardIds
==
null
||
cardIds
.
Count
==
0
)
safeGogo
(
4000
,
()
=>
{
{
canSave
=
true
;
return
startTime
;
// 如果没有卡片,直接返回起始时间
}
}
);
int
indexOfLogic
=
0
;
// 根据区域决定动画的交错延迟
int
[]
hangshu
=
UIHelper
.
get_decklieshuArray
(
deck
.
Main
.
Count
);
float
staggerDelay
=
(
zone
==
CardZone
.
Main
)
?
0.015f
:
0.045f
;
foreach
(
var
item
in
deck
.
Main
)
int
[]
hangshu
=
(
zone
==
CardZone
.
Main
)
?
UIHelper
.
get_decklieshuArray
(
cardIds
.
Count
)
:
null
;
for
(
int
i
=
0
;
i
<
cardIds
.
Count
;
i
++)
{
{
Vector2
v
=
UIHelper
.
get_hang_lieArry
(
indexOfLogic
,
hangshu
);
// C# 闭包陷阱:必须在循环内部为lambda表达式捕获变量的当前值
Vector3
toVector
=
new
Vector3
(
int
currentIndex
=
i
;
int
cardId
=
cardIds
[
i
];
// 计算卡片的目标位置
Vector3
toVector
;
switch
(
zone
)
{
case
CardZone
.
Main
:
Vector2
v
=
UIHelper
.
get_hang_lieArry
(
currentIndex
,
hangshu
);
toVector
=
new
Vector3
(
UIHelper
.
get_left_right_index
(-
12.5f
,
12.5f
,
(
int
)
v
.
y
,
hangshu
[(
int
)
v
.
x
]),
UIHelper
.
get_left_right_index
(-
12.5f
,
12.5f
,
(
int
)
v
.
y
,
hangshu
[(
int
)
v
.
x
]),
0.5f
+
v
.
y
/
3f
+
v
.
x
/
3f
,
0.5f
+
v
.
y
/
3f
+
v
.
x
/
3f
,
11.8f
-
v
.
x
*
4f
11.8f
-
v
.
x
*
4f
);
);
YGOSharp
.
Card
data
=
YGOSharp
.
CardsManager
.
Get
(
item
);
break
;
safeGogo
(
case
CardZone
.
Extra
:
indexOfLogic
*
15
,
toVector
=
new
Vector3
(
()
=>
UIHelper
.
get_left_right_indexZuo
(-
12.5f
,
12.5f
,
currentIndex
,
cardIds
.
Count
,
10
),
{
0.5f
+
(
float
)
currentIndex
/
3f
,
MonoCardInDeckManager
card
=
createCard
();
card
.
cardData
=
data
;
card
.
gameObject
.
layer
=
16
;
deck
.
IMain
.
Add
(
card
);
card
.
tweenToVectorAndFall
(
toVector
,
new
Vector3
(
90
,
0
,
0
));
}
);
indexOfLogic
++;
}
indexOfLogic
=
0
;
foreach
(
var
item
in
deck
.
Extra
)
{
Vector3
toVector
=
new
Vector3
(
UIHelper
.
get_left_right_indexZuo
(-
12.5f
,
12.5f
,
indexOfLogic
,
deck
.
Extra
.
Count
,
10
),
0.5f
+
(
float
)
indexOfLogic
/
3f
,
-
6.2f
-
6.2f
);
);
YGOSharp
.
Card
data
=
YGOSharp
.
CardsManager
.
Get
(
item
);
break
;
safeGogo
(
case
CardZone
.
Side
:
indexOfLogic
*
45
,
toVector
=
new
Vector3
(
()
=>
UIHelper
.
get_left_right_indexZuo
(-
12.5f
,
12.5f
,
currentIndex
,
cardIds
.
Count
,
10
),
0.5f
+
(
float
)
currentIndex
/
3f
,
-
12f
);
break
;
default
:
toVector
=
Vector3
.
zero
;
break
;
}
// 使用 InsertCallback 在序列的指定时间点执行卡片创建和动画开始的逻辑
// 这是整个重构的核心,它将原来的 safeGogo(delay, action) 替换为更精确的时间线插入
seq
.
InsertCallback
(
startTime
+
currentIndex
*
staggerDelay
,
()
=>
{
{
YGOSharp
.
Card
data
=
YGOSharp
.
CardsManager
.
Get
(
cardId
);
if
(
data
==
null
)
return
;
MonoCardInDeckManager
card
=
createCard
();
MonoCardInDeckManager
card
=
createCard
();
card
.
cardData
=
data
;
card
.
cardData
=
data
;
card
.
gameObject
.
layer
=
16
;
card
.
gameObject
.
layer
=
16
;
deck
.
IExtra
.
Add
(
card
);
objectList
.
Add
(
card
);
// tweenToVectorAndFall 本身就是DoTween动画, 它会独立运行,
// 而我们的Sequence只负责在正确的时间点触发它。
card
.
tweenToVectorAndFall
(
toVector
,
new
Vector3
(
90
,
0
,
0
));
card
.
tweenToVectorAndFall
(
toVector
,
new
Vector3
(
90
,
0
,
0
));
});
}
}
);
indexOfLogic
++;
// 返回这组动画播放完毕后的总时间
return
startTime
+
cardIds
.
Count
*
staggerDelay
;
}
}
indexOfLogic
=
0
;
foreach
(
var
item
in
deck
.
Side
)
public
void
FormCodedDeckToObjectDeck
(
)
{
{
Vector3
toVector
=
new
Vector3
(
canSave
=
false
;
UIHelper
.
get_left_right_indexZuo
(-
12.5f
,
12.5f
,
indexOfLogic
,
deck
.
Side
.
Count
,
10
),
0.5f
+
(
float
)
indexOfLogic
/
3f
,
// 如果上一个动画序列还在播放,则安全地销毁它,防止重叠或冲突
-
12f
if
(
deckLoadSequence
!=
null
&&
deckLoadSequence
.
IsActive
())
);
YGOSharp
.
Card
data
=
YGOSharp
.
CardsManager
.
Get
(
item
);
safeGogo
(
indexOfLogic
*
45
,
()
=>
{
{
MonoCardInDeckManager
card
=
createCard
();
deckLoadSequence
.
Kill
();
card
.
cardData
=
data
;
card
.
gameObject
.
layer
=
16
;
deck
.
ISide
.
Add
(
card
);
card
.
tweenToVectorAndFall
(
toVector
,
new
Vector3
(
90
,
0
,
0
));
}
);
indexOfLogic
++;
}
}
// 创建一个新的序列
deckLoadSequence
=
DOTween
.
Sequence
();
// 用于追踪序列当前的时间点
float
animationTimeline
=
0f
;
// 1. 将主卡组的动画添加到序列中,从时间 0 开始
AppendCardAnimations
(
deckLoadSequence
,
0f
,
deck
.
Main
,
deck
.
IMain
,
CardZone
.
Main
);
// 2. 将额外卡组的动画也添加到序列中,同样从时间 0 开始
AppendCardAnimations
(
deckLoadSequence
,
0f
,
deck
.
Extra
,
deck
.
IExtra
,
CardZone
.
Extra
);
// 3. 将副卡组的动画也添加到序列中,还是从时间 0 开始
AppendCardAnimations
(
deckLoadSequence
,
0f
,
deck
.
Side
,
deck
.
ISide
,
CardZone
.
Side
);
// 4. 设置整个序列播放完成后的回调
// 这比硬编码的4秒延迟要精确和可靠得多
deckLoadSequence
.
OnComplete
(()
=>
{
canSave
=
true
;
// 可以在这里加一句Debug日志,方便调试
// Debug.Log("Deck loading animation completed. Saving is now enabled.");
});
// 5. 播放整个动画序列
deckLoadSequence
.
Play
();
}
}
void
ShowObjectDeck
()
void
ShowObjectDeck
()
{
{
float
k
=
(
float
)(
1.5
*
0.1
/
0.130733633
);
float
k
=
(
float
)(
1.5
*
0.1
/
0.130733633
);
...
...
UserSettings/Layouts/default-2021.dwlt
View file @
0d5bb492
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