public CreateCutsceneMenu(CutsceneUi grandpa) : base("Cutscene Creator", "CREATE A CUTSCENE")
        {
            Children = new List<UIMenu>();
            MouseControlsEnabled = false;
            ResetKey(Common.MenuControls.Up);
            ResetKey(Common.MenuControls.Down);
            SetKey(Common.MenuControls.Up, GameControl.CellphoneUp, 0);
            SetKey(Common.MenuControls.Down, GameControl.CellphoneDown, 0);

            CurrentCutscene = new SerializableCutscene();
            GrandParent = grandpa;
            Build();
        }
Exemplo 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();
            };
        }
Exemplo n.º 3
0
 public void LeaveCutsceneEditor()
 {
     Editor.Editor.CameraClampMax = -30f;
     IsInCutsceneEditor = false;
     CurrentCutscene = null;
     RebuildCutsceneMenu();
     CutsceneMenus.Visible = true;
 }
Exemplo n.º 4
0
        public void Build(SerializableCutscene cutscene)
        {
            Clear();

            #region Name
            {
                var item = new UIMenuItem("Name");
                item.SetRightLabel(cutscene.Name);
                AddItem(item);
                item.Activated += (sender, selectedItem) =>
                {
                    GameFiber.StartNew(delegate
                    {
                        ResetKey(Common.MenuControls.Back);
                        Editor.Editor.DisableControlEnabling = true;

                        string title = Util.GetUserInput(this);
                        if (string.IsNullOrEmpty(title))
                        {
                            item.SetRightBadge(UIMenuItem.BadgeStyle.Alert);
                            item.SetRightLabel("");
                            SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel, 0);
                            Editor.Editor.DisableControlEnabling = false;
                            cutscene.Name = null;
                            MenuItems[3].Enabled = false;
                            return;
                        }
                        Editor.Editor.DisableControlEnabling = false;
                        item.SetRightBadge(UIMenuItem.BadgeStyle.None);
                        cutscene.Name = title;
                        selectedItem.SetRightLabel(title.Length > 20 ? title.Substring(0, 20) + "..." : title);
                        SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel, 0);

                        if (cutscene.Length > 0 && !string.IsNullOrEmpty(cutscene.Name))
                            MenuItems[3].Enabled = true;
                    });
                };
            }
            #endregion

            #region Play at Objective

            {
                var item = new UIMenuListItem("Play at Objective", StaticData.StaticLists.ObjectiveIndexList, cutscene.PlayAt);
                AddItem(item);
                item.OnListChanged += (sender, index) =>
                {
                    cutscene.PlayAt = index;
                };
            }
            #endregion

            #region Duration
            {
                var item = new UIMenuItem("Duration in Seconds");
                item.SetRightLabel(((int)(cutscene.Length/1000f)).ToString());
                AddItem(item);
                item.Activated += (sender, selectedItem) =>
                {
                    GameFiber.StartNew(delegate
                    {
                        ResetKey(Common.MenuControls.Back);
                        Editor.Editor.DisableControlEnabling = true;

                        string title = Util.GetUserInput(this);
                        if (string.IsNullOrEmpty(title))
                        {
                            item.SetRightBadge(UIMenuItem.BadgeStyle.Alert);
                            item.SetRightLabel("");
                            SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel, 0);
                            cutscene.Length = 0;
                            Editor.Editor.DisableControlEnabling = false;
                            MenuItems[3].Enabled = false;
                            return;
                        }
                        int len;
                        if (!int.TryParse(title, NumberStyles.Integer, CultureInfo.InvariantCulture, out len))
                        {
                            item.SetRightBadge(UIMenuItem.BadgeStyle.Alert);
                            item.SetRightLabel("");
                            SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel, 0);
                            cutscene.Length = 0;
                            Editor.Editor.DisableControlEnabling = false;
                            MenuItems[3].Enabled = false;
                            Game.DisplayNotification("Integer not in correct format.");
                            return;
                        }

                        if (len <= 0)
                        {
                            item.SetRightBadge(UIMenuItem.BadgeStyle.Alert);
                            item.SetRightLabel("");
                            SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel, 0);
                            cutscene.Length = 0;
                            Editor.Editor.DisableControlEnabling = false;
                            Game.DisplayNotification("Duration must be more than 0");
                            MenuItems[3].Enabled = false;
                            return;
                        }

                        Editor.Editor.DisableControlEnabling = false;
                        item.SetRightBadge(UIMenuItem.BadgeStyle.None);
                        cutscene.Length = len*1000;
                        selectedItem.SetRightLabel(title.Length > 20 ? title.Substring(0, 20) + "..." : title);
                        SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel, 0);
                        if (cutscene.Length > 0 && !string.IsNullOrEmpty(cutscene.Name))
                            MenuItems[3].Enabled = true;
                    });
                };
            }
            #endregion

            #region Edit

            {
                var item = new UIMenuItem("Continue");
                AddItem(item);
                if (cutscene.Length == 0 || string.IsNullOrEmpty(cutscene.Name))
                    MenuItems[3].Enabled = false;

                item.Activated += (sender, selectedItem) =>
                {
                    GrandParent.EnterCutsceneEditor(cutscene);
                    Visible = false;
                };
            }
            #endregion

            RefreshIndex();
        }