ContinuousController.cs 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807
  1. using Photon.Pun;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Security.Cryptography;
  8. using System.Threading.Tasks;
  9. using UnityEngine;
  10. using UnityEngine.EventSystems;
  11. using UnityEngine.Networking;
  12. using UnityEngine.SceneManagement;
  13. using Hashtable = ExitGames.Client.Photon.Hashtable;
  14. [RequireComponent(typeof(StarterDeck))]
  15. public class ContinuousController : MonoBehaviour
  16. {
  17. private static WaitForSeconds _waitForSeconds0_1 = new WaitForSeconds(0.1f);
  18. [Header("game language")]
  19. // public Language language;
  20. [Header("Game version")]
  21. public float GameVer;
  22. [Header("ignore updates")]
  23. public bool IgnoreUpdate;
  24. [Header("card list")]
  25. public CEntity_Base[] CardList = new CEntity_Base[] { };
  26. [Header("Card list sorted by card ID")]
  27. public CEntity_Base[] SortedCardList = new CEntity_Base[] { };
  28. [Header("Card back image")]
  29. public Sprite ReverseCard;
  30. public Sprite ReverseCard_Digitama;
  31. [Header("SE prefab")]
  32. public SoundObject soundObject;
  33. [Header("deck code encryption")]
  34. public ShuffleDeckCode ShuffleDeckCode;
  35. DeckData _battleDeckData = null;
  36. public DeckData BattleDeckData
  37. {
  38. get
  39. {
  40. return _battleDeckData;
  41. }
  42. set
  43. {
  44. _battleDeckData = value;
  45. if (value != null)
  46. {
  47. LastBattleDeckData = value;
  48. }
  49. }
  50. }
  51. public DeckData LastBattleDeckData { get; private set; } = null;
  52. public bool NeedUpdate { get; set; }
  53. public bool isRandomMatch { get; set; }
  54. [HideInInspector] public List<SkillInfo> nullSkillInfos = null;
  55. public String GameVerString => Application.version;//GameVer.ToString(CultureInfo.InvariantCulture);
  56. #region Key for property to save deck data for battle
  57. public static string DeckDataPropertyKey => "BattleDeckData";
  58. #endregion
  59. #region Key for the property that stores the player name data
  60. public static string PlayerNameKey => "PlayerNameKey";
  61. #endregion
  62. #region Key for the property that stores the win count data
  63. public static string WinCountKey => "WinCountKey";
  64. #endregion
  65. [Header("Player name character limit")]
  66. public int PlayerNameMaxLength;
  67. #region Call up a scene for data storage
  68. public static IEnumerator LoadCoroutine()
  69. {
  70. if (instance == null)
  71. {
  72. SceneManager.LoadSceneAsync("ContinuousControllerScene", LoadSceneMode.Additive);
  73. while (instance == null)
  74. {
  75. yield return null;
  76. }
  77. instance.Init();
  78. }
  79. }
  80. #endregion
  81. #region List of Deck Recipes
  82. public List<DeckData> DeckDatas { get; set; } = new List<DeckData>();
  83. #endregion
  84. #region Deck Recipe Key
  85. public string DeckDatasPlayerPrefsKey { get { return "DeckDatas3"; } }
  86. #endregion
  87. public CEntity_Base DiaboromonToken { get; private set; }
  88. public CEntity_Base AmonToken { get; private set; }
  89. public CEntity_Base UmonToken { get; private set; }
  90. public CEntity_Base FujitsumonToken { get; private set; }
  91. public CEntity_Base GyuukimonToken { get; private set; }
  92. public CEntity_Base KoHagurumonToken { get; private set; }
  93. public CEntity_Base FamiliarToken { get; private set; }
  94. public CEntity_Base SelfDeleteFamiliarToken { get; private set; }
  95. public CEntity_Base VoleeZerdruckenToken { get; private set; }
  96. public CEntity_Base UkaNoMitamaToken { get; private set; }
  97. public CEntity_Base WarGrowlmonToken { get; private set; }
  98. public CEntity_Base TaomonToken { get; private set; }
  99. public CEntity_Base RapidmonToken { get; private set; }
  100. public CEntity_Base PipeFoxToken { get; private set; }
  101. public CEntity_Base AthoRenePorToken { get; private set; }
  102. public CEntity_Base HinukamuyToken { get; private set; }
  103. public CEntity_Base PetrificationToken { get; private set; }
  104. //public CardRestriction BanList { get; private set; } = new CardRestriction(new List<CardLimitCount>(), new List<BannedPair>());
  105. public BanList BanList { get; private set; } = new BanList();
  106. async Task LoadBanListOnline()
  107. {
  108. string url = "https://www.dcgo.online/Banlist.json";
  109. UnityWebRequest jsonWebRequest = UnityWebRequest.Get(url);
  110. UnityWebRequestAsyncOperation operation = jsonWebRequest.SendWebRequest();
  111. while (!operation.isDone)
  112. {
  113. await Task.Yield(); // Keep the method asynchronous without blocking
  114. }
  115. if (jsonWebRequest.result != UnityWebRequest.Result.Success)
  116. {
  117. Debug.Log(jsonWebRequest.error);
  118. useBanlist = false;
  119. }
  120. else
  121. {
  122. BanList = JsonUtility.FromJson<BanList>(jsonWebRequest.downloadHandler.text);
  123. }
  124. }
  125. async Task CreateTokenData()
  126. {
  127. DiaboromonToken = ScriptableObject.CreateInstance<CEntity_Base>();
  128. DiaboromonToken.cardColors = new List<CardColor>() { CardColor.White };
  129. DiaboromonToken.PlayCost = 14;
  130. DiaboromonToken.Level = 6;
  131. DiaboromonToken.CardName_JPN = "ディアボロモン";
  132. DiaboromonToken.CardName_ENG = "Diaboromon";
  133. DiaboromonToken.Form_JPN = new List<string>() { "究極体" };
  134. DiaboromonToken.Form_ENG = new List<string>() { "Mega" };
  135. DiaboromonToken.Attribute_JPN = new List<string>() { "不明" };
  136. DiaboromonToken.Attribute_ENG = new List<string>() { "Unknown" };
  137. DiaboromonToken.Type_JPN = new List<string>() { "種族不明" };
  138. DiaboromonToken.Type_ENG = new List<string>() { "Unidentified" };
  139. DiaboromonToken.CardSpriteName = "BT2-082-token";
  140. DiaboromonToken.cardKind = new List<CardKind> { CardKind.Digimon };
  141. DiaboromonToken.DP = 3000;
  142. await DiaboromonToken.GetCardSprite();
  143. AmonToken = ScriptableObject.CreateInstance<CEntity_Base>();
  144. AmonToken.cardColors = new List<CardColor>() { CardColor.Red };
  145. AmonToken.PlayCost = -1;
  146. AmonToken.Level = 0;
  147. AmonToken.CardName_JPN = "紅炎のアモン";
  148. AmonToken.CardName_ENG = "Amon of Crimson Flame";
  149. AmonToken.Form_JPN = new List<string>();
  150. AmonToken.Form_ENG = new List<string>();
  151. AmonToken.Attribute_JPN = new List<string>();
  152. AmonToken.Attribute_ENG = new List<string>();
  153. AmonToken.Type_JPN = new List<string>();
  154. AmonToken.Type_ENG = new List<string>();
  155. AmonToken.CardSpriteName = "BT14-018-token-red";
  156. AmonToken.cardKind = new List<CardKind> { CardKind.Digimon };
  157. AmonToken.DP = 6000;
  158. AmonToken.CardEffectClassName = "BT4_038";
  159. await AmonToken.GetCardSprite();
  160. UmonToken = ScriptableObject.CreateInstance<CEntity_Base>();
  161. UmonToken.cardColors = new List<CardColor>() { CardColor.Yellow };
  162. UmonToken.PlayCost = -1;
  163. UmonToken.Level = 0;
  164. UmonToken.CardName_JPN = "蒼雷のウモン";
  165. UmonToken.CardName_ENG = "Umon of Blue Thunder";
  166. UmonToken.Form_JPN = new List<string>();
  167. UmonToken.Form_ENG = new List<string>();
  168. UmonToken.Attribute_JPN = new List<string>();
  169. UmonToken.Attribute_ENG = new List<string>();
  170. UmonToken.Type_JPN = new List<string>();
  171. UmonToken.Type_ENG = new List<string>();
  172. UmonToken.CardSpriteName = "BT14-018-token-yellow";
  173. UmonToken.cardKind = new List<CardKind> { CardKind.Digimon };
  174. UmonToken.DP = 6000;
  175. UmonToken.CardEffectClassName = "BT1_031";
  176. await UmonToken.GetCardSprite();
  177. FujitsumonToken = ScriptableObject.CreateInstance<CEntity_Base>();
  178. FujitsumonToken.cardColors = new List<CardColor>() { CardColor.Purple };
  179. FujitsumonToken.PlayCost = -1;
  180. FujitsumonToken.Level = 0;
  181. FujitsumonToken.CardName_JPN = "フジツモン";
  182. FujitsumonToken.CardName_ENG = "Fujitsumon";
  183. FujitsumonToken.Form_JPN = new List<string>();
  184. FujitsumonToken.Form_ENG = new List<string>();
  185. FujitsumonToken.Attribute_JPN = new List<string>();
  186. FujitsumonToken.Attribute_ENG = new List<string>();
  187. FujitsumonToken.Type_JPN = new List<string>();
  188. FujitsumonToken.Type_ENG = new List<string>();
  189. FujitsumonToken.CardSpriteName = "EX5-058-token";
  190. FujitsumonToken.cardKind = new List<CardKind> { CardKind.Digimon };
  191. FujitsumonToken.DP = 3000;
  192. FujitsumonToken.CardEffectClassName = "EX5_058_token";
  193. await FujitsumonToken.GetCardSprite();
  194. GyuukimonToken = ScriptableObject.CreateInstance<CEntity_Base>();
  195. GyuukimonToken.cardColors = new List<CardColor>() { CardColor.Purple };
  196. GyuukimonToken.PlayCost = 7;
  197. GyuukimonToken.Level = 5;
  198. GyuukimonToken.CardName_JPN = "ギュウキモン";
  199. GyuukimonToken.CardName_ENG = "Gyuukimon";
  200. GyuukimonToken.Form_JPN = new List<string>() { "究極の" };
  201. GyuukimonToken.Form_ENG = new List<string>() { "Ultimate" };
  202. GyuukimonToken.Attribute_JPN = new List<string>() { "ウイルス" };
  203. GyuukimonToken.Attribute_ENG = new List<string>() { "Virus" };
  204. GyuukimonToken.Type_JPN = new List<string>() { "ダークアニマル" };
  205. GyuukimonToken.Type_ENG = new List<string>() { "Dark Animal" };
  206. GyuukimonToken.CardSpriteName = "LM-018-token";
  207. GyuukimonToken.cardKind = new List<CardKind> { CardKind.Digimon };
  208. GyuukimonToken.DP = 3000;
  209. GyuukimonToken.CardEffectClassName = "LM_018_token";
  210. await GyuukimonToken.GetCardSprite();
  211. KoHagurumonToken = ScriptableObject.CreateInstance<CEntity_Base>();
  212. KoHagurumonToken.cardColors = new List<CardColor>() { CardColor.Black };
  213. KoHagurumonToken.PlayCost = -1;
  214. KoHagurumonToken.Level = 0;
  215. KoHagurumonToken.CardName_JPN = "";
  216. KoHagurumonToken.CardName_ENG = "KoHagurumon";
  217. KoHagurumonToken.Form_JPN = new List<string>();
  218. KoHagurumonToken.Form_ENG = new List<string>();
  219. KoHagurumonToken.Attribute_JPN = new List<string>();
  220. KoHagurumonToken.Attribute_ENG = new List<string>();
  221. KoHagurumonToken.Type_JPN = new List<string>();
  222. KoHagurumonToken.Type_ENG = new List<string>();
  223. KoHagurumonToken.CardSpriteName = "BT16-052-token";
  224. KoHagurumonToken.cardKind = new List<CardKind> { CardKind.Digimon };
  225. KoHagurumonToken.DP = 1000;
  226. KoHagurumonToken.CardEffectClassName = "BT16_052_token";
  227. await KoHagurumonToken.GetCardSprite();
  228. FamiliarToken = ScriptableObject.CreateInstance<CEntity_Base>();
  229. FamiliarToken.cardColors = new List<CardColor>() { CardColor.Yellow };
  230. FamiliarToken.PlayCost = -1;
  231. FamiliarToken.Level = 0;
  232. FamiliarToken.CardName_JPN = "";
  233. FamiliarToken.CardName_ENG = "Familiar";
  234. FamiliarToken.Form_JPN = new List<string>();
  235. FamiliarToken.Form_ENG = new List<string>();
  236. FamiliarToken.Attribute_JPN = new List<string>();
  237. FamiliarToken.Attribute_ENG = new List<string>();
  238. FamiliarToken.Type_JPN = new List<string>();
  239. FamiliarToken.Type_ENG = new List<string>();
  240. FamiliarToken.CardSpriteName = "EX7-030-token";
  241. FamiliarToken.cardKind = new List<CardKind> { CardKind.Digimon };
  242. FamiliarToken.DP = 3000;
  243. FamiliarToken.CardEffectClassName = "EX7_030_token";
  244. await FamiliarToken.GetCardSprite();
  245. SelfDeleteFamiliarToken = ScriptableObject.CreateInstance<CEntity_Base>();
  246. SelfDeleteFamiliarToken.cardColors = new List<CardColor>() { CardColor.Yellow };
  247. SelfDeleteFamiliarToken.PlayCost = -1;
  248. SelfDeleteFamiliarToken.Level = 0;
  249. SelfDeleteFamiliarToken.CardName_JPN = "";
  250. SelfDeleteFamiliarToken.CardName_ENG = "Familiar";
  251. SelfDeleteFamiliarToken.Form_JPN = new List<string>();
  252. SelfDeleteFamiliarToken.Form_ENG = new List<string>();
  253. SelfDeleteFamiliarToken.Attribute_JPN = new List<string>();
  254. SelfDeleteFamiliarToken.Attribute_ENG = new List<string>();
  255. SelfDeleteFamiliarToken.Type_JPN = new List<string>();
  256. SelfDeleteFamiliarToken.Type_ENG = new List<string>();
  257. SelfDeleteFamiliarToken.CardSpriteName = "EX7-030-token";
  258. SelfDeleteFamiliarToken.cardKind = new List<CardKind> { CardKind.Digimon };
  259. SelfDeleteFamiliarToken.DP = 3000;
  260. SelfDeleteFamiliarToken.CardEffectClassName = "P_165_token";
  261. await SelfDeleteFamiliarToken.GetCardSprite();
  262. VoleeZerdruckenToken = ScriptableObject.CreateInstance<CEntity_Base>();
  263. VoleeZerdruckenToken.cardColors = new List<CardColor>() { CardColor.Purple };
  264. VoleeZerdruckenToken.PlayCost = -1;
  265. VoleeZerdruckenToken.Level = 4;
  266. VoleeZerdruckenToken.CardName_JPN = "";
  267. VoleeZerdruckenToken.CardName_ENG = "Volée & Zerdrücken";
  268. VoleeZerdruckenToken.Form_JPN = new List<string>();
  269. VoleeZerdruckenToken.Form_ENG = new List<string>();
  270. VoleeZerdruckenToken.Attribute_JPN = new List<string>();
  271. VoleeZerdruckenToken.Attribute_ENG = new List<string>();
  272. VoleeZerdruckenToken.Type_JPN = new List<string>();
  273. VoleeZerdruckenToken.Type_ENG = new List<string>();
  274. VoleeZerdruckenToken.CardSpriteName = "EX7-058-token";
  275. VoleeZerdruckenToken.cardKind = new List<CardKind> { CardKind.Digimon };
  276. VoleeZerdruckenToken.DP = 5000;
  277. VoleeZerdruckenToken.CardEffectClassName = "EX7_058_token";
  278. await VoleeZerdruckenToken.GetCardSprite();
  279. UkaNoMitamaToken = ScriptableObject.CreateInstance<CEntity_Base>();
  280. UkaNoMitamaToken.cardColors = new List<CardColor>() { CardColor.Yellow };
  281. UkaNoMitamaToken.PlayCost = -1;
  282. UkaNoMitamaToken.Level = 0;
  283. UkaNoMitamaToken.CardName_JPN = "";
  284. UkaNoMitamaToken.CardName_ENG = "Uka-no-Mitama";
  285. UkaNoMitamaToken.Form_JPN = new List<string>();
  286. UkaNoMitamaToken.Form_ENG = new List<string>();
  287. UkaNoMitamaToken.Attribute_JPN = new List<string>();
  288. UkaNoMitamaToken.Attribute_ENG = new List<string>();
  289. UkaNoMitamaToken.Type_JPN = new List<string>();
  290. UkaNoMitamaToken.Type_ENG = new List<string>();
  291. UkaNoMitamaToken.CardSpriteName = "EX8-037-token";
  292. UkaNoMitamaToken.cardKind = new List<CardKind> { CardKind.Digimon };
  293. UkaNoMitamaToken.DP = 9000;
  294. UkaNoMitamaToken.CardEffectClassName = "EX8_037_token";
  295. await UkaNoMitamaToken.GetCardSprite();
  296. WarGrowlmonToken = ScriptableObject.CreateInstance<CEntity_Base>();
  297. WarGrowlmonToken.cardColors = new List<CardColor>() { CardColor.Red };
  298. WarGrowlmonToken.PlayCost = -1;
  299. WarGrowlmonToken.Level = 0;
  300. WarGrowlmonToken.CardName_JPN = "";
  301. WarGrowlmonToken.CardName_ENG = "WarGrowlmon";
  302. WarGrowlmonToken.Form_JPN = new List<string>();
  303. WarGrowlmonToken.Form_ENG = new List<string>();
  304. WarGrowlmonToken.Attribute_JPN = new List<string>();
  305. WarGrowlmonToken.Attribute_ENG = new List<string>();
  306. WarGrowlmonToken.Type_JPN = new List<string>();
  307. WarGrowlmonToken.Type_ENG = new List<string>();
  308. WarGrowlmonToken.CardSpriteName = "BT19-091-token-red";
  309. WarGrowlmonToken.cardKind = new List<CardKind> { CardKind.Digimon };
  310. WarGrowlmonToken.DP = 6000;
  311. await WarGrowlmonToken.GetCardSprite();
  312. TaomonToken = ScriptableObject.CreateInstance<CEntity_Base>();
  313. TaomonToken.cardColors = new List<CardColor>() { CardColor.Yellow };
  314. TaomonToken.PlayCost = -1;
  315. TaomonToken.Level = 0;
  316. TaomonToken.CardName_JPN = "";
  317. TaomonToken.CardName_ENG = "Taomon";
  318. TaomonToken.Form_JPN = new List<string>();
  319. TaomonToken.Form_ENG = new List<string>();
  320. TaomonToken.Attribute_JPN = new List<string>();
  321. TaomonToken.Attribute_ENG = new List<string>();
  322. TaomonToken.Type_JPN = new List<string>();
  323. TaomonToken.Type_ENG = new List<string>();
  324. TaomonToken.CardSpriteName = "BT19-091-token-yellow";
  325. TaomonToken.cardKind = new List<CardKind> { CardKind.Digimon };
  326. TaomonToken.DP = 6000;
  327. await TaomonToken.GetCardSprite();
  328. RapidmonToken = ScriptableObject.CreateInstance<CEntity_Base>();
  329. RapidmonToken.cardColors = new List<CardColor>() { CardColor.Green };
  330. RapidmonToken.PlayCost = -1;
  331. RapidmonToken.Level = 0;
  332. RapidmonToken.CardName_JPN = "";
  333. RapidmonToken.CardName_ENG = "Rapidmon";
  334. RapidmonToken.Form_JPN = new List<string>();
  335. RapidmonToken.Form_ENG = new List<string>();
  336. RapidmonToken.Attribute_JPN = new List<string>();
  337. RapidmonToken.Attribute_ENG = new List<string>();
  338. RapidmonToken.Type_JPN = new List<string>();
  339. RapidmonToken.Type_ENG = new List<string>();
  340. RapidmonToken.CardSpriteName = "BT19-091-token-green";
  341. RapidmonToken.cardKind = new List<CardKind> { CardKind.Digimon };
  342. RapidmonToken.DP = 6000;
  343. await RapidmonToken.GetCardSprite();
  344. PipeFoxToken = ScriptableObject.CreateInstance<CEntity_Base>();
  345. PipeFoxToken.cardColors = new List<CardColor>() { CardColor.Yellow };
  346. PipeFoxToken.PlayCost = -1;
  347. PipeFoxToken.Level = 0;
  348. PipeFoxToken.CardName_JPN = "";
  349. PipeFoxToken.CardName_ENG = "Pipe-Fox";
  350. PipeFoxToken.Form_JPN = new List<string>();
  351. PipeFoxToken.Form_ENG = new List<string>();
  352. PipeFoxToken.Attribute_JPN = new List<string>();
  353. PipeFoxToken.Attribute_ENG = new List<string>();
  354. PipeFoxToken.Type_JPN = new List<string>();
  355. PipeFoxToken.Type_ENG = new List<string>();
  356. PipeFoxToken.CardSpriteName = "BT19-040-token";
  357. PipeFoxToken.cardKind = new List<CardKind> { CardKind.Digimon };
  358. PipeFoxToken.DP = 6000;
  359. PipeFoxToken.CardEffectClassName = "BT19_040_token";
  360. await PipeFoxToken.GetCardSprite();
  361. AthoRenePorToken = ScriptableObject.CreateInstance<CEntity_Base>();
  362. AthoRenePorToken.cardColors = new List<CardColor>() { CardColor.White };
  363. AthoRenePorToken.PlayCost = -1;
  364. AthoRenePorToken.Level = 0;
  365. AthoRenePorToken.CardName_JPN = "";
  366. AthoRenePorToken.CardName_ENG = "Atho, René & Por";
  367. AthoRenePorToken.Form_JPN = new List<string>();
  368. AthoRenePorToken.Form_ENG = new List<string>();
  369. AthoRenePorToken.Attribute_JPN = new List<string>();
  370. AthoRenePorToken.Attribute_ENG = new List<string>();
  371. AthoRenePorToken.Type_JPN = new List<string>();
  372. AthoRenePorToken.Type_ENG = new List<string>();
  373. AthoRenePorToken.CardSpriteName = "BT20-017-token";
  374. AthoRenePorToken.cardKind = new List<CardKind> { CardKind.Digimon };
  375. AthoRenePorToken.DP = 6000;
  376. AthoRenePorToken.CardEffectClassName = "BT20_017_token";
  377. await AthoRenePorToken.GetCardSprite();
  378. HinukamuyToken = ScriptableObject.CreateInstance<CEntity_Base>();
  379. HinukamuyToken.cardColors = new List<CardColor>() { CardColor.White };
  380. HinukamuyToken.PlayCost = -1;
  381. HinukamuyToken.Level = 0;
  382. HinukamuyToken.CardName_JPN = "";
  383. HinukamuyToken.CardName_ENG = "HinukamuyToken";
  384. HinukamuyToken.Form_JPN = new List<string>();
  385. HinukamuyToken.Form_ENG = new List<string>();
  386. HinukamuyToken.Attribute_JPN = new List<string>();
  387. HinukamuyToken.Attribute_ENG = new List<string>();
  388. HinukamuyToken.Type_JPN = new List<string>();
  389. HinukamuyToken.Type_ENG = new List<string>();
  390. HinukamuyToken.CardSpriteName = "BT23-057-token";
  391. HinukamuyToken.cardKind = new List<CardKind> { CardKind.Digimon };
  392. HinukamuyToken.DP = 6000;
  393. HinukamuyToken.CardEffectClassName = "BT23_057_token";
  394. await HinukamuyToken.GetCardSprite();
  395. PetrificationToken = ScriptableObject.CreateInstance<CEntity_Base>();
  396. PetrificationToken.cardColors = new List<CardColor>() { CardColor.White };
  397. PetrificationToken.PlayCost = -1;
  398. PetrificationToken.Level = 0;
  399. PetrificationToken.CardName_JPN = "";
  400. PetrificationToken.CardName_ENG = "Petrification";
  401. PetrificationToken.Form_JPN = new List<string>();
  402. PetrificationToken.Form_ENG = new List<string>();
  403. PetrificationToken.Attribute_JPN = new List<string>();
  404. PetrificationToken.Attribute_ENG = new List<string>();
  405. PetrificationToken.Type_JPN = new List<string>();
  406. PetrificationToken.Type_ENG = new List<string>();
  407. PetrificationToken.CardSpriteName = "BT21-029-token";
  408. PetrificationToken.cardKind = new List<CardKind> { CardKind.Digimon };
  409. PetrificationToken.DP = 3000;
  410. PetrificationToken.CardEffectClassName = "BT21_029_token";
  411. await PetrificationToken.GetCardSprite();
  412. }
  413. public static ContinuousController instance = null;
  414. private void Awake()
  415. {
  416. instance = this;
  417. }
  418. public async void Init()
  419. {
  420. Application.targetFrameRate = 60;
  421. long random = RandomUtility.GetSecureRandom();
  422. GameRandom.Seed(random);
  423. Debug.Log($"Game Initialize - random number sequence initialization, GameRandom.Seed:{random}");
  424. Sprite reverseCardSprite = await StreamingAssetsUtility.GetSprite("card_back_main");
  425. if (reverseCardSprite != null)
  426. {
  427. ReverseCard = reverseCardSprite;
  428. }
  429. Sprite reverseDigieggCardSprite = await StreamingAssetsUtility.GetSprite("card_back_sub");
  430. if (reverseDigieggCardSprite != null)
  431. {
  432. ReverseCard_Digitama = reverseDigieggCardSprite;
  433. }
  434. await LoadBanListOnline();
  435. // deck data
  436. //DeckDatas = PlayerPrefsUtil.LoadList<DeckData>(DeckDatasPlayerPrefsKey);
  437. LoadDeckLists();
  438. GetComponent<StarterDeck>().SetStarterDecks();
  439. // player data
  440. LoadPlayerName();
  441. LoadWinCount();
  442. // game play
  443. LoadAutoEffectOrder();
  444. LoadAutoDeckBottomOrder();
  445. LoadAutoDeckTopOrder();
  446. LoadAutoMinDigivolutionCost();
  447. LoadAutoMaxCardCount();
  448. LoadAutoHatch();
  449. //LoadUseBanlist();
  450. LoadShowCutInAnimation();
  451. LoadReverseOpponentsCards();
  452. LoadTurnSuspendedCards();
  453. LoadCheckBeforeEndingSelection();
  454. LoadSuspendedCardsDirectionIsLeft();
  455. //Graphics
  456. LoadShowBackgroundParticle();
  457. // Sound
  458. LoadVolume();
  459. // ServerRegion
  460. LoadServerRegion();
  461. // Language
  462. LoadLanguage();
  463. await CreateTokenData();
  464. DontDestroyOnLoad(gameObject);
  465. }
  466. [Obsolete("This is obsolete, switching to save files")]
  467. public void ModifyAllDeckDatas()
  468. {
  469. List<DeckData> tempDeckDatas = new List<DeckData>();
  470. foreach (DeckData deckData in DeckDatas)
  471. {
  472. tempDeckDatas.Add(deckData);
  473. }
  474. foreach (DeckData deckData in tempDeckDatas)
  475. {
  476. if (deckData.AllDeckCards().Count == 0)
  477. {
  478. DeckDatas.Remove(deckData);
  479. }
  480. }
  481. for (int i = 0; i < DeckDatas.Count; i++)
  482. {
  483. //DeckData deckData = new DeckData(DeckData.GetDeckCode(DeckDatas[i].DeckName, DeckData.SortedDeckCardsList(DeckDatas[i].DeckCards()), DeckData.SortedDeckCardsList(DeckDatas[i].DigitamaDeckCards()), DeckDatas[i].KeyCard));
  484. DeckData deckData = DeckDatas[i];
  485. DeckDatas[i] = deckData.ModifiedDeckData();
  486. }
  487. SaveDeckDatas();
  488. }
  489. [Obsolete("This is obsolete, switching to save files")]
  490. public void SaveDeckDatas()
  491. {
  492. PlayerPrefsUtil.SaveList(DeckDatasPlayerPrefsKey, DeckDatas);
  493. PlayerPrefs.Save();
  494. }
  495. public void SaveDeckData(DeckData data)
  496. {
  497. string savePath = StreamingAssetsUtility.GetStreamingAssetPath("Decks", false);
  498. File.WriteAllText($"{savePath}/{data.DeckName}_{data.DeckID}.txt", DeckCodeUtility.GetDeckBuilderFile(data));
  499. }
  500. public void RenameDeck(DeckData data, string newName)
  501. {
  502. string savePath = StreamingAssetsUtility.GetStreamingAssetPath("Decks", false);
  503. if (File.Exists($"{savePath}/{data.DeckName}_{data.DeckID}.txt"))
  504. {
  505. File.Move($"{savePath}/{data.DeckName}_{data.DeckID}.txt", $"{savePath}/{newName}_{data.DeckID}.txt");
  506. data.DeckName = newName;
  507. SaveDeckData(data);
  508. }
  509. else
  510. data.DeckName = newName;
  511. }
  512. public void DeleteDeck(DeckData data)
  513. {
  514. string filePath = StreamingAssetsUtility.GetStreamingAssetPath("Decks", false);
  515. if (!Directory.Exists(filePath))
  516. return;
  517. if (!File.Exists($"{filePath}/{data.DeckName}_{data.DeckID}.txt"))
  518. return;
  519. File.Delete($"{filePath}/{data.DeckName}_{data.DeckID}.txt");
  520. }
  521. public void DeleteAllDecks()
  522. {
  523. foreach(DeckData data in DeckDatas)
  524. {
  525. DeleteDeck(data);
  526. }
  527. }
  528. public void LoadDeckLists()
  529. {
  530. string loadPath = StreamingAssetsUtility.GetStreamingAssetPath("Decks", false);
  531. if (!Directory.Exists(loadPath))
  532. return;
  533. string[] deckLists = Directory.GetFiles(loadPath);
  534. foreach(string deckPath in deckLists)
  535. {
  536. string fileName = Path.GetFileNameWithoutExtension(deckPath);
  537. if (!fileName.Contains("_"))
  538. continue;
  539. string deckList = File.ReadAllText(deckPath);
  540. StreamReader sr = new StreamReader(deckPath);
  541. string deckName = sr.ReadLine().Replace("Name: ", "");
  542. int KeyCard = int.Parse(sr.ReadLine().Replace("Key Card: ", ""));
  543. int SortValue = int.Parse(sr.ReadLine().Replace("Sort Index: ", ""));
  544. sr.Close();
  545. string deck = deckList[deckList.IndexOf("//")..];
  546. //Debug.Log(deckName);
  547. if(SortValue < 0)
  548. SortValue = 0;
  549. CreateDeckFromFile(fileName.Split("_")[1], deckName, KeyCard, deck, SortValue);
  550. }
  551. DeckDatas = DeckDatas.OrderBy(x => x.DeckName).ToList();
  552. }
  553. private void CreateDeckFromFile(string id, string name, int keyID, string deckCode, int index = 0)
  554. {
  555. List<CEntity_Base> AllDeckCards = DeckCodeUtility.GetAllDeckCardsFromDeckBuilderDeckCode(deckCode);
  556. if (AllDeckCards.Count == 0)
  557. {
  558. AllDeckCards = DeckCodeUtility.GetAllDeckCardsFromTTSDeckCode(deckCode);
  559. }
  560. List<CEntity_Base> deckCards = new List<CEntity_Base>();
  561. List<CEntity_Base> digitamaDeckCards = new List<CEntity_Base>();
  562. foreach (CEntity_Base cEntity_Base in AllDeckCards)
  563. {
  564. if (cEntity_Base.cardKind.Contains(CardKind.DigiEgg))
  565. {
  566. digitamaDeckCards.Add(cEntity_Base);
  567. }
  568. else
  569. {
  570. deckCards.Add(cEntity_Base);
  571. }
  572. }
  573. Debug.Log($"Create Deck From File: {name}");
  574. DeckData deckData = (new DeckData(DeckData.GetDeckCode(name, deckCards, digitamaDeckCards, null),id)).ModifiedDeckData();
  575. deckData.KeyCardId = keyID;
  576. deckData.DeckName = name;
  577. deckData.SortValue = index;
  578. DeckDatas.Insert(index, deckData);
  579. }
  580. #region Player Name
  581. string _playerName;
  582. string _playerNameKey = "PlayerName";
  583. public string PlayerName
  584. {
  585. get
  586. {
  587. if (string.IsNullOrEmpty(_playerName))
  588. {
  589. return "Player";
  590. }
  591. return _playerName;
  592. }
  593. set
  594. {
  595. _playerName = DeckData.ValidateDeckName(value);
  596. }
  597. }
  598. public void SavePlayerName(string playerName)
  599. {
  600. PlayerName = playerName;
  601. PlayerPrefs.SetString(_playerNameKey, playerName);
  602. PlayerPrefs.Save();
  603. }
  604. public void LoadPlayerName()
  605. {
  606. if (PlayerPrefs.HasKey(_playerNameKey))
  607. {
  608. PlayerName = PlayerPrefs.GetString(_playerNameKey);
  609. }
  610. if (string.IsNullOrEmpty(PlayerName))
  611. {
  612. PlayerName = "Player";
  613. }
  614. }
  615. #endregion
  616. #region number of victories
  617. public int WinCount { get; set; }
  618. string _winCountKey = "WinCount";
  619. public void SaveWinCount()
  620. {
  621. PlayerPrefs.SetInt(_winCountKey, WinCount);
  622. PlayerPrefs.Save();
  623. }
  624. public void LoadWinCount()
  625. {
  626. if (PlayerPrefs.HasKey(_winCountKey))
  627. {
  628. WinCount = PlayerPrefs.GetInt(_winCountKey);
  629. }
  630. }
  631. #endregion
  632. #region Auto effect order
  633. [HideInInspector] public bool autoEffectOrder = false;
  634. string _autoEffectOrderKey = "AutoEffectOrder";
  635. public void SaveAutoEffectOrder()
  636. {
  637. PlayerPrefsUtil.SetBool(_autoEffectOrderKey, autoEffectOrder);
  638. PlayerPrefs.Save();
  639. }
  640. public void LoadAutoEffectOrder()
  641. {
  642. autoEffectOrder = PlayerPrefsUtil.GetBool(_autoEffectOrderKey, false);
  643. }
  644. #endregion
  645. #region Auto deck bottom order
  646. [HideInInspector] public bool autoDeckBottomOrder = false;
  647. string _autoDeckBottomOrderKey = "AutoDeckBottomOrder";
  648. public void SaveAutoDeckBottomOrder()
  649. {
  650. PlayerPrefsUtil.SetBool(_autoDeckBottomOrderKey, autoDeckBottomOrder);
  651. PlayerPrefs.Save();
  652. }
  653. public void LoadAutoDeckBottomOrder()
  654. {
  655. autoDeckBottomOrder = PlayerPrefsUtil.GetBool(_autoDeckBottomOrderKey, false);
  656. }
  657. #endregion
  658. #region Auto deck top order
  659. [HideInInspector] public bool autoDeckTopOrder = false;
  660. string _autoDeckTopOrderKey = "AutoDeckTopOrder";
  661. public void SaveAutoDeckTopOrder()
  662. {
  663. PlayerPrefsUtil.SetBool(_autoDeckTopOrderKey, autoDeckTopOrder);
  664. PlayerPrefs.Save();
  665. }
  666. public void LoadAutoDeckTopOrder()
  667. {
  668. autoDeckTopOrder = PlayerPrefsUtil.GetBool(_autoDeckTopOrderKey, false);
  669. }
  670. #endregion
  671. #region Auto min digivolution cost
  672. [HideInInspector] public bool autoMinDigivolutionCost = false;
  673. string _autoMinDigivolutionCostKey = "AutoMinDigivolutionCost";
  674. public void SaveAutoMinDigivolutionCost()
  675. {
  676. PlayerPrefsUtil.SetBool(_autoMinDigivolutionCostKey, autoMinDigivolutionCost);
  677. PlayerPrefs.Save();
  678. }
  679. public void LoadAutoMinDigivolutionCost()
  680. {
  681. autoMinDigivolutionCost = PlayerPrefsUtil.GetBool(_autoMinDigivolutionCostKey, false);
  682. }
  683. #endregion
  684. #region Auto max card count
  685. [HideInInspector] public bool autoMaxCardCount = false;
  686. string _autoMaxCardCountKey = "AutoMaxCardCount";
  687. public void SaveAutoMaxCardCount()
  688. {
  689. PlayerPrefsUtil.SetBool(_autoMaxCardCountKey, autoMaxCardCount);
  690. PlayerPrefs.Save();
  691. }
  692. public void LoadAutoMaxCardCount()
  693. {
  694. autoMaxCardCount = PlayerPrefsUtil.GetBool(_autoMaxCardCountKey, false);
  695. }
  696. #endregion
  697. #region Auto hatch
  698. [HideInInspector] public bool autoHatch = false;
  699. string _autoHatchKey = "AutoHatch";
  700. public void SaveAutoHatch()
  701. {
  702. PlayerPrefsUtil.SetBool(_autoHatchKey, autoHatch);
  703. PlayerPrefs.Save();
  704. }
  705. public void LoadAutoHatch()
  706. {
  707. autoHatch = PlayerPrefsUtil.GetBool(_autoHatchKey, false);
  708. }
  709. #endregion
  710. #region Use Banlist
  711. public bool useBanlist = true;
  712. string _useBanlistKey = "UseBanlist";
  713. public void SaveUseBanlist()
  714. {
  715. PlayerPrefsUtil.SetBool(_useBanlistKey, useBanlist);
  716. PlayerPrefs.Save();
  717. }
  718. public void LoadUseBanlist()
  719. {
  720. useBanlist = PlayerPrefsUtil.GetBool(_useBanlistKey, false);
  721. }
  722. #endregion
  723. #region Show CutIn Animation
  724. public bool showCutInAnimation = false;
  725. string _showCutInAnimationKey = "ShowCutInAnimation";
  726. public void SaveShowCutInAnimation()
  727. {
  728. PlayerPrefsUtil.SetBool(_showCutInAnimationKey, showCutInAnimation);
  729. PlayerPrefs.Save();
  730. }
  731. public void LoadShowCutInAnimation()
  732. {
  733. //TODO: Setting default to false, to fix animation syncing bug, MB
  734. showCutInAnimation = false;
  735. //showCutInAnimation = PlayerPrefsUtil.GetBool(_showCutInAnimationKey, true);
  736. }
  737. #endregion
  738. #region Reverse opponents' cards
  739. [HideInInspector] public bool reverseOpponentsCards = false;
  740. string _reverseOpponentsCardsKey = "ReverseOpponentsCards";
  741. public void SaveReverseOpponentsCards()
  742. {
  743. PlayerPrefsUtil.SetBool(_reverseOpponentsCardsKey, reverseOpponentsCards);
  744. PlayerPrefs.Save();
  745. }
  746. public void LoadReverseOpponentsCards()
  747. {
  748. reverseOpponentsCards = PlayerPrefsUtil.GetBool(_reverseOpponentsCardsKey, false);
  749. }
  750. #endregion
  751. #region Turn suspended cards
  752. [HideInInspector] public bool turnSuspendedCards = false;
  753. string _turnSuspendedCardsKey = "TurnSuspendedCards";
  754. public void SaveTurnSuspendedCards()
  755. {
  756. PlayerPrefsUtil.SetBool(_turnSuspendedCardsKey, turnSuspendedCards);
  757. PlayerPrefs.Save();
  758. }
  759. public void LoadTurnSuspendedCards()
  760. {
  761. turnSuspendedCards = PlayerPrefsUtil.GetBool(_turnSuspendedCardsKey, true);
  762. }
  763. #endregion
  764. #region Check before ending selection
  765. [HideInInspector] public bool checkBeforeEndingSelection = false;
  766. string _checkBeforeEndingSelectionKey = "CheckBeforeEndingSelection";
  767. public void SaveCheckBeforeEndingSelection()
  768. {
  769. PlayerPrefsUtil.SetBool(_checkBeforeEndingSelectionKey, checkBeforeEndingSelection);
  770. PlayerPrefs.Save();
  771. }
  772. public void LoadCheckBeforeEndingSelection()
  773. {
  774. checkBeforeEndingSelection = PlayerPrefsUtil.GetBool(_checkBeforeEndingSelectionKey, true);
  775. }
  776. #endregion
  777. #region Suspended cards' direction is left
  778. [HideInInspector] public bool suspendedCardsDirectionIsLeft = false;
  779. string _suspendedCardsDirectionIsLeftKey = "SuspendedCardsDirectionIsLeft";
  780. public void SaveSuspendedCardsDirectionIsLeft()
  781. {
  782. PlayerPrefsUtil.SetBool(_suspendedCardsDirectionIsLeftKey, suspendedCardsDirectionIsLeft);
  783. PlayerPrefs.Save();
  784. }
  785. public void LoadSuspendedCardsDirectionIsLeft()
  786. {
  787. suspendedCardsDirectionIsLeft = PlayerPrefsUtil.GetBool(_suspendedCardsDirectionIsLeftKey, true);
  788. }
  789. #endregion
  790. #region Show background particle
  791. [HideInInspector] public bool showBackgroundParticle = false;
  792. string _showBackgroundParticleKey = "ShowBackgroundParticle";
  793. public void SaveShowBackgroundParticle()
  794. {
  795. PlayerPrefsUtil.SetBool(_showBackgroundParticleKey, showBackgroundParticle);
  796. PlayerPrefs.Save();
  797. }
  798. public void LoadShowBackgroundParticle()
  799. {
  800. showBackgroundParticle = PlayerPrefsUtil.GetBool(_showBackgroundParticleKey, true);
  801. }
  802. #endregion
  803. #region Sound volume
  804. public float BGMVolume { get; set; }
  805. public float SEVolume { get; set; }
  806. public void SetBGMVolume(float BGMVolume)
  807. {
  808. this.BGMVolume = BGMVolume;
  809. PlayerPrefs.SetFloat("BGMVolume", BGMVolume);
  810. PlayerPrefs.Save();
  811. }
  812. public void SetSEVolume(float SEVolume)
  813. {
  814. this.SEVolume = SEVolume;
  815. PlayerPrefs.SetFloat("SEVolume", SEVolume);
  816. PlayerPrefs.Save();
  817. }
  818. public void ChangeBGMVolume(AudioSource audioSource)
  819. {
  820. audioSource.volume = BGMVolume * 0.25f * 0.8f;
  821. }
  822. public void ChangeSEVolume(AudioSource audioSource)
  823. {
  824. audioSource.volume = SEVolume * 0.5f * 0.8f;
  825. }
  826. void LoadVolume()
  827. {
  828. BGMVolume = 0.5f;
  829. SEVolume = 0.5f;
  830. if (PlayerPrefs.HasKey("BGMVolume"))
  831. {
  832. BGMVolume = PlayerPrefs.GetFloat("BGMVolume");
  833. }
  834. if (PlayerPrefs.HasKey("SEVolume"))
  835. {
  836. SEVolume = PlayerPrefs.GetFloat("SEVolume");
  837. }
  838. }
  839. #endregion
  840. #region Server region
  841. [HideInInspector] public string serverRegion = "us";
  842. string _serverRegionKey = "ServerRegion";
  843. public void SaveServerRegion()
  844. {
  845. PlayerPrefs.SetString(_serverRegionKey, serverRegion);
  846. PlayerPrefs.Save();
  847. }
  848. public void LoadServerRegion()
  849. {
  850. //serverRegion = PlayerPrefs.GetString(_serverRegionKey, "us");
  851. }
  852. public string LastConnectServerRegion = "";
  853. #endregion
  854. #region Language
  855. [HideInInspector] public Language language = Language.ENG;
  856. string _languageKey = "Language";
  857. public void SaveLanguage()
  858. {
  859. PlayerPrefs.SetString(_languageKey, language.ToString());
  860. PlayerPrefs.Save();
  861. }
  862. public void LoadLanguage()
  863. {
  864. language = (Language)Enum.Parse(typeof(Language), PlayerPrefs.GetString(_languageKey, "ENG"));
  865. }
  866. #endregion
  867. #region PlaySE(AudioClip clip)
  868. public SoundObject PlaySE(AudioClip clip)
  869. {
  870. SoundObject _soundObject = Instantiate(soundObject);
  871. _soundObject.PlaySE(clip);
  872. return _soundObject;
  873. }
  874. #endregion
  875. #region カードIndexからカードを取得
  876. public CEntity_Base getCardEntityByCardID(int cardIndex)
  877. {
  878. //int searchIndex = cardIndex - 1;
  879. //int count = 0;
  880. CEntity_Base cEntity_Base = SortedCardList.First(entity => entity.CardIndex == cardIndex);
  881. return cEntity_Base;
  882. //TODO: REMOVE IN FUTURE
  883. /*do
  884. {
  885. if (count != 0)
  886. {
  887. searchIndex += (int)Math.Pow(-1, count % 2) * count / 2;
  888. }
  889. if (0 <= searchIndex)
  890. {
  891. if (searchIndex <= SortedCardList.Length - 1)
  892. {
  893. CEntity_Base cEntity_Base = SortedCardList[searchIndex];
  894. if (cEntity_Base != null)
  895. {
  896. if (cEntity_Base.CardIndex == cardIndex)
  897. {
  898. return cEntity_Base;
  899. }
  900. }
  901. }
  902. else
  903. {
  904. for (int i = 0; i < 300; i++)
  905. {
  906. CEntity_Base cEntity_Base = SortedCardList[SortedCardList.Length - 1 - i];
  907. if (cEntity_Base != null)
  908. {
  909. if (cEntity_Base.CardIndex == cardIndex)
  910. {
  911. return cEntity_Base;
  912. }
  913. }
  914. }
  915. return null;
  916. }
  917. }
  918. if (count != 0)
  919. {
  920. searchIndex -= (int)Math.Pow(-1, count % 2) * count / 2;
  921. }
  922. count++;
  923. }
  924. while (count <= 20);
  925. return null;*/
  926. }
  927. #endregion
  928. public Coroutine LoadingTextCoroutine;
  929. bool _endBattle = false;
  930. public void EndBattle()
  931. {
  932. if (!_endBattle)
  933. {
  934. _endBattle = true;
  935. StartCoroutine(EndBattleCoroutine());
  936. }
  937. }
  938. public IEnumerator EndBattleCoroutine()
  939. {
  940. if (Opening.instance == null)
  941. {
  942. yield break;
  943. }
  944. Opening.instance.openingObject.SetActive(true);
  945. //yield return StartCoroutine(Opening.instance.LoadingObject_Unload.StartLoading("Now Loading"));
  946. //Camera camera1 = Camera.main;
  947. //Destroy(camera1.gameObject);
  948. //yield return null;
  949. isAI = false;
  950. long random = RandomUtility.GetSecureRandom();
  951. GameRandom.Seed(random);
  952. Debug.Log($"random number sequence initialization, GameRandom.Seed:{random}");
  953. var unload = SceneManager.UnloadSceneAsync("BattleScene");
  954. yield return unload;
  955. yield return Resources.UnloadUnusedAssets();
  956. yield return StartCoroutine(Opening.instance.LoadingObject_Unload.StartLoading("Now Loading"));
  957. //Opening.instance.MainCamera.gameObject.SetActive(true);
  958. foreach (Camera camera in Opening.instance.openingCameras)
  959. {
  960. camera.gameObject.SetActive(true);
  961. }
  962. Opening.instance.LoadingObject_light.gameObject.SetActive(false);
  963. yield return ContinuousController.instance.StartCoroutine(PhotonUtility.SetPlayerName());
  964. if (isRandomMatch)
  965. {
  966. Debug.Log("Unload from Random Match");
  967. yield return StartCoroutine(Opening.instance.battle.lobbyManager_RandomMatch.CloseLobbyCoroutine());
  968. yield return StartCoroutine(Opening.instance.battle.selectBattleMode.SetUpSelectBattleModeCoroutine());
  969. }
  970. else
  971. {
  972. Debug.Log("Unload from Room Match");
  973. yield return StartCoroutine(Opening.instance.battle.roomManager.Init(true));
  974. yield return _waitForSeconds0_1;
  975. }
  976. yield return new WaitWhile(() => GManager.instance != null);
  977. Opening.instance.LoadingObject.gameObject.SetActive(false);
  978. yield return StartCoroutine(Opening.instance.LoadingObject_Unload.EndLoading());
  979. _endBattle = false;
  980. if (!isRandomMatch)
  981. {
  982. Hashtable PlayerProp = PhotonNetwork.LocalPlayer.CustomProperties;
  983. if (PlayerProp.TryGetValue("isBattle", out object value))
  984. {
  985. PlayerProp["isBattle"] = false;
  986. }
  987. else
  988. {
  989. PlayerProp.Add("isBattle", false);
  990. }
  991. PhotonNetwork.LocalPlayer.SetCustomProperties(PlayerProp);
  992. }
  993. Scene newScene = SceneManager.GetSceneByName("Opening");
  994. SceneManager.SetActiveScene(newScene);
  995. for (int i = 0; i < 3; i++)
  996. {
  997. yield return _waitForSeconds0_1;
  998. EventSystem.current.SetSelectedGameObject(Opening.instance.battle.selectBattleMode.transform.GetChild(0).gameObject);
  999. }
  1000. //GUI.UnfocusWindow();
  1001. yield return null;
  1002. //StartCoroutine(DestroyEffectCoroutine());
  1003. if (Opening.instance.OpeningBGM != null)
  1004. {
  1005. if (!Opening.instance.OpeningBGM.isPlaying)
  1006. {
  1007. Opening.instance.OpeningBGM.StartPlayBGM(Opening.instance.bgm);
  1008. }
  1009. }
  1010. }
  1011. private void Update()
  1012. {
  1013. #if UNITY_WINDOWS
  1014. if (Input.GetKey(KeyCode.Escape))
  1015. {
  1016. Application.Quit();
  1017. }
  1018. #endif
  1019. #if UNITY_EDITOR
  1020. if (Input.GetKeyDown(KeyCode.F1))
  1021. {
  1022. _showPhotonDebug = !_showPhotonDebug;
  1023. }
  1024. #endif
  1025. }
  1026. int _frameCount = 0;
  1027. int _updateFrame = 40;
  1028. void LateUpdate()
  1029. {
  1030. #region Update only once every few frames
  1031. _frameCount++;
  1032. if (_frameCount < _updateFrame)
  1033. {
  1034. return;
  1035. }
  1036. else
  1037. {
  1038. _frameCount = 0;
  1039. }
  1040. #endregion
  1041. if (PhotonNetwork.InRoom)
  1042. {
  1043. if (!isAI)
  1044. {
  1045. bool notEnterOther = false;
  1046. if (PhotonNetwork.PlayerList.Length == 1)
  1047. {
  1048. if (GManager.instance != null)
  1049. {
  1050. notEnterOther = true;
  1051. }
  1052. }
  1053. if (notEnterOther)
  1054. {
  1055. if (PhotonNetwork.CurrentRoom.MaxPlayers != 1)
  1056. {
  1057. PhotonNetwork.CurrentRoom.MaxPlayers = 1;
  1058. }
  1059. }
  1060. else
  1061. {
  1062. if (PhotonNetwork.CurrentRoom.MaxPlayers != 2)
  1063. {
  1064. PhotonNetwork.CurrentRoom.MaxPlayers = 2;
  1065. }
  1066. }
  1067. }
  1068. }
  1069. }
  1070. public bool isAI { get; set; } = false;
  1071. //Flag that the sharing of the random number sequence is over.
  1072. public bool DoneSetRandom { get; set; } = false;
  1073. public bool CanSetRandom { get; set; } = false;
  1074. [PunRPC]
  1075. public void SetRandom(long random)
  1076. {
  1077. StartCoroutine(SetRandomCoroutine(random));
  1078. }
  1079. IEnumerator SetRandomCoroutine(long random)
  1080. {
  1081. yield return new WaitWhile(() => !CanSetRandom);
  1082. GameRandom.Seed(random);
  1083. DoneSetRandom = true;
  1084. Debug.Log($"random number sequence initialization, GameRandom.Seed:{random}");
  1085. }
  1086. #if UNITY_EDITOR
  1087. #region Photon Debug HUD
  1088. bool _showPhotonDebug = false;
  1089. Photon.Realtime.IConnectionCallbacks _connectionCallbacks;
  1090. Photon.Realtime.IMatchmakingCallbacks _matchmakingCallbacks;
  1091. Photon.Realtime.ILobbyCallbacks _lobbyCallbacks;
  1092. void OnEnable()
  1093. {
  1094. var listener = new PhotonDebugListener();
  1095. _connectionCallbacks = listener;
  1096. _matchmakingCallbacks = listener;
  1097. _lobbyCallbacks = listener;
  1098. PhotonNetwork.AddCallbackTarget(listener);
  1099. }
  1100. void OnDisable()
  1101. {
  1102. if (_connectionCallbacks != null)
  1103. PhotonNetwork.RemoveCallbackTarget(_connectionCallbacks);
  1104. }
  1105. class PhotonDebugListener :
  1106. Photon.Realtime.IConnectionCallbacks,
  1107. Photon.Realtime.IMatchmakingCallbacks,
  1108. Photon.Realtime.ILobbyCallbacks
  1109. {
  1110. public void OnDisconnected(Photon.Realtime.DisconnectCause cause)
  1111. {
  1112. Debug.LogWarning($"[Photon Debug] Disconnected: {cause}");
  1113. }
  1114. public void OnConnected() { }
  1115. public void OnConnectedToMaster()
  1116. {
  1117. Debug.Log("[Photon Debug] Connected to Master");
  1118. }
  1119. public void OnRegionListReceived(Photon.Realtime.RegionHandler handler) { }
  1120. public void OnCustomAuthenticationResponse(Dictionary<string, object> data) { }
  1121. public void OnCustomAuthenticationFailed(string debugMessage)
  1122. {
  1123. Debug.LogError($"[Photon Debug] Auth failed: {debugMessage}");
  1124. }
  1125. public void OnJoinedLobby()
  1126. {
  1127. Debug.Log("[Photon Debug] Joined Lobby");
  1128. }
  1129. public void OnLeftLobby()
  1130. {
  1131. Debug.Log("[Photon Debug] Left Lobby");
  1132. }
  1133. public void OnLobbyStatisticsUpdate(List<Photon.Realtime.TypedLobbyInfo> lobbyStatistics) { }
  1134. public void OnRoomListUpdate(List<Photon.Realtime.RoomInfo> roomList) { }
  1135. public void OnJoinedRoom()
  1136. {
  1137. Debug.Log($"[Photon Debug] Joined Room: {PhotonNetwork.CurrentRoom?.Name}");
  1138. }
  1139. public void OnJoinRoomFailed(short returnCode, string message)
  1140. {
  1141. Debug.LogError($"[Photon Debug] Join Room FAILED: [{returnCode}] {message}");
  1142. }
  1143. public void OnJoinRandomFailed(short returnCode, string message)
  1144. {
  1145. Debug.LogError($"[Photon Debug] Join Random FAILED: [{returnCode}] {message}");
  1146. }
  1147. public void OnCreateRoomFailed(short returnCode, string message)
  1148. {
  1149. Debug.LogError($"[Photon Debug] Create Room FAILED: [{returnCode}] {message}");
  1150. }
  1151. public void OnCreatedRoom()
  1152. {
  1153. Debug.Log("[Photon Debug] Created Room");
  1154. }
  1155. public void OnLeftRoom()
  1156. {
  1157. Debug.Log("[Photon Debug] Left Room");
  1158. }
  1159. public void OnFriendListUpdate(List<Photon.Realtime.FriendInfo> friendList) { }
  1160. }
  1161. void OnGUI()
  1162. {
  1163. if (!string.IsNullOrEmpty(PhotonUtility.RetryStatus))
  1164. {
  1165. GUIStyle retryStyle = new GUIStyle(GUI.skin.label)
  1166. {
  1167. fontSize = 20,
  1168. richText = true,
  1169. fontStyle = FontStyle.Bold,
  1170. alignment = TextAnchor.MiddleCenter
  1171. };
  1172. float boxW = 500;
  1173. float boxH = 40;
  1174. float x = (Screen.width - boxW) / 2;
  1175. float y = (Screen.height - boxH) / 2;
  1176. GUI.Box(new Rect(x - 10, y - 10, boxW + 20, boxH + 20), "");
  1177. GUI.Label(new Rect(x, y, boxW, boxH), $"<color=#FFAA00>{PhotonUtility.RetryStatus}</color>", retryStyle);
  1178. }
  1179. if (!_showPhotonDebug) return;
  1180. string status;
  1181. if (!PhotonNetwork.IsConnected)
  1182. {
  1183. status = "<color=#FF4444>[Photon] Disconnected</color>";
  1184. }
  1185. else if (PhotonNetwork.InRoom)
  1186. {
  1187. string roomName = PhotonNetwork.CurrentRoom != null ? PhotonNetwork.CurrentRoom.Name : "?";
  1188. int players = PhotonNetwork.CurrentRoom != null ? PhotonNetwork.CurrentRoom.PlayerCount : 0;
  1189. status = $"<color=#44FF44>[Photon] Connected | Region: {PhotonNetwork.CloudRegion} | Room: {roomName} ({players} players)</color>";
  1190. }
  1191. else if (PhotonNetwork.InLobby)
  1192. {
  1193. status = $"<color=#44FF44>[Photon] Connected | Region: {PhotonNetwork.CloudRegion} | In Lobby</color>";
  1194. }
  1195. else
  1196. {
  1197. status = $"<color=#FFAA00>[Photon] Connected | Region: {PhotonNetwork.CloudRegion} | Not in Lobby/Room</color>";
  1198. }
  1199. GUIStyle style = new GUIStyle(GUI.skin.label)
  1200. {
  1201. fontSize = 16,
  1202. richText = true,
  1203. fontStyle = FontStyle.Bold
  1204. };
  1205. GUI.Label(new Rect(10, 10, 800, 30), status, style);
  1206. }
  1207. #endregion
  1208. #endif
  1209. }
  1210. #region Manage random numbers
  1211. public static class RandomUtility
  1212. {
  1213. /// <summary>
  1214. /// Generates a cryptographically secure 64-bit random seed.
  1215. /// Uses OS entropy pool via System.Security.Cryptography.
  1216. /// </summary>
  1217. public static long GetSecureRandom()
  1218. {
  1219. byte[] bytes = new byte[8];
  1220. using (var rng = RandomNumberGenerator.Create())
  1221. {
  1222. rng.GetBytes(bytes);
  1223. }
  1224. return BitConverter.ToInt64(bytes, 0);
  1225. }
  1226. #region IsSucceedProbability(float Probability)
  1227. public static bool IsSucceedProbability(float Probability)
  1228. {
  1229. if (Probability >= 1)
  1230. {
  1231. return true;
  1232. }
  1233. if (Probability <= 0)
  1234. {
  1235. return false;
  1236. }
  1237. float random = GameRandom.Range(0f, 1f);
  1238. if (random <= Probability)
  1239. {
  1240. return true;
  1241. }
  1242. return false;
  1243. }
  1244. #endregion
  1245. #region Shuffle the deck
  1246. public static List<CEntity_Base> ShuffledDeckCards(List<CEntity_Base> DeckCards)
  1247. {
  1248. List<CEntity_Base> CardDatas = new List<CEntity_Base>();
  1249. CardDatas.AddRange(DeckCards);
  1250. // Fisher-Yates shuffle using GameRandom (Xoshiro256**)
  1251. int n = CardDatas.Count;
  1252. while (n > 0)
  1253. {
  1254. n--;
  1255. // Random index from 0 to n (inclusive) — Range takes exclusive max
  1256. int k = GameRandom.Range(0, n + 1);
  1257. // Swap elements at indices n and k
  1258. (CardDatas[k], CardDatas[n]) = (CardDatas[n], CardDatas[k]);
  1259. }
  1260. return CardDatas;
  1261. }
  1262. public static List<CardSource> ShuffledDeckCards(List<CardSource> DeckCards)
  1263. {
  1264. List<CardSource> CardDatas = new List<CardSource>();
  1265. CardDatas.AddRange(DeckCards);
  1266. // Fisher-Yates shuffle using GameRandom (Xoshiro256**)
  1267. int n = CardDatas.Count;
  1268. while (n > 0)
  1269. {
  1270. n--;
  1271. // Random index from 0 to n (inclusive) — Range takes exclusive max
  1272. int k = GameRandom.Range(0, n + 1);
  1273. // Swap elements at indices n and k
  1274. CardSource temp = CardDatas[n];
  1275. if (!temp.IsFlipped)
  1276. {
  1277. temp.SetReverse();
  1278. if(temp.Owner.SecurityCards.Contains(temp))
  1279. GManager.OnSecurityStackChanged?.Invoke(temp.Owner);
  1280. }
  1281. CardDatas[n] = CardDatas[k];
  1282. CardDatas[k] = temp;
  1283. }
  1284. return CardDatas;
  1285. }
  1286. #endregion
  1287. }
  1288. #endregion
  1289. #region Manage connections to Photon
  1290. public class PhotonUtility
  1291. {
  1292. public static string RetryStatus { get; set; } = null;
  1293. #region Disconnected from Photon
  1294. public static IEnumerator DisconnectCoroutine()
  1295. {
  1296. #region Exit Room
  1297. if (PhotonNetwork.InRoom)
  1298. {
  1299. PhotonNetwork.LeaveRoom();
  1300. }
  1301. yield return new WaitWhile(() => PhotonNetwork.InRoom);
  1302. #endregion
  1303. #region Exit from the lobby
  1304. if (PhotonNetwork.InLobby)
  1305. {
  1306. PhotonNetwork.LeaveLobby();
  1307. }
  1308. yield return new WaitWhile(() => PhotonNetwork.InLobby);
  1309. #endregion
  1310. #region Disconnected from Photon
  1311. if (PhotonNetwork.IsConnected)
  1312. {
  1313. PhotonNetwork.Disconnect();
  1314. }
  1315. yield return new WaitWhile(() => PhotonNetwork.IsConnected);
  1316. #endregion
  1317. }
  1318. #endregion
  1319. #region Connect to Photon server
  1320. public static IEnumerator ConnectToMasterServerCoroutine()
  1321. {
  1322. int maxRetries = 5;
  1323. float retryDelay = 3f;
  1324. for (int attempt = 0; attempt <= maxRetries; attempt++)
  1325. {
  1326. if (!PhotonNetwork.IsConnected || ContinuousController.instance.LastConnectServerRegion != ContinuousController.instance.serverRegion)
  1327. {
  1328. if (PhotonNetwork.IsConnected)
  1329. {
  1330. yield return ContinuousController.instance.StartCoroutine(DisconnectCoroutine());
  1331. yield return new WaitWhile(() => PhotonNetwork.IsConnected);
  1332. }
  1333. PhotonNetwork.NetworkingClient.AppId = PhotonNetwork.PhotonServerSettings.AppSettings.AppIdRealtime;
  1334. PhotonNetwork.ConnectToRegion(ContinuousController.instance.serverRegion);
  1335. PhotonNetwork.NickName = ContinuousController.instance.PlayerName;
  1336. PhotonNetwork.GameVersion = ContinuousController.instance.GameVerString;
  1337. ContinuousController.instance.LastConnectServerRegion = ContinuousController.instance.serverRegion;
  1338. }
  1339. yield return new WaitUntil(() =>
  1340. PhotonNetwork.IsConnectedAndReady ||
  1341. PhotonNetwork.NetworkingClient.State == Photon.Realtime.ClientState.Disconnected);
  1342. if (PhotonNetwork.IsConnectedAndReady)
  1343. {
  1344. RetryStatus = null;
  1345. yield break;
  1346. }
  1347. var cause = PhotonNetwork.NetworkingClient.DisconnectedCause;
  1348. Debug.LogWarning($"[Photon] Connection failed: {cause} (attempt {attempt + 1}/{maxRetries + 1})");
  1349. if (cause == Photon.Realtime.DisconnectCause.MaxCcuReached && attempt < maxRetries)
  1350. {
  1351. RetryStatus = LocalizeUtility.GetLocalizedString(
  1352. EngMessage: $"Server full. Retrying... ({attempt + 1}/{maxRetries})",
  1353. JpnMessage: $"サーバーが満員です。再接続中... ({attempt + 1}/{maxRetries})"
  1354. );
  1355. Debug.Log($"[Photon] Server full, retrying in {retryDelay}s...");
  1356. yield return new WaitForSeconds(retryDelay);
  1357. retryDelay += 2f;
  1358. continue;
  1359. }
  1360. RetryStatus = LocalizeUtility.GetLocalizedString(
  1361. EngMessage: "Connection failed. Please try again later.",
  1362. JpnMessage: "接続に失敗しました。後でもう一度お試しください。"
  1363. );
  1364. Debug.LogError($"[Photon] Connection failed permanently: {cause}");
  1365. yield break;
  1366. }
  1367. }
  1368. #endregion
  1369. #region Connect to Photon Server and Lobby
  1370. public static IEnumerator ConnectToLobbyCoroutine()
  1371. {
  1372. #region Connect to Photon server
  1373. yield return ContinuousController.instance.StartCoroutine(ConnectToMasterServerCoroutine());
  1374. #endregion
  1375. #region Save player name to custom properties
  1376. yield return ContinuousController.instance.StartCoroutine(SetPlayerName());
  1377. #endregion
  1378. #region Save the number of wins to a custom property
  1379. Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1380. if (hash.TryGetValue(ContinuousController.WinCountKey, out object value))
  1381. {
  1382. hash[ContinuousController.WinCountKey] = ContinuousController.instance.WinCount;
  1383. }
  1384. else
  1385. {
  1386. hash.Add(ContinuousController.WinCountKey, ContinuousController.instance.WinCount);
  1387. }
  1388. PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
  1389. while (true)
  1390. {
  1391. Hashtable _hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1392. if (_hash.TryGetValue(ContinuousController.WinCountKey, out value))
  1393. {
  1394. if ((int)value == ContinuousController.instance.WinCount)
  1395. {
  1396. break;
  1397. }
  1398. }
  1399. yield return null;
  1400. }
  1401. #endregion
  1402. #region Connect to Lobby
  1403. if (!PhotonNetwork.InLobby)
  1404. {
  1405. PhotonNetwork.JoinLobby();
  1406. }
  1407. yield return new WaitWhile(() => !PhotonNetwork.InLobby);
  1408. yield return new WaitUntil(() => PhotonNetwork.InLobby && PhotonNetwork.IsConnectedAndReady);
  1409. #endregion
  1410. }
  1411. #endregion
  1412. #region Save player name to properties
  1413. public static IEnumerator SetPlayerName()
  1414. {
  1415. Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1416. if (hash.TryGetValue(ContinuousController.PlayerNameKey, out object value))
  1417. {
  1418. hash[ContinuousController.PlayerNameKey] = ContinuousController.instance.PlayerName;
  1419. }
  1420. else
  1421. {
  1422. hash.Add(ContinuousController.PlayerNameKey, ContinuousController.instance.PlayerName);
  1423. }
  1424. PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
  1425. while (true)
  1426. {
  1427. Hashtable _hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1428. if (_hash.TryGetValue(ContinuousController.PlayerNameKey, out value))
  1429. {
  1430. if ((string)value == ContinuousController.instance.PlayerName)
  1431. {
  1432. break;
  1433. }
  1434. }
  1435. yield return null;
  1436. }
  1437. }
  1438. #endregion
  1439. #region Save deck data to custom properties
  1440. public static IEnumerator SignUpBattleDeckData()
  1441. {
  1442. Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1443. if (hash.TryGetValue(ContinuousController.DeckDataPropertyKey, out object value))
  1444. {
  1445. hash[ContinuousController.DeckDataPropertyKey] = ContinuousController.instance.BattleDeckData.GetThisDeckCode();
  1446. }
  1447. else
  1448. {
  1449. hash.Add(ContinuousController.DeckDataPropertyKey, ContinuousController.instance.BattleDeckData.GetThisDeckCode());
  1450. }
  1451. PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
  1452. while (true)
  1453. {
  1454. Hashtable _hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1455. if (_hash.TryGetValue(ContinuousController.DeckDataPropertyKey, out value))
  1456. {
  1457. if ((string)value == ContinuousController.instance.BattleDeckData.GetThisDeckCode())
  1458. {
  1459. break;
  1460. }
  1461. }
  1462. yield return null;
  1463. }
  1464. }
  1465. #endregion
  1466. #region Remove custom properties from deck data
  1467. public static IEnumerator DeleteBattleDeckData()
  1468. {
  1469. Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1470. if (hash.TryGetValue(ContinuousController.DeckDataPropertyKey, out object value))
  1471. {
  1472. hash.Remove(ContinuousController.DeckDataPropertyKey);
  1473. }
  1474. PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
  1475. while (true)
  1476. {
  1477. Hashtable _hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1478. if (!_hash.TryGetValue(ContinuousController.DeckDataPropertyKey, out value))
  1479. {
  1480. break;
  1481. }
  1482. yield return null;
  1483. }
  1484. }
  1485. #endregion
  1486. }
  1487. #endregion
  1488. public enum Language
  1489. {
  1490. ENG,
  1491. JPN,
  1492. }