fix: 修复Shim无法匹配某些版本的PacketUpsertUserAll#125
fix: 修复Shim无法匹配某些版本的PacketUpsertUserAll#125zhicheng233 wants to merge 1 commit intoMuNET-OSS:mainfrom
Conversation
审阅者指南扩展 Shim 对 Shim 使用带 maxTrackNo 构造函数创建 PacketUpsertUserAll 的时序图sequenceDiagram
participant Caller
participant Shim
participant Singleton_GamePlayManager_ as Singleton_GamePlayManager
participant GamePlayManager
participant PacketUpsertUserAll
Caller->>Shim: CreatePacketUpsertUserAll(index, src, onDone, onError)
activate Shim
Shim->>Shim: Reflect PacketUpsertUserAll constructors
alt Constructor with maxTrackNo found
Shim->>Singleton_GamePlayManager_: get Instance
Singleton_GamePlayManager_->>GamePlayManager: access Instance
activate GamePlayManager
GamePlayManager-->>Shim: GamePlayManager instance
Shim->>GamePlayManager: IsEmpty()
GamePlayManager-->>Shim: isEmpty
alt src.IsEntry and not isEmpty
Shim->>GamePlayManager: GetScoreListCount()
GamePlayManager-->>Shim: maxTrackNo
else otherwise
Shim->>Shim: maxTrackNo = 0
end
Shim->>PacketUpsertUserAll: ctor(index, src, maxTrackNo, onDone, onError)
PacketUpsertUserAll-->>Shim: instance
else Other constructor overload
Shim->>PacketUpsertUserAll: ctor(index, src, onDone, onError)
PacketUpsertUserAll-->>Shim: instance
end
Shim-->>Caller: PacketUpsertUserAll instance
deactivate Shim
更新后的 Shim 处理 PacketUpsertUserAll 构造函数的类图classDiagram
class Shim {
+EncryptNetPacketBody(byte[] data) byte[]
+CreatePacketUpsertUserAll(int index, UserData src, Action~int~ onDone, Action~PacketStatus~ onError) PacketUpsertUserAll
}
class PacketUpsertUserAll {
+PacketUpsertUserAll(int index, UserData src, Action~int~ onDone, Action~PacketStatus~ onError)
+PacketUpsertUserAll(int index, UserData src, int maxTrackNo, Action~int~ onDone, Action~PacketStatus~ onError)
}
class UserData {
}
class PacketStatus {
}
class GamePlayManager {
+IsEmpty() bool
+GetScoreListCount() int
}
class Singleton_GamePlayManager_ {
+Instance GamePlayManager
}
Shim ..> PacketUpsertUserAll : uses via reflection
Shim ..> UserData
Shim ..> PacketStatus
Shim ..> Singleton_GamePlayManager_ : queries Instance
Singleton_GamePlayManager_ *-- GamePlayManager
note for Singleton_GamePlayManager_ "Represents Singleton<GamePlayManager>"
文件级变更
技巧与命令与 Sourcery 交互
自定义你的体验前往你的 控制面板 以:
获取帮助Original review guide in EnglishReviewer's GuideExtend Shim's constructor matching for PacketUpsertUserAll to support an additional constructor overload that includes a maxTrackNo parameter, ensuring compatibility with more game versions. Sequence diagram for Shim creating PacketUpsertUserAll with maxTrackNo constructorsequenceDiagram
participant Caller
participant Shim
participant Singleton_GamePlayManager_ as Singleton_GamePlayManager
participant GamePlayManager
participant PacketUpsertUserAll
Caller->>Shim: CreatePacketUpsertUserAll(index, src, onDone, onError)
activate Shim
Shim->>Shim: Reflect PacketUpsertUserAll constructors
alt Constructor with maxTrackNo found
Shim->>Singleton_GamePlayManager_: get Instance
Singleton_GamePlayManager_->>GamePlayManager: access Instance
activate GamePlayManager
GamePlayManager-->>Shim: GamePlayManager instance
Shim->>GamePlayManager: IsEmpty()
GamePlayManager-->>Shim: isEmpty
alt src.IsEntry and not isEmpty
Shim->>GamePlayManager: GetScoreListCount()
GamePlayManager-->>Shim: maxTrackNo
else otherwise
Shim->>Shim: maxTrackNo = 0
end
Shim->>PacketUpsertUserAll: ctor(index, src, maxTrackNo, onDone, onError)
PacketUpsertUserAll-->>Shim: instance
else Other constructor overload
Shim->>PacketUpsertUserAll: ctor(index, src, onDone, onError)
PacketUpsertUserAll-->>Shim: instance
end
Shim-->>Caller: PacketUpsertUserAll instance
deactivate Shim
Class diagram for updated Shim handling of PacketUpsertUserAll constructorsclassDiagram
class Shim {
+EncryptNetPacketBody(byte[] data) byte[]
+CreatePacketUpsertUserAll(int index, UserData src, Action~int~ onDone, Action~PacketStatus~ onError) PacketUpsertUserAll
}
class PacketUpsertUserAll {
+PacketUpsertUserAll(int index, UserData src, Action~int~ onDone, Action~PacketStatus~ onError)
+PacketUpsertUserAll(int index, UserData src, int maxTrackNo, Action~int~ onDone, Action~PacketStatus~ onError)
}
class UserData {
}
class PacketStatus {
}
class GamePlayManager {
+IsEmpty() bool
+GetScoreListCount() int
}
class Singleton_GamePlayManager_ {
+Instance GamePlayManager
}
Shim ..> PacketUpsertUserAll : uses via reflection
Shim ..> UserData
Shim ..> PacketStatus
Shim ..> Singleton_GamePlayManager_ : queries Instance
Singleton_GamePlayManager_ *-- GamePlayManager
note for Singleton_GamePlayManager_ "Represents Singleton<GamePlayManager>"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - 我已经审查了你的更改,一切看起来都很棒!
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈来改进以后的审查。
Original comment in English
Hey - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Code Review
This pull request adds support for an additional constructor signature for PacketUpsertUserAll in Shim.cs, which includes logic to determine the maximum track number based on the current GamePlayManager state. The review feedback suggests using C# 12 collection expressions for the constructor parameter types to maintain consistency with the existing codebase and improve readability.
| else if (type.GetConstructor(new[] | ||
| { | ||
| typeof(int), | ||
| typeof(UserData), | ||
| typeof(int), | ||
| typeof(Action<int>), | ||
| typeof(Action<PacketStatus>) | ||
| }) is ConstructorInfo ctor3) |
There was a problem hiding this comment.
Pull request overview
This PR updates the Shim reflection-based constructor selection to support additional PacketUpsertUserAll constructor signatures seen in some game versions, improving compatibility across builds.
Changes:
- Add a new
PacketUpsertUserAllconstructor match for the(int, UserData, int, Action<int>, Action<PacketStatus>)signature. - When using that signature, derive the third
intargument fromGamePlayManagerscore list count (when applicable).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
由 Sourcery 提供的总结
错误修复:
maxTrackNo参数的构造函数时,Shim 无法匹配并构造PacketUpsertUserAll的问题。Original summary in English
Summary by Sourcery
Bug Fixes: