Exemple #1
0
        public static void FromTiltVideo(TiltVideo tiltVideo)
        {
            VideoWidget videoWidget = Instantiate(WidgetManager.m_Instance.VideoWidgetPrefab);

            videoWidget.m_LoadingFromSketch  = true;
            videoWidget.transform.parent     = App.Instance.m_CanvasTransform;
            videoWidget.transform.localScale = Vector3.one;

            var video = VideoCatalog.Instance.GetVideoByPersistentPath(tiltVideo.FilePath);

            if (video == null)
            {
                video = ReferenceVideo.CreateDummyVideo();
                ControllerConsoleScript.m_Instance.AddNewLine(
                    $"Could not find video {App.VideoLibraryPath()}\\{tiltVideo.FilePath}.");
            }
            videoWidget.SetVideo(video);
            videoWidget.m_InitialState = new VideoState
            {
                Volume = tiltVideo.Volume,
                Paused = tiltVideo.Paused,
            };
            if (tiltVideo.Paused)
            {
                videoWidget.m_InitialState.Time = tiltVideo.Time;
            }
            videoWidget.SetSignedWidgetSize(tiltVideo.Transform.scale);
            videoWidget.Show(bShow: true, bPlayAudio: false);
            videoWidget.transform.localPosition = tiltVideo.Transform.translation;
            videoWidget.transform.localRotation = tiltVideo.Transform.rotation;
            if (tiltVideo.Pinned)
            {
                videoWidget.PinFromSave();
            }
            videoWidget.Group = App.GroupManager.GetGroupFromId(tiltVideo.GroupId);
            TiltMeterScript.m_Instance.AdjustMeterWithWidget(videoWidget.GetTiltMeterCost(), up: true);
            videoWidget.UpdateScale();
        }