private static void SelectTextCallback(IComponentTranslationContext context) { if (!_pointerCallbackRegistered || !MakerAPI.InsideMaker) { return; } // ReSharper disable once InvertIf if (ComponentTranslationHelpers.TryTranslateFullName(context, t => t != null && PointerCallbackActiveTexts.Contains(t), () => null, (CharacterSex)MakerAPI.GetMakerSex())) { context.IgnoreComponent(); } }
private static void CharaListHandler(IComponentTranslationContext obj) { // TODO: migrate to a version of this call /* * if (ComponentTranslationHelpers.TryTranslateFullName(obj, * ShouldHandleCharaListText, * ()=>null, * * t => t != null && PointerCallbackActiveTexts.Contains(t), * () => null, (CharacterSex)MakerAPI.GetMakerSex())) * { * obj.IgnoreComponent(); * } */ if (!TranslationHelper.Instance.CurrentCardLoadTranslationEnabled || CharaListsInProgress.Count == 0) { return; } var textComponent = obj.Component as Text; if (textComponent == null) { return; } var charaList = textComponent.GetComponentInParent <CharaList>(); if (charaList == null || !CharaListsInProgress.Contains(charaList)) { return; } CharacterSex sex; if (charaList.name.EndsWith("_Male", StringComparison.OrdinalIgnoreCase)) { sex = CharacterSex.Male; } else if (charaList.name.EndsWith("_Female", StringComparison.OrdinalIgnoreCase)) { sex = CharacterSex.Female; } else { return; } /* * var scope = new NameScope(sex); * if (TranslationHelper.TryFastTranslateFullName(scope, textComponent.text, out var translatedName)) * { * obj.OverrideTranslatedText(translatedName); * obj.IgnoreComponent(); * } */ if (ComponentTranslationHelpers.TryTranslateFullName(obj, ShouldHandleCharaListText, () => null, sex)) { obj.IgnoreComponent(); } }