Exemple #1
0
 public void EndModify()
 {
     EndOfFrame.Instance.Listeners.AddListener(() =>
     {
         Enable        = false;
         note          = null;
         currentSetter = null;
         AdeCursorManager.Instance.EnableVerticalPanel = false;
     });
 }
Exemple #2
0
 public void ModifyNote(ArcNote note, Action <int> setter)
 {
     Enable        = true;
     this.note     = note;
     currentSetter = setter;
     if (note is ArcArc)
     {
         AdeCursorManager.Instance.EnableVerticalPanel = true;
     }
 }
Exemple #3
0
        private void RaycastSelecting()
        {
            if (Input.GetMouseButtonDown(0))
            {
                Ray ray = GameplayCamera.ScreenPointToRay();

                RaycastHit[] hits     = Physics.RaycastAll(ray, 120, 1 << 9);
                ArcNote      n        = null;
                float        distance = float.MaxValue;
                foreach (var h in hits)
                {
                    ArcNote t = ArcGameplayManager.Instance.FindNoteByInstance(h.transform.gameObject);
                    if (t is ArcArc && h.point.z > 0 && t.Timing + ArcAudioManager.Instance.AudioOffset < ArcGameplayManager.Instance.Timing)
                    {
                        continue;
                    }
                    if (h.distance < distance)
                    {
                        distance = h.distance;
                        n        = t;
                    }
                }
                if (n != null)
                {
                    if (!Input.GetKey(KeyCode.LeftControl))
                    {
                        DeselectAllNotes();
                        SelectNote(n);
                    }
                    else
                    {
                        if (SelectedNotes.Contains(n))
                        {
                            DeselectNote(n);
                        }
                        else
                        {
                            SelectNote(n);
                        }
                    }
                }
                else
                {
                    if (!Input.GetKey(KeyCode.LeftControl) && IsHorizontalHit)
                    {
                        DeselectAllNotes();
                    }
                }
            }
        }
Exemple #4
0
 public void DeselectNote(ArcNote note)
 {
     if (note.Instance != null)
     {
         note.Selected = false;
     }
     if (SelectedNotes.Contains(note))
     {
         SelectedNotes.Remove(note);
         foreach (var l in NoteEventListeners)
         {
             l.OnNoteDeselect(note);
         }
     }
 }
Exemple #5
0
 public void SelectNote(ArcNote note)
 {
     if (note.Instance != null)
     {
         note.Selected = true;
     }
     if (!SelectedNotes.Contains(note))
     {
         SelectedNotes.Add(note);
         foreach (var l in NoteEventListeners)
         {
             l.OnNoteSelect(note);
         }
     }
 }
        public ArcVisualNote([NotNull] VisualBeatmap beatmap, [NotNull] ArcNote baseNote, [NotNull] StageMetrics metrics)
            : base(beatmap, baseNote)
        {
            _baseNote = baseNote;
            _metrics  = metrics;

            PreviewStartY = beatmap.CalculateY(baseNote.StartTick, metrics, metrics.FinishLineY);
            PreviewEndY   = beatmap.CalculateY(baseNote.EndTick, metrics, metrics.FinishLineY);

            _arcMesh = new BottomlessColoredTriangularPrism(beatmap.GraphicsDevice);
            _shadow  = new ColoredParallelogram(beatmap.GraphicsDevice);
            _support = new TexturedRectangle(beatmap.GraphicsDevice);
            _header  = new BottomlessColoredTetrahedron(beatmap.GraphicsDevice);

            if (baseNote.SkyNotes != null && baseNote.SkyNotes.Length > 0)
            {
                SkyVisualNotes = baseNote.SkyNotes.Select(n => new SkyVisualNote(beatmap, n, this, metrics)).ToArray();
            }
        }
Exemple #7
0
 public void OnNoteSelect(ArcNote note)
 {
     if (note is ArcArc)
     {
         if (Mode == ClickToCreateMode.ArcTap)
         {
             if (selectedArc != null)
             {
                 skipNextClick = true;
             }
             selectedArc = note as ArcArc;
         }
         else
         {
             selectedArc   = note as ArcArc;
             skipNextClick = true;
         }
     }
 }
Exemple #8
0
        public void UpdateTimingGroupOptions()
        {
            List <Dropdown.OptionData> options = new List <Dropdown.OptionData>();

            options.Add(new Dropdown.OptionData {
                text = "默认"
            });
            foreach (var tg in ArcTimingManager.Instance.timingGroups)
            {
                options.Add(new Dropdown.OptionData {
                    text = tg.Id.ToString()
                });
            }
            TimingGroup.GetComponentInChildren <Dropdown>().options = options;
            List <ArcNote> selected = AdeCursorManager.Instance.SelectedNotes;
            int            count    = selected.Count;

            if (TimingGroup.gameObject.activeSelf && count > 0)
            {
                bool    multiple = count != 1;
                ArcNote note     = selected[0];
                TimingGroup.GetComponentInChildren <Dropdown>().SetValueWithoutNotify(multiple ? 0 : ((note as IHasTimingGroup).TimingGroup?.Id ?? 0));
            }
        }
        private void MakeupFields()
        {
            canEdit = false;
            List <ArcNote> selected = AdeCursorManager.Instance.SelectedNotes;
            int            count    = selected.Count;

            if (count == 0)
            {
                Panel.gameObject.SetActive(false);
                return;
            }
            else
            {
                SelectParent.gameObject.SetActive(false);
                if (count == 1)
                {
                    if (selected[0] is ArcArcTap)
                    {
                        SelectParent.gameObject.SetActive(true);
                    }
                }
                Timing.gameObject.SetActive(true);
                Track.gameObject.SetActive(true);
                EndTiming.gameObject.SetActive(true);
                StartPos.gameObject.SetActive(true);
                EndPos.gameObject.SetActive(true);
                LineType.gameObject.SetActive(true);
                Color.gameObject.SetActive(true);
                IsVoid.gameObject.SetActive(true);
                foreach (var s in selected)
                {
                    if (Track.gameObject.activeSelf)
                    {
                        Track.gameObject.SetActive(s is ArcTap || s is ArcHold);
                    }
                    if (EndTiming.gameObject.activeSelf)
                    {
                        EndTiming.gameObject.SetActive(s is ArcLongNote);
                    }
                    if (StartPos.gameObject.activeSelf)
                    {
                        StartPos.gameObject.SetActive(s is ArcArc);
                    }
                    if (EndPos.gameObject.activeSelf)
                    {
                        EndPos.gameObject.SetActive(s is ArcArc);
                    }
                    if (LineType.gameObject.activeSelf)
                    {
                        LineType.gameObject.SetActive(s is ArcArc);
                    }
                    if (Color.gameObject.activeSelf)
                    {
                        Color.gameObject.SetActive(s is ArcArc);
                    }
                    if (IsVoid.gameObject.activeSelf)
                    {
                        IsVoid.gameObject.SetActive(s is ArcArc);
                    }
                }
                bool    multiple = count != 1;
                ArcNote note     = selected[0];
                Timing.GetComponentInChildren <InputField>().text = multiple ? "-" : note.Timing.ToString();
                if (Track.gameObject.activeSelf)
                {
                    Track.GetComponentInChildren <InputField>().text = multiple ? "-" : (note is ArcTap ? (note as ArcTap).Track.ToString() : (note as ArcHold).Track.ToString());
                }
                if (EndTiming.gameObject.activeSelf)
                {
                    EndTiming.GetComponentInChildren <InputField>().text = multiple ? "-" : (note as ArcLongNote).EndTiming.ToString();
                }
                if (StartPos.gameObject.activeSelf)
                {
                    StartPos.GetComponentInChildren <InputField>().text = multiple ? "-,-" : $"{(note as ArcArc).XStart.ToString("f2")},{(note as ArcArc).YStart.ToString("f2")}";
                }
                if (EndPos.gameObject.activeSelf)
                {
                    EndPos.GetComponentInChildren <InputField>().text = multiple ? "-,-" : $"{(note as ArcArc).XEnd.ToString("f2")},{(note as ArcArc).YEnd.ToString("f2")}";
                }
                if (LineType.gameObject.activeSelf)
                {
                    LineType.GetComponentInChildren <Dropdown>().value = multiple ? 0 : (int)(note as ArcArc).LineType;
                }
                if (Color.gameObject.activeSelf)
                {
                    Color.GetComponentInChildren <Dropdown>().value = multiple ? 0 : (note as ArcArc).Color;
                }
                if (IsVoid.gameObject.activeSelf)
                {
                    IsVoid.GetComponentInChildren <Toggle>().isOn = multiple ? false : (note as ArcArc).IsVoid;
                }
                Panel.gameObject.SetActive(true);
            }
            canEdit = true;
        }
 public void OnNoteDeselect(ArcNote note)
 {
     MakeupFields();
 }
Exemple #11
0
 public void OnNoteDeselect(ArcNote note)
 {
     return;
 }
Exemple #12
0
        private void AddNoteHandler()
        {
            if (!AdeCursorManager.Instance.IsHorizontalHit)
            {
                return;
            }
            if (skipNextClick)
            {
                skipNextClick = false;
                return;
            }
            Vector3 pos    = AdeCursorManager.Instance.AttachedHorizontalPoint;
            int     timing = ArcTimingManager.Instance.CalculateTimingByPosition(-pos.z * 1000) - ArcAudioManager.Instance.AudioOffset;
            ArcNote note   = null;

            switch (Mode)
            {
            case ClickToCreateMode.Tap:
                note = new ArcTap()
                {
                    Timing = timing, Track = PositionToTrack(pos.x)
                };
                break;

            case ClickToCreateMode.Hold:
                note = new ArcHold()
                {
                    Timing = timing, Track = PositionToTrack(pos.x), EndTiming = timing
                };
                break;

            case ClickToCreateMode.Arc:
                note = new ArcArc()
                {
                    Timing = timing, EndTiming = timing, Color = currentArcColor, IsVoid = currentArcIsVoid, LineType = currentArcType
                };
                break;

            case ClickToCreateMode.ArcTap:
                note = new ArcArcTap()
                {
                    Timing = timing
                };
                break;
            }
            if (note == null)
            {
                return;
            }
            switch (Mode)
            {
            case ClickToCreateMode.Tap:
                CommandManager.Instance.Add(new AddArcEventCommand(note));
                break;

            case ClickToCreateMode.Hold:
            case ClickToCreateMode.Arc:
                CommandManager.Instance.Prepare(new AddArcEventCommand(note));
                break;

            case ClickToCreateMode.ArcTap:
                if (canAddArcTap)
                {
                    CommandManager.Instance.Add(new AddArcTapCommand(selectedArc, note as ArcArcTap));
                }
                else
                {
                    if (selectedArc != null)
                    {
                        selectedArc = null;
                        Mode        = ClickToCreateMode.Idle;
                    }
                }
                break;
            }
            if (note is ArcLongNote)
            {
                pendingNote = note as ArcLongNote;
            }
            switch (Mode)
            {
            case ClickToCreateMode.Hold:
                PostCreateHoldNote(note as ArcHold);
                break;

            case ClickToCreateMode.Arc:
                PostCreateArcNote(note as ArcArc);
                break;
            }
        }
        private void Selecting()
        {
            if (!AdeInputManager.Instance.Inputs.RangeSelection.IsPressed())
            {
                rangeSelectPosition = null;
            }

            if (Mouse.current.leftButton.wasPressedThisFrame)
            {
                //range selection shortcut
                if (AdeInputManager.Instance.Inputs.RangeSelection.IsPressed())
                {
                    if (rangeSelectPosition == null)
                    {
                        rangeSelectPosition = AttachedTiming;
                    }
                    else
                    {
                        if (!AdeInputManager.Instance.Inputs.MultipleSelection.IsPressed())
                        {
                            DeselectAllNotes();
                        }
                        RangeSelectNote(rangeSelectPosition.Value, AttachedTiming);
                        rangeSelectPosition = null;
                    }
                    return;
                }

                Ray ray = GameplayCamera.ScreenPointToRay();

                RaycastHit[] hits     = Physics.RaycastAll(ray, 120, 1 << 9);
                ArcNote      n        = null;
                float        distance = float.MaxValue;
                foreach (var h in hits)
                {
                    ArcNote t = ArcGameplayManager.Instance.FindNoteByRaycastHit(h);
                    if (t != null)
                    {
                        if (h.distance < distance)
                        {
                            distance = h.distance;
                            n        = t;
                        }
                    }
                }
                if (n != null)
                {
                    if (!AdeInputManager.Instance.Inputs.RangeSelection.IsPressed())
                    {
                        DeselectAllNotes();
                        SelectNote(n);
                    }
                    else
                    {
                        if (SelectedNotes.Contains(n))
                        {
                            DeselectNote(n);
                        }
                        else
                        {
                            SelectNote(n);
                        }
                    }
                }
                else
                {
                    if (!AdeInputManager.Instance.Inputs.MultipleSelection.IsPressed() && IsHorizontalHit)
                    {
                        DeselectAllNotes();
                    }
                }
            }
        }