ContinuousController.cs 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805
  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. showCutInAnimation = PlayerPrefsUtil.GetBool(_showCutInAnimationKey, false);
  734. }
  735. #endregion
  736. #region Reverse opponents' cards
  737. [HideInInspector] public bool reverseOpponentsCards = false;
  738. string _reverseOpponentsCardsKey = "ReverseOpponentsCards";
  739. public void SaveReverseOpponentsCards()
  740. {
  741. PlayerPrefsUtil.SetBool(_reverseOpponentsCardsKey, reverseOpponentsCards);
  742. PlayerPrefs.Save();
  743. }
  744. public void LoadReverseOpponentsCards()
  745. {
  746. reverseOpponentsCards = PlayerPrefsUtil.GetBool(_reverseOpponentsCardsKey, false);
  747. }
  748. #endregion
  749. #region Turn suspended cards
  750. [HideInInspector] public bool turnSuspendedCards = false;
  751. string _turnSuspendedCardsKey = "TurnSuspendedCards";
  752. public void SaveTurnSuspendedCards()
  753. {
  754. PlayerPrefsUtil.SetBool(_turnSuspendedCardsKey, turnSuspendedCards);
  755. PlayerPrefs.Save();
  756. }
  757. public void LoadTurnSuspendedCards()
  758. {
  759. turnSuspendedCards = PlayerPrefsUtil.GetBool(_turnSuspendedCardsKey, true);
  760. }
  761. #endregion
  762. #region Check before ending selection
  763. [HideInInspector] public bool checkBeforeEndingSelection = false;
  764. string _checkBeforeEndingSelectionKey = "CheckBeforeEndingSelection";
  765. public void SaveCheckBeforeEndingSelection()
  766. {
  767. PlayerPrefsUtil.SetBool(_checkBeforeEndingSelectionKey, checkBeforeEndingSelection);
  768. PlayerPrefs.Save();
  769. }
  770. public void LoadCheckBeforeEndingSelection()
  771. {
  772. checkBeforeEndingSelection = PlayerPrefsUtil.GetBool(_checkBeforeEndingSelectionKey, true);
  773. }
  774. #endregion
  775. #region Suspended cards' direction is left
  776. [HideInInspector] public bool suspendedCardsDirectionIsLeft = false;
  777. string _suspendedCardsDirectionIsLeftKey = "SuspendedCardsDirectionIsLeft";
  778. public void SaveSuspendedCardsDirectionIsLeft()
  779. {
  780. PlayerPrefsUtil.SetBool(_suspendedCardsDirectionIsLeftKey, suspendedCardsDirectionIsLeft);
  781. PlayerPrefs.Save();
  782. }
  783. public void LoadSuspendedCardsDirectionIsLeft()
  784. {
  785. suspendedCardsDirectionIsLeft = PlayerPrefsUtil.GetBool(_suspendedCardsDirectionIsLeftKey, true);
  786. }
  787. #endregion
  788. #region Show background particle
  789. [HideInInspector] public bool showBackgroundParticle = false;
  790. string _showBackgroundParticleKey = "ShowBackgroundParticle";
  791. public void SaveShowBackgroundParticle()
  792. {
  793. PlayerPrefsUtil.SetBool(_showBackgroundParticleKey, showBackgroundParticle);
  794. PlayerPrefs.Save();
  795. }
  796. public void LoadShowBackgroundParticle()
  797. {
  798. showBackgroundParticle = PlayerPrefsUtil.GetBool(_showBackgroundParticleKey, true);
  799. }
  800. #endregion
  801. #region Sound volume
  802. public float BGMVolume { get; set; }
  803. public float SEVolume { get; set; }
  804. public void SetBGMVolume(float BGMVolume)
  805. {
  806. this.BGMVolume = BGMVolume;
  807. PlayerPrefs.SetFloat("BGMVolume", BGMVolume);
  808. PlayerPrefs.Save();
  809. }
  810. public void SetSEVolume(float SEVolume)
  811. {
  812. this.SEVolume = SEVolume;
  813. PlayerPrefs.SetFloat("SEVolume", SEVolume);
  814. PlayerPrefs.Save();
  815. }
  816. public void ChangeBGMVolume(AudioSource audioSource)
  817. {
  818. audioSource.volume = BGMVolume * 0.25f * 0.8f;
  819. }
  820. public void ChangeSEVolume(AudioSource audioSource)
  821. {
  822. audioSource.volume = SEVolume * 0.5f * 0.8f;
  823. }
  824. void LoadVolume()
  825. {
  826. BGMVolume = 0.5f;
  827. SEVolume = 0.5f;
  828. if (PlayerPrefs.HasKey("BGMVolume"))
  829. {
  830. BGMVolume = PlayerPrefs.GetFloat("BGMVolume");
  831. }
  832. if (PlayerPrefs.HasKey("SEVolume"))
  833. {
  834. SEVolume = PlayerPrefs.GetFloat("SEVolume");
  835. }
  836. }
  837. #endregion
  838. #region Server region
  839. [HideInInspector] public string serverRegion = "us";
  840. string _serverRegionKey = "ServerRegion";
  841. public void SaveServerRegion()
  842. {
  843. PlayerPrefs.SetString(_serverRegionKey, serverRegion);
  844. PlayerPrefs.Save();
  845. }
  846. public void LoadServerRegion()
  847. {
  848. //serverRegion = PlayerPrefs.GetString(_serverRegionKey, "us");
  849. }
  850. public string LastConnectServerRegion = "";
  851. #endregion
  852. #region Language
  853. [HideInInspector] public Language language = Language.ENG;
  854. string _languageKey = "Language";
  855. public void SaveLanguage()
  856. {
  857. PlayerPrefs.SetString(_languageKey, language.ToString());
  858. PlayerPrefs.Save();
  859. }
  860. public void LoadLanguage()
  861. {
  862. language = (Language)Enum.Parse(typeof(Language), PlayerPrefs.GetString(_languageKey, "ENG"));
  863. }
  864. #endregion
  865. #region PlaySE(AudioClip clip)
  866. public SoundObject PlaySE(AudioClip clip)
  867. {
  868. SoundObject _soundObject = Instantiate(soundObject);
  869. _soundObject.PlaySE(clip);
  870. return _soundObject;
  871. }
  872. #endregion
  873. #region カードIndexからカードを取得
  874. public CEntity_Base getCardEntityByCardID(int cardIndex)
  875. {
  876. //int searchIndex = cardIndex - 1;
  877. //int count = 0;
  878. CEntity_Base cEntity_Base = SortedCardList.First(entity => entity.CardIndex == cardIndex);
  879. return cEntity_Base;
  880. //TODO: REMOVE IN FUTURE
  881. /*do
  882. {
  883. if (count != 0)
  884. {
  885. searchIndex += (int)Math.Pow(-1, count % 2) * count / 2;
  886. }
  887. if (0 <= searchIndex)
  888. {
  889. if (searchIndex <= SortedCardList.Length - 1)
  890. {
  891. CEntity_Base cEntity_Base = SortedCardList[searchIndex];
  892. if (cEntity_Base != null)
  893. {
  894. if (cEntity_Base.CardIndex == cardIndex)
  895. {
  896. return cEntity_Base;
  897. }
  898. }
  899. }
  900. else
  901. {
  902. for (int i = 0; i < 300; i++)
  903. {
  904. CEntity_Base cEntity_Base = SortedCardList[SortedCardList.Length - 1 - i];
  905. if (cEntity_Base != null)
  906. {
  907. if (cEntity_Base.CardIndex == cardIndex)
  908. {
  909. return cEntity_Base;
  910. }
  911. }
  912. }
  913. return null;
  914. }
  915. }
  916. if (count != 0)
  917. {
  918. searchIndex -= (int)Math.Pow(-1, count % 2) * count / 2;
  919. }
  920. count++;
  921. }
  922. while (count <= 20);
  923. return null;*/
  924. }
  925. #endregion
  926. public Coroutine LoadingTextCoroutine;
  927. bool _endBattle = false;
  928. public void EndBattle()
  929. {
  930. if (!_endBattle)
  931. {
  932. _endBattle = true;
  933. StartCoroutine(EndBattleCoroutine());
  934. }
  935. }
  936. public IEnumerator EndBattleCoroutine()
  937. {
  938. if (Opening.instance == null)
  939. {
  940. yield break;
  941. }
  942. Opening.instance.openingObject.SetActive(true);
  943. //yield return StartCoroutine(Opening.instance.LoadingObject_Unload.StartLoading("Now Loading"));
  944. //Camera camera1 = Camera.main;
  945. //Destroy(camera1.gameObject);
  946. //yield return null;
  947. isAI = false;
  948. long random = RandomUtility.GetSecureRandom();
  949. GameRandom.Seed(random);
  950. Debug.Log($"random number sequence initialization, GameRandom.Seed:{random}");
  951. var unload = SceneManager.UnloadSceneAsync("BattleScene");
  952. yield return unload;
  953. yield return Resources.UnloadUnusedAssets();
  954. yield return StartCoroutine(Opening.instance.LoadingObject_Unload.StartLoading("Now Loading"));
  955. //Opening.instance.MainCamera.gameObject.SetActive(true);
  956. foreach (Camera camera in Opening.instance.openingCameras)
  957. {
  958. camera.gameObject.SetActive(true);
  959. }
  960. Opening.instance.LoadingObject_light.gameObject.SetActive(false);
  961. yield return ContinuousController.instance.StartCoroutine(PhotonUtility.SetPlayerName());
  962. if (isRandomMatch)
  963. {
  964. Debug.Log("Unload from Random Match");
  965. yield return StartCoroutine(Opening.instance.battle.lobbyManager_RandomMatch.CloseLobbyCoroutine());
  966. yield return StartCoroutine(Opening.instance.battle.selectBattleMode.SetUpSelectBattleModeCoroutine());
  967. }
  968. else
  969. {
  970. Debug.Log("Unload from Room Match");
  971. yield return StartCoroutine(Opening.instance.battle.roomManager.Init(true));
  972. yield return _waitForSeconds0_1;
  973. }
  974. yield return new WaitWhile(() => GManager.instance != null);
  975. Opening.instance.LoadingObject.gameObject.SetActive(false);
  976. yield return StartCoroutine(Opening.instance.LoadingObject_Unload.EndLoading());
  977. _endBattle = false;
  978. if (!isRandomMatch)
  979. {
  980. Hashtable PlayerProp = PhotonNetwork.LocalPlayer.CustomProperties;
  981. if (PlayerProp.TryGetValue("isBattle", out object value))
  982. {
  983. PlayerProp["isBattle"] = false;
  984. }
  985. else
  986. {
  987. PlayerProp.Add("isBattle", false);
  988. }
  989. PhotonNetwork.LocalPlayer.SetCustomProperties(PlayerProp);
  990. }
  991. Scene newScene = SceneManager.GetSceneByName("Opening");
  992. SceneManager.SetActiveScene(newScene);
  993. for (int i = 0; i < 3; i++)
  994. {
  995. yield return _waitForSeconds0_1;
  996. EventSystem.current.SetSelectedGameObject(Opening.instance.battle.selectBattleMode.transform.GetChild(0).gameObject);
  997. }
  998. //GUI.UnfocusWindow();
  999. yield return null;
  1000. //StartCoroutine(DestroyEffectCoroutine());
  1001. if (Opening.instance.OpeningBGM != null)
  1002. {
  1003. if (!Opening.instance.OpeningBGM.isPlaying)
  1004. {
  1005. Opening.instance.OpeningBGM.StartPlayBGM(Opening.instance.bgm);
  1006. }
  1007. }
  1008. }
  1009. private void Update()
  1010. {
  1011. #if UNITY_WINDOWS
  1012. if (Input.GetKey(KeyCode.Escape))
  1013. {
  1014. Application.Quit();
  1015. }
  1016. #endif
  1017. #if UNITY_EDITOR
  1018. if (Input.GetKeyDown(KeyCode.F1))
  1019. {
  1020. _showPhotonDebug = !_showPhotonDebug;
  1021. }
  1022. #endif
  1023. }
  1024. int _frameCount = 0;
  1025. int _updateFrame = 40;
  1026. void LateUpdate()
  1027. {
  1028. #region Update only once every few frames
  1029. _frameCount++;
  1030. if (_frameCount < _updateFrame)
  1031. {
  1032. return;
  1033. }
  1034. else
  1035. {
  1036. _frameCount = 0;
  1037. }
  1038. #endregion
  1039. if (PhotonNetwork.InRoom)
  1040. {
  1041. if (!isAI)
  1042. {
  1043. bool notEnterOther = false;
  1044. if (PhotonNetwork.PlayerList.Length == 1)
  1045. {
  1046. if (GManager.instance != null)
  1047. {
  1048. notEnterOther = true;
  1049. }
  1050. }
  1051. if (notEnterOther)
  1052. {
  1053. if (PhotonNetwork.CurrentRoom.MaxPlayers != 1)
  1054. {
  1055. PhotonNetwork.CurrentRoom.MaxPlayers = 1;
  1056. }
  1057. }
  1058. else
  1059. {
  1060. if (PhotonNetwork.CurrentRoom.MaxPlayers != 2)
  1061. {
  1062. PhotonNetwork.CurrentRoom.MaxPlayers = 2;
  1063. }
  1064. }
  1065. }
  1066. }
  1067. }
  1068. public bool isAI { get; set; } = false;
  1069. //Flag that the sharing of the random number sequence is over.
  1070. public bool DoneSetRandom { get; set; } = false;
  1071. public bool CanSetRandom { get; set; } = false;
  1072. [PunRPC]
  1073. public void SetRandom(long random)
  1074. {
  1075. StartCoroutine(SetRandomCoroutine(random));
  1076. }
  1077. IEnumerator SetRandomCoroutine(long random)
  1078. {
  1079. yield return new WaitWhile(() => !CanSetRandom);
  1080. GameRandom.Seed(random);
  1081. DoneSetRandom = true;
  1082. Debug.Log($"random number sequence initialization, GameRandom.Seed:{random}");
  1083. }
  1084. #if UNITY_EDITOR
  1085. #region Photon Debug HUD
  1086. bool _showPhotonDebug = false;
  1087. Photon.Realtime.IConnectionCallbacks _connectionCallbacks;
  1088. Photon.Realtime.IMatchmakingCallbacks _matchmakingCallbacks;
  1089. Photon.Realtime.ILobbyCallbacks _lobbyCallbacks;
  1090. void OnEnable()
  1091. {
  1092. var listener = new PhotonDebugListener();
  1093. _connectionCallbacks = listener;
  1094. _matchmakingCallbacks = listener;
  1095. _lobbyCallbacks = listener;
  1096. PhotonNetwork.AddCallbackTarget(listener);
  1097. }
  1098. void OnDisable()
  1099. {
  1100. if (_connectionCallbacks != null)
  1101. PhotonNetwork.RemoveCallbackTarget(_connectionCallbacks);
  1102. }
  1103. class PhotonDebugListener :
  1104. Photon.Realtime.IConnectionCallbacks,
  1105. Photon.Realtime.IMatchmakingCallbacks,
  1106. Photon.Realtime.ILobbyCallbacks
  1107. {
  1108. public void OnDisconnected(Photon.Realtime.DisconnectCause cause)
  1109. {
  1110. Debug.LogWarning($"[Photon Debug] Disconnected: {cause}");
  1111. }
  1112. public void OnConnected() { }
  1113. public void OnConnectedToMaster()
  1114. {
  1115. Debug.Log("[Photon Debug] Connected to Master");
  1116. }
  1117. public void OnRegionListReceived(Photon.Realtime.RegionHandler handler) { }
  1118. public void OnCustomAuthenticationResponse(Dictionary<string, object> data) { }
  1119. public void OnCustomAuthenticationFailed(string debugMessage)
  1120. {
  1121. Debug.LogError($"[Photon Debug] Auth failed: {debugMessage}");
  1122. }
  1123. public void OnJoinedLobby()
  1124. {
  1125. Debug.Log("[Photon Debug] Joined Lobby");
  1126. }
  1127. public void OnLeftLobby()
  1128. {
  1129. Debug.Log("[Photon Debug] Left Lobby");
  1130. }
  1131. public void OnLobbyStatisticsUpdate(List<Photon.Realtime.TypedLobbyInfo> lobbyStatistics) { }
  1132. public void OnRoomListUpdate(List<Photon.Realtime.RoomInfo> roomList) { }
  1133. public void OnJoinedRoom()
  1134. {
  1135. Debug.Log($"[Photon Debug] Joined Room: {PhotonNetwork.CurrentRoom?.Name}");
  1136. }
  1137. public void OnJoinRoomFailed(short returnCode, string message)
  1138. {
  1139. Debug.LogError($"[Photon Debug] Join Room FAILED: [{returnCode}] {message}");
  1140. }
  1141. public void OnJoinRandomFailed(short returnCode, string message)
  1142. {
  1143. Debug.LogError($"[Photon Debug] Join Random FAILED: [{returnCode}] {message}");
  1144. }
  1145. public void OnCreateRoomFailed(short returnCode, string message)
  1146. {
  1147. Debug.LogError($"[Photon Debug] Create Room FAILED: [{returnCode}] {message}");
  1148. }
  1149. public void OnCreatedRoom()
  1150. {
  1151. Debug.Log("[Photon Debug] Created Room");
  1152. }
  1153. public void OnLeftRoom()
  1154. {
  1155. Debug.Log("[Photon Debug] Left Room");
  1156. }
  1157. public void OnFriendListUpdate(List<Photon.Realtime.FriendInfo> friendList) { }
  1158. }
  1159. void OnGUI()
  1160. {
  1161. if (!string.IsNullOrEmpty(PhotonUtility.RetryStatus))
  1162. {
  1163. GUIStyle retryStyle = new GUIStyle(GUI.skin.label)
  1164. {
  1165. fontSize = 20,
  1166. richText = true,
  1167. fontStyle = FontStyle.Bold,
  1168. alignment = TextAnchor.MiddleCenter
  1169. };
  1170. float boxW = 500;
  1171. float boxH = 40;
  1172. float x = (Screen.width - boxW) / 2;
  1173. float y = (Screen.height - boxH) / 2;
  1174. GUI.Box(new Rect(x - 10, y - 10, boxW + 20, boxH + 20), "");
  1175. GUI.Label(new Rect(x, y, boxW, boxH), $"<color=#FFAA00>{PhotonUtility.RetryStatus}</color>", retryStyle);
  1176. }
  1177. if (!_showPhotonDebug) return;
  1178. string status;
  1179. if (!PhotonNetwork.IsConnected)
  1180. {
  1181. status = "<color=#FF4444>[Photon] Disconnected</color>";
  1182. }
  1183. else if (PhotonNetwork.InRoom)
  1184. {
  1185. string roomName = PhotonNetwork.CurrentRoom != null ? PhotonNetwork.CurrentRoom.Name : "?";
  1186. int players = PhotonNetwork.CurrentRoom != null ? PhotonNetwork.CurrentRoom.PlayerCount : 0;
  1187. status = $"<color=#44FF44>[Photon] Connected | Region: {PhotonNetwork.CloudRegion} | Room: {roomName} ({players} players)</color>";
  1188. }
  1189. else if (PhotonNetwork.InLobby)
  1190. {
  1191. status = $"<color=#44FF44>[Photon] Connected | Region: {PhotonNetwork.CloudRegion} | In Lobby</color>";
  1192. }
  1193. else
  1194. {
  1195. status = $"<color=#FFAA00>[Photon] Connected | Region: {PhotonNetwork.CloudRegion} | Not in Lobby/Room</color>";
  1196. }
  1197. GUIStyle style = new GUIStyle(GUI.skin.label)
  1198. {
  1199. fontSize = 16,
  1200. richText = true,
  1201. fontStyle = FontStyle.Bold
  1202. };
  1203. GUI.Label(new Rect(10, 10, 800, 30), status, style);
  1204. }
  1205. #endregion
  1206. #endif
  1207. }
  1208. #region Manage random numbers
  1209. public static class RandomUtility
  1210. {
  1211. /// <summary>
  1212. /// Generates a cryptographically secure 64-bit random seed.
  1213. /// Uses OS entropy pool via System.Security.Cryptography.
  1214. /// </summary>
  1215. public static long GetSecureRandom()
  1216. {
  1217. byte[] bytes = new byte[8];
  1218. using (var rng = RandomNumberGenerator.Create())
  1219. {
  1220. rng.GetBytes(bytes);
  1221. }
  1222. return BitConverter.ToInt64(bytes, 0);
  1223. }
  1224. #region IsSucceedProbability(float Probability)
  1225. public static bool IsSucceedProbability(float Probability)
  1226. {
  1227. if (Probability >= 1)
  1228. {
  1229. return true;
  1230. }
  1231. if (Probability <= 0)
  1232. {
  1233. return false;
  1234. }
  1235. float random = GameRandom.Range(0f, 1f);
  1236. if (random <= Probability)
  1237. {
  1238. return true;
  1239. }
  1240. return false;
  1241. }
  1242. #endregion
  1243. #region Shuffle the deck
  1244. public static List<CEntity_Base> ShuffledDeckCards(List<CEntity_Base> DeckCards)
  1245. {
  1246. List<CEntity_Base> CardDatas = new List<CEntity_Base>();
  1247. CardDatas.AddRange(DeckCards);
  1248. // Fisher-Yates shuffle using GameRandom (Xoshiro256**)
  1249. int n = CardDatas.Count;
  1250. while (n > 0)
  1251. {
  1252. n--;
  1253. // Random index from 0 to n (inclusive) — Range takes exclusive max
  1254. int k = GameRandom.Range(0, n + 1);
  1255. // Swap elements at indices n and k
  1256. (CardDatas[k], CardDatas[n]) = (CardDatas[n], CardDatas[k]);
  1257. }
  1258. return CardDatas;
  1259. }
  1260. public static List<CardSource> ShuffledDeckCards(List<CardSource> DeckCards)
  1261. {
  1262. List<CardSource> CardDatas = new List<CardSource>();
  1263. CardDatas.AddRange(DeckCards);
  1264. // Fisher-Yates shuffle using GameRandom (Xoshiro256**)
  1265. int n = CardDatas.Count;
  1266. while (n > 0)
  1267. {
  1268. n--;
  1269. // Random index from 0 to n (inclusive) — Range takes exclusive max
  1270. int k = GameRandom.Range(0, n + 1);
  1271. // Swap elements at indices n and k
  1272. CardSource temp = CardDatas[n];
  1273. if (!temp.IsFlipped)
  1274. {
  1275. temp.SetReverse();
  1276. if(temp.Owner.SecurityCards.Contains(temp))
  1277. GManager.OnSecurityStackChanged?.Invoke(temp.Owner);
  1278. }
  1279. CardDatas[n] = CardDatas[k];
  1280. CardDatas[k] = temp;
  1281. }
  1282. return CardDatas;
  1283. }
  1284. #endregion
  1285. }
  1286. #endregion
  1287. #region Manage connections to Photon
  1288. public class PhotonUtility
  1289. {
  1290. public static string RetryStatus { get; set; } = null;
  1291. #region Disconnected from Photon
  1292. public static IEnumerator DisconnectCoroutine()
  1293. {
  1294. #region Exit Room
  1295. if (PhotonNetwork.InRoom)
  1296. {
  1297. PhotonNetwork.LeaveRoom();
  1298. }
  1299. yield return new WaitWhile(() => PhotonNetwork.InRoom);
  1300. #endregion
  1301. #region Exit from the lobby
  1302. if (PhotonNetwork.InLobby)
  1303. {
  1304. PhotonNetwork.LeaveLobby();
  1305. }
  1306. yield return new WaitWhile(() => PhotonNetwork.InLobby);
  1307. #endregion
  1308. #region Disconnected from Photon
  1309. if (PhotonNetwork.IsConnected)
  1310. {
  1311. PhotonNetwork.Disconnect();
  1312. }
  1313. yield return new WaitWhile(() => PhotonNetwork.IsConnected);
  1314. #endregion
  1315. }
  1316. #endregion
  1317. #region Connect to Photon server
  1318. public static IEnumerator ConnectToMasterServerCoroutine()
  1319. {
  1320. int maxRetries = 5;
  1321. float retryDelay = 3f;
  1322. for (int attempt = 0; attempt <= maxRetries; attempt++)
  1323. {
  1324. if (!PhotonNetwork.IsConnected || ContinuousController.instance.LastConnectServerRegion != ContinuousController.instance.serverRegion)
  1325. {
  1326. if (PhotonNetwork.IsConnected)
  1327. {
  1328. yield return ContinuousController.instance.StartCoroutine(DisconnectCoroutine());
  1329. yield return new WaitWhile(() => PhotonNetwork.IsConnected);
  1330. }
  1331. PhotonNetwork.NetworkingClient.AppId = PhotonNetwork.PhotonServerSettings.AppSettings.AppIdRealtime;
  1332. PhotonNetwork.ConnectToRegion(ContinuousController.instance.serverRegion);
  1333. PhotonNetwork.NickName = ContinuousController.instance.PlayerName;
  1334. PhotonNetwork.GameVersion = ContinuousController.instance.GameVerString;
  1335. ContinuousController.instance.LastConnectServerRegion = ContinuousController.instance.serverRegion;
  1336. }
  1337. yield return new WaitUntil(() =>
  1338. PhotonNetwork.IsConnectedAndReady ||
  1339. PhotonNetwork.NetworkingClient.State == Photon.Realtime.ClientState.Disconnected);
  1340. if (PhotonNetwork.IsConnectedAndReady)
  1341. {
  1342. RetryStatus = null;
  1343. yield break;
  1344. }
  1345. var cause = PhotonNetwork.NetworkingClient.DisconnectedCause;
  1346. Debug.LogWarning($"[Photon] Connection failed: {cause} (attempt {attempt + 1}/{maxRetries + 1})");
  1347. if (cause == Photon.Realtime.DisconnectCause.MaxCcuReached && attempt < maxRetries)
  1348. {
  1349. RetryStatus = LocalizeUtility.GetLocalizedString(
  1350. EngMessage: $"Server full. Retrying... ({attempt + 1}/{maxRetries})",
  1351. JpnMessage: $"サーバーが満員です。再接続中... ({attempt + 1}/{maxRetries})"
  1352. );
  1353. Debug.Log($"[Photon] Server full, retrying in {retryDelay}s...");
  1354. yield return new WaitForSeconds(retryDelay);
  1355. retryDelay += 2f;
  1356. continue;
  1357. }
  1358. RetryStatus = LocalizeUtility.GetLocalizedString(
  1359. EngMessage: "Connection failed. Please try again later.",
  1360. JpnMessage: "接続に失敗しました。後でもう一度お試しください。"
  1361. );
  1362. Debug.LogError($"[Photon] Connection failed permanently: {cause}");
  1363. yield break;
  1364. }
  1365. }
  1366. #endregion
  1367. #region Connect to Photon Server and Lobby
  1368. public static IEnumerator ConnectToLobbyCoroutine()
  1369. {
  1370. #region Connect to Photon server
  1371. yield return ContinuousController.instance.StartCoroutine(ConnectToMasterServerCoroutine());
  1372. #endregion
  1373. #region Save player name to custom properties
  1374. yield return ContinuousController.instance.StartCoroutine(SetPlayerName());
  1375. #endregion
  1376. #region Save the number of wins to a custom property
  1377. Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1378. if (hash.TryGetValue(ContinuousController.WinCountKey, out object value))
  1379. {
  1380. hash[ContinuousController.WinCountKey] = ContinuousController.instance.WinCount;
  1381. }
  1382. else
  1383. {
  1384. hash.Add(ContinuousController.WinCountKey, ContinuousController.instance.WinCount);
  1385. }
  1386. PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
  1387. while (true)
  1388. {
  1389. Hashtable _hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1390. if (_hash.TryGetValue(ContinuousController.WinCountKey, out value))
  1391. {
  1392. if ((int)value == ContinuousController.instance.WinCount)
  1393. {
  1394. break;
  1395. }
  1396. }
  1397. yield return null;
  1398. }
  1399. #endregion
  1400. #region Connect to Lobby
  1401. if (!PhotonNetwork.InLobby)
  1402. {
  1403. PhotonNetwork.JoinLobby();
  1404. }
  1405. yield return new WaitWhile(() => !PhotonNetwork.InLobby);
  1406. yield return new WaitUntil(() => PhotonNetwork.InLobby && PhotonNetwork.IsConnectedAndReady);
  1407. #endregion
  1408. }
  1409. #endregion
  1410. #region Save player name to properties
  1411. public static IEnumerator SetPlayerName()
  1412. {
  1413. Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1414. if (hash.TryGetValue(ContinuousController.PlayerNameKey, out object value))
  1415. {
  1416. hash[ContinuousController.PlayerNameKey] = ContinuousController.instance.PlayerName;
  1417. }
  1418. else
  1419. {
  1420. hash.Add(ContinuousController.PlayerNameKey, ContinuousController.instance.PlayerName);
  1421. }
  1422. PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
  1423. while (true)
  1424. {
  1425. Hashtable _hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1426. if (_hash.TryGetValue(ContinuousController.PlayerNameKey, out value))
  1427. {
  1428. if ((string)value == ContinuousController.instance.PlayerName)
  1429. {
  1430. break;
  1431. }
  1432. }
  1433. yield return null;
  1434. }
  1435. }
  1436. #endregion
  1437. #region Save deck data to custom properties
  1438. public static IEnumerator SignUpBattleDeckData()
  1439. {
  1440. Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1441. if (hash.TryGetValue(ContinuousController.DeckDataPropertyKey, out object value))
  1442. {
  1443. hash[ContinuousController.DeckDataPropertyKey] = ContinuousController.instance.BattleDeckData.GetThisDeckCode();
  1444. }
  1445. else
  1446. {
  1447. hash.Add(ContinuousController.DeckDataPropertyKey, ContinuousController.instance.BattleDeckData.GetThisDeckCode());
  1448. }
  1449. PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
  1450. while (true)
  1451. {
  1452. Hashtable _hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1453. if (_hash.TryGetValue(ContinuousController.DeckDataPropertyKey, out value))
  1454. {
  1455. if ((string)value == ContinuousController.instance.BattleDeckData.GetThisDeckCode())
  1456. {
  1457. break;
  1458. }
  1459. }
  1460. yield return null;
  1461. }
  1462. }
  1463. #endregion
  1464. #region Remove custom properties from deck data
  1465. public static IEnumerator DeleteBattleDeckData()
  1466. {
  1467. Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1468. if (hash.TryGetValue(ContinuousController.DeckDataPropertyKey, out object value))
  1469. {
  1470. hash.Remove(ContinuousController.DeckDataPropertyKey);
  1471. }
  1472. PhotonNetwork.LocalPlayer.SetCustomProperties(hash);
  1473. while (true)
  1474. {
  1475. Hashtable _hash = PhotonNetwork.LocalPlayer.CustomProperties;
  1476. if (!_hash.TryGetValue(ContinuousController.DeckDataPropertyKey, out value))
  1477. {
  1478. break;
  1479. }
  1480. yield return null;
  1481. }
  1482. }
  1483. #endregion
  1484. }
  1485. #endregion
  1486. public enum Language
  1487. {
  1488. ENG,
  1489. JPN,
  1490. }