Ejemplo n.º 1
0
        public void EnterCutsceneEditor(SerializableCutscene cutscene)
        {
            Markers = new List <TimeMarker>();

            Editor.Editor.CameraClampMax = 30f;
            CurrentCutscene    = cutscene;
            IsInCutsceneEditor = true;

            if (cutscene.Cameras != null)
            {
                foreach (var camera in cutscene.Cameras)
                {
                    Markers.Add(new CameraMarker()
                    {
                        Time          = camera.PositionInTime,
                        CameraPos     = camera.Position,
                        CameraRot     = camera.Rotation,
                        Interpolation = camera.InterpolationStyle,
                    });
                }
            }

            if (cutscene.Subtitles != null)
            {
                foreach (var subtitle in cutscene.Subtitles)
                {
                    Markers.Add(new SubtitleMarker()
                    {
                        Content  = subtitle.Content,
                        Duration = subtitle.DurationInMs,
                        Time     = subtitle.PositionInTime,
                    });
                }
            }

            CurrentTimestamp   = 0;
            MarkerMenu         = new TimelineMarkerMenu(this);
            MarkerMenu.Visible = true;
            MarkerMenu.BuildFor(Markers.FirstOrDefault(m => m.Time == CurrentTimestamp));
            MarkerMenu.OnMenuClose += sender =>
            {
                LeaveCutsceneEditor();
            };
        }
Ejemplo n.º 2
0
        public void EnterCutsceneEditor(SerializableCutscene cutscene)
        {
            Markers = new List<TimeMarker>();

            Editor.Editor.CameraClampMax = 30f;
            CurrentCutscene = cutscene;
            IsInCutsceneEditor = true;

            if(cutscene.Cameras != null)
            foreach (var camera in cutscene.Cameras)
            {
                Markers.Add(new CameraMarker()
                {
                    Time = camera.PositionInTime,
                    CameraPos = camera.Position,
                    CameraRot = camera.Rotation,
                    Interpolation = camera.InterpolationStyle,
                });
            }

            if(cutscene.Subtitles != null)
            foreach (var subtitle in cutscene.Subtitles)
            {
                Markers.Add(new SubtitleMarker()
                {
                    Content = subtitle.Content,
                    Duration = subtitle.DurationInMs,
                    Time = subtitle.PositionInTime,
                });
            }

            CurrentTimestamp = 0;
            MarkerMenu = new TimelineMarkerMenu(this);
            MarkerMenu.Visible = true;
            MarkerMenu.BuildFor(Markers.FirstOrDefault(m => m.Time == CurrentTimestamp));
            MarkerMenu.OnMenuClose += sender =>
            {
                LeaveCutsceneEditor();
            };
        }
Ejemplo n.º 3
0
        public void Tick()
        {
            NativeFunction.CallByName <uint>("HIDE_HUD_AND_RADAR_THIS_FRAME");
            TimeBar();
            Game.DisplaySubtitle(TimeSpan.FromMilliseconds(CurrentTimestamp).ToString("g"), 200);

            if (Game.IsControlPressed(0, GameControl.CellphoneLeft) &&
                CurrentTimestamp > 0 &&
                DateTime.Now.Subtract(_lastPress).TotalMilliseconds > 50f &&
                MarkerMenu.CanMoveMarker)
            {
                CurrentTimestamp = (int)Math.Max(CurrentTimestamp - 200, 0);
                _lastPress       = DateTime.Now;
            }
            else if (Game.IsControlPressed(0, GameControl.CellphoneRight) &&
                     CurrentTimestamp < CurrentCutscene.Length &&
                     DateTime.Now.Subtract(_lastPress).TotalMilliseconds > 50f &&
                     MarkerMenu.CanMoveMarker)
            {
                CurrentTimestamp = (int)Math.Min(CurrentTimestamp + 200, CurrentCutscene.Length);
                _lastPress       = DateTime.Now;
            }

            if (Game.IsControlJustPressed(0, GameControl.FrontendLb))
            {
                var prevNodes = Markers.Where(m => m.Time < CurrentTimestamp);
                if (prevNodes.Any())
                {
                    CurrentTimestamp = prevNodes.OrderBy(m => Math.Abs(m.Time - CurrentTimestamp)).First().Time;
                }
            }
            else if (Game.IsControlJustPressed(0, GameControl.FrontendRb))
            {
                var nextNodes = Markers.Where(m => m.Time > CurrentTimestamp);
                if (nextNodes.Any())
                {
                    CurrentTimestamp = nextNodes.OrderBy(m => Math.Abs(m.Time - CurrentTimestamp)).First().Time;
                }
            }

            if (((Game.IsControlJustReleased(0, GameControl.CellphoneLeft) ||
                  Game.IsControlJustReleased(0, GameControl.CellphoneRight)) && MarkerMenu.CanMoveMarker) ||
                Game.IsControlJustReleased(0, GameControl.FrontendRb) ||
                Game.IsControlJustReleased(0, GameControl.FrontendLb))
            {
                _lastPress = DateTime.MinValue;
                MarkerMenu.BuildFor(Markers.FirstOrDefault(m => m.Time == CurrentTimestamp));
            }

            if (Game.IsControlJustReleased(0, GameControl.CellphoneLeft) ||
                Game.IsControlJustReleased(0, GameControl.CellphoneRight))
            {
                SaveCurrentCutscene();
            }

            counter++;
            if (counter % 100 == 0)
            {
                SaveCurrentCutscene();
            }
            if (counter > 1000)
            {
                counter = 0;
            }

            DrawInstructionalButtonsScaleform();
        }