You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+79Lines changed: 79 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,85 @@ in **Inscryption/BepInEx/Config/BepInEx/cfg**
48
48
___
49
49
If you want help debugging you can find me on the [Inscryption Modding Discord](https://discord.gg/QrJEF5Denm) or on [Daniel Mullins Discord](https://discord.com/invite/danielmullinsgames) as Cyantist.
50
50
51
+
## Using the API
52
+
53
+
### Custom Save Game Data
54
+
If your mod needs to save data, the ModdedSaveManager class is here to help. There are two chunks of extra save data that you can access here: 'SaveData' (which persists across runs) and 'RunState' (which is reset on every run). Note that these require you to pass in a GUID, which should be your mod's plugin GUID, and an arbitrary key, which you can select for each property to you want to save.
55
+
56
+
The easiest way to use these helpers is to map them behind static properties, like so:
57
+
58
+
```
59
+
public static int NumberOfItems
60
+
{
61
+
get { return ModdedSaveManager.SaveData.GetValueAsInt(Plugin.PluginGuid, "NumberOfItems"); }
62
+
set { ModdedSaveManager.SaveData.SetValue(Plugin.PluginGuid, "NumberOfItems", value); }
63
+
}
64
+
```
65
+
66
+
When written like this, the static property "NumberOfItems" now automatically syncs to the save file.
67
+
68
+
### Adding new Challenges
69
+
The API supports adding new Challenges as part of Kaycee's Mod using the ChallengeManager class. You can add a new Challenge using ChallengeManager.Add, either by passing in a new AscensionChallengeInfo object or by passing the individual properties of your challenge (which will construct the information object for you). This will make your challenge automatically appear in the challenge selection screen.
70
+
71
+
If you use the overload of Add that takes an AscensionChallengeInfo object, note that the "challengeType" field of type AscensionChallenge is completely irrelevant. This is an enumerated value, and it will be set for you by the ChallengeManager to ensure there is no collision with other challenges created by other mods. As such, you need to save the ID that is returned by the Add method of ChallengeManager so that you can reference it later.
72
+
73
+
If your challenge can stack, set the stackable flag to 'true' when adding your challenge. This will cause it to appear twice in the challenge selection screen. Yes, this means stackable challenges are currently limited to a max of two.
74
+
75
+
You will be responsible to write all of the necessary patches for your challenge to function. When writing those patches, you *must* make sure that the challenge is active before you do anything. This is entirely up to you - there is nothing in the API that can detect this for you.
76
+
77
+
You should also make sure to alert the user whenever your challenge has triggered some change in the game. The ChallengeActivationUI class (from DiskCardGame) has a helper to alert the user.
78
+
79
+
```
80
+
private static AscensionChallenge ID = ChallengeManager.Add
This API supports adding new screens to Kaycee's Mod that execute before a run starts. New screens can use the AscensionScreenSort attribute to influence their sort order. Custom screens will execute in the following order:
103
+
104
+
1. Starter Decks
105
+
2. Select Challenges
106
+
3. Custom Screens
107
+
1. Requires Start
108
+
2. Prefers Start
109
+
3. No Preference (default)
110
+
4. Prefers End
111
+
5. Requires End
112
+
4. Start Run
113
+
114
+
To create a custom screen, you need to write a special screen behavior class that inherits from AscensionRunSetupScreenBase (which in turn inherits from MonoBehavior). You will be required to override the following:
115
+
116
+
- headerText: The displayed title on the screen
117
+
- showCardDisplayer: Set this to return true if you want the panel on your screen that shows card information
118
+
- showCardPanel: Set this to return true if you want the scrollable panel on your screen that shows selectable cards
119
+
120
+
There is also a virtual method called InitializeScreen which you should use to build the content of your screen.
121
+
122
+
In general, you are responsible for doing all the hard work of building your screen. However, all the boilerplate content is built for you. You will automatically be given the continue and back buttons, the header (which shows the current challenge level), the footer (which displays changes as the challenge level changes), and the title of your screen. You can also optionally be given a scrollable card selection panel and card information displayer panel if you need them (using the properties shown above).
123
+
124
+
Once you've written the custom screen class, you need to register it with AscensionScreenManager like so:
0 commit comments