My state is like this:
onInit(options)
this.maxClients = 5;
this.minClients = 3;
this.setState({
players: {},
apid: [],
dpid: [1, 2, 3, 4, 5],
});
onJoin(client, options) {
var id;
id = this.state.dpid.shift();
this.state.apid.push(id);
this.state.players[client.sessionId] = {
playerId: id,
cards: [],
state: 1,
pack: 0,
trickData: {
Rank: 0,
Sum: 0,
c1: 0,
c2: 0,
c3: 0
}
}
C# code for listen to state change is:
room.Listen("players/:id", OnPlayerChange);
//room.Listen("players/:id/:playerId", OnPlayerIdChange);
//room.Listen("players/:id/:pack", OnPlayerPack);
room.Listen("players/:id/:cards/:number", OnCardsChange);
Problem is when palyersId change the OnPlayerIdChange and OnPlayerPack both getting the this data of state
trickData: {
Rank: 0,
Sum: 0,
c1: 0,
c2: 0,
c3: 0
}
i want to listen to only playerId and pack when this variable changes