ContinuousController.cs 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413
  1. using Photon.Pun;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Threading.Tasks;
  7. using UnityEngine;
  8. using UnityEngine.Events;
  9. using UnityEngine.EventSystems;
  10. using UnityEngine.SceneManagement;
  11. using Hashtable = ExitGames.Client.Photon.Hashtable;
  12. public class ContinuousController : MonoBehaviour
  13. {
  14. [Header("game language")]
  15. // public Language language;
  16. [Header("Game version")]
  17. public float GameVer;
  18. [Header("ignore updates")]
  19. public bool IgnoreUpdate;
  20. [Header("card list")]
  21. public CEntity_Base[] CardList = new CEntity_Base[] { };
  22. [Header("Card list sorted by card ID")]
  23. public CEntity_Base[] SortedCardList = new CEntity_Base[] { };
  24. [Header("Card back image")]
  25. public Sprite ReverseCard;
  26. public Sprite ReverseCard_Digitama;
  27. [Header("SE prefab")]
  28. public SoundObject soundObject;
  29. [Header("deck code encryption")]
  30. public ShuffleDeckCode ShuffleDeckCode;
  31. DeckData _battleDeckData = null;
  32. public DeckData BattleDeckData
  33. {
  34. get
  35. {
  36. return _battleDeckData;
  37. }
  38. set
  39. {
  40. _battleDeckData = value;
  41. if (value != null)
  42. {
  43. LastBattleDeckData = value;
  44. }
  45. }
  46. }
  47. public DeckData LastBattleDeckData { get; private set; } = null;
  48. public bool NeedUpdate { get; set; }
  49. public bool isRandomMatch { get; set; }
  50. [HideInInspector] public List<SkillInfo> nullSkillInfos = null;
  51. public String GameVerString => Application.version;//GameVer.ToString(CultureInfo.InvariantCulture);
  52. #region Key for property to save deck data for battle
  53. public static string DeckDataPropertyKey => "BattleDeckData";
  54. #endregion
  55. #region Key for the property that stores the player name data
  56. public static string PlayerNameKey => "PlayerNameKey";
  57. #endregion
  58. #region Key for the property that stores the win count data
  59. public static string WinCountKey => "WinCountKey";
  60. #endregion
  61. [Header("Player name character limit")]
  62. public int PlayerNameMaxLength;
  63. #region Call up a scene for data storage
  64. public static IEnumerator LoadCoroutine()
  65. {
  66. if (instance == null)
  67. {
  68. SceneManager.LoadSceneAsync("ContinuousControllerScene", LoadSceneMode.Additive);
  69. while (instance == null)
  70. {
  71. yield return null;
  72. }
  73. instance.Init();
  74. }
  75. }
  76. #endregion
  77. #region List of Deck Recipes
  78. public List<DeckData> DeckDatas { get; set; } = new List<DeckData>();
  79. #endregion
  80. #region Deck Recipe Key
  81. public string DeckDatasPlayerPrefsKey { get { return "DeckDatas3"; } }
  82. #endregion
  83. public CEntity_Base DiaboromonToken { get; private set; }
  84. public CEntity_Base AmonToken { get; private set; }
  85. public CEntity_Base UmonToken { get; private set; }
  86. public CEntity_Base FujitsumonToken { get; private set; }
  87. public CEntity_Base GyuukimonToken { get; private set; }
  88. public CEntity_Base KoHagurumonToken { get; private set; }
  89. public CEntity_Base FamiliarToken { get; private set; }
  90. public CardRestriction BanList { get; private set; } = new CardRestriction(new List<CardLimitCount>(), new List<BannedPair>());
  91. void LoadBanList()
  92. {
  93. BanList = DataBase.ENGBanList;
  94. }
  95. async Task CreateTokenData()
  96. {
  97. DiaboromonToken = new CEntity_Base()
  98. {
  99. cardColors = new List<CardColor>() { CardColor.White },
  100. PlayCost = 14,
  101. Level = 6,
  102. CardName_JPN = "ディアボロモン",
  103. CardName_ENG = "Diaboromon",
  104. Form_JPN = new List<string>() { "究極体" },
  105. Form_ENG = new List<string>() { "Mega" },
  106. Attribute_JPN = new List<string>() { "不明" },
  107. Attribute_ENG = new List<string>() { "Unknown" },
  108. Type_JPN = new List<string>() { "種族不明" },
  109. Type_ENG = new List<string>() { "Unidentified" },
  110. CardSpriteName = "BT2-082-token",
  111. cardKind = CardKind.Digimon,
  112. DP = 3000,
  113. };
  114. await DiaboromonToken.GetCardSprite();
  115. AmonToken = new CEntity_Base()
  116. {
  117. cardColors = new List<CardColor>() { CardColor.Red },
  118. PlayCost = -1,
  119. Level = 0,
  120. CardName_JPN = "紅炎のアモン",
  121. CardName_ENG = "Amon of Crimson Flame",
  122. Form_JPN = new List<string>(),
  123. Form_ENG = new List<string>(),
  124. Attribute_JPN = new List<string>(),
  125. Attribute_ENG = new List<string>(),
  126. Type_JPN = new List<string>(),
  127. Type_ENG = new List<string>(),
  128. CardSpriteName = "BT14-018-token-red",
  129. cardKind = CardKind.Digimon,
  130. DP = 6000,
  131. CardEffectClassName = "Bushiagumon_BT4_038"
  132. };
  133. await AmonToken.GetCardSprite();
  134. UmonToken = new CEntity_Base()
  135. {
  136. cardColors = new List<CardColor>() { CardColor.Yellow },
  137. PlayCost = -1,
  138. Level = 0,
  139. CardName_JPN = "蒼雷のウモン",
  140. CardName_ENG = "Umon of Blue Thunder",
  141. Form_JPN = new List<string>(),
  142. Form_ENG = new List<string>(),
  143. Attribute_JPN = new List<string>(),
  144. Attribute_ENG = new List<string>(),
  145. Type_JPN = new List<string>(),
  146. Type_ENG = new List<string>(),
  147. CardSpriteName = "BT14-018-token-yellow",
  148. cardKind = CardKind.Digimon,
  149. DP = 6000,
  150. CardEffectClassName = "Koemon_BT1_031"
  151. };
  152. await UmonToken.GetCardSprite();
  153. FujitsumonToken = new CEntity_Base()
  154. {
  155. cardColors = new List<CardColor>() { CardColor.Purple },
  156. PlayCost = -1,
  157. Level = 0,
  158. CardName_JPN = "フジツモン",
  159. CardName_ENG = "Fujitsumon",
  160. Form_JPN = new List<string>(),
  161. Form_ENG = new List<string>(),
  162. Attribute_JPN = new List<string>(),
  163. Attribute_ENG = new List<string>(),
  164. Type_JPN = new List<string>(),
  165. Type_ENG = new List<string>(),
  166. CardSpriteName = "EX5-058-token",
  167. cardKind = CardKind.Digimon,
  168. DP = 3000,
  169. CardEffectClassName = "Fujitsumon_EX5_058_token"
  170. };
  171. await FujitsumonToken.GetCardSprite();
  172. GyuukimonToken = new CEntity_Base()
  173. {
  174. cardColors = new List<CardColor>() { CardColor.Purple },
  175. PlayCost = 7,
  176. Level = 5,
  177. CardName_JPN = "ギュウキモン",
  178. CardName_ENG = "Gyuukimon",
  179. Form_JPN = new List<string>() { "究極の" },
  180. Form_ENG = new List<string>() { "Ultimate" },
  181. Attribute_JPN = new List<string>() { "ウイルス" },
  182. Attribute_ENG = new List<string>() { "Virus" },
  183. Type_JPN = new List<string>() { "ダークアニマル" },
  184. Type_ENG = new List<string>() { "Dark Animal" },
  185. CardSpriteName = "LM-018-token",
  186. cardKind = CardKind.Digimon,
  187. DP = 3000,
  188. };
  189. await GyuukimonToken.GetCardSprite();
  190. KoHagurumonToken = new CEntity_Base()
  191. {
  192. cardColors = new List<CardColor>() { CardColor.Black },
  193. PlayCost = -1,
  194. Level = 0,
  195. CardName_JPN = "",
  196. CardName_ENG = "KoHagurumon",
  197. Form_JPN = new List<string>(),
  198. Form_ENG = new List<string>(),
  199. Attribute_JPN = new List<string>(),
  200. Attribute_ENG = new List<string>(),
  201. Type_JPN = new List<string>(),
  202. Type_ENG = new List<string>(),
  203. CardSpriteName = "BT16-052-token",
  204. cardKind = CardKind.Digimon,
  205. DP = 1000,
  206. CardEffectClassName = "KoHagurumon_BT16_052_token"
  207. };
  208. await KoHagurumonToken.GetCardSprite();
  209. FamiliarToken = new CEntity_Base()
  210. {
  211. cardColors = new List<CardColor>() { CardColor.Yellow },
  212. PlayCost = -1,
  213. Level = 0,
  214. CardName_JPN = "",
  215. CardName_ENG = "Familiar",
  216. Form_JPN = new List<string>(),
  217. Form_ENG = new List<string>(),
  218. Attribute_JPN = new List<string>(),
  219. Attribute_ENG = new List<string>(),
  220. Type_JPN = new List<string>(),
  221. Type_ENG = new List<string>(),
  222. CardSpriteName = "EX7-030-token",
  223. cardKind = CardKind.Digimon,
  224. DP = 3000,
  225. CardEffectClassName = "Familiar_EX7_030_token"
  226. };
  227. await FamiliarToken.GetCardSprite();
  228. }
  229. public static ContinuousController instance = null;
  230. private void Awake()
  231. {
  232. instance = this;
  233. }
  234. public async void Init()
  235. {
  236. Application.targetFrameRate = 60;
  237. int random = RandomUtility.getRamdom();
  238. UnityEngine.Random.InitState(random);
  239. Debug.Log($"Game Initialize - random number sequence initialization,InitState:{random}");
  240. Sprite reverseCardSprite = await StreamingAssetsUtility.GetSprite("card_back_main");
  241. if (reverseCardSprite != null)
  242. {
  243. ReverseCard = reverseCardSprite;
  244. }
  245. Sprite reverseDigieggCardSprite = await StreamingAssetsUtility.GetSprite("card_back_sub");
  246. if (reverseDigieggCardSprite != null)
  247. {
  248. ReverseCard_Digitama = reverseDigieggCardSprite;
  249. }
  250. // deck data
  251. //DeckDatas = PlayerPrefsUtil.LoadList<DeckData>(DeckDatasPlayerPrefsKey);
  252. LoadDeckLists();
  253. GetComponent<StarterDeck>().SetStarterDecks();
  254. // player data
  255. LoadPlayerName();
  256. LoadWinCount();
  257. // game play
  258. LoadAutoEffectOrder();
  259. LoadAutoDeckBottomOrder();
  260. LoadAutoDeckTopOrder();
  261. LoadAutoMinDigivolutionCost();
  262. LoadAutoMaxCardCount();
  263. LoadAutoHatch();
  264. LoadShowCutInAnimation();
  265. LoadReverseOpponentsCards();
  266. LoadTurnSuspendedCards();
  267. LoadCheckBeforeEndingSelection();
  268. LoadSuspendedCardsDirectionIsLeft();
  269. //Graphics
  270. LoadShowBackgroundParticle();
  271. // Sound
  272. LoadVolume();
  273. // ServerRegion
  274. LoadServerRegion();
  275. // Language
  276. LoadLanguage();
  277. await CreateTokenData();
  278. LoadBanList();
  279. DontDestroyOnLoad(gameObject);
  280. }
  281. [Obsolete("This is obsolete, switching to save files")]
  282. public void ModifyAllDeckDatas()
  283. {
  284. List<DeckData> tempDeckDatas = new List<DeckData>();
  285. foreach (DeckData deckData in DeckDatas)
  286. {
  287. tempDeckDatas.Add(deckData);
  288. }
  289. foreach (DeckData deckData in tempDeckDatas)
  290. {
  291. if (deckData.AllDeckCards().Count == 0)
  292. {
  293. DeckDatas.Remove(deckData);
  294. }
  295. }
  296. for (int i = 0; i < DeckDatas.Count; i++)
  297. {
  298. //DeckData deckData = new DeckData(DeckData.GetDeckCode(DeckDatas[i].DeckName, DeckData.SortedDeckCardsList(DeckDatas[i].DeckCards()), DeckData.SortedDeckCardsList(DeckDatas[i].DigitamaDeckCards()), DeckDatas[i].KeyCard));
  299. DeckData deckData = DeckDatas[i];
  300. DeckDatas[i] = deckData.ModifiedDeckData();
  301. }
  302. SaveDeckDatas();
  303. }
  304. [Obsolete("This is obsolete, switching to save files")]
  305. public void SaveDeckDatas()
  306. {
  307. PlayerPrefsUtil.SaveList(DeckDatasPlayerPrefsKey, DeckDatas);
  308. PlayerPrefs.Save();
  309. }
  310. public void SaveDeckData(DeckData data)
  311. {
  312. string savePath = StreamingAssetsUtility.GetStreamingAssetPath("Decks", false);
  313. File.WriteAllText($"{savePath}/{data.DeckName}_{data.DeckID}.txt", DeckCodeUtility.GetDeckBuilderFile(data));
  314. }
  315. public void RenameDeck(DeckData data, string newName)
  316. {
  317. string savePath = StreamingAssetsUtility.GetStreamingAssetPath("Decks", false);
  318. if (File.Exists($"{savePath}/{data.DeckName}_{data.DeckID}.txt"))
  319. {
  320. File.Move($"{savePath}/{data.DeckName}_{data.DeckID}.txt", $"{savePath}/{newName}_{data.DeckID}.txt");
  321. data.DeckName = newName;
  322. SaveDeckData(data);
  323. }
  324. else
  325. data.DeckName = newName;
  326. }
  327. public void DeleteDeck(DeckData data)
  328. {
  329. string filePath = StreamingAssetsUtility.GetStreamingAssetPath("Decks", false);
  330. if (!Directory.Exists(filePath))
  331. return;
  332. if (!File.Exists($"{filePath}/{data.DeckName}_{data.DeckID}.txt"))
  333. return;
  334. File.Delete($"{filePath}/{data.DeckName}_{data.DeckID}.txt");
  335. }
  336. public void DeleteAllDecks()
  337. {
  338. foreach(DeckData data in DeckDatas)
  339. {
  340. DeleteDeck(data);
  341. }
  342. }
  343. public void LoadDeckLists()
  344. {
  345. string loadPath = StreamingAssetsUtility.GetStreamingAssetPath("Decks", false);
  346. if (!Directory.Exists(loadPath))
  347. return;
  348. string[] deckLists = Directory.GetFiles(loadPath);
  349. foreach(string deckPath in deckLists)
  350. {
  351. string fileName = Path.GetFileNameWithoutExtension(deckPath);
  352. if (!fileName.Contains("_"))
  353. continue;
  354. string deckList = File.ReadAllText(deckPath);
  355. StreamReader sr = new StreamReader(deckPath);
  356. string deckName = sr.ReadLine().Replace("Name: ", "");
  357. int KeyCard = int.Parse(sr.ReadLine().Replace("Key Card: ", ""));
  358. int SortValue = int.Parse(sr.ReadLine().Replace("Sort Index: ", ""));
  359. sr.Close();
  360. string deck = deckList.Substring(deckList.IndexOf("//"));
  361. //Debug.Log(deckName);
  362. if(SortValue < 0)
  363. SortValue = 0;
  364. CreateDeckFromFile(fileName.Split("_")[1], deckName, KeyCard, deck, SortValue);
  365. }
  366. }
  367. private void CreateDeckFromFile(string id, string name, int keyID, string deckCode, int index = 0)
  368. {
  369. List<CEntity_Base> AllDeckCards = DeckCodeUtility.GetAllDeckCardsFromDeckBuilderDeckCode(deckCode);
  370. if (AllDeckCards.Count == 0)
  371. {
  372. AllDeckCards = DeckCodeUtility.GetAllDeckCardsFromTTSDeckCode(deckCode);
  373. }
  374. List<CEntity_Base> deckCards = new List<CEntity_Base>();
  375. List<CEntity_Base> digitamaDeckCards = new List<CEntity_Base>();
  376. foreach (CEntity_Base cEntity_Base in AllDeckCards)
  377. {
  378. if (cEntity_Base.cardKind == CardKind.DigiEgg)
  379. {
  380. digitamaDeckCards.Add(cEntity_Base);
  381. }
  382. else
  383. {
  384. deckCards.Add(cEntity_Base);
  385. }
  386. }
  387. DeckData deckData = (new DeckData(DeckData.GetDeckCode(name, deckCards, digitamaDeckCards, null),id)).ModifiedDeckData();
  388. deckData.KeyCardId = keyID;
  389. deckData.DeckName = name;
  390. deckData.SortValue = index;
  391. DeckDatas.Insert(index, deckData);
  392. }
  393. #region Player Name
  394. string _playerName;
  395. string _playerNameKey = "PlayerName";
  396. public string PlayerName
  397. {
  398. get
  399. {
  400. if (string.IsNullOrEmpty(_playerName))
  401. {
  402. return "Player";
  403. }
  404. return _playerName;
  405. }
  406. set
  407. {
  408. _playerName = value;
  409. }
  410. }
  411. public void SavePlayerName(string playerName)
  412. {
  413. PlayerName = playerName;
  414. PlayerPrefs.SetString(_playerNameKey, playerName);
  415. PlayerPrefs.Save();
  416. }
  417. public void LoadPlayerName()
  418. {
  419. if (PlayerPrefs.HasKey(_playerNameKey))
  420. {
  421. PlayerName = PlayerPrefs.GetString(_playerNameKey);
  422. }
  423. if (string.IsNullOrEmpty(PlayerName))
  424. {
  425. PlayerName = "Player";
  426. }
  427. }
  428. #endregion
  429. #region number of victories
  430. public int WinCount { get; set; }
  431. string _winCountKey = "WinCount";
  432. public void SaveWinCount()
  433. {
  434. PlayerPrefs.SetInt(_winCountKey, WinCount);
  435. PlayerPrefs.Save();
  436. }
  437. public void LoadWinCount()
  438. {
  439. if (PlayerPrefs.HasKey(_winCountKey))
  440. {
  441. WinCount = PlayerPrefs.GetInt(_winCountKey);
  442. }
  443. }
  444. #endregion
  445. #region Auto effect order
  446. [HideInInspector] public bool autoEffectOrder = false;
  447. string _autoEffectOrderKey = "AutoEffectOrder";
  448. public void SaveAutoEffectOrder()
  449. {
  450. PlayerPrefsUtil.SetBool(_autoEffectOrderKey, autoEffectOrder);
  451. PlayerPrefs.Save();
  452. }
  453. public void LoadAutoEffectOrder()
  454. {
  455. autoEffectOrder = PlayerPrefsUtil.GetBool(_autoEffectOrderKey, false);
  456. }
  457. #endregion
  458. #region Auto deck bottom order
  459. [HideInInspector] public bool autoDeckBottomOrder = false;
  460. string _autoDeckBottomOrderKey = "AutoDeckBottomOrder";
  461. public void SaveAutoDeckBottomOrder()
  462. {
  463. PlayerPrefsUtil.SetBool(_autoDeckBottomOrderKey, autoDeckBottomOrder);
  464. PlayerPrefs.Save();
  465. }
  466. public void LoadAutoDeckBottomOrder()
  467. {
  468. autoDeckBottomOrder = PlayerPrefsUtil.GetBool(_autoDeckBottomOrderKey, false);
  469. }
  470. #endregion
  471. #region Auto deck top order
  472. [HideInInspector] public bool autoDeckTopOrder = false;
  473. string _autoDeckTopOrderKey = "AutoDeckTopOrder";
  474. public void SaveAutoDeckTopOrder()
  475. {
  476. PlayerPrefsUtil.SetBool(_autoDeckTopOrderKey, autoDeckTopOrder);
  477. PlayerPrefs.Save();
  478. }
  479. public void LoadAutoDeckTopOrder()
  480. {
  481. autoDeckTopOrder = PlayerPrefsUtil.GetBool(_autoDeckTopOrderKey, false);
  482. }
  483. #endregion
  484. #region Auto min digivolution cost
  485. [HideInInspector] public bool autoMinDigivolutionCost = false;
  486. string _autoMinDigivolutionCostKey = "AutoMinDigivolutionCost";
  487. public void SaveAutoMinDigivolutionCost()
  488. {
  489. PlayerPrefsUtil.SetBool(_autoMinDigivolutionCostKey, autoMinDigivolutionCost);
  490. PlayerPrefs.Save();
  491. }
  492. public void LoadAutoMinDigivolutionCost()
  493. {
  494. autoMinDigivolutionCost = PlayerPrefsUtil.GetBool(_autoMinDigivolutionCostKey, false);
  495. }
  496. #endregion
  497. #region Auto max card count
  498. [HideInInspector] public bool autoMaxCardCount = false;
  499. string _autoMaxCardCountKey = "AutoMaxCardCount";
  500. public void SaveAutoMaxCardCount()
  501. {
  502. PlayerPrefsUtil.SetBool(_autoMaxCardCountKey, autoMaxCardCount);
  503. PlayerPrefs.Save();
  504. }
  505. public void LoadAutoMaxCardCount()
  506. {
  507. autoMaxCardCount = PlayerPrefsUtil.GetBool(_autoMaxCardCountKey, false);
  508. }
  509. #endregion
  510. #region Auto hatch
  511. [HideInInspector] public bool autoHatch = false;
  512. string _autoHatchKey = "AutoHatch";
  513. public void SaveAutoHatch()
  514. {
  515. PlayerPrefsUtil.SetBool(_autoHatchKey, autoHatch);
  516. PlayerPrefs.Save();
  517. }
  518. public void LoadAutoHatch()
  519. {
  520. autoHatch = PlayerPrefsUtil.GetBool(_autoHatchKey, false);
  521. }
  522. #endregion
  523. #region Show CutIn Animation
  524. [HideInInspector] public bool showCutInAnimation = false;
  525. string _showCutInAnimationKey = "ShowCutInAnimation";
  526. public void SaveShowCutInAnimation()
  527. {
  528. PlayerPrefsUtil.SetBool(_showCutInAnimationKey, showCutInAnimation);
  529. PlayerPrefs.Save();
  530. }
  531. public void LoadShowCutInAnimation()
  532. {
  533. //TODO: Setting default to false, to fix animation syncing bug, MB
  534. showCutInAnimation = false;
  535. //showCutInAnimation = PlayerPrefsUtil.GetBool(_showCutInAnimationKey, true);
  536. }
  537. #endregion
  538. #region Reverse opponents' cards
  539. [HideInInspector] public bool reverseOpponentsCards = false;
  540. string _reverseOpponentsCardsKey = "ReverseOpponentsCards";
  541. public void SaveReverseOpponentsCards()
  542. {
  543. PlayerPrefsUtil.SetBool(_reverseOpponentsCardsKey, reverseOpponentsCards);
  544. PlayerPrefs.Save();
  545. }
  546. public void LoadReverseOpponentsCards()
  547. {
  548. reverseOpponentsCards = PlayerPrefsUtil.GetBool(_reverseOpponentsCardsKey, false);
  549. }
  550. #endregion
  551. #region Turn suspended cards
  552. [HideInInspector] public bool turnSuspendedCards = false;
  553. string _turnSuspendedCardsKey = "TurnSuspendedCards";
  554. public void SaveTurnSuspendedCards()
  555. {
  556. PlayerPrefsUtil.SetBool(_turnSuspendedCardsKey, turnSuspendedCards);
  557. PlayerPrefs.Save();
  558. }
  559. public void LoadTurnSuspendedCards()
  560. {
  561. turnSuspendedCards = PlayerPrefsUtil.GetBool(_turnSuspendedCardsKey, true);
  562. }
  563. #endregion
  564. #region Check before ending selection
  565. [HideInInspector] public bool checkBeforeEndingSelection = false;
  566. string _checkBeforeEndingSelectionKey = "CheckBeforeEndingSelection";
  567. public void SaveCheckBeforeEndingSelection()
  568. {
  569. PlayerPrefsUtil.SetBool(_checkBeforeEndingSelectionKey, checkBeforeEndingSelection);
  570. PlayerPrefs.Save();
  571. }
  572. public void LoadCheckBeforeEndingSelection()
  573. {
  574. checkBeforeEndingSelection = PlayerPrefsUtil.GetBool(_checkBeforeEndingSelectionKey, true);
  575. }
  576. #endregion
  577. #region Suspended cards' direction is left
  578. [HideInInspector] public bool suspendedCardsDirectionIsLeft = false;
  579. string _suspendedCardsDirectionIsLeftKey = "SuspendedCardsDirectionIsLeft";
  580. public void SaveSuspendedCardsDirectionIsLeft()
  581. {
  582. PlayerPrefsUtil.SetBool(_suspendedCardsDirectionIsLeftKey, suspendedCardsDirectionIsLeft);
  583. PlayerPrefs.Save();
  584. }
  585. public void LoadSuspendedCardsDirectionIsLeft()
  586. {
  587. suspendedCardsDirectionIsLeft = PlayerPrefsUtil.GetBool(_suspendedCardsDirectionIsLeftKey, true);
  588. }
  589. #endregion
  590. #region Show background particle
  591. [HideInInspector] public bool showBackgroundParticle = false;
  592. string _showBackgroundParticleKey = "ShowBackgroundParticle";
  593. public void SaveShowBackgroundParticle()
  594. {
  595. PlayerPrefsUtil.SetBool(_showBackgroundParticleKey, showBackgroundParticle);
  596. PlayerPrefs.Save();
  597. }
  598. public void LoadShowBackgroundParticle()
  599. {
  600. showBackgroundParticle = PlayerPrefsUtil.GetBool(_showBackgroundParticleKey, true);
  601. }
  602. #endregion
  603. #region Sound volume
  604. public float BGMVolume { get; set; }
  605. public float SEVolume { get; set; }
  606. public void SetBGMVolume(float BGMVolume)
  607. {
  608. this.BGMVolume = BGMVolume;
  609. PlayerPrefs.SetFloat("BGMVolume", BGMVolume);
  610. PlayerPrefs.Save();
  611. }
  612. public void SetSEVolume(float SEVolume)
  613. {
  614. this.SEVolume = SEVolume;
  615. PlayerPrefs.SetFloat("SEVolume", SEVolume);
  616. PlayerPrefs.Save();
  617. }
  618. public void ChangeBGMVolume(AudioSource audioSource)
  619. {
  620. audioSource.volume = BGMVolume * 0.25f * 0.8f;
  621. }
  622. public void ChangeSEVolume(AudioSource audioSource)
  623. {
  624. audioSource.volume = SEVolume * 0.5f * 0.8f;
  625. }
  626. void LoadVolume()
  627. {
  628. BGMVolume = 0.5f;
  629. SEVolume = 0.5f;
  630. if (PlayerPrefs.HasKey("BGMVolume"))
  631. {
  632. BGMVolume = PlayerPrefs.GetFloat("BGMVolume");
  633. }
  634. if (PlayerPrefs.HasKey("SEVolume"))
  635. {
  636. SEVolume = PlayerPrefs.GetFloat("SEVolume");
  637. }
  638. }
  639. #endregion
  640. #region Server region
  641. [HideInInspector] public string serverRegion = "us";
  642. string _serverRegionKey = "ServerRegion";
  643. public void SaveServerRegion()
  644. {
  645. PlayerPrefs.SetString(_serverRegionKey, serverRegion);
  646. PlayerPrefs.Save();
  647. }
  648. public void LoadServerRegion()
  649. {
  650. serverRegion = PlayerPrefs.GetString(_serverRegionKey, "us");
  651. }
  652. public string LastConnectServerRegion = "";
  653. #endregion
  654. #region Language
  655. [HideInInspector] public Language language = Language.ENG;
  656. string _languageKey = "Language";
  657. public void SaveLanguage()
  658. {
  659. PlayerPrefs.SetString(_languageKey, language.ToString());
  660. PlayerPrefs.Save();
  661. }
  662. public void LoadLanguage()
  663. {
  664. language = (Language)Enum.Parse(typeof(Language), PlayerPrefs.GetString(_languageKey, "ENG"));
  665. }
  666. #endregion
  667. #region PlaySE(AudioClip clip)
  668. public SoundObject PlaySE(AudioClip clip)
  669. {
  670. SoundObject _soundObject = Instantiate(soundObject);
  671. _soundObject.PlaySE(clip);
  672. return _soundObject;
  673. }
  674. #endregion
  675. #region カードIndexからカードを取得
  676. public CEntity_Base getCardEntityByCardID(int cardIndex)
  677. {
  678. int searchIndex = cardIndex - 1;
  679. int count = 0;
  680. do
  681. {
  682. if (count != 0)
  683. {
  684. searchIndex += (int)Math.Pow(-1, count % 2) * count / 2;
  685. }
  686. if (0 <= searchIndex)
  687. {
  688. if (searchIndex <= SortedCardList.Length - 1)
  689. {
  690. CEntity_Base cEntity_Base = SortedCardList[searchIndex];
  691. if (cEntity_Base != null)
  692. {
  693. if (cEntity_Base.CardIndex == cardIndex)
  694. {
  695. return cEntity_Base;
  696. }
  697. }
  698. }
  699. else
  700. {
  701. for (int i = 0; i < 300; i++)
  702. {
  703. CEntity_Base cEntity_Base = SortedCardList[SortedCardList.Length - 1 - i];
  704. if (cEntity_Base != null)
  705. {
  706. if (cEntity_Base.CardIndex == cardIndex)
  707. {
  708. return cEntity_Base;
  709. }
  710. }
  711. }
  712. return null;
  713. }
  714. }
  715. if (count != 0)
  716. {
  717. searchIndex -= (int)Math.Pow(-1, count % 2) * count / 2;
  718. }
  719. count++;
  720. }
  721. while (count <= 20);
  722. return null;
  723. }
  724. #endregion
  725. public Coroutine LoadingTextCoroutine;
  726. bool _endBattle = false;
  727. public void EndBattle()
  728. {
  729. if (!_endBattle)
  730. {
  731. _endBattle = true;
  732. StartCoroutine(EndBattleCoroutine());
  733. }
  734. }
  735. public IEnumerator EndBattleCoroutine()
  736. {
  737. if (Opening.instance == null)
  738. {
  739. yield break;
  740. }
  741. Opening.instance.openingObject.SetActive(true);
  742. //yield return StartCoroutine(Opening.instance.LoadingObject_Unload.StartLoading("Now Loading"));
  743. //Camera camera1 = Camera.main;
  744. //Destroy(camera1.gameObject);
  745. //yield return null;
  746. isAI = false;
  747. int random = RandomUtility.getRamdom();
  748. UnityEngine.Random.InitState(random);
  749. Debug.Log($"random number sequence initialization, InitState:{random}");
  750. var unload = SceneManager.UnloadSceneAsync("BattleScene");
  751. yield return unload;
  752. yield return Resources.UnloadUnusedAssets();
  753. yield return StartCoroutine(Opening.instance.LoadingObject_Unload.StartLoading("Now Loading"));
  754. //Opening.instance.MainCamera.gameObject.SetActive(true);
  755. foreach (Camera camera in Opening.instance.openingCameras)
  756. {
  757. camera.gameObject.SetActive(true);
  758. }
  759. Opening.instance.LoadingObject_light.gameObject.SetActive(false);
  760. yield return ContinuousController.instance.StartCoroutine(PhotonUtility.SetPlayerName());
  761. if (isRandomMatch)
  762. {
  763. Debug.Log("Unload from Random Match");
  764. yield return StartCoroutine(Opening.instance.battle.lobbyManager_RandomMatch.CloseLobbyCoroutine());
  765. yield return StartCoroutine(Opening.instance.battle.selectBattleMode.SetUpSelectBattleModeCoroutine());
  766. }
  767. else
  768. {
  769. Debug.Log("Unload from Room Match");
  770. yield return StartCoroutine(Opening.instance.battle.roomManager.Init(true));
  771. yield return new WaitForSeconds(0.1f);
  772. }
  773. yield return new WaitWhile(() => GManager.instance != null);
  774. Opening.instance.LoadingObject.gameObject.SetActive(false);
  775. yield return StartCoroutine(Opening.instance.LoadingObject_Unload.EndLoading());
  776. _endBattle = false;
  777. if (!isRandomMatch)
  778. {
  779. Hashtable PlayerProp = PhotonNetwork.LocalPlayer.CustomProperties;
  780. if (PlayerProp.TryGetValue("isBattle", out object value))
  781. {
  782. PlayerProp["isBattle"] = false;
  783. }
  784. else
  785. {
  786. PlayerProp.Add("isBattle", false);
  787. }
  788. PhotonNetwork.LocalPlayer.SetCustomProperties(PlayerProp);
  789. }
  790. Scene newScene = SceneManager.GetSceneByName("Opening");
  791. SceneManager.SetActiveScene(newScene);
  792. for (int i = 0; i < 3; i++)
  793. {
  794. yield return new WaitForSeconds(0.1f);
  795. EventSystem.current.SetSelectedGameObject(Opening.instance.battle.selectBattleMode.transform.GetChild(0).gameObject);
  796. //Debug.Log("フォーカスを設定");
  797. }
  798. //GUI.UnfocusWindow();
  799. yield return null;
  800. //StartCoroutine(DestroyEffectCoroutine());
  801. if (Opening.instance.OpeningBGM != null)
  802. {
  803. if (!Opening.instance.OpeningBGM.isPlaying)
  804. {
  805. Opening.instance.OpeningBGM.StartPlayBGM(Opening.instance.bgm);
  806. }
  807. }
  808. }
  809. private void Update()
  810. {
  811. #if UNITY_WINDOWS
  812. if (Input.GetKey(KeyCode.Escape))
  813. {
  814. Application.Quit();
  815. }
  816. #endif
  817. }
  818. int _frameCount = 0;
  819. int _updateFrame = 40;
  820. void LateUpdate()
  821. {
  822. #region Update only once every few frames
  823. _frameCount++;
  824. if (_frameCount < _updateFrame)
  825. {
  826. return;
  827. }
  828. else
  829. {
  830. _frameCount = 0;
  831. }
  832. #endregion
  833. if (PhotonNetwork.InRoom)
  834. {
  835. if (!isAI)
  836. {
  837. bool notEnterOther = false;
  838. if (PhotonNetwork.PlayerList.Length == 1)
  839. {
  840. if (GManager.instance != null)
  841. {
  842. notEnterOther = true;
  843. }
  844. }
  845. if (notEnterOther)
  846. {
  847. if (PhotonNetwork.CurrentRoom.MaxPlayers != 1)
  848. {
  849. PhotonNetwork.CurrentRoom.MaxPlayers = 1;
  850. }
  851. }
  852. else
  853. {
  854. if (PhotonNetwork.CurrentRoom.MaxPlayers != 2)
  855. {
  856. PhotonNetwork.CurrentRoom.MaxPlayers = 2;
  857. }
  858. }
  859. }
  860. }
  861. }
  862. public bool isAI { get; set; } = false;
  863. //Flag that the sharing of the random number sequence is over.
  864. public bool DoneSetRandom { get; set; } = false;
  865. public bool CanSetRandom { get; set; } = false;
  866. [PunRPC]
  867. public void SetRandom(int random)
  868. {
  869. StartCoroutine(SetRandomCoroutine(random));
  870. }
  871. IEnumerator SetRandomCoroutine(int random)
  872. {
  873. yield return new WaitWhile(() => !CanSetRandom);
  874. UnityEngine.Random.InitState(random);
  875. DoneSetRandom = true;
  876. Debug.Log($"random number sequence initialization,InitState:{random}");
  877. }
  878. }
  879. #region Manage random numbers
  880. public static class RandomUtility
  881. {
  882. private static System.Random random;
  883. public static int getRamdom()
  884. {
  885. int _max = 1500000000;
  886. if (random == null)
  887. {
  888. random = new System.Random((int)DateTime.Now.Ticks);
  889. }
  890. return random.Next(0, _max);
  891. }
  892. #region IsSucceedProbability(float Probability)
  893. public static bool IsSucceedProbability(float Probability)
  894. {
  895. if (Probability >= 1)
  896. {
  897. return true;
  898. }
  899. if (Probability <= 0)
  900. {
  901. return false;
  902. }
  903. float random = UnityEngine.Random.Range(0f, 1f);
  904. if (random <= Probability)
  905. {
  906. return true;
  907. }
  908. return false;
  909. }
  910. #endregion
  911. #region Shuffle the deck
  912. public static List<CEntity_Base> ShuffledDeckCards(List<CEntity_Base> DeckCards)
  913. {
  914. List<CEntity_Base> CardDatas = new List<CEntity_Base>();
  915. foreach (CEntity_Base cEntity_Base in DeckCards)
  916. {
  917. CardDatas.Add(cEntity_Base);
  918. }
  919. // The initial value of integer n is the number of cards in the deck
  920. int n = CardDatas.Count;
  921. for (int i = 0; i < 20; i++)
  922. {
  923. // Repeat until n is less than 1
  924. while (n > 1)
  925. {
  926. n--;
  927. // k is a random value between 0 and n+1
  928. int k = UnityEngine.Random.Range(0, n + 1);
  929. // Assign the kth card to temp
  930. CEntity_Base temp = CardDatas[k];
  931. CardDatas[k] = CardDatas[n];
  932. CardDatas[n] = temp;
  933. }
  934. }
  935. return CardDatas;
  936. }
  937. public static List<CardSource> ShuffledDeckCards(List<CardSource> DeckCards)
  938. {
  939. List<CardSource> CardDatas = new List<CardSource>();
  940. foreach (CardSource cardSource in DeckCards)
  941. {
  942. CardDatas.Add(cardSource);
  943. }
  944. // 整数 n の初期値はデッキの枚数
  945. int n = CardDatas.Count;
  946. for (int i = 0; i < 20; i++)
  947. {
  948. // nが1より小さくなるまで繰り返す
  949. while (n > 1)
  950. {
  951. n--;
  952. // kは 0 ~ n+1 の間のランダムな値
  953. int k = UnityEngine.Random.Range(0, n + 1);
  954. // k番目のカードをtempに代入
  955. CardSource temp = CardDatas[k];
  956. CardDatas[k] = CardDatas[n];
  957. CardDatas[n] = temp;
  958. }
  959. }
  960. return CardDatas;
  961. }
  962. #endregion
  963. }
  964. #endregion
  965. #region Manage connections to Photon
  966. public class PhotonUtility
  967. {
  968. #region Disconnected from Photon
  969. public static IEnumerator DisconnectCoroutine()
  970. {
  971. #region Exit Room
  972. if (PhotonNetwork.InRoom)
  973. {
  974. PhotonNetwork.LeaveRoom();
  975. }
  976. yield return new WaitWhile(() => PhotonNetwork.InRoom);
  977. #endregion
  978. #region Exit from the lobby
  979. if (PhotonNetwork.InLobby)
  980. {
  981. PhotonNetwork.LeaveLobby();
  982. }
  983. yield return new WaitWhile(() => PhotonNetwork.InLobby);
  984. #endregion
  985. #region Disconnected from Photon
  986. if (PhotonNetwork.IsConnected)
  987. {
  988. PhotonNetwork.Disconnect();
  989. }
  990. yield return new WaitWhile(() => PhotonNetwork.IsConnected);
  991. #endregion
  992. }
  993. #endregion
  994. #region Connect to Photon server
  995. public static IEnumerator ConnectToMasterServerCoroutine()
  996. {
  997. if (!PhotonNetwork.IsConnected || ContinuousController.instance.LastConnectServerRegion != ContinuousController.instance.serverRegion)
  998. {
  999. if (PhotonNetwork.IsConnected)
  1000. {
  1001. yield return ContinuousController.instance.StartCoroutine(DisconnectCoroutine());
  1002. yield return new WaitWhile(() => PhotonNetwork.IsConnected);
  1003. }
  1004. PhotonNetwork.NetworkingClient.AppId = PhotonNetwork.PhotonServerSettings.AppSettings.AppIdRealtime;
  1005. PhotonNetwork.ConnectToRegion(ContinuousController.instance.serverRegion);
  1006. PhotonNetwork.NickName = ContinuousController.instance.PlayerName;
  1007. PhotonNetwork.GameVersion = ContinuousController.instance.GameVerString;
  1008. ContinuousController.instance.LastConnectServerRegion = ContinuousController.instance.serverRegion;
  1009. }
  1010. yield return new WaitWhile(() => !PhotonNetwork.IsConnectedAndReady);
  1011. }
  1012. #endregion
  1013. #region Connect to Photon Server and Lobby
  1014. public static IEnumerator ConnectToLobbyCoroutine()
  1015. {
  1016. #region Connect to Photon server
  1017. yield return ContinuousController.instance.StartCoroutine(ConnectToMasterServerCoroutine());
  1018. #endregion
  1019. #region Save player name to custom properties
  1020. yield return ContinuousController.instance.StartCoroutine(SetPlayerName());
  1021. #endregion
  1022. #region Save the number of wins to a custom property
  1023. Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1024. object value;
  1025. hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1026. if (hash.TryGetValue(ContinuousController.WinCountKey, out value))
  1027. {
  1028. hash[ContinuousController.WinCountKey] = ContinuousController.instance.WinCount;
  1029. }
  1030. else
  1031. {
  1032. hash.Add(ContinuousController.WinCountKey, ContinuousController.instance.WinCount);
  1033. }
  1034. PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
  1035. while (true)
  1036. {
  1037. Hashtable _hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1038. if (_hash.TryGetValue(ContinuousController.WinCountKey, out value))
  1039. {
  1040. if ((int)value == ContinuousController.instance.WinCount)
  1041. {
  1042. break;
  1043. }
  1044. }
  1045. yield return null;
  1046. }
  1047. #endregion
  1048. #region Connect to Lobby
  1049. if (!PhotonNetwork.InLobby)
  1050. {
  1051. PhotonNetwork.JoinLobby();
  1052. }
  1053. yield return new WaitWhile(() => !PhotonNetwork.InLobby);
  1054. yield return new WaitUntil(() => PhotonNetwork.InLobby && PhotonNetwork.IsConnectedAndReady);
  1055. #endregion
  1056. }
  1057. #endregion
  1058. #region Save player name to properties
  1059. public static IEnumerator SetPlayerName()
  1060. {
  1061. Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1062. object value;
  1063. hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1064. if (hash.TryGetValue(ContinuousController.PlayerNameKey, out value))
  1065. {
  1066. hash[ContinuousController.PlayerNameKey] = ContinuousController.instance.PlayerName;
  1067. }
  1068. else
  1069. {
  1070. hash.Add(ContinuousController.PlayerNameKey, ContinuousController.instance.PlayerName);
  1071. }
  1072. PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
  1073. while (true)
  1074. {
  1075. Hashtable _hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1076. if (_hash.TryGetValue(ContinuousController.PlayerNameKey, out value))
  1077. {
  1078. if ((string)value == ContinuousController.instance.PlayerName)
  1079. {
  1080. break;
  1081. }
  1082. }
  1083. yield return null;
  1084. }
  1085. }
  1086. #endregion
  1087. #region Save deck data to custom properties
  1088. public static IEnumerator SignUpBattleDeckData()
  1089. {
  1090. Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1091. if (hash.TryGetValue(ContinuousController.DeckDataPropertyKey, out object value))
  1092. {
  1093. hash[ContinuousController.DeckDataPropertyKey] = ContinuousController.instance.BattleDeckData.GetThisDeckCode();
  1094. }
  1095. else
  1096. {
  1097. hash.Add(ContinuousController.DeckDataPropertyKey, ContinuousController.instance.BattleDeckData.GetThisDeckCode());
  1098. }
  1099. //Debug.Log($"バトルデッキデータ登録,KeyCard:{ContinuousController.instance.BattleDeckData.KeyCard.CardName_JPN}");
  1100. PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
  1101. while (true)
  1102. {
  1103. Hashtable _hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1104. if (_hash.TryGetValue(ContinuousController.DeckDataPropertyKey, out value))
  1105. {
  1106. if ((string)value == ContinuousController.instance.BattleDeckData.GetThisDeckCode())
  1107. {
  1108. break;
  1109. }
  1110. }
  1111. yield return null;
  1112. }
  1113. }
  1114. #endregion
  1115. #region Remove custom properties from deck data
  1116. public static IEnumerator DeleteBattleDeckData()
  1117. {
  1118. Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1119. if (hash.TryGetValue(ContinuousController.DeckDataPropertyKey, out object value))
  1120. {
  1121. hash.Remove(ContinuousController.DeckDataPropertyKey);
  1122. }
  1123. PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
  1124. while (true)
  1125. {
  1126. Hashtable _hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1127. if (!_hash.TryGetValue(ContinuousController.DeckDataPropertyKey, out value))
  1128. {
  1129. break;
  1130. }
  1131. yield return null;
  1132. }
  1133. }
  1134. #endregion
  1135. }
  1136. #endregion
  1137. public enum Language
  1138. {
  1139. ENG,
  1140. JPN,
  1141. }