void OnMessage(object sender, WebSocketSharp.MessageEventArgs message)
    {
        NetworkingDefinitions.Response r = JsonUtility.FromJson <NetworkingDefinitions.Response>(message.Data);
        Debug.Log(r);
        if (r.command == "sessionJoin")
        {
            mapName      = r.mapName;
            currentStart = r.session.currentRoute.start;
            currentEnd   = r.session.currentRoute.end;
            SessionID    = r.sessionID;
        }

        if (r.session.currentRoute.start != currentStart || r.session.currentRoute.end != currentEnd)
        {
            Debug.LogFormat("[OPERA] Task Update! [from '{0}' to '{1}']", r.session.currentRoute.start, r.session.currentRoute.end);

            currentStart = r.session.currentRoute.start;
            currentEnd   = r.session.currentRoute.end;
            UIDirtyFlag  = false;

            if (currentStart == "" && currentEnd == "")
            {
                audioDirtyFlag = true;
            }
        }
    }
 void OnMessage(object sender, WebSocketSharp.MessageEventArgs message)
 {
     NetworkingDefinitions.Response r = JsonUtility.FromJson <NetworkingDefinitions.Response>(message.Data);
     // Debug.LogFormat("Position Update! [{0}, {1}]", r.session.carPosition.x, r.session.carPosition.y);
     x = r.session.carPosition.x;
     y = r.session.carPosition.y;
 }
Exemplo n.º 3
0
 void OnMessage(object sender, WebSocketSharp.MessageEventArgs message)
 {
     NetworkingDefinitions.Response response = JsonUtility.FromJson <NetworkingDefinitions.Response>(message.Data);
     if (response.command == "sessionJoin")
     {
         // TODO: GLOBALIZE THIS
         sessionID = response.sessionID;
         Debug.LogFormat("[BROAD] Joined ID {0}", sessionID);
         IsReady = true;
         websocketClient.Send(NetworkingDefinitions.Generator.SetCurrentRoute(sessionID, "Wochenmarkt", "Stadtgrenze"));
     }
 }
    void OnMessage(object sender, WebSocketSharp.MessageEventArgs message)
    {
        Debug.Log("JOIN RESPONSE: " + message.Data);
        NetworkingDefinitions.Response r = JsonUtility.FromJson <NetworkingDefinitions.Response>(message.Data);
        x = r.session.carPosition.x;
        y = r.session.carPosition.y;

        if (r.command == "sessionJoin")
        {
            // TODO: GLOBALIZE THIS
            SessionID = r.sessionID;
        }
    }
 void OnMessage(object sender, WebSocketSharp.MessageEventArgs message)
 {
     NetworkingDefinitions.Response r = JsonUtility.FromJson <NetworkingDefinitions.Response>(message.Data);
     if (r.session.currentRoute.start != start || r.session.currentRoute.end != end)
     {
         Debug.LogFormat("Task Update! [from '{0}' to '{1}']", r.session.currentRoute.start, r.session.currentRoute.end);
         start     = r.session.currentRoute.start;
         end       = r.session.currentRoute.end;
         startDone = false;
         endDone   = false;
         if (r.session.currentRoute.start != "" && r.session.currentRoute.end != "")
         {
             newTaskFlag = true;
         }
     }
     if (r.command == "sessionJoin")
     {
         SessionID = r.sessionID;
     }
 }