use nameof for RaiseEvent

This commit is contained in:
JohnCorby 2021-12-26 21:01:24 -08:00
parent 3e9965101a
commit 0574cd17e5
6 changed files with 15 additions and 15 deletions

View File

@ -10,10 +10,10 @@ namespace QSB.Animation.NPC.WorldObjects
public abstract CharacterDialogueTree GetDialogueTree();
public virtual void StartConversation()
=> GetDialogueTree().RaiseEvent("OnStartConversation");
=> GetDialogueTree().RaiseEvent(nameof(CharacterDialogueTree.OnStartConversation));
public virtual void EndConversation()
=> GetDialogueTree().RaiseEvent("OnEndConversation");
=> GetDialogueTree().RaiseEvent(nameof(CharacterDialogueTree.OnEndConversation));
public virtual bool InConversation()
=> false;

View File

@ -93,24 +93,24 @@ namespace QSB.Animation.Player.Patches
if (!____leftFootGrounded && leftFootLift < 0.333f)
{
____leftFootGrounded = true;
__instance.RaiseEvent("OnLeftFootGrounded");
__instance.RaiseEvent(nameof(__instance.OnLeftFootGrounded));
}
else if (____leftFootGrounded && leftFootLift > 0.666f)
{
____leftFootGrounded = false;
__instance.RaiseEvent("OnLeftFootLift");
__instance.RaiseEvent(nameof(__instance.OnLeftFootLift));
}
var rightFootLift = ____animator.GetFloat("RightFootLift");
if (!____rightFootGrounded && rightFootLift < 0.333f)
{
____rightFootGrounded = true;
__instance.RaiseEvent("OnRightFootGrounded");
__instance.RaiseEvent(nameof(__instance.OnRightFootGrounded));
}
else if (____rightFootGrounded && rightFootLift > 0.666f)
{
____rightFootGrounded = false;
__instance.RaiseEvent("OnRightFootLift");
__instance.RaiseEvent(nameof(__instance.OnRightFootLift));
}
}

View File

@ -16,12 +16,12 @@ namespace QSB.QuantumSync.Patches
[HarmonyPostfix]
[HarmonyPatch(typeof(Shape), nameof(Shape.OnEnable))]
public static void Shape_OnEnable(Shape __instance)
=> __instance.RaiseEvent("OnShapeActivated", __instance);
=> __instance.RaiseEvent(nameof(__instance.OnShapeActivated), __instance);
[HarmonyPostfix]
[HarmonyPatch(typeof(Shape), nameof(Shape.OnDisable))]
public static void Shape_OnDisable(Shape __instance)
=> __instance.RaiseEvent("OnShapeDeactivated", __instance);
=> __instance.RaiseEvent(nameof(__instance.OnShapeDeactivated), __instance);
// ShapeVisibilityTracker patches

View File

@ -123,7 +123,7 @@ namespace QSB.ShipSync.Patches
__instance._damaged = true;
__instance._repairFraction = 0f;
__instance.OnComponentDamaged();
__instance.RaiseEvent("OnDamaged", __instance);
__instance.RaiseEvent(nameof(__instance.OnDamaged), __instance);
qsbShipComponent
.SendMessage(new ComponentDamagedMessage());
}
@ -132,7 +132,7 @@ namespace QSB.ShipSync.Patches
__instance._damaged = false;
__instance._repairFraction = 1f;
__instance.OnComponentRepaired();
__instance.RaiseEvent("OnRepaired", __instance);
__instance.RaiseEvent(nameof(__instance.OnRepaired), __instance);
qsbShipComponent
.SendMessage(new ComponentRepairedMessage());
}
@ -166,7 +166,7 @@ namespace QSB.ShipSync.Patches
if (!____damaged)
{
____damaged = true;
__instance.RaiseEvent("OnDamaged", __instance);
__instance.RaiseEvent(nameof(__instance.OnDamaged), __instance);
qsbShipHull
.SendMessage(new HullDamagedMessage());
@ -192,7 +192,7 @@ namespace QSB.ShipSync.Patches
}
}
__instance.RaiseEvent("OnImpact", ____dominantImpact, damage);
__instance.RaiseEvent(nameof(__instance.OnImpact), ____dominantImpact, damage);
____dominantImpact = null;
}
@ -229,7 +229,7 @@ namespace QSB.ShipSync.Patches
if (____integrity >= 1f)
{
____damaged = false;
__instance.RaiseEvent("OnRepaired", __instance);
__instance.RaiseEvent(nameof(__instance.OnRepaired), __instance);
qsbShipHull
.SendMessage(new HullRepairedMessage());
}

View File

@ -53,7 +53,7 @@ namespace QSB.ZeroGCaveSync.Patches
__instance._lanternEmissiveRenderer.sharedMaterials = __instance._lanternMaterials;
}
__instance.RaiseEvent("OnRepaired", __instance);
__instance.RaiseEvent(nameof(__instance.OnRepaired), __instance);
}
if (__instance._damageEffect != null)

View File

@ -32,7 +32,7 @@ namespace QSB.ZeroGCaveSync.WorldObjects
AttachedObject._lanternEmissiveRenderer.sharedMaterials = AttachedObject._lanternMaterials;
}
AttachedObject.RaiseEvent("OnRepaired", AttachedObject);
AttachedObject.RaiseEvent(nameof(AttachedObject.OnRepaired), AttachedObject);
}
public void RepairTick(float repairFraction)