From fa48ed9945fc17f3f827e0bfe9186f6545542279 Mon Sep 17 00:00:00 2001 From: TML Date: Sat, 28 Sep 2024 21:01:36 +0800 Subject: [PATCH] Change generated On{SignalName} to EmitSignal{SignalName} --- .../GeneratedSources/EventSignals_ScriptSignals.generated.cs | 2 +- .../Godot.SourceGenerators/ScriptSignalsGenerator.cs | 4 ++-- modules/mono/editor/bindings_generator.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/GeneratedSources/EventSignals_ScriptSignals.generated.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/GeneratedSources/EventSignals_ScriptSignals.generated.cs index 188972e6fe3..f54058b0d96 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/GeneratedSources/EventSignals_ScriptSignals.generated.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/GeneratedSources/EventSignals_ScriptSignals.generated.cs @@ -32,7 +32,7 @@ partial class EventSignals add => backing_MySignal += value; remove => backing_MySignal -= value; } - protected void OnMySignal(string str, int num) + protected void EmitSignalMySignal(string str, int num) { EmitSignal(SignalName.MySignal, str, num); } diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs index 0dda43ab4ce..702c50d4616 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs @@ -282,7 +282,7 @@ namespace Godot.SourceGenerators .Append(" -= value;\n") .Append("}\n"); - // Generate On{EventName} method to raise the event + // Generate EmitSignal{EventName} method to raise the event var invokeMethodSymbol = signalDelegate.InvokeMethodData.Method; int paramCount = invokeMethodSymbol.Parameters.Length; @@ -291,7 +291,7 @@ namespace Godot.SourceGenerators "private" : "protected"; - source.Append($" {raiseMethodModifiers} void On{signalName}("); + source.Append($" {raiseMethodModifiers} void EmitSignal{signalName}("); for (int i = 0; i < paramCount; i++) { var paramSymbol = invokeMethodSymbol.Parameters[i]; diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 89655e0b561..b45a8ecd894 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -3228,10 +3228,10 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf p_output.append(CLOSE_BLOCK_L1); - // Generate On{EventName} method to raise the event. + // Generate EmitSignal{EventName} method to raise the event. if (!p_itype.is_singleton) { p_output.append(MEMBER_BEGIN "protected void "); - p_output << "On" << p_isignal.proxy_name; + p_output << "EmitSignal" << p_isignal.proxy_name; if (is_parameterless) { p_output.append("()\n" OPEN_BLOCK_L1 INDENT2); p_output << "EmitSignal(SignalName." << p_isignal.proxy_name << ");\n";