Product.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. using System;
  2. using I2.Loc;
  3. using UnityEngine;
  4. public static class Product
  5. {
  6. public static Product.Type type { get; private set; }
  7. public static bool supportMultiLanguage
  8. {
  9. get
  10. {
  11. return Product.type != Product.Type.JpAdult && Product.type != Product.Type.JpPublic;
  12. }
  13. }
  14. public static bool isPublic
  15. {
  16. get
  17. {
  18. return Product.type == Product.Type.JpPublic || Product.type == Product.Type.EnPublic;
  19. }
  20. }
  21. public static bool isJapan
  22. {
  23. get
  24. {
  25. return Product.type == Product.Type.JpAdult || Product.type == Product.Type.JpPublic;
  26. }
  27. }
  28. public static bool isEnglish
  29. {
  30. get
  31. {
  32. return Product.type == Product.Type.EnAdult || Product.type == Product.Type.EnPublic;
  33. }
  34. }
  35. public static Product.Language systemLanguage
  36. {
  37. get
  38. {
  39. if (!Product.supportMultiLanguage)
  40. {
  41. return Product.Language.Japanese;
  42. }
  43. string currentLanguage = LocalizationManager.CurrentLanguage;
  44. return (!(currentLanguage == "English")) ? Product.Language.Japanese : Product.Language.English;
  45. }
  46. set
  47. {
  48. if (!Product.supportMultiLanguage)
  49. {
  50. LocalizationManager.CurrentLanguage = Product.EnumConvert.ToI2LocalizeLanguageName(Product.Language.Japanese);
  51. return;
  52. }
  53. LocalizationManager.CurrentLanguage = Product.EnumConvert.ToI2LocalizeLanguageName(value);
  54. foreach (LanguageSource languageSource in LocalizationManager.Sources)
  55. {
  56. languageSource.LoadAllLanguages(false);
  57. }
  58. }
  59. }
  60. public static Product.Language defaultLanguage
  61. {
  62. get
  63. {
  64. return (!Product.supportMultiLanguage) ? Product.Language.Japanese : Product.Language.English;
  65. }
  66. }
  67. public static string gameTitle
  68. {
  69. get
  70. {
  71. string text = "System/カスタムオーダーメイド3D 2";
  72. if (Product.isPublic)
  73. {
  74. text += "全年齢";
  75. }
  76. return LocalizationManager.GetTranslation(text, true, 0, true, false, null, Product.EnumConvert.ToI2LocalizeLanguageName(Product.systemLanguage));
  77. }
  78. }
  79. public static string windowTitel
  80. {
  81. get
  82. {
  83. string text = Product.gameTitle;
  84. if (Product.isJapan)
  85. {
  86. text = "CUSTOM ORDER MAID 3D 2";
  87. if (Product.isPublic)
  88. {
  89. text += " It's a Night Magic";
  90. }
  91. }
  92. return text;
  93. }
  94. }
  95. public static string gameDataPath
  96. {
  97. get
  98. {
  99. Product.Type type = Product.type;
  100. if (type == Product.Type.JpPublic)
  101. {
  102. return "_public";
  103. }
  104. if (type == Product.Type.EnAdult)
  105. {
  106. return "_en";
  107. }
  108. if (type != Product.Type.EnPublic)
  109. {
  110. return string.Empty;
  111. }
  112. return "_enpublic";
  113. }
  114. }
  115. public static bool enabeldAdditionalRelation
  116. {
  117. get
  118. {
  119. return Product.type != Product.Type.JpAdult;
  120. }
  121. }
  122. public static void Initialize(AFileSystemBase fileSystem)
  123. {
  124. Product.type = Product.Type.JpAdult;
  125. Debug.Log("ProductType:" + Product.type.ToString());
  126. Product.systemLanguage = Product.defaultLanguage;
  127. }
  128. public static void OnApplicationQuit()
  129. {
  130. }
  131. public enum Type
  132. {
  133. JpAdult,
  134. JpPublic,
  135. EnAdult,
  136. EnPublic
  137. }
  138. public enum Language
  139. {
  140. Japanese,
  141. English
  142. }
  143. public static class EnumConvert
  144. {
  145. public static string GetString(Product.Language language)
  146. {
  147. if (language == Product.Language.Japanese)
  148. {
  149. return "日本語";
  150. }
  151. return "英語";
  152. }
  153. public static string ToI2LocalizeLanguageName(Product.Language language)
  154. {
  155. if (language == Product.Language.Japanese)
  156. {
  157. return "Japanese";
  158. }
  159. if (language != Product.Language.English)
  160. {
  161. return "Japanese";
  162. }
  163. return "English";
  164. }
  165. public static string GetTerm(Product.Language language)
  166. {
  167. return "System/言語/" + Product.EnumConvert.GetString(language);
  168. }
  169. }
  170. }