Skip to content

Commit

Permalink
Fix #3977, language workshop tags will persist with some leniency.
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Jan 10, 2024
1 parent 9d2744a commit b1faab1
Showing 1 changed file with 6 additions and 5 deletions.
Expand Up @@ -151,12 +151,13 @@ public override void OnInitialize()
float localizationProgress = (float)countOtherEntries / countMaxEntries;
ModLoader.Logging.tML.Info($"{culture.Name}, {countOtherEntries}/{countMaxEntries}, {localizationProgress:P0}, missing {countMaxEntries - countOtherEntries}");

bool languageMostlyLocalized = localizationProgress > 0.75f; // Suitable threshold?
bool languageMostlyLocalized = localizationProgress > 0.75f; // 75% Threshold to be localized.
bool languagePreviouslyLocalizedAndStillEnough = tagOption.IsSelected && localizationProgress > 0.5f; // If mod previously tagged as localized, persist selection as long as above 50%

// Override existing selection or only set to true if true? Current behavior is override.
tagOption.SetCurrentOption(languageMostlyLocalized ? tagOption.OptionValue : null);
// Automatically set option is slightly redder, indicating it was automaticly selected
tagOption.SetColor(tagOption.IsSelected ? new Color(192, 175, 235) : Colors.InventoryDefaultColor, 1f);
// Override existing selection. Existing selection will persist if still above 50% to accommodate temporarily falling below threshold.
tagOption.SetCurrentOption(languageMostlyLocalized || languagePreviouslyLocalizedAndStillEnough ? tagOption.OptionValue : null);
// Automatically set option slightly redder, indicating it was automatically selected. Even redder if below 75%
tagOption.SetColor(tagOption.IsSelected ? (languageMostlyLocalized ? new Color(192, 175, 235) : new Color(255, 175, 235)) : Colors.InventoryDefaultColor, 1f);
}
}
}
Expand Down

0 comments on commit b1faab1

Please sign in to comment.