public IResult DeleteNote(string noteKey) { if (noteKey == null) { throw new ArgumentNullException("noteKey"); } var keyResult = KeyParserHelper.ParseResult <INoteKey>(noteKey); if (!keyResult.Success) { return(keyResult); } var key = new NoteKey(keyResult.ResultingObject); var note = _notebookUnitOfWork.NoteRepository.FindByKey(key); if (note == null) { return(new InvalidResult(string.Format(UserMessages.NoteNotFound, noteKey))); } _notebookUnitOfWork.NoteRepository.Remove(note); _notebookUnitOfWork.Commit(); return(SyncParameters.Using(new SuccessResult(), new NotebookKey(key))); }
private void SpawnNote(NoteKey key, int index) { GameObject note; switch (key) { case NoteKey.LEFTLEFT: note = Instantiate(note1, notes_parent.transform); activeNotes.Add(note); notesSpawns[index].instantiated = true; break; case NoteKey.LEFT: note = Instantiate(note2, notes_parent.transform); activeNotes.Add(note); notesSpawns[index].instantiated = true; break; case NoteKey.RIGHT: note = Instantiate(note3, notes_parent.transform); activeNotes.Add(note); notesSpawns[index].instantiated = true; break; case NoteKey.RIGHTRIGHT: note = Instantiate(note3, notes_parent.transform); activeNotes.Add(note); notesSpawns[index].instantiated = true; break; } }
internal IResult Execute(NoteKey noteKey, DateTime timestamp, IUpdateNoteParameters parameters) { if (noteKey == null) { throw new ArgumentNullException("noteKey "); } if (timestamp == null) { throw new ArgumentNullException("timestamp"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } var note = _notebookUnitOfWork.NoteRepository.FindByKey(noteKey); if (note == null) { return(new InvalidResult(string.Format(UserMessages.NoteNotFound, noteKey.KeyValue))); } var employeeResult = new GetEmployeeCommand(_notebookUnitOfWork).GetEmployee(parameters); if (!employeeResult.Success) { return(employeeResult); } note.EmployeeId = employeeResult.ResultingObject.EmployeeId; note.TimeStamp = timestamp; note.Text = parameters.Text; return(new SuccessResult()); }
internal static void AssertEqual(this Notebook notebook, INotebookReturn notebookReturn) { if (notebook == null) { throw new ArgumentNullException("notebook"); } if (notebookReturn == null) { throw new ArgumentNullException("notebookReturn"); } Assert.AreEqual(new NotebookKey(notebook).KeyValue, notebookReturn.NotebookKey); if (notebook.Notes != null) { notebook.Notes.ForEach(n => { var noteKey = new NoteKey(n); n.AssertEqual(notebookReturn.Notes.Single(r => r.NoteKey == noteKey.KeyValue)); }); } else if (notebookReturn.Notes != null) { Assert.IsEmpty(notebookReturn.Notes); } }
public IResult UpdateNote(string noteKey, IUpdateNoteParameters parameters) { if (noteKey == null) { throw new ArgumentNullException("noteKey"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } var keyResult = KeyParserHelper.ParseResult <INoteKey>(noteKey); if (!keyResult.Success) { return(keyResult); } var parsedNoteKey = new NoteKey(keyResult.ResultingObject); var updateNoteResult = new UpdateNoteCommand(_notebookUnitOfWork).Execute(parsedNoteKey, _timeStamper.CurrentTimeStamp, parameters); if (!updateNoteResult.Success) { return(updateNoteResult); } _notebookUnitOfWork.Commit(); return(SyncParameters.Using(new SuccessResult(), new NotebookKey(parsedNoteKey))); }
private void SpawnNote(NoteKey key, int index) { GameObject note; switch (key) { case NoteKey.LEFTLEFT: note = Instantiate(noteLeftLeftPrefab, notesParent); activeNotes.Add(note); notesSpawns[index].instantiated = true; break; case NoteKey.LEFT: note = Instantiate(noteLeftPrefab, notesParent); activeNotes.Add(note); notesSpawns[index].instantiated = true; break; case NoteKey.RIGHT: note = Instantiate(noteRightPrefab, notesParent); activeNotes.Add(note); notesSpawns[index].instantiated = true; break; case NoteKey.RIGHTRIGHT: note = Instantiate(noteRightRightPrefab, notesParent); activeNotes.Add(note); notesSpawns[index].instantiated = true; break; } }
public void Serializes_Contract_with_updated_Comments_Note_in_old_context() { //Arrange const string updatedNote = "Updated contract comment!"; var contract = RVCUnitOfWork.ContractRepository .Filter(c => c.Comments.Notes.Count() == 1 && c.Comments.Notes.All(n => n.Text != updatedNote), c => c.Comments.Notes) .FirstOrDefault(); if (contract == null) { Assert.Inconclusive("No suitable test contract found."); } var noteKey = new NoteKey(contract.Comments.Notes.Single()); //Assert var result = Service.UpdateNote(noteKey, new UpdateNoteParameters { UserToken = TestUser.UserName, Text = updatedNote }); var contractKeyString = GetKeyFromConsoleString(ConsoleOutput.SynchronizedContract); //Assert result.AssertSuccess(); MockKillSwitch.Verify(k => k.Engage(), Times.Never()); var contractId = int.Parse(contractKeyString); using (var oldContext = new RioAccessSQLEntities()) { var serialized = oldContext.tblContracts.First(c => c.ContractID == contractId).Serialized; var serializedContract = SerializableContract.Deserialize(serialized); Assert.AreEqual(updatedNote, serializedContract.Notes.Single().Text); } }
public static Chord Maj(NoteKey key) { return(new Chord(new [] { key, key + 4, key + 7 })); }
public void Removes_Note_record_from_database_if_successful() { //Arrange var noteKey = new NoteKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Note>()); //Act var result = Service.DeleteNote(noteKey.KeyValue); //Assert result.AssertSuccess(); Assert.IsNull(RVCUnitOfWork.NoteRepository.FindByKey(noteKey)); }
//難易度計算 static private float calculateNoteDifficult(NoteKey aNote1, NoteKey aNote2) { float tDifference = aNote2.second - aNote1.second; if (kFurthestSecond < tDifference) { return(0); } float tSecondDifficult = calculateSecondDifficult(tDifference); float tKeyDifficult = calculateKeyDifficult(aNote1.key, aNote2.key); float tDifficult = (tSecondDifficult * tSecondDifficult * tKeyDifficult) / 500000 * kDifficultStage; return((tDifficult < kDifficultStage) ? tDifficult : kDifficultStage - 1); }
public void HitKey(NoteKey key) { if (nextNote.key == key) { if (progress >= nextNote.timeStamp - activeNoteThreshold && progress <= nextNote.timeStamp + activeNoteThreshold) //Check if hit was during nextnotes activethreshold { combo++; if (combo >= 50) { scoreMultiplier = Mathf.FloorToInt(combo / comboIncrement) * comboMultiplier; } else { scoreMultiplier = 1; } float difference = Mathf.Abs(progress - nextNote.timeStamp); if (difference <= perfectHit) { score += Mathf.FloorToInt(scoreMultiplier * perfectScore); ScorePopUpManager.instance.Spawn300((int)nextNote.key); Debug.Log("Perfect hit"); } else if (difference <= normalHit) { score += Mathf.FloorToInt(scoreMultiplier * normalScore); ScorePopUpManager.instance.Spawn100((int)nextNote.key); Debug.Log("Normal hit"); } else if (difference <= badHit) { score += Mathf.FloorToInt(scoreMultiplier * badScore); ScorePopUpManager.instance.Spawn50((int)nextNote.key); Debug.Log("Bad hit"); } NextNote(); UIScript.instance.SetCombo(combo); UIScript.instance.SetScore(score); } } }
public void Updates_Note_record_as_expected_on_success() { //Arrange var noteKey = new NoteKey(TestHelper.CreateObjectGraphAndInsertIntoDatabase <Note>()); var parameters = new UpdateNoteParameters { UserToken = TestUser.UserName, Text = "Something something something else as well." }; //Act var result = Service.UpdateNote(noteKey.KeyValue, parameters); //Assert result.AssertSuccess(); var note = RVCUnitOfWork.NoteRepository.FindByKey(noteKey, n => n.Employee); Assert.AreEqual(parameters.UserToken, note.Employee.UserName); Assert.AreEqual(parameters.Text, note.Text); }
public KeyEvent(NoteKey noteKey) : this(0, noteKey) { }
public Note(float timeStamp, NoteKey key) { this.timeStamp = timeStamp; this.key = key; }
public static float Get(NoteKey key) => Frequencies[key];
public static (KeyAccidentalSign keyAccidentalSign, Tonality tonality) ToKeyAccidentalSign_Tonality( this NoteKey noteKey) { switch (noteKey) { case CFlatMajor: return(Flat7, Major); case AFlatMinor: return(Flat7, Minor); case GFlatMajor: return(Flat6, Major); case EFlatMinor: return(Flat6, Minor); case DFlatMajor: return(Flat5, Major); case BFlatMinor: return(Flat5, Minor); case AFlatMajor: return(Flat4, Major); case FMinor: return(Flat4, Minor); case EFlatMajor: return(Flat3, Major); case CMinor: return(Flat3, Minor); case BFlatMajor: return(Flat2, Major); case GMinor: return(Flat2, Minor); case FMajor: return(Flat1, Major); case DMinor: return(Flat1, Minor); case CMajor: return(NoFlatsOrSharps, Major); case AMinor: return(NoFlatsOrSharps, Minor); case GMajor: return(Sharp1, Major); case EMinor: return(Sharp1, Minor); case DMajor: return(Sharp2, Major); case BMinor: return(Sharp2, Minor); case AMajor: return(Sharp3, Major); case FSharpMinor: return(Sharp3, Minor); case EMajor: return(Sharp4, Major); case CSharpMinor: return(Sharp4, Minor); case BMajor: return(Sharp5, Major); case GSharpMinor: return(Sharp5, Minor); case FSharpMajor: return(Sharp6, Major); case DSharpMinor: return(Sharp6, Minor); case CSharpMajor: return(Sharp7, Major); case ASharpMinor: return(Sharp7, Minor); default: throw new Exception(); } }
internal KeyEvent(uint ticks, NoteKey noteKey) : base(ticks) { this.noteKey = noteKey; }