Product.cs 4.6 KB

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