ContinuousController.cs 41 KB

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