public Note findNote(string content, noteType type) { if (type == noteType.generalNote) { foreach (Note n in generalNoteList) { if (n.NoteContent == content) { return(n); } } } else { foreach (Campaign c in campaignList) { foreach (Note n in c.notes) { if (n.NoteContent == content) { return(n); } } } } return(null); }
public void initNote(string n, float width, float height, float rotation, float fs, direction dir, noteType nt) { Name = n; this.name = n; this.tag = "Note"; this.transform.SetPositionAndRotation(new Vector3(width, height, -5), Quaternion.Euler(0, 0, rotation)); this.transform.localScale = new Vector3(0.3f, 0.3f, 1f); Width = width; Height = height; Rotation = rotation; Direction = dir; Type = nt; fallingSpeed = fs; // Modify the game object passed on the information passed in. }
public void deleteNote(string content, noteType type) { Note noteToDelete = findNote(content, type); deleteNote(noteToDelete); }
// The list has notes that look like "(tag) note contents", so when selecting a note we have a parse // the note contents to give to findNote private string parseNoteContent(string stringToParse, out noteType type) { int OpenParenIndex = 0; int ClosedParenIndex = 0; if (stringToParse.ElementAt(2) != '(' && stringToParse.ElementAt(0) == '\u2022') // Applies to general notes, no tag { stringToParse = stringToParse.Substring(3).TrimEnd("\n ".ToCharArray()); // remove bullet point and space in the beginning type = noteType.generalNote; } else // if the note belongs to a campaign, trim off tag { if (stringToParse.Contains("(TIMER)")) { type = noteType.timer; } else { type = noteType.note; } // First half trims the tag off the noteContent for (int i = 0; i < stringToParse.Length && stringToParse[i] != '('; i++) { OpenParenIndex = i; } for (int i = OpenParenIndex; i < stringToParse.Length && stringToParse[i] != ')'; i++) { ClosedParenIndex = i; } if (stringToParse.Contains("(PAUSED)") && type == noteType.timer) { for (int i = ClosedParenIndex + 2; i < stringToParse.Length && stringToParse[i] != ')'; i++) { ClosedParenIndex = i; } } int startIndex = 0; if (OpenParenIndex < ClosedParenIndex) { startIndex = ClosedParenIndex + 3; } else { stringToParse = null; } stringToParse = stringToParse.Substring(startIndex).TrimEnd('\n'); } // This part applies if the current date is not the note's date // Trims off the (x years ago) or (in x years) if (stringToParse.ElementAt(stringToParse.Length - 1) == ')') { if (stringToParse.Contains(" years ago)") || stringToParse.Contains(" year ago)") || stringToParse.Contains(" years)") || stringToParse.Contains(" year)") || stringToParse.Contains(" days)") || stringToParse.Contains(" day)")) // If the end parenthesis is not part of the note { // such as (string) (1 year ago) for (int i = stringToParse.Length - 1; i > 0 && stringToParse[i] != '('; i--) { OpenParenIndex = i; } stringToParse = stringToParse.Substring(0, OpenParenIndex - 2); } else // if the end parentheses IS part of the string, such as the note being "this happened one year ago (about)" { // do nothing } } return(stringToParse); }
public void setNoteType(noteType NT) { myNoteAttribute.myNoteType = NT; }