コード例 #1
0
        //)
        public bool IsChordSameAsStoredChord(GuitarChord c, StoredChord sc,
            bool noteType, bool noteFret, bool matchAll, bool matchStrum)
        {
            bool same = true;
            if (noteType)
            {
                if ((c.HasHammeron == sc.IsHammeron &&
                    c.HasSlide == sc.IsSlide &&
                    c.HasSlideReversed == sc.IsSlideRev &&
                    c.IsTap == sc.IsTap &&
                    c.IsXNote == sc.IsXNote) == false)
                {
                    same = false;
                }
            }

            if (same == true && noteFret)
            {

                int numToMatch = 0;
                var cn = new List<int>();
                for (int x = 0; x < 6; x++)
                {
                    var n = c.Notes[x];
                    int scn = sc.Notes[5 - x];

                    if (scn.IsNotNull())
                        numToMatch++;
                    if (n == null && scn.IsNull())
                    {
                        continue;
                    }
                    else if (n == null && scn.IsNotNull())
                    {
                        same = false;
                    }
                    else if (n != null && scn.IsNull())
                    {
                        same = false;
                    }
                    else if (n != null && scn.IsNotNull() &&
                        n.NoteFretDown == scn)
                    {
                        cn.Add(x);
                    }
                    else
                    {
                        same = false;
                    }

                }

                if (same == true && matchAll)
                {
                    if (cn.Count != numToMatch)
                        same = false;
                }
                else if (matchAll == false && cn.Any())
                {
                    same = true;
                }
            }

            if (same == true && matchStrum)
            {
                same = (c.StrumMode == sc.Strum);
            }
            return same;
        }
コード例 #2
0
        public void SetStoredChordToEditor(StoredChord sc)
        {
            if (sc == null)
                return;

            var hb = GetHoldBoxes();

            for (int x = 0; x < hb.Length; x++)
            {
                var n = sc.Notes[x];

                hb[x].Text = n.ToStringEx();

                var ch = sc.NoteChannels[x];
                if (ch.IsNotNull())
                {
                    NoteChannelBoxes[x].Text = ch.ToStringEx();
                }
                else
                {
                    NoteChannelBoxes[x].Text = hb[x].Text.ToInt().ToStringEx("0");
                }
            }

            checkIsSlide.Checked = sc.IsSlide;
            checkIsSlideReversed.Checked = sc.IsSlideRev;
            checkIsHammeron.Checked = sc.IsHammeron;
            checkIsTap.Checked = sc.IsTap;
            checkIsX.Checked = sc.IsXNote;

            checkStrumHigh.Checked = sc.Strum.HasFlag(ChordStrum.High);
            checkStrumMid.Checked = sc.Strum.HasFlag(ChordStrum.Mid);
            checkStrumLow.Checked = sc.Strum.HasFlag(ChordStrum.Low);

            GetChordEndBox().Text = "";

            textBoxNoteEditorSelectedChordTickLength.Text = sc.TickLength.ToStringEx();
            int sp = GetChordStartBox().Text.ToInt();

            if (sp.IsNotNull())
            {
                GetChordEndBox().Text = (sp + sc.TickLength).ToStringEx();
            }

            var gc = GetChordFromScreen();
            if (gc != null)
            {
                EditorPro.SetChordToClipboard(gc);
            }
        }
コード例 #3
0
        public StoredChord GetStoredChordFromScreen(int tickLength)
        {
            StoredChord ret = null;

            var notes = GetHoldBoxes().Select(x => x.Text.ToInt()).ToArray();
            if (notes.Any(x => x.IsNull() == false) && tickLength.IsNotNull())
            {
                ret = new StoredChord();

                ret.NoteChannels = Utility.Null6.ToArray();

                ret.Notes = notes;

                var channels = NoteChannelBoxes.Select(cb => cb.Text.ToInt()).ToArray();
                bool isXChan = channels.Any(x => x == Utility.ChannelX);
                if (isXChan)
                {
                    channels = channels.Select(x => Utility.ChannelX).ToArray();
                }

                ret.Notes.ForEach((n, index) =>
                {
                    ret.NoteChannels[index] = channels[index].GetIfNull(0);
                });

                ret.IsSlide = checkIsSlide.Checked;
                ret.IsSlideRev = checkIsSlideReversed.Checked;
                ret.IsHammeron = checkIsHammeron.Checked;
                ret.IsTap = checkIsTap.Checked;
                ret.IsXNote = checkIsX.Checked;

                ret.Strum = ChordStrum.Normal;
                if (checkStrumHigh.Checked)
                {
                    ret.Strum |= ChordStrum.High;
                }
                if (checkStrumMid.Checked)
                {
                    ret.Strum |= ChordStrum.Mid;
                }
                if (checkStrumLow.Checked)
                {
                    ret.Strum |= ChordStrum.Low;
                }
                ret.TickLength = tickLength;
            }
            return ret;
        }