LocalizeTarget_UnityStandard_GUITexture.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using UnityEngine;
  3. namespace I2.Loc
  4. {
  5. public class LocalizeTarget_UnityStandard_GUITexture : LocalizeTarget<GUITexture>
  6. {
  7. static LocalizeTarget_UnityStandard_GUITexture()
  8. {
  9. LocalizeTarget_UnityStandard_GUITexture.AutoRegister();
  10. }
  11. [RuntimeInitializeOnLoadMethod]
  12. private static void AutoRegister()
  13. {
  14. LocalizationManager.RegisterTarget(new LocalizeTargetDesc_Type<GUITexture, LocalizeTarget_UnityStandard_GUITexture>
  15. {
  16. Name = "GUITexture",
  17. Priority = 100
  18. });
  19. }
  20. public override eTermType GetPrimaryTermType(Localize cmp)
  21. {
  22. return eTermType.Texture;
  23. }
  24. public override eTermType GetSecondaryTermType(Localize cmp)
  25. {
  26. return eTermType.Text;
  27. }
  28. public override bool CanUseSecondaryTerm()
  29. {
  30. return false;
  31. }
  32. public override bool AllowMainTermToBeRTL()
  33. {
  34. return false;
  35. }
  36. public override bool AllowSecondTermToBeRTL()
  37. {
  38. return false;
  39. }
  40. public override void GetFinalTerms(Localize cmp, string Main, string Secondary, out string primaryTerm, out string secondaryTerm)
  41. {
  42. primaryTerm = ((!this.mTarget.texture) ? string.Empty : this.mTarget.texture.name);
  43. secondaryTerm = null;
  44. }
  45. public override void DoLocalize(Localize cmp, string mainTranslation, string secondaryTranslation)
  46. {
  47. Texture texture = this.mTarget.texture;
  48. if (texture == null || texture.name != mainTranslation)
  49. {
  50. this.mTarget.texture = cmp.FindTranslatedObject<Texture>(mainTranslation);
  51. }
  52. }
  53. }
  54. }