Merge pull request #394 from misternebula/eventnames-nameof

use nameof in EventNames
This commit is contained in:
_nebula 2021-12-04 16:19:57 +00:00 committed by GitHub
commit 4b3b8cd4a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 103 additions and 104 deletions

View File

@ -5,8 +5,8 @@ namespace QSB.ConversationSync.Events
{
public class DialogueConditionEvent : QSBEvent<DialogueConditionMessage>
{
public override void SetupListener() => GlobalMessenger<string, bool>.AddListener(EventNames.DialogueCondition, Handler);
public override void CloseListener() => GlobalMessenger<string, bool>.RemoveListener(EventNames.DialogueCondition, Handler);
public override void SetupListener() => GlobalMessenger<string, bool>.AddListener(EventNames.DialogueConditionChanged, Handler);
public override void CloseListener() => GlobalMessenger<string, bool>.RemoveListener(EventNames.DialogueConditionChanged, Handler);
private void Handler(string name, bool state) => SendEvent(CreateMessage(name, state));

View File

@ -3,105 +3,104 @@
public static class EventNames
{
// Built into Outer Wilds -- don't change unless they change in-game!
public static string TurnOnFlashlight = "TurnOnFlashlight";
public static string TurnOffFlashlight = "TurnOffFlashlight";
public static string ProbeLauncherEquipped = "ProbeLauncherEquipped";
public static string ProbeLauncherUnequipped = "ProbeLauncherUnequipped";
public static string EquipSignalscope = "EquipSignalscope";
public static string UnequipSignalscope = "UnequipSignalscope";
public static string SuitUp = "SuitUp";
public static string RemoveSuit = "RemoveSuit";
public static string EquipTranslator = "EquipTranslator";
public static string UnequipTranslator = "UnequipTranslator";
public static string RestartTimeLoop = "RestartTimeLoop";
public static string WakeUp = "WakeUp";
public static string DialogueCondition = "DialogueConditionChanged";
public static string EnterQuantumMoon = "PlayerEnterQuantumMoon";
public static string ExitQuantumMoon = "PlayerExitQuantumMoon";
public static string EnterRoastingMode = "EnterRoastingMode";
public static string ExitRoastingMode = "ExitRoastingMode";
public static string EnterFlightConsole = "EnterFlightConsole";
public static string ExitFlightConsole = "ExitFlightConsole";
public static string EnterShip = "EnterShip";
public static string ExitShip = "ExitShip";
public const string TurnOnFlashlight = nameof(TurnOnFlashlight);
public const string TurnOffFlashlight = nameof(TurnOffFlashlight);
public const string ProbeLauncherEquipped = nameof(ProbeLauncherEquipped);
public const string ProbeLauncherUnequipped = nameof(ProbeLauncherUnequipped);
public const string EquipSignalscope = nameof(EquipSignalscope);
public const string UnequipSignalscope = nameof(UnequipSignalscope);
public const string SuitUp = nameof(SuitUp);
public const string RemoveSuit = nameof(RemoveSuit);
public const string EquipTranslator = nameof(EquipTranslator);
public const string UnequipTranslator = nameof(UnequipTranslator);
public const string WakeUp = nameof(WakeUp);
public const string DialogueConditionChanged = nameof(DialogueConditionChanged);
public const string PlayerEnterQuantumMoon = nameof(PlayerEnterQuantumMoon);
public const string PlayerExitQuantumMoon = nameof(PlayerExitQuantumMoon);
public const string EnterRoastingMode = nameof(EnterRoastingMode);
public const string ExitRoastingMode = nameof(ExitRoastingMode);
public const string EnterFlightConsole = nameof(EnterFlightConsole);
public const string ExitFlightConsole = nameof(ExitFlightConsole);
public const string EnterShip = nameof(EnterShip);
public const string ExitShip = nameof(ExitShip);
// Custom event names -- change if you want! These can be anything, as long as both
// sides of the GlobalMessenger (fireevent and addlistener) reference the same thing.
public static string QSBPlayerDeath = "QSBPlayerDeath";
public static string QSBPlayerJoin = "QSBPlayerJoin";
public static string QSBPlayerReady = "QSBPlayerReady";
public static string QSBRequestStateResync = "QSBPlayerStatesRequest";
public static string QSBServerTime = "QSBServerTime";
public static string QSBStartLift = "QSBStartLift";
public static string QSBGeyserState = "QSBGeyserState";
public static string QSBOrbSlot = "QSBOrbSlot";
public static string QSBOrbUser = "QSBOrbUser";
public static string QSBConversation = "QSBConversation";
public static string QSBConversationStartEnd = "QSBConversationStartEnd";
public static string QSBChangeAnimType = "QSBPlayInstrument";
public static string QSBPlayerInformation = "QSBServerSendPlayerStates";
public static string QSBRevealFact = "QSBRevealFact";
public static string QSBSocketStateChange = "QSBSocketStateChange";
public static string QSBMultiStateChange = "QSBMultiStateChange";
public static string QSBQuantumShuffle = "QSBQuantumShuffle";
public static string QSBQuantumAuthority = "QSBQuantumAuthority";
public static string QSBMoonStateChange = "QSBMoonStateChange";
public static string QSBIdentifyFrequency = "QSBIdentifyFrequency";
public static string QSBIdentifySignal = "QSBIdentifySignal";
public static string QSBTextTranslated = "QSBTextTranslated";
public static string QSBEnterShrine = "QSBEnterShrine";
public static string QSBExitShrine = "QSBExitShrine";
public static string QSBPlayerEntangle = "QSBPlayerEntangle";
public static string QSBDropItem = "QSBDropItem";
public static string QSBSocketItem = "QSBSocketItem";
public static string QSBMoveToCarry = "QSBMoveToCarry";
public static string QSBStartStatue = "QSBStartStatue";
public static string QSBPlayerKick = "QSBPlayerKick";
public static string QSBEnterPlatform = "QSBEnterPlatform";
public static string QSBExitPlatform = "QSBExitPlatform";
public static string QSBCampfireState = "QSBCampfireState";
public static string QSBMarshmallowEvent = "QSBMarshmallowEvent";
public static string QSBAnimTrigger = "QSBAnimTrigger";
public static string QSBEnterNonNomaiHeadZone = "QSBEnterNonNomaiHeadZone";
public static string QSBExitNonNomaiHeadZone = "QSBExitNonNomaiHeadZone";
public static string QSBNpcAnimEvent = "QSBNpcAnimEvent";
public static string QSBHatchState = "QSBHatchState";
public static string QSBEnableFunnel = "QSBEnableFunnel";
public static string QSBHullImpact = "QSBHullImpact";
public static string QSBHullDamaged = "QSBHullDamaged";
public static string QSBHullChangeIntegrity = "QSBHullChangeIntegrity";
public static string QSBHullRepaired = "QSBHullRepaired";
public static string QSBHullRepairTick = "QSBHullRepairTick";
public static string QSBComponentDamaged = "QSBComponentDamaged";
public static string QSBComponentRepaired = "QSBComponentRepaired";
public static string QSBComponentRepairTick = "QSBComponentRepairTick";
public static string QSBPlayerRespawn = "QSBPlayerRespawn";
public static string QSBProbeEvent = "QSBProbeEvent";
public static string QSBProbeStartRetrieve = "QSBProbeStartRetrieve";
public static string QSBRetrieveProbe = "QSBRetrieveProbe";
public static string QSBPlayerRetrieveProbe = "QSBPlayerRetrieveProbe";
public static string QSBLaunchProbe = "QSBLaunchProbe";
public static string QSBPlayerLaunchProbe = "QSBPlayerLaunchProbe";
public static string QSBEndLoop = "QSBEndLoop";
public static string QSBStartLoop = "QSBStartLoop";
public static string QSBServerState = "QSBServerState";
public static string QSBClientState = "QSBClientState";
public static string QSBDebugEvent = "QSBDebugEvent";
public static string QSBEnterNomaiHeadZone = "QSBEnterNomaiHeadZone";
public static string QSBExitNomaiHeadZone = "QSBExitNomaiHeadZone";
public static string QSBEnterSatelliteCamera = "QSBEnterSatelliteCamera";
public static string QSBExitSatelliteCamera = "QSBExitSatelliteCamera";
public static string QSBSatelliteSnapshot = "QSBSatelliteSnapshot";
public static string QSBAnglerChangeState = "QSBAnglerChangeState";
public static string QSBMeteorPreLaunch = "QSBMeteorPreLaunch";
public static string QSBMeteorLaunch = "QSBMeteorLaunch";
public static string QSBMeteorSpecialImpact = "QSBMeteorSpecialImpact";
public static string QSBFragmentDamage = "QSBFragmentDamage";
public static string QSBFragmentResync = "QSBFragmentResync";
public static string QSBLearnLaunchCodes = "QSBLearnLaunchCodes";
public static string QSBSatelliteRepairTick = "QSBSatelliteRepairTick";
public static string QSBSatelliteRepaired = "QSBSatelliteRepairTick";
public static string QSBAuthorityQueue = "QSBAuthorityQueue";
public static string QSBJellyfishRising = "QSBJellyfishRising";
public const string QSBPlayerDeath = nameof(QSBPlayerDeath);
public const string QSBPlayerJoin = nameof(QSBPlayerJoin);
public const string QSBPlayerReady = nameof(QSBPlayerReady);
public const string QSBRequestStateResync = nameof(QSBRequestStateResync);
public const string QSBServerTime = nameof(QSBServerTime);
public const string QSBStartLift = nameof(QSBStartLift);
public const string QSBGeyserState = nameof(QSBGeyserState);
public const string QSBOrbSlot = nameof(QSBOrbSlot);
public const string QSBOrbUser = nameof(QSBOrbUser);
public const string QSBConversation = nameof(QSBConversation);
public const string QSBConversationStartEnd = nameof(QSBConversationStartEnd);
public const string QSBChangeAnimType = nameof(QSBChangeAnimType);
public const string QSBPlayerInformation = nameof(QSBPlayerInformation);
public const string QSBRevealFact = nameof(QSBRevealFact);
public const string QSBSocketStateChange = nameof(QSBSocketStateChange);
public const string QSBMultiStateChange = nameof(QSBMultiStateChange);
public const string QSBQuantumShuffle = nameof(QSBQuantumShuffle);
public const string QSBQuantumAuthority = nameof(QSBQuantumAuthority);
public const string QSBMoonStateChange = nameof(QSBMoonStateChange);
public const string QSBIdentifyFrequency = nameof(QSBIdentifyFrequency);
public const string QSBIdentifySignal = nameof(QSBIdentifySignal);
public const string QSBTextTranslated = nameof(QSBTextTranslated);
public const string QSBEnterShrine = nameof(QSBEnterShrine);
public const string QSBExitShrine = nameof(QSBExitShrine);
public const string QSBPlayerEntangle = nameof(QSBPlayerEntangle);
public const string QSBDropItem = nameof(QSBDropItem);
public const string QSBSocketItem = nameof(QSBSocketItem);
public const string QSBMoveToCarry = nameof(QSBMoveToCarry);
public const string QSBStartStatue = nameof(QSBStartStatue);
public const string QSBPlayerKick = nameof(QSBPlayerKick);
public const string QSBEnterPlatform = nameof(QSBEnterPlatform);
public const string QSBExitPlatform = nameof(QSBExitPlatform);
public const string QSBCampfireState = nameof(QSBCampfireState);
public const string QSBMarshmallowEvent = nameof(QSBMarshmallowEvent);
public const string QSBAnimTrigger = nameof(QSBAnimTrigger);
public const string QSBEnterNonNomaiHeadZone = nameof(QSBEnterNonNomaiHeadZone);
public const string QSBExitNonNomaiHeadZone = nameof(QSBExitNonNomaiHeadZone);
public const string QSBNpcAnimEvent = nameof(QSBNpcAnimEvent);
public const string QSBHatchState = nameof(QSBHatchState);
public const string QSBEnableFunnel = nameof(QSBEnableFunnel);
public const string QSBHullImpact = nameof(QSBHullImpact);
public const string QSBHullDamaged = nameof(QSBHullDamaged);
public const string QSBHullChangeIntegrity = nameof(QSBHullChangeIntegrity);
public const string QSBHullRepaired = nameof(QSBHullRepaired);
public const string QSBHullRepairTick = nameof(QSBHullRepairTick);
public const string QSBComponentDamaged = nameof(QSBComponentDamaged);
public const string QSBComponentRepaired = nameof(QSBComponentRepaired);
public const string QSBComponentRepairTick = nameof(QSBComponentRepairTick);
public const string QSBPlayerRespawn = nameof(QSBPlayerRespawn);
public const string QSBProbeEvent = nameof(QSBProbeEvent);
public const string QSBProbeStartRetrieve = nameof(QSBProbeStartRetrieve);
public const string QSBRetrieveProbe = nameof(QSBRetrieveProbe);
public const string QSBPlayerRetrieveProbe = nameof(QSBPlayerRetrieveProbe);
public const string QSBLaunchProbe = nameof(QSBLaunchProbe);
public const string QSBPlayerLaunchProbe = nameof(QSBPlayerLaunchProbe);
public const string QSBEndLoop = nameof(QSBEndLoop);
public const string QSBStartLoop = nameof(QSBStartLoop);
public const string QSBServerState = nameof(QSBServerState);
public const string QSBClientState = nameof(QSBClientState);
public const string QSBDebugEvent = nameof(QSBDebugEvent);
public const string QSBEnterNomaiHeadZone = nameof(QSBEnterNomaiHeadZone);
public const string QSBExitNomaiHeadZone = nameof(QSBExitNomaiHeadZone);
public const string QSBEnterSatelliteCamera = nameof(QSBEnterSatelliteCamera);
public const string QSBExitSatelliteCamera = nameof(QSBExitSatelliteCamera);
public const string QSBSatelliteSnapshot = nameof(QSBSatelliteSnapshot);
public const string QSBAnglerChangeState = nameof(QSBAnglerChangeState);
public const string QSBMeteorPreLaunch = nameof(QSBMeteorPreLaunch);
public const string QSBMeteorLaunch = nameof(QSBMeteorLaunch);
public const string QSBMeteorSpecialImpact = nameof(QSBMeteorSpecialImpact);
public const string QSBFragmentDamage = nameof(QSBFragmentDamage);
public const string QSBFragmentResync = nameof(QSBFragmentResync);
public const string QSBLearnLaunchCodes = nameof(QSBLearnLaunchCodes);
public const string QSBSatelliteRepairTick = nameof(QSBSatelliteRepairTick);
public const string QSBSatelliteRepaired = nameof(QSBSatelliteRepairTick);
public const string QSBAuthorityQueue = nameof(QSBAuthorityQueue);
public const string QSBJellyfishRising = nameof(QSBJellyfishRising);
}
}

View File

@ -12,8 +12,8 @@ namespace QSB.Player.Events
{
public override void SetupListener()
{
GlobalMessenger.AddListener(EventNames.EnterQuantumMoon, () => Handler(EnterLeaveType.EnterMoon));
GlobalMessenger.AddListener(EventNames.ExitQuantumMoon, () => Handler(EnterLeaveType.ExitMoon));
GlobalMessenger.AddListener(EventNames.PlayerEnterQuantumMoon, () => Handler(EnterLeaveType.EnterMoon));
GlobalMessenger.AddListener(EventNames.PlayerExitQuantumMoon, () => Handler(EnterLeaveType.ExitMoon));
GlobalMessenger.AddListener(EventNames.QSBEnterShrine, () => Handler(EnterLeaveType.EnterShrine));
GlobalMessenger.AddListener(EventNames.QSBExitShrine, () => Handler(EnterLeaveType.ExitShrine));
GlobalMessenger<int>.AddListener(EventNames.QSBEnterPlatform, (int id) => Handler(EnterLeaveType.EnterPlatform, id));
@ -28,8 +28,8 @@ namespace QSB.Player.Events
public override void CloseListener()
{
GlobalMessenger.RemoveListener(EventNames.EnterQuantumMoon, () => Handler(EnterLeaveType.EnterMoon));
GlobalMessenger.RemoveListener(EventNames.ExitQuantumMoon, () => Handler(EnterLeaveType.ExitMoon));
GlobalMessenger.RemoveListener(EventNames.PlayerEnterQuantumMoon, () => Handler(EnterLeaveType.EnterMoon));
GlobalMessenger.RemoveListener(EventNames.PlayerExitQuantumMoon, () => Handler(EnterLeaveType.ExitMoon));
GlobalMessenger.RemoveListener(EventNames.QSBEnterShrine, () => Handler(EnterLeaveType.EnterShrine));
GlobalMessenger.RemoveListener(EventNames.QSBExitShrine, () => Handler(EnterLeaveType.ExitShrine));
GlobalMessenger<int>.RemoveListener(EventNames.QSBEnterPlatform, (int id) => Handler(EnterLeaveType.EnterPlatform, id));

View File

@ -47,7 +47,7 @@ namespace QSB.Player.Events
private void SendWorldObjectInfo()
{
QSBWorldSync.DialogueConditions.ForEach(condition
=> QSBEventManager.FireEvent(EventNames.DialogueCondition, condition.Key, condition.Value));
=> QSBEventManager.FireEvent(EventNames.DialogueConditionChanged, condition.Key, condition.Value));
QSBWorldSync.ShipLogFacts.ForEach(fact
=> QSBEventManager.FireEvent(EventNames.QSBRevealFact, fact.Id, fact.SaveGame, false));