private void OnSongQueueUpdate(object source, HuntingHornSongEventArgs args) { if (args.IsCastingSongs) { return; } Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { if (SongQueue.Children.Count == args.SongsQueued) { int index = args.RawSongIndexesQueue[args.LastSongIndex]; if (args.Songs.Length < index + 1 || index < 0) { return; } sHuntingHornSong song = args.Songs[index]; SongComponent songComponent = new SongComponent() { SongName = GStrings.GetAbnormalityByID("HUNTINGHORN", song.BuffId, 0) }; songComponent.SetSong(song.Notes, cachedBrushes); SongQueue.Children.Insert(0, songComponent); SongQueue.Children.RemoveAt(SongQueue.Children.Count - 1); } else { bool insert = SongQueue.Children.Count > 0; // Add remaning songs to the queue based on the SongQueue length for (int i = 0; SongQueue.Children.Count < args.SongsQueued; i++) { int index = args.SongIndexesQueue[i]; sHuntingHornSong song = args.Songs[index]; SongComponent songComponent = new SongComponent() { SongName = GStrings.GetAbnormalityByID("HUNTINGHORN", song.BuffId, 0) }; songComponent.SetSong(song.Notes, cachedBrushes); if (insert) { SongQueue.Children.Insert(0, songComponent); } else { SongQueue.Children.Add(songComponent); } } } })); }
private void UpdatePredictedSong(sHuntingHornSong[] predictions) { PredictionSheet.Children.Clear(); foreach (sHuntingHornSong song in predictions) { SongPredComponent predDisplay = new SongPredComponent() { SongName = GStrings.GetAbnormalityByID("HUNTINGHORN", song.BuffId, 0) }; predDisplay.UpdateNote(song.Notes[song.NotesLength - 1], cachedBrushes[song.Notes[song.NotesLength - 1] - 1]); PredictionSheet.Children.Add(predDisplay); } }
private void PopulateAbnormalities(IEnumerable <AbnormalityInfo> abnormalities, Panel panel) { foreach (AbnormalityInfo abnormality in abnormalities) { string name = GStrings.GetAbnormalityByID(abnormality.Type, abnormality.Id, 0); bool isEnabled = bar.AcceptedAbnormalities.Contains(abnormality.InternalId); ImageSource icon = (ImageSource)FindResource(abnormality.IconName); icon?.Freeze(); AbnormalitySettingControl settingsControl = new AbnormalitySettingControl(); settingsControl.SetAbnormalityInfo(icon, name, abnormality.InternalId, isEnabled); abnormalityControls.Add(settingsControl); panel.Children.Add(settingsControl); } }
private void ReconstructQueue() { for (int i = 0; SongQueue.Children.Count < Context.SongsQueued; i++) { int index = Context.SongIndexesQueue[i]; sHuntingHornSong song = Context.Songs[index]; SongComponent songComponent = new SongComponent() { SongName = GStrings.GetAbnormalityByID("HUNTINGHORN", song.BuffId, 0) }; songComponent.SetSong(song.Notes, cachedBrushes); SongQueue.Children.Add(songComponent); } }
private void PopulateDebuffs() { foreach (XmlNode Abnorm in AbnormalityData.GetBlightAbnormalities()) { string Type = "DEBUFF"; int ID = int.Parse(Abnorm.Attributes["ID"].Value); string Name = GStrings.GetAbnormalityByID(Type, ID, 0); string InternalID = $"DE_{ID}"; bool IsEnabled = UserSettings.PlayerConfig.Overlay.AbnormalitiesWidget.BarPresets[BuffTrayIndex].AcceptedAbnormalities.Contains(InternalID); ImageSource Icon = TryFindResource(Abnorm.Attributes["Icon"].Value) as ImageSource ?? FindResource("ICON_MISSING") as ImageSource; Icon?.Freeze(); Parts.AbnormalitySettingControl AbnormDisplay = new Parts.AbnormalitySettingControl(); AbnormDisplay.SetAbnormalityInfo(Icon, Name, InternalID, IsEnabled); AbnormalitiesList.Add(AbnormDisplay); Debuffs.Children.Add(AbnormDisplay); } }