跳转到内容

CwlOnCreateEvent ​

命名空间: Cwl.Patches.Sources;

游戏创建一个 Card 时触发的事件。您需要使用派生特性 CwlCharaOnCreateEvent 和 CwlThingOnCreateEvent 来分别注册游戏实例化 Chara 和 Thing 时触发的事件。

CwlThingOnCreateEvent ​

cs
[CwlThingOnCreateEvent]
internal static void OnThingSpawned(Thing thing)
{
    if (thing.id == "some_item") {
        // do stuff
    }
}

CwlCharaOnCreateEvent ​

cs
[CwlCharaOnCreateEvent]
internal static void OnCharaInstantiation(Chara chara)
{
    if (chara.id == "chicken") {
        chara.Destroy();
    }
}

This project is an unofficial documentation site and is not affiliated with, endorsed by, or associated with Elin or Lafrontier / Noa. All trademarks are the property of their respective owners.