Closed yty closed 8 months ago
https://docs.colyseus.io/state/schema.zh_cn/?h=listen#listenprop-callback
I found OnCurrentTurnChange here, how to implement it?
state.OnCurrentTurnChange((currentValue, previousValue) => {
Debug.Log(currentValue);
Debug.Log(previousValue);
})
using Colyseus.Schema;
public partial class Player : Schema
{
[Type(0, "number")]
public float x = default(float);
[Type(1, "number")]
public float y = default(float);
}
Hi @yty, the schema-codegen
tool is responsible for generating the listeners per property on C#
@endel
thank you, I understand. Suggest adding it to Example by default.
0.15.5 \ Example \ Scripts \ Scheme \ MyRoomState.cs 0.15.5 \ Example \ Scripts \ Scheme \ Player.cs
Schema's onChange behaviour change](https://docs.colyseus.io/migrating/0.15/?h=onadd#schema-callbacks-api-slightly-changed)
I can't find the listen method in c#. How can I use it?