Esempio n. 1
0
 public EditorStatus(EditorMode edit, NoteMode note, int size, TimingPosition beat)
 {
     EditorMode = edit;
     NoteMode   = note;
     NoteSize   = size;
     BeatStride = beat;
 }
Esempio n. 2
0
        public bool AddNote(string str, int userId)
        {
            if (str.IsNullOrEmpty())
            {
                return(false);
            }
            NoteMode note  = JsonConvert.DeserializeObject <NoteMode>(str);
            Notes    notes = new Notes
            {
                Title        = note.Title,
                ClassifyID   = note.ClassifyID,
                UserID       = userId,
                Content      = note.Content,
                iCon         = note.iCon,
                Viewed       = 0,
                ThumbUpCount = 0
            };
            X_Classify xc = this.GetModel(x => x.Id == note.ClassifyID);

            if (xc != null)
            {
                xc.Count += 1;
            }
            if (this.Update(xc))
            {
                return(noteService.Insert(notes));
            }
            return(false);
        }
Esempio n. 3
0
 private Note(NoteMode Mode, TimeSpan Start, TimeSpan End, int Lane)
 {
     this.Mode    = Mode;
     StartingTime = Start;
     EndingTime   = End;
     this.Lane    = Lane;
 }
Esempio n. 4
0
        public static float RoundToRelativeBeat(float notRounded, NoteMode mode)
        {
            float factor  = Note.GetFactor(mode);
            float rounded = ((float)Math.Round((notRounded * 100) * factor, MidpointRounding.ToEven) / factor) / 100f;

            if (((int)rounded) + 1 - rounded < .01f)
            {
                rounded = (int)rounded + 1;
            }
            return(rounded);
        }
Esempio n. 5
0
        private void SetNoteMode(NoteMode mode, EditorStatus status)
        {
            status.NoteMode = mode;
            foreach (var item in toolStrip2.Items)
            {
                var tsb = item as ToolStripButton;
                if (tsb != null)
                {
                    tsb.Checked = false;
                }
            }
            switch (mode)
            {
            case NoteMode.Touch:
                tsbTouch.Checked = true;
                return;

            case NoteMode.Chain:
                tsbChain.Checked = true;
                return;

            case NoteMode.SlideL:
                tsbSlideL.Checked = true;
                return;

            case NoteMode.SlideR:
                tsbSlideR.Checked = true;
                return;

            case NoteMode.SnapU:
                tsbSnapU.Checked = true;
                return;

            case NoteMode.SnapD:
                tsbSnapD.Checked = true;
                return;

            case NoteMode.Hold:
                tsbHold.Checked = true;
                return;

            case NoteMode.HoldRelay:
                tsbHoldStep.Checked = true;
                return;

            case NoteMode.Field:
                tsbField.Checked = true;
                return;

            default:
                Debug.Assert(false);
                break;
            }
        }
Esempio n. 6
0
 public void StartNewMap()
 {
     if (!flatMenu.IsReadyForNew())
     {
         BeatMap.Log("Start new called, but not ready");
         return;
     }
     currentNoteMode = flatMenu.selectedMode;
     StartNewMap(0, flatMenu.selectedBPM, flatMenu.selectedAudioPath,
                 flatMenu.selectedSongArtist, flatMenu.selectedMapArtist, flatMenu.selectedNewSongName,
                 flatMenu.selectedDifficulty, flatMenu.selecedNewSongFileName);
 }
Esempio n. 7
0
        public virtual void PlayNote(int interval, NoteMode mode, float duration = 1.5f)
        {
            int noteNum = GetSingleNote(interval, mode);


            ActivateNote(noteNum, duration);

            if (debug)
            {
                Debug.Log("Single Note: " + noteNum);
            }
        }
Esempio n. 8
0
        public Note(SpriteBatch spriteBatch, NoteMode mode, int screenWidth, int screenHeight, float speed)
        {
            bgw        = screenWidth;
            bgh        = screenHeight;
            LocalSpeed = speed;
            var tex = GameData.Instance.CurrentSkin.Note;

            Mode = mode;
            if (mode == NoteMode.left)
            {
                BaseX          = -1 * tex.Width;
                BaseY          = (screenHeight / 2) - (tex.Height / 2);
                NoteSprite     = new Sprite(spriteBatch, BaseX, BaseY, tex, Color.White);
                traveldistance = screenWidth / 2;
            }
            if (mode == NoteMode.up)
            {
                BaseX          = (screenWidth / 2) - (tex.Width / 2);
                BaseY          = -1 * tex.Height;
                NoteSprite     = new Sprite(spriteBatch, BaseX, BaseY, tex, Color.White);
                traveldistance = screenHeight / 2;
            }
            if (mode == NoteMode.right)
            {
                BaseX          = screenWidth + tex.Width;
                BaseY          = (screenHeight / 2) - (tex.Height / 2);
                NoteSprite     = new Sprite(spriteBatch, BaseX, BaseY, tex, Color.White);
                traveldistance = screenWidth / 2 + NoteSprite.Texture.Width;
            }
            if (mode == NoteMode.down)
            {
                BaseX          = (screenWidth / 2) - (tex.Width / 2);
                BaseY          = screenHeight + tex.Height;
                NoteSprite     = new Sprite(spriteBatch, BaseX, BaseY, tex, Color.White);
                traveldistance = screenHeight / 2 + NoteSprite.Texture.Height;
            }
            jumpinoffset   = traveldistance;
            traveldistance = (int)(traveldistance / speed);
            jumpinoffset   = traveldistance - jumpinoffset;
            //Time = Time - noteoffset;
            Alpha            = -50;
            NoteSprite.Scale = GameData.Instance.Mods.SizeMultiplier;
        }
Esempio n. 9
0
        private int GetSingleNote(int interval, NoteMode mode)
        {
            ScalePosition pos = new ScalePosition();

            // Handle Static Mode
            if (mode == NoteMode.STATIC_MODE)
            {
                pos = Scales.GetNoteFromScale(interval, minOctave, maxOctave);
            }
            if (mode == NoteMode.RELATIVE_MODE)
            {
                currInterval += interval;
                int finalInterval = currInterval; // octave offset (middle c at 0 octave)
                pos    = Scales.GetNoteFromScale(finalInterval, minOctave, maxOctave);
                octave = pos.octaveChange;        // need to update octave if changed
            }

            // center around 4th octave (middle c)
            return(NoteFromScalePosition(pos));
        }
Esempio n. 10
0
        public SNote(SpriteBatch spriteBatch, NoteMode mode, int screenWidth, int screenHeight)
        {
            bgw = screenWidth;
            bgh = screenHeight;
            var tex = GameData.Instance.CurrentSkin.Note;

            Mode = mode;
            if (mode == NoteMode.left)
            {
                BaseX          = -1 * tex.Width;
                BaseY          = (screenHeight / 2) - (tex.Height / 2);
                NoteSprite     = new Sprite(spriteBatch, BaseX, BaseY, GameData.Instance.CurrentSkin.SlideLeft, Color.White);
                traveldistance = screenWidth / 2;
            }
            if (mode == NoteMode.up)
            {
                BaseX          = (screenWidth / 2) - (tex.Width / 2);
                BaseY          = -1 * tex.Height;
                NoteSprite     = new Sprite(spriteBatch, BaseX, BaseY, GameData.Instance.CurrentSkin.SlideUp, Color.White);
                traveldistance = screenHeight / 2;
            }
            if (mode == NoteMode.right)
            {
                BaseX          = screenWidth + tex.Width;
                BaseY          = (screenHeight / 2) - (tex.Height / 2);
                NoteSprite     = new Sprite(spriteBatch, BaseX, BaseY, GameData.Instance.CurrentSkin.SlideRight, Color.White);
                traveldistance = screenWidth / 2 + NoteSprite.Texture.Width;
            }
            if (mode == NoteMode.down)
            {
                BaseX          = (screenWidth / 2) - (tex.Width / 2);
                BaseY          = screenHeight + tex.Height;
                NoteSprite     = new Sprite(spriteBatch, BaseX, BaseY, GameData.Instance.CurrentSkin.SlideDown, Color.White);
                traveldistance = screenHeight / 2 + NoteSprite.Texture.Height;
            }
            Alpha            = -50;
            NoteSprite.Scale = GameData.Instance.Mods.SizeMultiplier;
        }
Esempio n. 11
0
        public static NoteType ToNoteType(this NoteMode mode)
        {
            switch (mode)
            {
            case NoteMode.Touch: return(NoteType.Touch);

            case NoteMode.Chain: return(NoteType.Chain);

            case NoteMode.SlideL: return(NoteType.SlideL);

            case NoteMode.SlideR: return(NoteType.SlideR);

            case NoteMode.SnapU: return(NoteType.SnapU);

            case NoteMode.SnapD: return(NoteType.SnapD);

            case NoteMode.Hold: return(NoteType.HoldBegin);

            case NoteMode.HoldRelay: return(NoteType.HoldRelay);

            default: return(NoteType.Unknown);
            }
        }
Esempio n. 12
0
 public void SetNoteMode(NoteMode mode)
 {
     currentNoteMode = mode;
 }
Esempio n. 13
0
        public void Initialize(BeatMapData data, NoteMode noteMode, EditorState requestedState)
        {
            if (BeatMap.state != EditorState.Started)
            {
                Debug.Log("Trying to initialize when not in started state - " + state);
                return;
            }
            Debug.LogWarning("Audio loaded, Initializing with note mode " + currentNoteMode);

            waitingNotes       = new List <NoteDetails>();
            activeNotes        = new List <Note>();
            completedNotes     = new List <NoteDetails>();
            beatManager        = new Utilities.BeatManager(data.beatsPerMinute, song);
            audioSource.clip   = song;
            beatsToReachPlayer = timeToReachPlayer * beatManager.beatsPerSecond; // Convert from seconds to beats
            Debug.Log("Time to reach player Seconds-Beats -- " + timeToReachPlayer + "-" + beatsToReachPlayer);
            Debug.Log("BPM - " + data.beatsPerMinute + " BPS - " + beatManager.beatsPerSecond);
            Debug.Log("Total beats - " + beatManager.GetTotalBeats);
            lastBeatBarPlacedAtBeat = beatManager.GetCurrentWholeBeat;
            beatMapData             = data;
            waitingNotes            = new List <NoteDetails>();
            activeNotes             = new List <Note>();
            completedNotes          = new List <NoteDetails>();
            if (data.notes == null)
            {
                beatMapData.notes = new NoteDetails[0];
            }
            Log("Loading notes, size - " + data.notes.Length);
            for (int count = 0; count < data.notes.Length; count++)
            {
                data.notes[count].inverted    = false;
                data.notes[count].timeToSpawn = RoundToRelativeBeat(data.notes[count].timeToSpawn, noteMode);
                waitingNotes.Add(data.notes[count]);
            }
            // When in creative mode, we keep the inverted objects in memory //
            if (requestedState == EditorState.Recording || requestedState == EditorState.Editing)
            {
                Debug.Log("Creating inverted array, waitingnotes size - " + waitingNotes.Count + " - " +
                          "total beats - " + beatManager.GetTotalBeats);
                NoteDetails[] invertedArray = BeatMapData.InvertNoteArray(waitingNotes.ToArray(), beatManager.GetTotalBeats, currentNoteMode);
                for (int count = 0; count < invertedArray.Length; count++)
                {
                    invertedArray[count].inverted = true;
                    waitingNotes.Add(invertedArray[count]);
                }
                Log("Inverted array size - " + invertedArray.Length);
            }
            if (requestedState == EditorState.Editing || requestedState == EditorState.PlaybackPaused)
            {
                // If we have an inverted map on top of the regular map, disable note displah for performance //
                miniMap.showNotes = true;
            }
            else if (requestedState == EditorState.Playback || requestedState == EditorState.Recording)
            {
                miniMap.showNotes = false;
            }
            SetRunning(false);
            SetCurrentState(requestedState);
            miniMap.Initialize(beatManager.GetTotalBeats, beatsToReachPlayer);
            initialized = true;
        }
Esempio n. 14
0
 public void Initialize(BeatSaberJSONClass data, NoteMode noteMode, EditorState requestedState)
 {
     Initialize(BeatSaberJSONClass.ConvertBSDataToEditorData(data), noteMode, requestedState);
 }
Esempio n. 15
0
        /// <summary>
        /// nullを返すことがあります
        /// </summary>
        /// <param name="lane"></param>
        /// <param name="timing"></param>
        /// <param name="size"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        public static ShortNote NoteFactory(LanePotision lane, TimingPosition timing, NoteSize size, NoteMode mode)
        {
            switch (mode)
            {
            case NoteMode.Touch:
                return(new Touch(lane, timing, size));

            case NoteMode.Chain:
                return(new Chain(lane, timing, size));

            case NoteMode.SlideL:
                return(new SlideL(lane, timing, size));

            case NoteMode.SlideR:
                return(new SlideR(lane, timing, size));

            case NoteMode.SnapU:
                return(new SnapU(lane, timing, size));

            case NoteMode.SnapD:
                return(new SnapD(lane, timing, size));

            default:
                //Debug.Assert(false);
                return(null);
            }
        }