-
Notifications
You must be signed in to change notification settings - Fork 48
Property AutoSync
Garrett Luskey edited this page Mar 12, 2024
·
3 revisions
The IAutoSync
interface currently only provides functionality to automatically sync property setters.
AutoSync
will create a handler, internal messages, a network message, and a patch for the provided property's setter.
For example the following
// TODO rename
public class HeroDataHandler : IHandler
{
public HeroDataHandler(IAutoSync autoSync)
{
// Copy and paste the following line for each property you need to sync
autoSync.SyncProperty<Hero>(AccessTools.Property(typeof(Hero), nameof(Hero.Build)), GetHeroId);
}
public static string GetHeroId(Hero hero)
{
return hero.StringId;
}
public void Dispose()
{
}
}