Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/deploy-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ jobs:
- name: Run .NET build for MonoBepInEx
run: dotnet build ./S1API.sln -c MonoBepInEx -f netstandard2.1

# TODO (@MaxtorCoder): Il2CppBepInEx still does not build properly.
# - name: Run .NET build for Il2CppBepInEx
# run: dotnet build ./S1API.sln -c Il2CppBepInEx -f net6.0
- name: Run .NET build for Il2CppBepInEx
run: dotnet build ./S1API.sln -c Il2CppBepInEx -f net6.0

- name: Run .NET build for MonoMelon
run: dotnet build ./S1API.sln -c MonoMelon -f netstandard2.1
Expand All @@ -77,8 +76,8 @@ jobs:
cp ./S1APILoader/bin/MonoBepInEx/netstandard2.1/S1APILoader.dll ./artifacts/thunderstore/Plugins/S1APILoader.BepInEx.dll
cp ./S1API/bin/Il2CppMelon/net6.0/S1API.dll ./artifacts/thunderstore/Mods/S1API.Il2Cpp.MelonLoader.dll
cp ./S1API/bin/MonoMelon/netstandard2.1/S1API.dll ./artifacts/thunderstore/Mods/S1API.Mono.MelonLoader.dll
cp ./S1API/bin/Il2CppBepInEx/net6.0/S1API.dll ./artifacts/thunderstore/Mods/S1API.Il2Cpp.BepInEx.dll
cp ./S1API/bin/MonoBepInEx/netstandard2.1/S1API.dll ./artifacts/thunderstore/Mods/S1API.Mono.BepInEx.dll
# cp ./S1API/bin/Il2CppBepInEx/net6.0/S1API.dll ./artifacts/thunderstore/Mods/S1API.Il2Cpp.BepInEx.dll

- name: Publish artifact to Thunderstore
uses: GreenTF/upload-thunderstore-package@v4.3
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/verify-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ jobs:

- name: Run .NET build for MonoBepInEx
run: dotnet build ./S1API.sln -c MonoBepInEx -f netstandard2.1

# TODO (@MaxtorCoder): Il2CppBepInEx still does not build properly.
# - name: Run .NET build for Il2CppBepInEx
# run: dotnet build ./S1API.sln -c Il2CppBepInEx -f net6.0

- name: Run .NET build for Il2CppBepInEx
run: dotnet build ./S1API.sln -c Il2CppBepInEx -f net6.0

- name: Run .NET build for MonoMelon
run: dotnet build ./S1API.sln -c MonoMelon -f netstandard2.1
Expand Down
4 changes: 2 additions & 2 deletions S1API/Conditionals/SystemTriggerEntry.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#if (IL2CPPMELON || IL2CPPBEPINEX)
#if (IL2CPPMELON)
using S1Quests = Il2CppScheduleOne.Quests;
using S1Variables = Il2CppScheduleOne.Variables;
using static Il2CppScheduleOne.Quests.QuestManager;
#elif (MONOMELON || MONOBEPINEX)
#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX)
using S1Quests = ScheduleOne.Quests;
using S1Variables = ScheduleOne.Variables;
using static ScheduleOne.Quests.QuestManager;
Expand Down
2 changes: 1 addition & 1 deletion S1API/Console/ConsoleHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if (IL2CPPMELON || IL2CPPBEPINEX)
#if (IL2CPPMELON)
using Il2CppSystem.Collections.Generic;
using static Il2CppScheduleOne.Console;
#else
Expand Down
4 changes: 2 additions & 2 deletions S1API/DeadDrops/DeadDropInstance.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#if (IL2CPPMELON || IL2CPPBEPINEX)
#if (IL2CPPMELON)
using S1Economy = Il2CppScheduleOne.Economy;
#elif (MONOMELON || MONOBEPINEX)
#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX)
using S1Economy = ScheduleOne.Economy;
#endif

Expand Down
4 changes: 2 additions & 2 deletions S1API/DeadDrops/DeadDropManager.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#if (IL2CPPMELON || IL2CPPBEPINEX)
#if (IL2CPPMELON)
using S1Economy = Il2CppScheduleOne.Economy;
#elif (MONOMELON || MONOBEPINEX)
#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX)
using S1Economy = ScheduleOne.Economy;
#endif

Expand Down
21 changes: 11 additions & 10 deletions S1API/Dialogues/DialogueChoiceListener.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using UnityEngine.Events;
#if IL2CPPBEPINEX || IL2CPPMELON

#if IL2CPPMELON
using Il2CppScheduleOne.Dialogue;
#elif MONOBEPINEX || MONOMELON
#elif MONOBEPINEX || MONOMELON || IL2CPPBEPINEX
using ScheduleOne.Dialogue;
#endif

Expand All @@ -22,21 +23,21 @@ public static class DialogueChoiceListener
/// to match the label of the choice selected by the user. When the label matches
/// <c>expectedChoiceLabel</c>, the registered callback is executed.
/// </remarks>
private static string expectedChoiceLabel;
private static string? _expectedChoiceLabel;

/// <summary>
/// Represents a delegate invoked when a specific dialogue choice is selected during interaction.
/// </summary>
private static Action callback;
private static Action? _callback;

/// Registers a specific dialogue choice with a callback to be invoked when the choice is selected.
/// <param name="handlerRef">The reference to the DialogueHandler that manages dialogue choices.</param>
/// <param name="label">The label identifying the specific dialogue choice to be registered.</param>
/// <param name="action">The callback action to execute when the dialogue choice is selected.</param>
public static void Register(DialogueHandler handlerRef, string label, Action action)
{
expectedChoiceLabel = label;
callback = action;
_expectedChoiceLabel = label;
_callback = action;

if (handlerRef != null)
{
Expand All @@ -45,7 +46,7 @@ public static void Register(DialogueHandler handlerRef, string label, Action act
// ✅ IL2CPP-safe: explicit method binding via wrapper
handlerRef.onDialogueChoiceChosen.AddListener((UnityAction<string>)delegate (string choice)
{
if (choice == expectedChoiceLabel)
if (choice == _expectedChoiceLabel)
((UnityAction)ForwardCall).Invoke();
});
}
Expand All @@ -60,8 +61,8 @@ public static void Register(DialogueHandler handlerRef, string label, Action act
/// </remarks>
private static void OnChoice()
{
callback?.Invoke();
callback = null; // optional: remove if one-time use
_callback?.Invoke();
_callback = null; // optional: remove if one-time use
}
}
}
}
127 changes: 65 additions & 62 deletions S1API/Dialogues/DialogueInjection.cs
Original file line number Diff line number Diff line change
@@ -1,75 +1,78 @@
using System;

/// <summary>
/// Represents a dialogue injection configuration for adding custom dialogues into an NPC's conversation flow dynamically.
/// </summary>
public class DialogueInjection
namespace S1API.Dialogues
{
/// <summary>
/// Represents the name of the NPC (Non-Player Character) to which the dialogue injection is associated.
/// This value is expected to match or partially match the name of an NPC in the game, allowing the system
/// to identify and target the specific NPC for dialogue modifications.
/// Represents a dialogue injection configuration for adding custom dialogues into an NPC's conversation flow dynamically.
/// </summary>
public string NpcName;
public class DialogueInjection
{
/// <summary>
/// Represents the name of the NPC (Non-Player Character) to which the dialogue injection is associated.
/// This value is expected to match or partially match the name of an NPC in the game, allowing the system
/// to identify and target the specific NPC for dialogue modifications.
/// </summary>
public string NpcName;

/// <summary>
/// Represents the name of the dialogue container being referenced for injections or modifications
/// within the NPC's dialogue system.
/// </summary>
/// <remarks>
/// This variable is used for identifying a specific dialogue container when attempting to
/// inject new dialogue nodes, choices, or links into an NPC's dialogue setup.
/// </remarks>
public string ContainerName;
/// <summary>
/// Represents the name of the dialogue container being referenced for injections or modifications
/// within the NPC's dialogue system.
/// </summary>
/// <remarks>
/// This variable is used for identifying a specific dialogue container when attempting to
/// inject new dialogue nodes, choices, or links into an NPC's dialogue setup.
/// </remarks>
public string ContainerName;

/// <summary>
/// Represents the unique identifier (GUID) of the starting dialogue node within a dialogue container.
/// </summary>
/// <remarks>
/// This variable is used to identify the specific dialogue node from which a new choice or interaction is injected.
/// </remarks>
public string FromNodeGuid;
/// <summary>
/// Represents the unique identifier (GUID) of the starting dialogue node within a dialogue container.
/// </summary>
/// <remarks>
/// This variable is used to identify the specific dialogue node from which a new choice or interaction is injected.
/// </remarks>
public string FromNodeGuid;

/// <summary>
/// Represents the unique identifier (GUID) for the target dialogue node to which a choice or link is pointing in a dialogue system.
/// </summary>
public string ToNodeGuid;
/// <summary>
/// Represents the unique identifier (GUID) for the target dialogue node to which a choice or link is pointing in a dialogue system.
/// </summary>
public string ToNodeGuid;

/// <summary>
/// Represents a descriptive label for a dialogue choice used in the dialogue system.
/// </summary>
/// <remarks>
/// This label is utilized for identifying a specific dialogue choice during execution
/// and for associating a callback or specific functionality when that choice is selected.
/// </remarks>
public string ChoiceLabel;
/// <summary>
/// Represents a descriptive label for a dialogue choice used in the dialogue system.
/// </summary>
/// <remarks>
/// This label is utilized for identifying a specific dialogue choice during execution
/// and for associating a callback or specific functionality when that choice is selected.
/// </remarks>
public string ChoiceLabel;

/// <summary>
/// Represents the text displayed for a dialogue choice in the game's dialogue system.
/// </summary>
/// <remarks>
/// The property is utilized to define the text that appears visually for a specific dialogue choice
/// in conjunction with the dialogue system. The text is injected dynamically during runtime for scenarios
/// requiring additional or modified dialogue options.
/// </remarks>
public string ChoiceText;
/// <summary>
/// Represents the text displayed for a dialogue choice in the game's dialogue system.
/// </summary>
/// <remarks>
/// The property is utilized to define the text that appears visually for a specific dialogue choice
/// in conjunction with the dialogue system. The text is injected dynamically during runtime for scenarios
/// requiring additional or modified dialogue options.
/// </remarks>
public string ChoiceText;

/// <summary>
/// Represents a callback action that is invoked when a dialogue choice is confirmed.
/// </summary>
public Action OnConfirmed;
/// <summary>
/// Represents a callback action that is invoked when a dialogue choice is confirmed.
/// </summary>
public Action OnConfirmed;

/// <summary>
/// Represents an injectable dialogue configuration that can be used to add or modify dialogue interactions in a game.
/// </summary>
public DialogueInjection(string npc, string container, string from, string to, string label, string text, Action onConfirmed)
{
NpcName = npc;
ContainerName = container;
FromNodeGuid = from;
ToNodeGuid = to;
ChoiceLabel = label;
ChoiceText = text;
OnConfirmed = onConfirmed;
/// <summary>
/// Represents an injectable dialogue configuration that can be used to add or modify dialogue interactions in a game.
/// </summary>
public DialogueInjection(string npc, string container, string from, string to, string label, string text, Action onConfirmed)
{
NpcName = npc;
ContainerName = container;
FromNodeGuid = from;
ToNodeGuid = to;
ChoiceLabel = label;
ChoiceText = text;
OnConfirmed = onConfirmed;
}
}
}
}
Loading
Loading