Example #1
0
        public override GrabWidget Clone()
        {
            VideoWidget clone = Instantiate(WidgetManager.m_Instance.VideoWidgetPrefab) as VideoWidget;

            clone.m_LoadingFromSketch = true; // prevents intro animation
            clone.m_TransitionScale   = 1.0f;
            clone.transform.parent    = transform.parent;
            clone.SetVideo(m_Video);
            clone.SetSignedWidgetSize(m_Size);
            clone.Show(bShow: true, bPlayAudio: false);
            clone.transform.position = transform.position;
            clone.transform.rotation = transform.rotation;
            HierarchyUtils.RecursivelySetLayer(clone.transform, gameObject.layer);
            TiltMeterScript.m_Instance.AdjustMeterWithWidget(clone.GetTiltMeterCost(), up: true);
            clone.CloneInitialMaterials(this);
            clone.TrySetCanvasKeywordsFromObject(transform);
            return(clone);
        }
Example #2
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();
        }