private void SelectCharasById(CharaId matchId) { var selected = 0; var origCharCount = StudioAPI.GetSelectedCharacters().Count(); var origObjCount = StudioAPI.GetSelectedObjects().Count() - origCharCount; foreach (var objectCtrlInfo in EnumerateObjects()) { Logger.DebugLogDebug($"SelectCharasById: {objectCtrlInfo}"); if (objectCtrlInfo is OCIChar ociChar) { if (DoesCharaMatch(matchId, ociChar)) { ociChar.MultiSelectInWorkarea(); selected++; } else { if (ociChar.IsSelectedInWorkarea()) { ociChar.UnselectInWorkarea(); } } } else { objectCtrlInfo.UnselectInWorkarea(); } } Logger.Log(BepInLogLevel.Info | BepInLogLevel.Message, $"characters selected: {selected} ({selected - origCharCount} new selections, {origObjCount} non-characters unselected)"); GeBoAPI.Instance.PlayNotificationSound(NotificationSound.Success); }
private static bool DoesCharaMatch(CharaId charaId, OCIChar test) { return(charaId == test.GetMatchId()); }