On server side, two variables are modified and set in the same time:
Code: Select all
List<RoomVariable> vars = Arrays.asList
(
new SFSRoomVariable("turn", 0),
new SFSRoomVariable("discard", 0),
);
The client tries to collect variable "discard" when the variable "turn" has been updated:
Code: Select all
void OnRoomVar (BaseEvent evt)
{
int turnUserID = theRoom.GetVariable("turn").GetIntValue();
if(turnUserID != latestUserID)
{
ISFSObject objIn = new SFSObject();
objIn = theRoom.GetVariable("discard").GetSFSObjectValue();
if (objIn != null && !objIn.IsNull("discard"))
{
ByteArray ba = objIn.GetByteArray("discard");
byte[] cc = ba.ReadBytes(ba.Length);
int dicardsLength = cc.Length;
if (dicardsLength > 0)
{
//...
}
}
}
It works in most of times but has a chance that when 'turn' has been updated the client can't get modified 'discards' variable.
Thanks.