예제 #1
0
    // Update camera position, rotation and projection
    void LateUpdate()
    {
        UpdateCamera(WebXRViewEyes.Left);
        UpdateCamera(WebXRViewEyes.Right);

        UpdateInput(LeftInput);
        UpdateInput(RightInput);

        LeftInput.Available  = _byteArray[44] != 0;
        RightInput.Available = _byteArray[45] != 0;

        // Input source change event
        if (_byteArray[3] != 0)
        {
            InputSourcesChange.Invoke();
            _byteArray[3] = 0;
        }

        // Session state changed invoked when all gamepads and cameras are updated
        if (InternalInSession && !InSession) //New session detected
        {
            InSession = true;
            SessionStart.Invoke();
        }
        else if (InSession && !InternalInSession) // End of session detected
        {
            InSession = false;
            SessionEnd.Invoke();
        }
    }
 protected virtual void OnSessionEnd()
 {
     notifyListeners("Session_End", null);
     if (null != SessionEnd)
     {
         SessionEnd.Invoke(this, new EventArgs());
     }
 }
예제 #3
0
 /// <summary>嘗試移除 CJF.Net.Http.Session 物件。</summary>
 /// <param name="sessionId">Session ID</param>
 /// <param name="session">傳回 CJF.Net.Http.Session 物件</param>
 /// <returns>true: 已移除; false: sessionId 不存在。</returns>
 public bool TryRemove(string sessionId, out HttpListenerSession session)
 {
     if (!_sessions.TryRemove(sessionId, out session))
     {
         return(false);
     }
     SessionEnd?.BeginInvoke(this, sessionId, null, null);
     return(true);
 }
예제 #4
0
        internal static void EndSession()
        {
            if (_sessionStopwatch == null)
            {
                return;
            }
            _sessionStopwatch.Stop();
            var endEvent = new SessionEnd((int)_sessionStopwatch.Elapsed.TotalSeconds);

            endEvent.Enqueue();
            _sessionStopwatch = null;
        }
예제 #5
0
 private void DialogHost_DialogClosing(object sender, DialogClosingEventArgs eventArgs)
 {
     if (eventArgs.Parameter == null)
     {
         return;
     }
     if ((bool)eventArgs.Parameter)
     {
         Session s = SavedState.Data.CurrentSession;
         SavedState.Data.CurrentSession = null;
         SavedState.Save();
         SessionEnd?.Invoke(this, s);
     }
 }
예제 #6
0
        private void btnSaveSession_Click(object sender, RoutedEventArgs e)
        {
            Session  s   = SavedState.Data.CurrentSession;
            DateTime now = DateTime.Now;

            if (!s.Paused)
            {
                PlayPause();
            }
            s.EndTime = s.PauseTime;
            SavedState.Data.SessionRecords.Add(s);
            SavedState.Data.CurrentSession = null;
            SavedState.Save();
            SessionEnd?.Invoke(this, s);
        }
예제 #7
0
 internal void Shutdown()
 {
     if (_osEntity != null)
     {
         SessionEnd?.Invoke();
         _osLayer.RemoveEntity(_osEntity);
         _osEntity.Dispose();
         _osEntity = null;
     }
     _splash.Reset();
     if (_localBackend != null)
     {
         if (_server.Connected)
         {
             _server.Disconnect();
         }
         _localBackend.Shutdown("");
     }
 }
예제 #8
0
 public static void CallSessionEnd()
 {
     SessionEnd?.Invoke();
 }