Example #1
0
    public void ToggleSongViewMode(bool globalView)
    {
        Globals.ViewMode originalView = Globals.viewMode;

        if (globalView)
        {
            Globals.viewMode = Globals.ViewMode.Song;

            if (Toolpane.currentTool == Toolpane.Tools.Note || Toolpane.currentTool == Toolpane.Tools.Starpower || Toolpane.currentTool == Toolpane.Tools.ChartEvent || Toolpane.currentTool == Toolpane.Tools.GroupSelect)
            {
                cursorSelect.onClick.Invoke();
            }
        }
        else
        {
            Globals.viewMode = Globals.ViewMode.Chart;

            if (Toolpane.currentTool == Toolpane.Tools.BPM || Toolpane.currentTool == Toolpane.Tools.Timesignature || Toolpane.currentTool == Toolpane.Tools.Section)
            {
                cursorSelect.onClick.Invoke();
            }
        }

        if (viewModeToggle.isOn != globalView)
        {
            viewModeToggle.isOn = globalView;
        }

        if (Toolpane.currentTool != Toolpane.Tools.Note)        // Allows the note panel to pop up instantly
        {
            editor.currentSelectedObject = null;
        }

        EventsManager.FireViewModeSwitchEvent();
    }
    void HighlightCurrentSection(SongObjectSelectedManipFn manipFn, Globals.ViewMode viewMode, int sectionOffset = 0)
    {
        // Get the previous and next section
        uint currentPos      = editor.currentTickPos;
        var  sections        = editor.currentSong.sections;
        int  maxSectionIndex = 0;

        while (maxSectionIndex < sections.Count && !(sections[maxSectionIndex].tick > currentPos))
        {
            ++maxSectionIndex;
        }

        maxSectionIndex += sectionOffset;

        uint rangeMin = (maxSectionIndex - 1) >= 0 ? sections[maxSectionIndex - 1].tick : 0;
        uint rangeMax = maxSectionIndex < sections.Count ? sections[maxSectionIndex].tick : uint.MaxValue;

        if (rangeMax > 0)
        {
            --rangeMax;
        }

        if (viewMode == Globals.ViewMode.Chart)
        {
            manipFn(SongObjectHelper.GetRangeCopy(editor.currentChart.chartObjects.ToArray(), rangeMin, rangeMax));
        }
        else
        {
            manipFn(SongObjectHelper.GetRangeCopy(editor.currentSong.syncTrack.ToArray(), rangeMin, rangeMax));
            manipFn(SongObjectHelper.GetRangeCopy(editor.currentSong.eventsAndSections.ToArray(), rangeMin, rangeMax));
        }
    }
    void UpdateCullingMask(Globals.ViewMode viewMode)
    {
        if (viewMode == Globals.ViewMode.Chart)
        {
            // Configure camera to ignore song
            cam.cullingMask |= 1 << LayerMask.NameToLayer("ChartObject");
            cam.cullingMask &= ~(1 << LayerMask.NameToLayer("SongObject"));

            if (mkGlow && !(SkinManager.Instance.noteSpritesAvaliable != null && SkinManager.Instance.noteSpritesAvaliable == Skin.AssestsAvaliable.All))
            {
                mkGlow.enabled = true;
                //mkGlow.GlowLayer |= 1 << LayerMask.NameToLayer("ChartObject");
                mkGlow.GlowLayer &= ~(1 << LayerMask.NameToLayer("SongObject"));
            }
        }
        else
        {
            // Configure camera to ignore chart
            cam.cullingMask |= 1 << LayerMask.NameToLayer("SongObject");
            cam.cullingMask &= ~(1 << LayerMask.NameToLayer("ChartObject"));

            if (mkGlow)
            {
                mkGlow.enabled = false;
            }
        }
    }
Example #4
0
    public void FillUndoRedoSnapInfo(uint tick, Globals.ViewMode viewMode)
    {
        UndoRedoSnapInfo newUndoRedoSnapInfo;

        newUndoRedoSnapInfo.tick     = tick;
        newUndoRedoSnapInfo.viewMode = viewMode;

        undoRedoSnapInfo = newUndoRedoSnapInfo;
    }
    void PostExecuteUpdate(bool isInvoke)
    {
        if (!postExecuteEnabled)
        {
            return;
        }

        ChartEditor editor = ChartEditor.Instance;

        if (!bpmAnchorFixupCommandsGenerated)
        {
            GenerateFixUpBPMAnchorCommands();
        }

        if (isInvoke)
        {
            foreach (ICommand command in bpmAnchorFixup)
            {
                command.Invoke();
            }
        }
        else
        {
            foreach (ICommand command in bpmAnchorFixup)
            {
                command.Revoke();
            }
        }

        editor.currentChart.UpdateCache();
        editor.currentSong.UpdateCache();

        if (Toolpane.currentTool != Toolpane.Tools.Note)
        {
            editor.currentSelectedObject = null;
        }

        ChartEditor.isDirty = true;

        var        soList       = validatedSongObjects.Count > 0 ? validatedSongObjects : songObjects;
        SongObject lowestTickSo = null;

        foreach (SongObject songObject in soList)
        {
            if (lowestTickSo == null || songObject.tick < lowestTickSo.tick)
            {
                lowestTickSo = songObject;
            }
        }

        if (lowestTickSo != null)
        {
            uint             jumpToPos = lowestTickSo.tick;
            Globals.ViewMode viewMode  = lowestTickSo.GetType().IsSubclassOf(typeof(ChartObject)) ? Globals.ViewMode.Chart : Globals.ViewMode.Song;
            editor.FillUndoRedoSnapInfo(jumpToPos, viewMode);
        }
    }
 void OnViewModeSwitch(Globals.ViewMode viewMode)
 {
     if (viewMode == Globals.ViewMode.Chart)
     {
         inspectorTitle.text = "Local Event";
     }
     else if (viewMode == Globals.ViewMode.Song)
     {
         inspectorTitle.text = "Global Event";
     }
 }
Example #7
0
 void OnViewModeSwitch(Globals.ViewMode viewMode)
 {
     if (viewMode == Globals.ViewMode.Chart)
     {
         eventImage.sprite = localEventSprite;
     }
     else if (viewMode == Globals.ViewMode.Song)
     {
         eventImage.sprite = globalEventSprite;
     }
 }
    public void SelectAllInView(Globals.ViewMode viewMode)
    {
        currentSelectedObject = null;

        if (viewMode == Globals.ViewMode.Chart)
        {
            currentSelectedObjects = editor.currentChart.chartObjects.ToArray();
        }
        else
        {
            currentSelectedObjects = editor.currentSong.syncTrack.ToArray();
            AddToSelectedObjects(editor.currentSong.eventsAndSections.ToArray());
        }
    }
Example #9
0
    void OnViewModeSwitch(Globals.ViewMode viewMode)
    {
        int newIndex = 0;

        if (viewMode == Globals.ViewMode.Chart)
        {
            newIndex = chartViewWaveformSelectionIndex;
        }
        else if (viewMode == Globals.ViewMode.Song)
        {
            newIndex = songViewWaveformSelectionIndex;
        }

        waveformSelect.value = newIndex;
    }
    void ApplyUndoRedoSnapInfo()
    {
        if (undoRedoSnapInfo.HasValue)
        {
            UndoRedoSnapInfo info     = undoRedoSnapInfo.Value;
            Globals.ViewMode viewMode = info.viewMode;
            uint             snapTick = info.tick;

            if (Globals.viewMode != viewMode)
            {
                toolPanel.ToggleSongViewMode(viewMode == Globals.ViewMode.Song);
            }

            movement.SetPosition(snapTick);
        }
    }
Example #11
0
    void ApplyUndoRedoSnapInfo()
    {
        if (undoRedoSnapInfo.HasValue)
        {
            UndoRedoSnapInfo info     = undoRedoSnapInfo.Value;
            Globals.ViewMode viewMode = info.viewMode;
            uint             snapTick = info.tick;

            if (Globals.viewMode != viewMode)
            {
                globals.ToggleSongViewMode(viewMode == Globals.ViewMode.Song);
            }

            if (snapTick < minPos || snapTick > maxPos)
            {
                movement.SetPosition(snapTick);
            }
        }
    }
Example #12
0
 bool ViewModeMaybeEqualsViewMode(ViewModeMaybe viewModeMaybe, Globals.ViewMode globalViewMode)
 {
     return
         ((viewModeMaybe == ViewModeMaybe.Chart && globalViewMode == Globals.ViewMode.Chart) ||
          (viewModeMaybe == ViewModeMaybe.Song && globalViewMode == Globals.ViewMode.Song));
 }
 public void AddOrRemoveHighlightCurrentSection(Globals.ViewMode viewMode)
 {
     HighlightCurrentSection(AddOrRemoveSelectedObjects, viewMode);
 }
 public void RemoveHighlightCurrentSection(Globals.ViewMode viewMode, int sectionOffset = 0)
 {
     HighlightCurrentSection(RemoveFromSelectedObjects, viewMode, sectionOffset);
 }
 public void AddHighlightCurrentSection(Globals.ViewMode viewMode, int sectionOffset = 0)
 {
     HighlightCurrentSection(AddToSelectedObjects, viewMode, sectionOffset);
 }
    public void HighlightCurrentSection(Globals.ViewMode viewMode)
    {
        currentSelectedObject = null;

        AddHighlightCurrentSection(viewMode);
    }
Example #17
0
    public override void Update()
    {
        base.Update();

        ChartEditor editor   = ChartEditor.Instance;
        Services    services = editor.services;

        Globals.ViewMode viewMode = Globals.viewMode;

        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.StepIncrease))
        {
            Globals.gameSettings.snappingStep.Increment();
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.StepDecrease))
        {
            Globals.gameSettings.snappingStep.Decrement();
        }

        if (editor.groupMove.movementInProgress)
        {
            return;
        }

        if (services.CanPlay())
        {
            if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.PlayPause))
            {
                editor.Play();
                return;
            }
            else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.StartGameplay))
            {
                editor.StartGameplay();
                return;
            }
        }

        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.Delete) && editor.selectedObjectsManager.currentSelectedObjects.Count > 0)
        {
            editor.Delete();
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.SelectAll))
        {
            editor.toolManager.ChangeTool(EditorObjectToolManager.ToolID.Cursor);
            editor.selectedObjectsManager.SelectAllInView(viewMode);
        }
        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.SelectAllSection))
        {
            editor.toolManager.ChangeTool(EditorObjectToolManager.ToolID.Cursor);
            editor.selectedObjectsManager.HighlightCurrentSection(viewMode);
        }

        if (!Input.GetMouseButton(0) && !Input.GetMouseButton(1))
        {
            bool success = false;

            if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ActionHistoryUndo))
            {
                if (!editor.commandStack.isAtStart && editor.services.CanUndo())
                {
                    editor.UndoWrapper();
                    success = true;
                }
            }
            else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ActionHistoryRedo))
            {
                if (!editor.commandStack.isAtEnd && editor.services.CanRedo())
                {
                    editor.RedoWrapper();
                    success = true;
                }
            }

            if (success)
            {
                EventSystem.current.SetSelectedGameObject(null);
                editor.groupSelect.reset();
                TimelineHandler.Repaint();
            }
        }

        if (editor.selectedObjectsManager.currentSelectedObjects.Count > 0)
        {
            if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ClipboardCut))
            {
                editor.Cut();
            }
            else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ClipboardCopy))
            {
                editor.Copy();
            }
        }
    }