Navigation

  • Recent
  • Tags
  • Users
  • Search
  • Login
Colyseus
  • Login
  • Search
  • Recent
  • Tags
  • Users

Documentation GitHub

We're migrating to GitHub Discussions. This forum does not accept new registrations since April 6, 2023.
  1. Home
  2. game-libgdx-unity
game-libgdx-unity

game-libgdx-unity

@game-libgdx-unity

Chat Follow Unfollow
0
Reputation
1
Posts
726
Profile views
0
Followers
0
Following
Joined 18 Feb 2019, 18:04 Last Online 23 Feb 2019, 09:48

  • Profile
  • More
    • Continue chat with game-libgdx-unity
    • Flag Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups
game-libgdx-unity Follow

Posts made by game-libgdx-unity

How to listen to changes from server-side?

Hi I'm using unity client,

On the server-side I set

constructor() {
        super();
        this.setState({
            players: {},
            messages: [],
            turn: 0
        });
    }

update() {
for (var id in this.state.players) {
            this.state.players[id].score += 1;
        }
}

In the client side how to listen to changes on player scores?
I tried those code but can't get it done, examples:

 room.Listen("players/:id/score", change => {
            print("Operation " + change.operation);
            print("New player update " + change.value);

            foreach (var key in change.path.Keys)
            {
                print(string.Format("{0}: {1}", key, change.path[key]));
            }
        });

or

 room.Listen("players/:id/:*", change =>
        {
            print("Operation " + change.operation);
            print("New player update " + change.value);

            foreach (var key in change.path.Keys)
            {
                print(string.Format("{0}: {1}", key, change.path[key]));
            }
        });
posted in Questions & Help • 18 Feb 2019, 18:18

© 2023 Endel Dreyer