Пример #1
0
        ///<summary>
        ///Releasing the media elements when closing the replay window
        ///Switch to recording mode
        ///Written by Baptiste Germond
        ///</summary>
        private void quit()
        {
            isReplaying    = false;
            statisticsPath = "";
            if (skeletonScrolling != null)
            {
                skeletonScrolling.Stop();
                skeletonScrolling = null;
            }
            (TrainingSideTool.Get().FindResource("StopReplayButtonAction") as Storyboard).Begin();
            DrawingSheetView.Get().ReplayVideo.Close();
            DrawingSheetView.Get().ReplayVideo.Source = null;
            DrawingSheetView.Get().ReplayAudio.Close();
            DrawingSheetView.Get().ReplayAudio.Source = null;
            ReplayView.Get().SoundCheckbox.IsChecked = false;
            SideToolsViewModel.Get().enableTrackingAndTrainingTab();
            TrainingSideToolViewModel.Get().recordingMode();
            DrawingSheetAvatarViewModel.Get().normalMode();

            // reactivate the sensors
            KinectDevice.sensor.SkeletonStream.Enable();
            if (faceTrack)
            {
                KinectDevice.faceTracking = true;
            }
            TrackingSideToolViewModel.get().SpeedRate = speedRateActive;

            // reactivate the audience
            if (TrainingSideToolViewModel.audienceOn)
            {
                TrainingSideToolViewModel.audienceOn = false;
                GeneralSideTool.Get().AudienceControlCheckBox.IsChecked = true;
            }
        }
Пример #2
0
 public Replay(Window window, ReplayUtil replayUtil)//构造
 {
     InitializeComponent();
     replayView       = new ReplayView(this, replayUtil, new VideoUtil(mediaPlayer));
     this.DataContext = replayView;
     this.Owner       = window;
 }
Пример #3
0
    public void StartPlay(float i_StartTime)
    {
        if (!initialized)
        {
            return;
        }

        if (m_IsPlaying || m_IsRecording)
        {
            return;
        }

        {
            // TODO

            m_PlayTime = i_StartTime;

            for (int viewIndex = 0; viewIndex < m_Views.Count; ++viewIndex)
            {
                ReplayView view = m_Views[viewIndex];
                if (view != null)
                {
                    view.StartPlay(i_StartTime);
                }
            }
        }

        m_IsPlaying = true;
    }
Пример #4
0
    public void StopPlay()
    {
        if (!initialized)
        {
            return;
        }

        if (!m_IsPlaying)
        {
            return;
        }

        {
            // TODO

            for (int viewIndex = 0; viewIndex < m_Views.Count; ++viewIndex)
            {
                ReplayView view = m_Views[viewIndex];
                if (view != null)
                {
                    view.StopPlay();
                }
            }
        }

        m_IsPlaying = false;
    }
Пример #5
0
        /// <summary>
        /// Stops the performance
        /// </summary>
        public void Stop()
        {
            played = false;
            if (ReplayView.Get().Avatar.IsEnabled&& skeletonScrolling != null)
            {
                skeletonScrolling.Stop();
            }
            if (DrawingSheetView.Get().ReplayVideo.Source != null)
            {
                DrawingSheetView.Get().ReplayVideo.Position = new TimeSpan(0, 0, 0, 0, 5);
                DrawingSheetView.Get().ReplayVideo.Stop();
            }
            if (DrawingSheetView.Get().ReplayAudio.Source != null)
            {
                DrawingSheetView.Get().ReplayAudio.Position = new TimeSpan(0, 0, 0, 0, 5);
                DrawingSheetView.Get().ReplayAudio.Stop();
            }
            Tools.resetStopWatch();
            ReplayAvatar.offset   = 0;
            ReplayAvatar.realTime = true;
            currentListNumber     = 0;
            ReplayView.Get().PauseButton.IsEnabled = false;

            // Icons cleaning and initialization of the feedback queue thanks to the save
            IconViewModel.get().clearAll();
            if (filePath != null)
            {
                DrawingSheetView.Get().ReplayVideo.Source = new Uri(filePath, UriKind.Relative);
            }
        }
Пример #6
0
    public void StartRecord()
    {
        if (!initialized)
        {
            return;
        }

        if (m_IsRecording || m_IsPlaying)
        {
            return;
        }

        {
            // TODO

            m_RecordTime = 0f;

            for (int viewIndex = 0; viewIndex < m_Views.Count; ++viewIndex)
            {
                ReplayView view = m_Views[viewIndex];
                if (view != null)
                {
                    view.StartRecord();
                }
            }
        }

        m_IsRecording = true;
    }
Пример #7
0
 public static void UnregisterViewMain(ReplayView i_ReplayView)
 {
     if (Instance != null)
     {
         Instance.UnregisterView(i_ReplayView);
     }
 }
Пример #8
0
 public void startButtonCommand()
 {
     ReplayView.Get().PlayButton.IsChecked = true;
     if (ReplayView.Get().PlayButton.Command != null)
     {
         ReplayView.Get().PlayButton.Command.Execute(null);
     }
 }
Пример #9
0
    public void UnregisterView(ReplayView i_ReplayView)
    {
        if (m_Views == null)
        {
            return;
        }

        m_Views.Remove(i_ReplayView);
    }
Пример #10
0
    public void RegisterView(ReplayView i_ReplayView)
    {
        if (m_Views == null)
        {
            return;
        }

        if (!m_Views.Contains(i_ReplayView))
        {
            m_Views.Add(i_ReplayView);
        }
    }
Пример #11
0
 /// <summary>
 /// Manage the loading of the file the user choose
 /// Added by Baptiste Germond
 /// </summary>
 private void ManagePerformanceFiles()
 {
     if (File.Exists(filePath))
     {
         if (Path.GetFileName(filePath) == "stream.avi")
         {
             folderPath = filePath.Remove(filePath.Length - 10);
             DrawingSheetView.Get().ShowReplayVideoSheet();
             filePathVideoStream = filePath;
             activate(ReplayView.Get().Stream, GeneralSideTool.Get().Stream);
             DrawingSheetView.Get().ReplayVideo.Source = new Uri(filePathVideoStream, UriKind.Relative);
             skeletonScrolling = null;
             DrawingSheetView.Get().CanvasFeedback.Visibility = Visibility.Visible;
             tryAddOtherSources("stream.avi");
             isReplaying = true;
         }
         else if (Path.GetFileName(filePath) == "avatarSkeletonData.skd")
         {
             try
             {
                 folderPath = filePath.Remove(filePath.Length - 22);
                 skdRead    = true;
                 DrawingSheetView.Get().Show3DSheet();
                 filePathAvatar = filePath;
                 activate(ReplayView.Get().Avatar, GeneralSideTool.Get().Avatar);
                 voiceData = filePath.Replace("avatarSkeletonData.skd", "tonePeakData.xml");
                 if (!File.Exists(voiceData))
                 {
                     voiceData = "";
                 }
                 faceData = filePath.Replace("avatarSkeletonData.skd", "faceData.xml");
                 if (!File.Exists(faceData))
                 {
                     faceData = "";
                 }
                 skeletonScrolling = new ReplayAvatar(filePathAvatar, faceData, voiceData, this);
                 tryAddOtherSources("avatarSkeletonData.skd");
                 isReplaying = true;
             }
             catch (XmlLoadingException)
             {
                 throw;
             }
         }
         if (isReplaying)
         {
             ReplayView.Get().TitleReplay.Content = Path.GetFileName((Path.GetDirectoryName(filePath)));
         }
     }
 }
Пример #12
0
 public void performanceSound()
 {
     if (instance != null)
     {
         if (ReplayView.Get().SoundCheckbox.IsChecked.Value)
         {
             instance.Unmute();
         }
         else
         {
             instance.Mute();
         }
     }
 }
Пример #13
0
    // INTERNALS

    private void UpdateRecord()
    {
        float deltaTime = Time.deltaTime;

        for (int viewIndex = 0; viewIndex < m_Views.Count; ++viewIndex)
        {
            ReplayView view = m_Views[viewIndex];
            if (view != null)
            {
                view.UpdateRecord(deltaTime);
            }
        }

        m_RecordTime += deltaTime;
    }
Пример #14
0
 public void init(ReplayView host)
 {
     _host      = host;
     _data      = _host.Data;
     allCardGOs = new List <RCardGOs> (4);
     for (int i = 0; i < 4; i++)
     {
         RCardGOs cgo = new RCardGOs();
         cgo.HandParent  = host.HandParents [i];
         cgo.TableParent = host.TableParents [i];
         cgo.PGCParent   = host.PGCParents [i];
         cgo.PlayerItem  = host.PlayerItemViews [i];
         allCardGOs.Add(cgo);
     }
 }
Пример #15
0
    private void UpdatePlay()
    {
        float deltaTime = Time.deltaTime;

        float lastPlayedTime = m_PlayTime;

        m_PlayTime += deltaTime;

        for (int viewIndex = 0; viewIndex < m_Views.Count; ++viewIndex)
        {
            ReplayView view = m_Views[viewIndex];
            if (view != null)
            {
                view.UpdatePlay(lastPlayedTime, m_PlayTime);
            }
        }
    }
Пример #16
0
        /// <summary>
        /// Adding the other replay available with the replay the user chose
        /// Added by Baptiste Germond
        /// </summary>
        public void tryAddOtherSources(string fileBase)
        {
            bool audioLoad = false;

            foreach (string s in Directory.GetFiles(Path.GetDirectoryName(filePath)))
            {
                string fileName = Path.GetFileName(s);
                if (fileName != fileBase)
                {
                    if (fileName == "avatarSkeletonData.skd")
                    {
                        // the replay needs an instance of ReplayAvatar, so if the first file chose is not the .skd
                        // we have to create one
                        skdRead           = true;
                        skeletonScrolling = new ReplayAvatar(s, this);
                        addOtherVideoSources(ReplayView.Get().Avatar);
                        filePathAvatar = s;
                    }
                    else if (fileName == "stream.avi")
                    {
                        addOtherVideoSources(ReplayView.Get().Stream);
                        filePathVideoStream = s;
                    }
                    else if (fileName == "audio.wav" && !audioLoad)
                    {
                        AddAudio(s);
                        audioLoad = true;
                    }
                    else if (fileName == "feedback.txt")
                    {
                        initialiseFeedbacksQueue(s);
                    }
                    else if (fileName == "charts.xml")
                    {
                        statisticsPath = s;
                    }
                }
            }
            if (!audioLoad)
            {
                ReplayView.Get().SoundCheckbox.IsEnabled = false;
                DrawingSheetView.Get().ReplayAudio.Source = null;
                audioSource = false;
            }
        }
Пример #17
0
        /// <summary>
        /// Pauses the performance
        /// </summary>
        public void Pause()
        {
            played = false;
            if (ReplayView.Get().Avatar.IsEnabled&& skeletonScrolling != null)
            {
                skeletonScrolling.Pause();
            }
            if (DrawingSheetView.Get().ReplayVideo.Source != null)
            {
                DrawingSheetView.Get().ReplayVideo.Visibility = Visibility.Visible;
                DrawingSheetView.Get().ReplayVideo.Pause();
            }
            if (DrawingSheetView.Get().ReplayAudio.Source != null)
            {
                DrawingSheetView.Get().ReplayAudio.Pause();
            }

            ReplayView.Get().PauseButton.IsEnabled = true;
        }
Пример #18
0
        // These functions are invoked when the user manipulate the media player
        /// <summary>
        /// Plays the performance
        /// </summary>
        public void Play()
        {
            played = true;

            if (ReplayView.Get().Avatar.IsEnabled&& skeletonScrolling != null)
            {
                skeletonScrolling.Start();
            }

            if (DrawingSheetView.Get().ReplayVideo.Source != null)
            {
                DrawingSheetView.Get().ReplayVideo.Play();
            }
            if (DrawingSheetView.Get().ReplayAudio.Source != null)
            {
                DrawingSheetView.Get().ReplayAudio.Play();
            }
            ReplayView.Get().PauseButton.IsEnabled = true;
        }
        private void Start()
        {
            if (!scoreViewPrefab)
            {
                scoreViewPrefab = Resources.Load("PlayerText") as ScoreView;
            }
            else if (!replayUIPrefab)
            {
                replayUIPrefab = Resources.Load("ReplayUI") as ReplayView;
            }
            currentViewPos = scoreViewPrefab.gameObject.transform.position;

            if (!parentLayoutGroup)
            {
                Debug.Log("Parent not specified, using defaultParent");
                parentLayoutGroup = GameObject.FindObjectOfType <LayoutGroup>();
            }
            GameApplication.Instance.GetService <IReplayService>().SetSceneController(this);
            StartServices();
        }
Пример #20
0
        public ReplayController(GameFixedUpdate gameFixedUpdate, ChecksumProvider checksumProvider, ReplayView recorderView, Commands commands, Replay replay)
        {
            _recording = true;

            _checksumProvider = checksumProvider;

            _replay = replay;

//			_replay = new ReplayBase (checksumProvider);

            _gameFixedUpdate = gameFixedUpdate;
            _recorderView    = recorderView;
            _commands        = commands;

            if (_recorderView != null)
            {
                _recorderView.SetReplay(this);
            }

            _replayRecorder = new ReplayRecorder(_replay, _commands);
            _replayPlayer   = new ReplayPlayer(_replay, _commands);
        }
 public override void SpawnReplayUI()
 {
     replayViewInstance = GameObject.Instantiate(replayUIPrefab, currentViewPos, Quaternion.identity);
     replayViewInstance.gameObject.transform.SetParent(parentLayoutGroup.transform);
 }
        /// <summary>
        /// Show and place feedbacks in the canvas for the replay videostream
        /// </summary>
        /// <param name="avatar">use only in the live videostream</param>
        public void ShowFeedbacksOnVideoStream(Skeleton avatar = null)
        {
            if (ReplayViewModel.isReplaying && ReplayView.Get().Stream.IsChecked.Value)
            {
                List <String> feedbacksToDisplay = ReplayViewModel.Get().currentFeedbackList;

                if (feedbacksToDisplay != null)
                {
                    foreach (String message in feedbacksToDisplay)
                    {
                        switch (message)
                        {
                        // agitation
                        case ("Too agitated!"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Agitation"]]).Height = dsv.ActualHeight / 4;
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Agitation"]]),
                                          dsv.ActualHeight / 5 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Agitation"]]).ActualHeight / 2);
                            Canvas.SetLeft(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Agitation"]]),
                                           dsv.ActualWidth / 7 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Agitation"]]).ActualWidth / 2);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Agitation"]].Visibility = Visibility.Visible;
                            break;

                        // arms and hands
                        case ("Arms Crossed"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Arms_Crossed"]]).Height = dsv.ActualHeight / 4;
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Arms_Crossed"]]),
                                          dsv.ActualHeight / 2 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Arms_Crossed"]]).ActualHeight / 2);
                            Canvas.SetLeft(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Arms_Crossed"]]),
                                           dsv.ActualWidth / 7 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Arms_Crossed"]]).ActualWidth / 2);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Arms_Crossed"]].Visibility = Visibility.Visible;
                            break;

                        case ("Hands are joined"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Hand_Joined"]]).Height = dsv.ActualHeight / 4;
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Hand_Joined"]]),
                                          dsv.ActualHeight / 5 * 4 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Hand_Joined"]]).ActualHeight / 2);
                            Canvas.SetLeft(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Hand_Joined"]]),
                                           dsv.ActualWidth / 7 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Hand_Joined"]]).ActualWidth / 2);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Hand_Joined"]].Visibility = Visibility.Visible;
                            break;

                        // looking direction
                        case ("Look to the center"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Center_Arrow"]]).Height = dsv.CanvasFeedback.ActualHeight / 6;
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Center_Arrow"]]),
                                          dsv.ActualHeight / 6 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Center_Arrow"]]).ActualHeight / 2);
                            Canvas.SetLeft(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Center_Arrow"]]),
                                           dsv.ActualWidth / 2 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Center_Arrow"]]).ActualWidth / 2);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Center_Arrow"]].Visibility = Visibility.Visible;
                            break;

                        case ("Look to the left"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Left_Arrow"]]).Height = dsv.CanvasFeedback.ActualHeight / 6;
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Left_Arrow"]]),
                                          dsv.ActualHeight / 6 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Left_Arrow"]]).ActualHeight / 2);
                            Canvas.SetLeft(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Left_Arrow"]]),
                                           dsv.ActualWidth / 4 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Left_Arrow"]]).ActualWidth / 2);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Left_Arrow"]].Visibility = Visibility.Visible;
                            break;

                        case ("Look to the right"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Right_Arrow"]]).Height = dsv.CanvasFeedback.ActualHeight / 6;
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Right_Arrow"]]),
                                          dsv.ActualHeight / 6 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Right_Arrow"]]).ActualHeight / 2);
                            Canvas.SetLeft(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Right_Arrow"]]),
                                           dsv.ActualWidth * 3 / 4 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Right_Arrow"]]).ActualWidth / 2);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Right_Arrow"]].Visibility = Visibility.Visible;
                            break;

                        // emotion
                        case ("Happy"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Happy"]]).Height = dsv.CanvasFeedback.ActualHeight / 5;
                            Canvas.SetRight(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Happy"]]), dsv.CanvasFeedback.ActualHeight / 6);
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Happy"]]), dsv.CanvasFeedback.ActualHeight / 3);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Happy"]].Visibility = Visibility.Visible;
                            break;

                        case ("Surprised"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Surprised"]]).Height = dsv.CanvasFeedback.ActualHeight / 5;
                            Canvas.SetRight(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Surprised"]]), dsv.CanvasFeedback.ActualHeight / 6);
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Surprised"]]), dsv.CanvasFeedback.ActualHeight / 3);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Surprised"]].Visibility = Visibility.Visible;
                            break;
                        }
                    }
                }
            }
            dsv.CanvasFeedback.UpdateLayout();
        }
Пример #23
0
 /// <summary>
 /// Add the audio replay to the other replay
 /// Added by Baptiste Germond
 /// </summary>
 private void AddAudio(String name)
 {
     DrawingSheetView.Get().ReplayAudio.Source = new Uri(name);
     audioSource = true;
     ReplayView.Get().SoundCheckbox.IsEnabled = true;
 }