/// <summary> /// Indicates that a notes file has been added or removed /// </summary> /// <param name="item">GH notes item</param> /// <param name="addedRemoved">true=Added, false=Removed</param> internal GhItemMapChangedEventArgs(NotesFile fromFile, uint uniqueId, GhNotesItem toItem, bool isGenerated, bool addedRemoved) { this.ToGhNotesItem = toItem; this.FromFile = fromFile; this.UniqueId = uniqueId; this.IsGenerated = isGenerated; this.AddedRemoved = addedRemoved; }
public void Initialise(NotesFile baseNotesInfo, GhNotesItem[] items, float hopoMeasure, bool gh3SustainClipping, string[] wavPaths) { ne.NotesInfo = baseNotesInfo; ne.GhNotesInfoItems.AddRange(items); ne.WavFilenames.AddRange(wavPaths); ne.HoPoMeasure = hopoMeasure; ne.Gh3SustainClipping = gh3SustainClipping; ne.Initialise(); loadWindowInfo(this, _windowInfo); }
public MapSetting(int syncOffset, bool genSP, bool genFO, bool genBP, bool genNotes, uint uniqueId, GhNotesItem ghItem) { this.SyncOffset = syncOffset; this.GenSP = genSP; this.GenFO = genFO; this.GenBP = genBP; this.GenNotes = genNotes; this.UniqueId = uniqueId; this.GhItem = ghItem; }
private void addGhItem(GhNotesItem item) { ListViewItem li = new ListViewItem(item.Name); li.ImageIndex = (int)(item.Difficulty); li.SubItems.Add(""); li.SubItems.Add(""); li.SubItems.Add(""); li.SubItems.Add(""); li.SubItems.Add(""); li.SubItems.Add(""); lvwGh.Items.Add(li); }
private void setGhItemInformation(NotesFile file, uint uniqueId, GhNotesItem ghItem) { ListViewItem li = null; foreach (ListViewItem l in lvwGh.Items) { if (l.Text == ghItem.Name) { li = l; break; } } int fileNo = 0; for (int i = 0; i < lvwFiles.Items.Count; i++) { if (lvwFiles.Items[i].Tag == file) { fileNo = i + 1; break; } } if (li != null && ghItem != null) { if (ghItem.IsMapped) { li.SubItems[1].Text = ghItem.MappedFileItem.ButtonsUsed.ToString(); li.SubItems[2].Text = string.Concat(ghItem.MappedFileItem.NotesCount.ToString(), ghItem.MappedFileItem.HasGeneratedNotes ? " *" : string.Empty); if (_song.Notes.ForceNoStarPower) li.SubItems[3].Text = "0 (Forced)"; else li.SubItems[3].Text = string.Concat(ghItem.MappedFileItem.StarPowerCount.ToString(), ghItem.MappedFileItem.HasGeneratedStarPower ? " *" : string.Empty); li.SubItems[4].Text = string.Concat(ghItem.MappedFileItem.BattlePowerCount.ToString(), ghItem.MappedFileItem.HasGeneratedBattlePower ? " *" : string.Empty); li.SubItems[5].Text = string.Concat((ghItem.MappedFileItem.FaceOffP1Count + ghItem.MappedFileItem.FaceOffP2Count).ToString(), ghItem.MappedFileItem.HasGeneratedFaceOff ? " *" : string.Empty); string fileName = string.Format("{0} ({1})", fileNo.ToString(), (new FileInfo(file.Filename)).Extension.Substring(1)); if (ghItem.MappedFileItem.HasGeneratedNotes) li.SubItems[6].Text = string.Format("Generated from {0} : {1}", fileName, ghItem.MappedFileItem.SourceName); else li.SubItems[6].Text = string.Format("{0} : {1}", fileName, ghItem.MappedFileItem.SourceName); li.Tag = ghItem; } else { li.SubItems[1].Text = string.Empty; li.SubItems[2].Text = string.Empty; li.SubItems[3].Text = string.Empty; li.SubItems[4].Text = string.Empty; li.SubItems[5].Text = string.Empty; li.SubItems[6].Text = string.Empty; li.Tag = null; } } }
private bool findMatch(NotesFile nf, GhNotesItem ghi, NotesType type, NotesDifficulty difficulty) { string match; if (nf.Parser != null) { match = nf.Parser.MatchType(type, difficulty); if (match.Length != 0) { int j = 0; foreach (NotesFileItem nfi in nf.Items) { if (!ghi.IsMapped && nfi.SourceName == match && nfi.Notes.Length > 1 * 3) { this.MapToGhItem(nf, nfi.UniqueId, ghi, false); return true; } j++; } } } return false; }
protected void OnGhItemMapChanged(NotesFile fromFile, uint uniqueId, GhNotesItem toItem, bool isGenerated, bool addedRemoved) { if (GhItemMapChanged != null) GhItemMapChanged(this, new GhItemMapChangedEventArgs(fromFile, uniqueId, toItem, isGenerated, addedRemoved)); this.LastChanged = DateTime.Now; this.UpdateAffectsAudio = true; }
public void UnMapGhItem(GhNotesItem ghItem) { if (ghItem == null) return; bool gen = ghItem.MappedFileItem.HasGeneratedNotes; NotesFile nf = ghItem.MappedFile; uint id = 0; //unmap generated if (!gen) id = ghItem.MappedFileItem.UniqueId; ghItem.IsMapped = false; ghItem.MappedFile = null; ghItem.MappedFileItem = null; this.LastChanged = DateTime.Now; //Raise an event this.OnGhItemMapChanged(nf, id, ghItem, gen, false); }
/// <summary> /// Map the missing GH3 items to other difficulties /// </summary> //public void AutoMapMissing() //{ // foreach (GhNotesItem ghi in this.GhItems) // { // if (!ghi.IsMapped) // { // foreach (NotesFile nf in this.Files) // { // //loop up to expert // for (int i = (int)ghi.Difficulty; i <= (int)NotesDifficulty.Expert; i++) // findMatch(nf, ghi, (NotesDifficulty)i); // if (ghi.IsMapped) // break; // //loop down to easy // for (int i = ((int)ghi.Difficulty) - 1; i >= (int)NotesDifficulty.Easy; i--) // findMatch(nf, ghi, (NotesDifficulty)i); // if (ghi.IsMapped) // break; // } // if (ghi.IsMapped) // continue; // } // } //} public void MapToGhItem(NotesFile fromFile, uint uniqueId, GhNotesItem toItem, bool isGenerated) { toItem.IsMapped = true; toItem.MappedFile = fromFile; toItem.MappedFileItem = fromFile.FindItem(uniqueId); this.LastChanged = DateTime.Now; this.UpdateAffectsAudio = true; //Raise an event this.OnGhItemMapChanged(fromFile, uniqueId, toItem, isGenerated, false); }
public bool GenerateNotes(GhNotesItem ghi, bool force, bool replaceExistingSp, bool replaceExistingBattle, bool replaceExistingFaceOff, bool replaceGeneratedItems) { GhNotesItem source = null; if (!ghi.IsMapped || force) { //attempt to find a set of notes from the same notes type (Guitar / Rhythm etc) source = SourceGenerationItem(ghi.Type); if (source != null && source != ghi) { if (source.IsMapped && source.MappedFileItem.StarPowerCount <= 1) source.MappedFileItem.GenerateStarPower(this.BaseFile.Frets, true, null); ghi.GenerateNotes(this.BaseFile, source); ghi.MappedFileItem.SyncOffset = source.MappedFileItem.SyncOffset; this.OnGhItemMapChanged(source.MappedFile, ghi.MappedFileItem.UniqueId, ghi, true, true); } else return false; } else if (ghi.MappedFileItem.StarPowerCount <= 1 || replaceExistingSp || (ghi.MappedFileItem.HasGeneratedStarPower && replaceGeneratedItems)) { source = SourceGenerationItem(ghi.Type, NotesDifficulty.Expert); if (!source.IsMapped || (ghi.MappedFileItem.StarPowerCount <= 1 && ghi.Type != NotesType.Guitar)) source = SourceGenerationItem(NotesType.Guitar, NotesDifficulty.Expert); if (!source.IsMapped) this.GenerateNotes(source, true, true, true, true, true); if (source.MappedFileItem.StarPowerCount <= 1) source.MappedFileItem.GenerateStarPower(this.BaseFile.Frets, true, null); ghi.MappedFileItem.GenerateStarPower(this.BaseFile.Frets, false, source.MappedFileItem.StarPower); } if (ghi.MappedFileItem.BattlePowerCount <= 1 || replaceExistingBattle || (ghi.MappedFileItem.HasGeneratedBattlePower && replaceGeneratedItems)) { source = SourceGenerationItem(ghi.Type, NotesDifficulty.Expert); if (!source.IsMapped || (ghi.MappedFileItem.BattlePowerCount <= 1 && ghi.Type != NotesType.Guitar)) source = SourceGenerationItem(NotesType.Guitar, NotesDifficulty.Expert); if (!source.IsMapped) this.GenerateNotes(source, true, true, true, true, true); if (source.MappedFileItem.BattlePowerCount <= 1) source.MappedFileItem.GenerateBattlePower(this.BaseFile.Frets, source.MappedFileItem.StarPowerCount <= 1 ? null : source.MappedFileItem.StarPower); ghi.MappedFileItem.GenerateBattlePower(this.BaseFile.Frets, source.MappedFileItem.StarPower); } if (ghi.MappedFileItem.FaceOffP1Count <= 1 || ghi.MappedFileItem.FaceOffP2Count <= 1 || replaceExistingFaceOff || (ghi.MappedFileItem.HasGeneratedFaceOff && replaceGeneratedItems)) { source = SourceGenerationItem(ghi.Type, NotesDifficulty.Expert); if (!source.IsMapped || ((source.MappedFileItem.FaceOffP1Count <= 1 || source.MappedFileItem.FaceOffP2Count <= 1) && ghi.Type != NotesType.Guitar)) source = SourceGenerationItem(NotesType.Guitar, NotesDifficulty.Expert); if (!source.IsMapped) this.GenerateNotes(source, true, true, true, true, true); if (source.MappedFileItem.FaceOffP1Count <= 1 || source.MappedFileItem.FaceOffP2Count <= 1) source.MappedFileItem.GenerateFaceOff(this.BaseFile.Frets, null, null, source.MappedFileItem.StarPower); ghi.MappedFileItem.GenerateFaceOff(this.BaseFile.Frets, source.MappedFileItem.FaceOffP1, source.MappedFileItem.FaceOffP2, source.MappedFileItem.StarPower); } return true; }
public void GenerateNotes(NotesFile baseFile, GhNotesItem sourceItem) { this.IsMapped = true; this.MappedFile = sourceItem.MappedFile; this.MappedFileItem = new NotesFileItem(sourceItem.MappedFileItem.SourceName, baseFile, sourceItem.MappedFileItem, sourceItem.Difficulty, this.Difficulty); this.MappedFileItem.NotesGeneratedFrom = string.Format("{0} : {1}", sourceItem.Type.ToString(), sourceItem.Difficulty.ToString()); this.MappedFileItem.UniqueId = sourceItem.MappedFileItem.UniqueId; this.MappedFileItem.SyncOffset = sourceItem.MappedFileItem.SyncOffset; this.MappedFileItem.LastChanged = DateTime.Now; }