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
61f24eb5
Commit
61f24eb5
authored
Jun 20, 2025
by
hex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added confirmation when setting a monster card face-down.
parent
df6a6060
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1672 additions
and
662 deletions
+1672
-662
Assets/SibylSystem/MonoHelpers/TcpHelper.cs
Assets/SibylSystem/MonoHelpers/TcpHelper.cs
+23
-12
Assets/SibylSystem/Ocgcore/Ocgcore.cs
Assets/SibylSystem/Ocgcore/Ocgcore.cs
+1649
-650
No files found.
Assets/SibylSystem/MonoHelpers/TcpHelper.cs
View file @
61f24eb5
...
...
@@ -261,34 +261,45 @@ public static class TcpHelper
{
if
(
tcpClient
!=
null
&&
tcpClient
.
Connected
)
{
Thread
t
=
new
Thread
(
sender
);
t
.
Start
(
message
);
// 用线程池代替 Thread
System
.
Threading
.
ThreadPool
.
QueueUserWorkItem
(
sender
,
message
);
}
}
static
object
locker
=
new
object
();
static
void
sender
(
object
o
)
static
void
sender
(
object
state
)
{
try
{
Package
message
=
(
Package
)
state
;
byte
[]
data
=
message
.
Data
.
get
();
// 预分配足够的 buffer,避免多余的内存流
int
totalLen
=
2
+
1
+
data
.
Length
;
byte
[]
s
=
new
byte
[
totalLen
];
// 写入长度(short,包含功能码长度)
short
len
=
(
short
)(
data
.
Length
+
1
);
s
[
0
]
=
(
byte
)(
len
&
0xFF
);
s
[
1
]
=
(
byte
)((
len
>>
8
)
&
0xFF
);
// 写入功能码
s
[
2
]
=
(
byte
)
message
.
Fuction
;
// 写入数据
Buffer
.
BlockCopy
(
data
,
0
,
s
,
3
,
data
.
Length
);
// 只锁发送
lock
(
locker
)
{
Package
message
=
(
Package
)
o
;
byte
[]
data
=
message
.
Data
.
get
();
MemoryStream
memstream
=
new
MemoryStream
();
BinaryWriter
b
=
new
BinaryWriter
(
memstream
);
b
.
Write
(
BitConverter
.
GetBytes
((
Int16
)
data
.
Length
+
1
),
0
,
2
);
b
.
Write
(
BitConverter
.
GetBytes
((
byte
)
message
.
Fuction
),
0
,
1
);
b
.
Write
(
data
,
0
,
data
.
Length
);
byte
[]
s
=
memstream
.
ToArray
();
tcpClient
.
Client
.
Send
(
s
);
}
}
catch
(
Exception
e
)
{
onDisConnected
=
true
;
Program
.
DEBUGLOG
(
"onDisConnected 5
"
);
Program
.
DEBUGLOG
(
"onDisConnected 5
: "
+
e
.
Message
+
"\n"
+
e
.
StackTrace
);
}
}
...
...
Assets/SibylSystem/Ocgcore/Ocgcore.cs
View file @
61f24eb5
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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