Product.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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 enabledSpecialRelation
  126. {
  127. get
  128. {
  129. return false;
  130. }
  131. }
  132. public static bool lockDLCSiteLink
  133. {
  134. get
  135. {
  136. return Product.type == Product.Type.EnPublic && File.Exists(Path.Combine(UTY.gameProjectPath, "platform_others"));
  137. }
  138. }
  139. public static void Initialize(AFileSystemBase fileSystem)
  140. {
  141. KeyValuePair<string, Product.Type>[] array = new KeyValuePair<string, Product.Type>[]
  142. {
  143. new KeyValuePair<string, Product.Type>("RDFBMTE5RTItMEQxOC00NkM3LUFCNzctRERGNjkyNjNCNzcy", Product.Type.JpAdult),
  144. new KeyValuePair<string, Product.Type>("Nzc1RjVFNUQtQzc5Ri00NThGLTg4QzYtRTEwQ0JCRTVCRTVB", Product.Type.JpPublic),
  145. new KeyValuePair<string, Product.Type>("QTZEQUE0MDItNTI4MS00RTMxLUFGOEMtMTY3RUE5M0QwQ0Q5", Product.Type.EnAdult),
  146. new KeyValuePair<string, Product.Type>("QzhFODY4MkMtRTU1QS00MDZBLTkyREItRjQ5RTE1N0Y4M0VC", Product.Type.EnPublic)
  147. };
  148. Encoding encoding = Encoding.GetEncoding("UTF-8");
  149. Product.type = Product.Type.JpAdult;
  150. foreach (KeyValuePair<string, Product.Type> keyValuePair in array)
  151. {
  152. if (fileSystem.IsExistentFile(encoding.GetString(Convert.FromBase64String(keyValuePair.Key))))
  153. {
  154. Product.type = keyValuePair.Value;
  155. break;
  156. }
  157. }
  158. Debug.Log("ProductType:" + Product.type.ToString());
  159. Product.systemLanguage = Product.defaultLanguage;
  160. }
  161. public static void OnApplicationQuit()
  162. {
  163. }
  164. public enum Type
  165. {
  166. JpAdult,
  167. JpPublic,
  168. EnAdult,
  169. EnPublic
  170. }
  171. public enum Language
  172. {
  173. Japanese,
  174. English
  175. }
  176. public static class EnumConvert
  177. {
  178. public static string GetString(Product.Language language)
  179. {
  180. if (language == Product.Language.Japanese)
  181. {
  182. return "日本語";
  183. }
  184. return "英語";
  185. }
  186. public static string ToI2LocalizeLanguageName(Product.Language language)
  187. {
  188. if (language == Product.Language.Japanese)
  189. {
  190. return "Japanese";
  191. }
  192. if (language != Product.Language.English)
  193. {
  194. return "Japanese";
  195. }
  196. return "English";
  197. }
  198. public static string GetTerm(Product.Language language)
  199. {
  200. return "System/言語/" + Product.EnumConvert.GetString(language);
  201. }
  202. }
  203. }