Skip to content

Commit ef510e6

Browse files
committed
refactor: 将 ProtoGenerateHelper 重命名为 _protoGenerateHelper 以符合命名规范
重命名静态字段以遵循 C# 命名约定,使用下划线前缀表示私有字段。同时更新 Post 方法的参数传递方式,直接使用 launcherOptions 对象而非单独提取属性。
1 parent 1477d39 commit ef510e6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ProtoExport/ProtoBufMessageHandler.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public static class ProtoBufMessageHandler
44
{
5-
private static IProtoGenerateHelper ProtoGenerateHelper;
5+
private static IProtoGenerateHelper _protoGenerateHelper;
66

77
public static void Start(LauncherOptions launcherOptions, ModeType modeType)
88
{
@@ -22,7 +22,7 @@ public static void Start(LauncherOptions launcherOptions, ModeType modeType)
2222
var attrs = type.GetCustomAttributes(typeof(ModeAttribute), true);
2323
if (attrs?.Length > 0 && (attrs[0] is ModeAttribute modeAttribute) && modeAttribute.Mode == modeType)
2424
{
25-
ProtoGenerateHelper = (IProtoGenerateHelper)Activator.CreateInstance(type);
25+
_protoGenerateHelper = (IProtoGenerateHelper)Activator.CreateInstance(type);
2626
break;
2727
}
2828
}
@@ -38,16 +38,16 @@ public static void Start(LauncherOptions launcherOptions, ModeType modeType)
3838
{
3939
case ModeType.Server:
4040
case ModeType.Unity:
41-
ProtoGenerateHelper?.Run(operationCodeInfo, launcherOptions.OutputPath, launcherOptions.NamespaceName);
41+
_protoGenerateHelper?.Run(operationCodeInfo, launcherOptions.OutputPath, launcherOptions.NamespaceName);
4242
break;
4343
case ModeType.TypeScript:
44-
ProtoGenerateHelper?.Run(operationCodeInfo, launcherOptions.OutputPath, Path.GetFileNameWithoutExtension(file));
44+
_protoGenerateHelper?.Run(operationCodeInfo, launcherOptions.OutputPath, Path.GetFileNameWithoutExtension(file));
4545
break;
4646
default:
4747
throw new ArgumentOutOfRangeException();
4848
}
4949
}
5050

51-
ProtoGenerateHelper?.Post(messageInfoLists, launcherOptions.OutputPath);
51+
_protoGenerateHelper?.Post(messageInfoLists, launcherOptions);
5252
}
5353
}

0 commit comments

Comments
 (0)