Skip to content

Commit

Permalink
check if succeeded
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy committed Jul 22, 2024
1 parent df1e2c7 commit c77c6e4
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Winch/Patches/API/AchievementLoadPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ class AchievementLoadPatcher
{
public static void Prefix(AchievementManager __instance, AsyncOperationHandle<IList<AchievementData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.AchievementsLoaded.Trigger(__instance, handle, true);
}

public static void Postfix(AchievementManager __instance, AsyncOperationHandle<IList<AchievementData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.AchievementsLoaded.Trigger(__instance, handle, false);
}
}
Expand Down
4 changes: 4 additions & 0 deletions Winch/Patches/API/GridConfigsLoadPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ class GridConfigsLoadPatcher
{
public static void Prefix(DataLoader __instance, AsyncOperationHandle<IList<GridConfiguration>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

GridConfigUtil.AddModdedGridConfigurations(handle.Result);
DredgeEvent.AddressableEvents.GridConfigsLoaded.Trigger(__instance, handle, true);
}

public static void Postfix(DataLoader __instance, AsyncOperationHandle<IList<GridConfiguration>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

GridConfigUtil.PopulateGridConfigurations();
DredgeEvent.AddressableEvents.GridConfigsLoaded.Trigger(__instance, handle, false);
}
Expand Down
4 changes: 4 additions & 0 deletions Winch/Patches/API/ItemLoadPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ public static void ChangeDredgeCrane(IList<ItemData> items)

public static void Prefix(ItemManager __instance, AsyncOperationHandle<IList<ItemData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

ChangeDredgeCrane(handle.Result);
ItemUtil.AddModdedItemData(handle.Result);
DredgeEvent.AddressableEvents.ItemsLoaded.Trigger(__instance, handle, true);
}

public static void Postfix(ItemManager __instance, AsyncOperationHandle<IList<ItemData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

ItemUtil.PopulateItemData();
DredgeEvent.AddressableEvents.ItemsLoaded.Trigger(__instance, handle, false);
}
Expand Down
4 changes: 4 additions & 0 deletions Winch/Patches/API/MapMarkerLoadPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ class MapMarkerLoadPatcher
{
public static void Prefix(DataLoader __instance, AsyncOperationHandle<IList<MapMarkerData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.MapMarkersLoaded.Trigger(__instance, handle, true);
}

public static void Postfix(DataLoader __instance, AsyncOperationHandle<IList<MapMarkerData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.MapMarkersLoaded.Trigger(__instance, handle, false);
}
}
Expand Down
4 changes: 4 additions & 0 deletions Winch/Patches/API/QuestGridLoadPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ class QuestGridLoadPatcher
{
public static void Prefix(DataLoader __instance, AsyncOperationHandle<IList<QuestGridConfig>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.QuestGridConfigsLoaded.Trigger(__instance, handle, true);
}

public static void Postfix(DataLoader __instance, AsyncOperationHandle<IList<QuestGridConfig>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.QuestGridConfigsLoaded.Trigger(__instance, handle, false);
}
}
Expand Down
4 changes: 4 additions & 0 deletions Winch/Patches/API/QuestLoadPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ class QuestLoadPatcher
{
public static void Prefix(DataLoader __instance, AsyncOperationHandle<IList<QuestData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.QuestsLoaded.Trigger(__instance, handle, true);
}

public static void Postfix(DataLoader __instance, AsyncOperationHandle<IList<QuestData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.QuestsLoaded.Trigger(__instance, handle, false);
}
}
Expand Down
4 changes: 4 additions & 0 deletions Winch/Patches/API/UpgradeLoadPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ class UpgradeLoadPatcher
{
public static void Prefix(UpgradeManager __instance, AsyncOperationHandle<IList<UpgradeData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.UpgradesLoaded.Trigger(__instance, handle, true);
}

public static void Postfix(UpgradeManager __instance, AsyncOperationHandle<IList<UpgradeData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.UpgradesLoaded.Trigger(__instance, handle, false);
}
}
Expand Down
4 changes: 4 additions & 0 deletions Winch/Patches/API/WeatherDataLoadPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ class WeatherDataLoadPatcher
{
public static void Prefix(DataLoader __instance, AsyncOperationHandle<IList<WeatherData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.WeatherDataLoaded.Trigger(__instance, handle, true);
}

public static void Postfix(DataLoader __instance, AsyncOperationHandle<IList<WeatherData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.WeatherDataLoaded.Trigger(__instance, handle, false);
}
}
Expand Down
4 changes: 4 additions & 0 deletions Winch/Patches/API/WorldEventLoadPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ class WorldEventLoadPatcher
{
public static void Prefix(DataLoader __instance, AsyncOperationHandle<IList<WorldEventData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

WorldEventUtil.AddModdedWorldEvents(handle.Result);
DredgeEvent.AddressableEvents.WorldEventsLoaded.Trigger(__instance, handle, true);
}

public static void Postfix(DataLoader __instance, AsyncOperationHandle<IList<WorldEventData>> handle)
{
if (handle.Result == null || handle.Status != AsyncOperationStatus.Succeeded) return;

DredgeEvent.AddressableEvents.WorldEventsLoaded.Trigger(__instance, handle, false);
}
}
Expand Down

0 comments on commit c77c6e4

Please sign in to comment.