Product.cs 4.4 KB

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