Beispiel #1
0
 private void OnConnected(Socket socket, Packet packet, params object[] args)
 {
     if (PlayerPrefs.HasKey("Nick"))
     {
         this.Nick = PlayerPrefs.GetString("Nick", "NickName");
         this.Join();
     }
     else
     {
         this.State = SocketIOWePlaySample.States.WaitForNick;
     }
     this.AddMessage("connected");
 }
Beispiel #2
0
    private void Start()
    {
        SocketOptions socketOptions = new SocketOptions();

        socketOptions.AutoConnect = false;
        SocketManager socketManager = new SocketManager(new Uri("http://io.weplay.io/socket.io/"), socketOptions);

        this.Socket = socketManager.Socket;
        this.Socket.On(SocketIOEventTypes.Connect, new SocketIOCallback(this.OnConnected));
        this.Socket.On("joined", new SocketIOCallback(this.OnJoined));
        this.Socket.On("connections", new SocketIOCallback(this.OnConnections));
        this.Socket.On("join", new SocketIOCallback(this.OnJoin));
        this.Socket.On("move", new SocketIOCallback(this.OnMove));
        this.Socket.On("message", new SocketIOCallback(this.OnMessage));
        this.Socket.On("reload", new SocketIOCallback(this.OnReload));
        this.Socket.On("frame", new SocketIOCallback(this.OnFrame), false);
        this.Socket.On(SocketIOEventTypes.Error, new SocketIOCallback(this.OnError));
        socketManager.Open();
        this.State = SocketIOWePlaySample.States.Connecting;
    }
Beispiel #3
0
 private void OnJoined(Socket socket, Packet packet, params object[] args)
 {
     this.State = SocketIOWePlaySample.States.Joined;
 }