Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        OSCManager.Update();

        if (_theShow != null)
        {
            if ((System.DateTime.Now - _lastStatusTime).TotalSeconds > 5)
            {
                OSCManager.SendToAll(new OSCMessage("/unity/server/status", null));
                _lastStatusTime = System.DateTime.Now;
            }

            if (_timerSeconds > 0)
            {
                System.TimeSpan ts = (System.DateTime.Now - _timerMarker);
                if (ts.TotalSeconds >= _timerSeconds)
                {
                    // Timer expired, go to the next step
                    Show_ExecuteStep();
                }
                else
                {
                    SetSecondaryShowText((_timerSeconds - ts.TotalSeconds).ToString("N3"));
                }
            }

            // Bypass gesture with space bar
            if (_waitingForGesture != null)
            {
                if (Input.GetKeyDown(KeyCode.Space))
                {
                    Show_ExecuteStep();
                }
            }
        }

        foreach (var kvp in _knownClients)
        {
            if (kvp.Value.Status == ClientInfo.ConnectionStatus.Normal &&
                ((System.DateTime.Now - kvp.Value.LastSeenTime).TotalSeconds > 5))
            {
                // This client hasn't been seen for 5 seconds
                kvp.Value.Status = ClientInfo.ConnectionStatus.NotResponding;
            }

            if (kvp.Value.Status == ClientInfo.ConnectionStatus.NotResponding &&
                ((System.DateTime.Now - kvp.Value.RestartMsgTime).TotalSeconds > 2))
            {
                // Its been more than 2 seconds since the restarter was notified, send it again
                OSCManager.SendTo(new OSCMessage("/unity/client/restart"), kvp.Value.IPAddress, RemoteManagerPort);
                kvp.Value.RestartMsgTime = System.DateTime.Now;
            }
        }
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if ((System.DateTime.Now - _lastStatusTime).TotalSeconds >= 2)
        {
            OSCManager.SendToAll(new OSCMessage("/unity/client/status", _clientConfig.Id));
            _lastStatusTime = System.DateTime.Now;
        }

        if (_pendingSceneLoad != null && _pendingSceneLoad.isDone)
        {
            _pendingSceneLoad = null;
        }

        if (_pendingSceneLoad == null)
        {
            OSCManager.Update();                // Only process packets if pending scene loads are all done
        }
    }
Ejemplo n.º 3
0
    bool Show_DoEvent(Event evt)
    {
        switch (evt.action)
        {
        case "loadScene":
            Debug.Log("SHOW - Loading scene: " + evt.arg1);
            _lastSceneMarker = _theShow.currentEventGroupIndex - 1;
            OSCManager.SendToAll(new OSCMessage("/unity/server/show/loadScene", evt.arg1));
            break;

        case "showObject":
            Debug.Log("SHOW - showObject: " + evt.arg1);
            OSCManager.SendToAll(new OSCMessage("/unity/server/show/showObject", evt.arg1));
            break;

        case "hideObject":
            Debug.Log("SHOW - hideObject: " + evt.arg1);
            OSCManager.SendToAll(new OSCMessage("/unity/server/show/hideObject", evt.arg1));
            break;

        case "goto":
            Debug.Log("SHOW - goto: " + evt.arg1);
            for (int i = 0; i < _theShow.eventGroups.Count; i++)
            {
                if (_theShow.eventGroups[i].name == evt.arg1)
                {
                    _theShow.currentEventGroupIndex = i;
                    Show_ExecuteStep();
                    return(false);
                }
            }
            break;

        default:
            Debug.LogError("Unsupported event action encountered: " + evt.action);
            break;
        }
        return(true);
    }