Exemple #1
0
 private void UpdateAppearance()
 {
     if (instantiatedContainer is null)
     {
         return;
     }
     instantiatedContainer.mapNoteData = queuedData;
     noteAppearanceSO.SetNoteAppearance(instantiatedContainer);
     instantiatedContainer.Directionalize(queuedData._cutDirection);
 }
    public void UpdateCut(int value)
    {
        queuedData._cutDirection = value;
        if (draggedObjectContainer != null && draggedObjectContainer.mapNoteData != null)
        {
            draggedObjectContainer.mapNoteData._cutDirection = value;
            noteAppearanceSO?.SetNoteAppearance(draggedObjectContainer);
        }
        else if (beatmapNoteInputController.QuickModificationActive && Settings.Instance.QuickNoteEditing)
        {
            var note = ObjectUnderCursor();
            if (note != null && note.objectData is BeatmapNote noteData)
            {
                var newData = BeatmapObject.GenerateCopy(noteData);
                newData._cutDirection = value;

                BeatmapActionContainer.AddAction(new BeatmapObjectModifiedAction(newData, noteData, noteData, "Quick edit"), true);
            }
        }
        UpdateAppearance();
    }
    public static BeatmapNoteContainer SpawnBeatmapNote(BeatmapNote noteData, ref GameObject notePrefab, ref GameObject bombPrefab, ref NoteAppearanceSO appearanceSO)
    {
        bool isBomb = noteData._type == BeatmapNote.NOTE_TYPE_BOMB;
        BeatmapNoteContainer container = Instantiate(isBomb ? bombPrefab : notePrefab).GetComponent <BeatmapNoteContainer>();

        container.isBomb         = isBomb;
        container.mapNoteData    = noteData;
        container.noteAppearance = appearanceSO;
        appearanceSO.SetNoteAppearance(container);
        container.Directionalize(noteData._cutDirection);
        container._timeForEditor = noteData._time;
        return(container);
    }
Exemple #4
0
 //Do some shit later lmao
 public void OnInvertNoteColors(InputAction.CallbackContext context)
 {
     if (customStandaloneInputModule.IsPointerOverGameObject <GraphicRaycaster>(-1, true))
     {
         return;
     }
     if (!KeybindsController.AnyCriticalKeys)
     {
         RaycastFirstObject(out BeatmapNoteContainer note);
         if (note != null && note.mapNoteData._type != BeatmapNote.NOTE_TYPE_BOMB)
         {
             int newType = note.mapNoteData._type == BeatmapNote.NOTE_TYPE_A ? BeatmapNote.NOTE_TYPE_B : BeatmapNote.NOTE_TYPE_A;
             note.mapNoteData._type = newType;
             noteAppearanceSO.SetNoteAppearance(note);
         }
     }
 }
Exemple #5
0
    public void InvertNote(BeatmapNoteContainer note)
    {
        if (note.mapNoteData._type == BeatmapNote.NOTE_TYPE_BOMB)
        {
            return;
        }

        var original = BeatmapObject.GenerateCopy(note.objectData);
        var newType  = note.mapNoteData._type == BeatmapNote.NOTE_TYPE_A ? BeatmapNote.NOTE_TYPE_B : BeatmapNote.NOTE_TYPE_A;

        note.mapNoteData._type = newType;
        noteAppearanceSO.SetNoteAppearance(note);
        var collection = BeatmapObjectContainerCollection.GetCollectionForType <NotesContainer>(BeatmapObject.Type.NOTE);

        collection.RefreshSpecialAngles(note.objectData, false, false);
        collection.RefreshSpecialAngles(original, false, false);
        BeatmapActionContainer.AddAction(new BeatmapObjectModifiedAction(note.objectData, note.objectData, original));
    }
 public void UpdateAppearance(BeatmapObjectContainer obj)
 {
     if (obj is BeatmapNoteContainer note)
     {
         note.Directionalize(note.mapNoteData._cutDirection);
         noteAppearance.SetNoteAppearance(note);
     }
     else if (obj is BeatmapEventContainer e)
     {
         eventAppearance.SetEventAppearance(e);
     }
     else if (obj is BeatmapObstacleContainer o)
     {
         obstacleAppearance.SetObstacleAppearance(o);
     }
     obj.UpdateGridPosition();
     SelectionController.RefreshMap();
 }
    protected override void UpdateContainerData(BeatmapObjectContainer con, BeatmapObject obj)
    {
        BeatmapNoteContainer note     = con as BeatmapNoteContainer;
        BeatmapNote          noteData = obj as BeatmapNote;

        note.SetBomb(noteData._type == BeatmapNote.NOTE_TYPE_BOMB);
        noteAppearanceSO.SetNoteAppearance(note);
        note.Setup();
        note.transform.localEulerAngles = BeatmapNoteContainer.Directionalize(noteData);
        Track track = tracksManager.GetTrackAtTime(obj._time);

        track.AttachContainer(con);
        foreach (Material mat in con.ModelMaterials)
        {
            allNoteRenderers.Add(mat);
            mat.SetFloat("_Rotation", track.RotationValue.y);
        }
    }
 private void UpdateAppearance()
 {
     if (instantiatedContainer is null)
     {
         return;
     }
     instantiatedContainer.mapNoteData = queuedData;
     noteAppearanceSO.SetNoteAppearance(instantiatedContainer);
     foreach (MeshRenderer renderer in instantiatedContainer.GetComponentsInChildren <MeshRenderer>())
     {
         if (renderer.material.HasProperty("_AlwaysTranslucent") && renderer.material.GetFloat("_AlwaysTranslucent") == 1)
         {
             continue; //Dont want to do this shit almost every frame.
         }
         renderer.material.SetFloat("_AlwaysTranslucent", 1);
     }
     instantiatedContainer.transform.localEulerAngles = BeatmapNoteContainer.Directionalize(queuedData);
 }
    public void UpdateAppearance(BeatmapObjectContainer obj)
    {
        switch (obj)
        {
        case BeatmapNoteContainer note:
            note.Directionalize(note.mapNoteData._cutDirection);
            noteAppearance.SetNoteAppearance(note);
            break;

        case BeatmapEventContainer e:
            eventAppearance.SetEventAppearance(e);
            break;

        case BeatmapObstacleContainer o:
            obstacleAppearance.SetObstacleAppearance(o);
            break;
        }
        tracksManager.RefreshTracks();
        obj.UpdateGridPosition();
        SelectionController.RefreshMap();
    }
Exemple #10
0
    private void UpdateAppearance()
    {
        if (instantiatedContainer is null)
        {
            return;
        }
        instantiatedContainer.mapNoteData = queuedData;
        noteAppearanceSO.SetNoteAppearance(instantiatedContainer);
        foreach (MeshRenderer renderer in instantiatedContainer.GetComponentsInChildren <MeshRenderer>())
        {
            Color main = (queuedData._type == BeatmapNote.NOTE_TYPE_A ? //get red/blue instance material for custom colors
                          noteAppearanceSO.RedInstance : noteAppearanceSO.BlueInstance)?.GetColor("_Color") ?? Color.black;
            if (renderer.transform.parent.name == "Direction")
            {
                main = renderer.material.GetColor("_Color");                                                //but not for direction
            }
            if (renderer.material.HasProperty("_Mode") && renderer.material.GetFloat("_Mode") == 2)
            {
                continue; //Dont want to do this shit almost every frame.
            }

            /*
             * Woah, this is some jank code. ChroMapper has jank code? Blasphemy!
             *
             * This giant wall of crap is essentially how Unity changes materials from opaque to transparent.
             * If I want to have the hover note be transparent, this is what i gotta do.
             */
            renderer.material.SetFloat("_Mode", 2);
            renderer.material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
            renderer.material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
            renderer.material.SetInt("_ZWrite", 0);
            renderer.material.DisableKeyword("_ALPHATEST_ON");
            renderer.material.EnableKeyword("_ALPHABLEND_ON");
            renderer.material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
            renderer.material.renderQueue = 3001;
            renderer.material.SetColor("_Color", new Color(main.r, main.g, main.b, 0.75f));
        }
        instantiatedContainer.Directionalize(queuedData._cutDirection);
    }
 internal override void OnMouseOver()
 {
     if (Input.GetMouseButtonDown(2) && !KeybindsController.ShiftHeld)
     {
         if (mapNoteData is BeatmapChromaNote chroma)
         {
             mapNoteData = chroma.originalNote;                                          //Revert Chroma status, then invert types
         }
         mapNoteData._type = mapNoteData._type == BeatmapNote.NOTE_TYPE_A ? BeatmapNote.NOTE_TYPE_B : BeatmapNote.NOTE_TYPE_A;
         noteAppearance.SetNoteAppearance(this);
     }
     else if (Input.GetAxis("Mouse ScrollWheel") != 0)
     {
         if (KeybindsController.AltHeld)
         {
             if (mapNoteData._cutDirection == BeatmapNote.NOTE_CUT_DIRECTION_ANY)
             {
                 return;
             }
             mapNoteData._cutDirection += (Input.GetAxis("Mouse ScrollWheel") > 0 ? -1 : 1);
             if (mapNoteData._cutDirection == -1)
             {
                 mapNoteData._cutDirection = 7;
             }
             else if (mapNoteData._cutDirection == 8)
             {
                 mapNoteData._cutDirection = 0;
             }
             Directionalize(mapNoteData._cutDirection);
         }
     }
     else
     {
         base.OnMouseOver();
     }
 }
Exemple #12
0
    public void Mirror()
    {
        if (!SelectionController.HasSelectedObjects())
        {
            PersistentUI.Instance.DisplayMessage("Select stuff first!", PersistentUI.DisplayMessageType.BOTTOM);
            return;
        }
        foreach (BeatmapObjectContainer con in SelectionController.SelectedObjects)
        {
            if (con is BeatmapObstacleContainer obstacle)
            {
                bool precisionWidth = obstacle.obstacleData._width >= 1000;
                int  __state        = obstacle.obstacleData._lineIndex;
                if (__state > 3 || __state < 0 || precisionWidth)              // thank you past me for this code
                {
                    if (__state >= 1000 || __state <= -1000 || precisionWidth) // precision lineIndex
                    {
                        int newIndex = __state;
                        if (newIndex <= -1000) // normalize index values, we'll fix them later
                        {
                            newIndex += 1000;
                        }
                        else if (newIndex >= 1000)
                        {
                            newIndex -= 1000;
                        }
                        else
                        {
                            newIndex = newIndex * 1000;               //convert lineIndex to precision if not already
                        }
                        newIndex = (((newIndex - 2000) * -1) + 2000); //flip lineIndex

                        int newWidth = obstacle.obstacleData._width;  //normalize wall width
                        if (newWidth < 1000)
                        {
                            newWidth = newWidth * 1000;
                        }
                        else
                        {
                            newWidth -= 1000;
                        }
                        newIndex = newIndex - newWidth;

                        if (newIndex < 0)
                        { //this is where we fix them
                            newIndex -= 1000;
                        }
                        else
                        {
                            newIndex += 1000;
                        }
                        obstacle.obstacleData._lineIndex = newIndex;
                    }
                    else // state > -1000 || state < 1000 assumes no precision width
                    {
                        int mirrorLane = (((__state - 2) * -1) + 2); //flip lineIndex
                        obstacle.obstacleData._lineIndex = mirrorLane - obstacle.obstacleData._width; //adjust for wall width
                    }
                }
                con.UpdateGridPosition();
            }
            else if (con is BeatmapNoteContainer note)
            {
                int __state = note.mapNoteData._lineIndex; // flip line index
                if (__state > 3 || __state < 0)            // precision case
                {
                    int newIndex = __state;
                    if (newIndex <= -1000) // normalize index values, we'll fix them later
                    {
                        newIndex += 1000;
                    }
                    else if (newIndex >= 1000)
                    {
                        newIndex -= 1000;
                    }
                    newIndex = (((newIndex - 1500) * -1) + 1500); //flip lineIndex

                    if (newIndex < 0)                             //this is where we fix them
                    {
                        newIndex -= 1000;
                    }
                    else
                    {
                        newIndex += 1000;
                    }
                    note.mapNoteData._lineIndex = newIndex;
                }
                else
                {
                    int mirrorLane = (int)(((__state - 1.5f) * -1) + 1.5f);
                    note.mapNoteData._lineIndex = mirrorLane;
                }
                con.UpdateGridPosition();

                //flip colors
                if (note.mapNoteData is BeatmapChromaNote chroma)
                {
                    note.mapNoteData = chroma.originalNote;                                               //Revert Chroma status, then invert types
                }
                if (note.mapNoteData._type != BeatmapNote.NOTE_TYPE_BOMB)
                {
                    note.mapNoteData._type = note.mapNoteData._type == BeatmapNote.NOTE_TYPE_A ? BeatmapNote.NOTE_TYPE_B : BeatmapNote.NOTE_TYPE_A;

                    //flip cut direction horizontally
                    if (CutDirectionToMirrored.ContainsKey(note.mapNoteData._cutDirection))
                    {
                        note.mapNoteData._cutDirection = CutDirectionToMirrored[note.mapNoteData._cutDirection];
                        note.Directionalize(note.mapNoteData._cutDirection);
                    }
                }
                noteAppearance.SetNoteAppearance(note);
            }
            else if (con is BeatmapEventContainer e)
            {
                if (e.eventData.IsUtilityEvent())
                {
                    return;
                }
                if (e.eventData._value > 4 && e.eventData._value < 8)
                {
                    e.eventData._value -= 4;
                }
                else if (e.eventData._value > 0 && e.eventData._value <= 4)
                {
                    e.eventData._value += 4;
                }
                eventAppearance.SetEventAppearance(e);
            }
        }
        SelectionController.RefreshMap();
    }
Exemple #13
0
    public void Mirror()
    {
        if (!SelectionController.HasSelectedObjects())
        {
            PersistentUI.Instance.DisplayMessage("Select stuff first!", PersistentUI.DisplayMessageType.BOTTOM);
            return;
        }
        foreach (BeatmapObjectContainer con in SelectionController.SelectedObjects)
        {
            if (con is BeatmapObstacleContainer obstacle)
            {
                bool precisionWidth = obstacle.obstacleData._width >= 1000;
                int  __state        = obstacle.obstacleData._lineIndex;
                if (__state >= 1000 || __state <= -1000 || precisionWidth) // precision lineIndex
                {
                    int newIndex = __state;
                    if (newIndex <= -1000) // normalize index values, we'll fix them later
                    {
                        newIndex += 1000;
                    }
                    else if (newIndex >= 1000)
                    {
                        newIndex -= 1000;
                    }
                    else
                    {
                        newIndex = newIndex * 1000;               //convert lineIndex to precision if not already
                    }
                    newIndex = (((newIndex - 2000) * -1) + 2000); //flip lineIndex

                    int newWidth = obstacle.obstacleData._width;  //normalize wall width
                    if (newWidth < 1000)
                    {
                        newWidth = newWidth * 1000;
                    }
                    else
                    {
                        newWidth -= 1000;
                    }
                    newIndex = newIndex - newWidth;

                    if (newIndex < 0)
                    { //this is where we fix them
                        newIndex -= 1000;
                    }
                    else
                    {
                        newIndex += 1000;
                    }
                    obstacle.obstacleData._lineIndex = newIndex;
                }
                else // state > -1000 || state < 1000 assumes no precision width
                {
                    int mirrorLane = (((__state - 2) * -1) + 2); //flip lineIndex
                    obstacle.obstacleData._lineIndex = mirrorLane - obstacle.obstacleData._width; //adjust for wall width
                }
                con.UpdateGridPosition();
            }
            else if (con is BeatmapNoteContainer note)
            {
                int __state = note.mapNoteData._lineIndex; // flip line index
                if (__state > 3 || __state < 0)            // precision case
                {
                    int newIndex = __state;
                    if (newIndex <= -1000) // normalize index values, we'll fix them later
                    {
                        newIndex += 1000;
                    }
                    else if (newIndex >= 1000)
                    {
                        newIndex -= 1000;
                    }
                    newIndex = (((newIndex - 1500) * -1) + 1500); //flip lineIndex

                    if (newIndex < 0)                             //this is where we fix them
                    {
                        newIndex -= 1000;
                    }
                    else
                    {
                        newIndex += 1000;
                    }
                    note.mapNoteData._lineIndex = newIndex;
                }
                else
                {
                    int mirrorLane = (int)(((__state - 1.5f) * -1) + 1.5f);
                    note.mapNoteData._lineIndex = mirrorLane;
                }
                con.UpdateGridPosition();

                //flip colors
                if (note.mapNoteData is BeatmapChromaNote chroma)
                {
                    note.mapNoteData = chroma.originalNote;                                               //Revert Chroma status, then invert types
                }
                if (note.mapNoteData._type != BeatmapNote.NOTE_TYPE_BOMB)
                {
                    note.mapNoteData._type = note.mapNoteData._type == BeatmapNote.NOTE_TYPE_A ? BeatmapNote.NOTE_TYPE_B : BeatmapNote.NOTE_TYPE_A;

                    //flip cut direction horizontally
                    if (CutDirectionToMirrored.ContainsKey(note.mapNoteData._cutDirection))
                    {
                        note.mapNoteData._cutDirection  = CutDirectionToMirrored[note.mapNoteData._cutDirection];
                        note.transform.localEulerAngles = BeatmapNoteContainer.Directionalize(note.mapNoteData);
                    }
                }
                noteAppearance.SetNoteAppearance(note);
            }
            else if (con is BeatmapEventContainer e)
            {
                if (e.eventData.IsRotationEvent)
                {
                    int?rotation = e.eventData.GetRotationDegreeFromValue();
                    if (rotation != null)
                    {
                        if (e.eventData._value >= 0 && e.eventData._value < MapEvent.LIGHT_VALUE_TO_ROTATION_DEGREES.Length)
                        {
                            e.eventData._value = MapEvent.LIGHT_VALUE_TO_ROTATION_DEGREES.ToList().IndexOf((rotation ?? 0) * -1);
                        }
                        else if (e.eventData._value >= 1000 && e.eventData._value <= 1720) //Invert Mapping Extensions rotation
                        {
                            e.eventData._value = 1720 - (e.eventData._value - 1000);
                        }
                    }
                    eventAppearance?.SetEventAppearance(e);
                    tracksManager?.RefreshTracks();
                    return;
                }
                if (e.eventData.IsUtilityEvent)
                {
                    return;
                }
                if (e.eventData._value > 4 && e.eventData._value < 8)
                {
                    e.eventData._value -= 4;
                }
                else if (e.eventData._value > 0 && e.eventData._value <= 4)
                {
                    e.eventData._value += 4;
                }
                eventAppearance?.SetEventAppearance(e);
            }
        }
        SelectionController.RefreshMap();
    }