SelectCardEffect.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon.Pun;
  6. using System;
  7. public class SelectCardEffect : MonoBehaviourPunCallbacks
  8. {
  9. public void SetUp(
  10. Func<CardSource, bool> canTargetCondition,
  11. Func<List<CardSource>, CardSource, bool> canTargetCondition_ByPreSelecetedList,
  12. Func<List<CardSource>, bool> canEndSelectCondition,
  13. Func<bool> canNoSelect,
  14. Func<CardSource, IEnumerator> selectCardCoroutine,
  15. Func<List<CardSource>, IEnumerator> afterSelectCardCoroutine,
  16. string message,
  17. int maxCount,
  18. bool canEndNotMax,
  19. bool isShowOpponent,
  20. Mode mode,
  21. Root root,
  22. List<CardSource> customRootCardList,
  23. bool canLookReverseCard,
  24. Player selectPlayer,
  25. ICardEffect cardEffect)
  26. {
  27. _canTargetCondition = canTargetCondition;
  28. _canTargetCondition_ByPreSelecetedList = canTargetCondition_ByPreSelecetedList;
  29. _canEndSelectCondition = canEndSelectCondition;
  30. _canNoSelect = canNoSelect;
  31. _selectCardCoroutine = selectCardCoroutine;
  32. _afterSelectCardCoroutine = afterSelectCardCoroutine;
  33. _message = message;
  34. _maxCount = maxCount;
  35. _canEndNotMax = canEndNotMax;
  36. _isShowOpponent = isShowOpponent;
  37. _mode = mode;
  38. _root = root;
  39. _customRootCardList = customRootCardList;
  40. _canLookReverseCard = canLookReverseCard;
  41. _selectPlayer = selectPlayer;
  42. _cardEffect = cardEffect;
  43. _isLocal = false;
  44. _customMessage = null;
  45. _customMessage_Enemy = null;
  46. _customMessage_ShowCard = null;
  47. _customCountText = null;
  48. _showReverseCard = true;
  49. _showCard = true;
  50. _isDigiXros = false;
  51. _isAssembly = false;
  52. _isDeckBottom = false;
  53. _isDeckTop = false;
  54. _notAddLog = false;
  55. _isSecurity = false;
  56. _allowFaceDown = false;
  57. _skillInfos = new List<SkillInfo>();
  58. _afterSelectIndexCoroutine = null;
  59. _endSelect = false;
  60. }
  61. public void SetIsLocal()
  62. {
  63. _isLocal = true;
  64. }
  65. public void SetIsDeckBottom()
  66. {
  67. _isDeckBottom = true;
  68. }
  69. public void SetIsDeckTop()
  70. {
  71. _isDeckTop = true;
  72. }
  73. public void SetNotShowCard()
  74. {
  75. _showCard = false;
  76. }
  77. public void SetNotAddLog()
  78. {
  79. _notAddLog = true;
  80. }
  81. public void SetDigiXros()
  82. {
  83. _isDigiXros = true;
  84. }
  85. public void SetAssembly()
  86. {
  87. _isAssembly = true;
  88. }
  89. public void SetIsSecurity()
  90. {
  91. _isSecurity = true;
  92. }
  93. public void SetUseFaceDown()
  94. {
  95. _allowFaceDown = true;
  96. }
  97. public void SetUpSkillInfos(List<SkillInfo> skillInfos)
  98. {
  99. _skillInfos = skillInfos.Clone();
  100. }
  101. public void SetUpCustomMessage(string CustomMessage, string CustomMessage_Enemy)
  102. {
  103. _customMessage = CustomMessage;
  104. _customMessage_Enemy = CustomMessage_Enemy;
  105. }
  106. public void SetUpCustomMessage_ShowCard(string CustomMessage_ShowCard)
  107. {
  108. _customMessage_ShowCard = CustomMessage_ShowCard;
  109. }
  110. public void SetUpCustomCountText(string CustomCountText)
  111. {
  112. _customCountText = CustomCountText;
  113. }
  114. public void SetShowReverseCard()
  115. {
  116. _showReverseCard = false;
  117. }
  118. Func<CardSource, bool> _canTargetCondition = null;
  119. Func<List<CardSource>, CardSource, bool> _canTargetCondition_ByPreSelecetedList = null;
  120. Func<List<CardSource>, bool> _canEndSelectCondition = null;
  121. Func<bool> _canNoSelect = null;
  122. List<CardSource> _targetCards = new List<CardSource>();
  123. Func<CardSource, IEnumerator> _selectCardCoroutine = null;
  124. Func<List<CardSource>, IEnumerator> _afterSelectCardCoroutine = null;
  125. string _message = "";
  126. int _maxCount = 0;
  127. bool _canEndNotMax = false;
  128. bool _isShowOpponent = false;
  129. bool _canLookReverseCard = false;
  130. List<CardSource> _customRootCardList { get; set; } = new List<CardSource>();
  131. Player _selectPlayer = null;
  132. ICardEffect _cardEffect = null;
  133. bool _isLocal = false;
  134. bool _showReverseCard = true;
  135. bool _showCard = true;
  136. bool _notAddLog = false;
  137. bool _isDigiXros = false;
  138. bool _isAssembly = false;
  139. bool _isSecurity = false;
  140. bool _allowFaceDown = false;
  141. public enum Mode
  142. {
  143. AddHand,
  144. Discard,
  145. // PutLibraryTop,
  146. // PutLibraryBottom,
  147. Custom,
  148. }
  149. Mode _mode;
  150. public enum Root
  151. {
  152. Library,
  153. Trash,
  154. Clock,
  155. Security,
  156. Custom,
  157. Hand,
  158. Recollection,
  159. Execution,
  160. DigivolutionCards,
  161. None,
  162. }
  163. Root _root;
  164. bool _endSelect = false;
  165. bool _isDeckBottom = false;
  166. bool _isDeckTop = false;
  167. string _customMessage = null;
  168. string _customMessage_Enemy = null;
  169. string _customMessage_ShowCard = null;
  170. string _customCountText = null;
  171. List<SkillInfo> _skillInfos = new List<SkillInfo>();
  172. List<int> _slectedInexesInList = new List<int>();
  173. Func<List<int>, IEnumerator> _afterSelectIndexCoroutine = null;
  174. public void SetUpAfterSelectIndexCoroutine(Func<List<int>, IEnumerator> AfterSelectIndexCoroutine)
  175. {
  176. _afterSelectIndexCoroutine = AfterSelectIndexCoroutine;
  177. }
  178. public virtual List<CardSource> RootCardList()
  179. {
  180. List<CardSource> RootCardList = new List<CardSource>();
  181. switch (_root)
  182. {
  183. case Root.Library:
  184. if (_customRootCardList.Count > 0)
  185. {
  186. foreach (CardSource cardSource in _customRootCardList)
  187. {
  188. RootCardList.Add(cardSource);
  189. }
  190. }
  191. else
  192. {
  193. foreach (CardSource cardSource in _selectPlayer.LibraryCards)
  194. {
  195. RootCardList.Add(cardSource);
  196. }
  197. }
  198. break;
  199. case Root.Trash:
  200. foreach (CardSource cardSource in _selectPlayer.TrashCards)
  201. {
  202. RootCardList.Add(cardSource);
  203. }
  204. break;
  205. case Root.Security:
  206. foreach (CardSource cardSource in _selectPlayer.SecurityCards)
  207. {
  208. RootCardList.Add(cardSource);
  209. }
  210. break;
  211. case Root.Recollection:
  212. foreach (CardSource cardSource in _selectPlayer.LostCards)
  213. {
  214. RootCardList.Add(cardSource);
  215. }
  216. break;
  217. case Root.Custom:
  218. foreach (CardSource cardSource in _customRootCardList)
  219. {
  220. RootCardList.Add(cardSource);
  221. }
  222. break;
  223. }
  224. return RootCardList;
  225. }
  226. private bool CanSelectCard(CardSource cardSource)
  227. {
  228. if (_root != Root.Library && _root != Root.Security && _root != Root.Custom)
  229. {
  230. if (cardSource.IsFlipped)
  231. return false;
  232. }
  233. if (_canTargetCondition != null)
  234. {
  235. if (_canTargetCondition(cardSource))
  236. {
  237. if (!_allowFaceDown)
  238. {
  239. if (cardSource.IsFlipped)
  240. return false;
  241. }
  242. return true;
  243. }
  244. }
  245. return false;
  246. }
  247. public bool active()
  248. {
  249. if (RootCardList().Count > 0)
  250. {
  251. if (_root != Root.Library && _root != Root.Security)
  252. {
  253. if (RootCardList().Count(CanSelectCard) > 0)
  254. {
  255. return true;
  256. }
  257. }
  258. else
  259. {
  260. return true;
  261. }
  262. }
  263. return false;
  264. }
  265. public virtual IEnumerator Activate()
  266. {
  267. bool oldIsSelecting = GManager.instance.turnStateMachine.IsSelecting;
  268. List<CardSource> handCards = new List<CardSource>();
  269. _targetCards = new List<CardSource>();
  270. _slectedInexesInList = new List<int>();
  271. if (!_isLocal)
  272. {
  273. yield return GManager.instance.photonWaitController.StartWait("SelectCardEffect");
  274. }
  275. bool oldIsActiveOutline_AttackingPermanent = false;
  276. if (GManager.instance.attackProcess.AttackingPermanent != null)
  277. {
  278. if (GManager.instance.attackProcess.AttackingPermanent.ShowingPermanentCard != null)
  279. {
  280. oldIsActiveOutline_AttackingPermanent = GManager.instance.attackProcess.AttackingPermanent.ShowingPermanentCard.Outline_Select.gameObject.activeSelf;
  281. }
  282. }
  283. foreach (Player player in GManager.instance.turnStateMachine.gameContext.Players)
  284. {
  285. GManager.instance.turnStateMachine.OffFieldCardTarget(player);
  286. GManager.instance.turnStateMachine.OffHandCardTarget(player);
  287. }
  288. if (GManager.instance.attackProcess.AttackingPermanent != null)
  289. {
  290. if (GManager.instance.attackProcess.AttackingPermanent.ShowingPermanentCard != null)
  291. {
  292. GManager.instance.attackProcess.AttackingPermanent.ShowingPermanentCard.Outline_Select.gameObject.SetActive(oldIsActiveOutline_AttackingPermanent);
  293. }
  294. }
  295. if (_maxCount == 0)
  296. {
  297. _canNoSelect = () => true;
  298. }
  299. if (_root == Root.Security)
  300. {
  301. SetIsSecurity();
  302. }
  303. if (active())
  304. {
  305. if (_isSecurity)
  306. {
  307. GManager.instance.turnStateMachine.gameContext.IsSecurityLooking = true;
  308. }
  309. if (_selectPlayer.isYou)
  310. {
  311. if ((_isDeckBottom && ContinuousController.instance.autoDeckBottomOrder)
  312. || (_isDeckTop && ContinuousController.instance.autoDeckTopOrder))
  313. {
  314. AutoSelect();
  315. }
  316. else
  317. {
  318. List<int> targetCardIDs = new List<int>();
  319. GManager.instance.turnStateMachine.IsSelecting = true;
  320. #region Message Display
  321. if (!string.IsNullOrEmpty(_customMessage))
  322. {
  323. GManager.instance.commandText.OpenCommandText(_customMessage, _isDigiXros, _isAssembly);
  324. }
  325. else
  326. {
  327. string message = "";
  328. switch (_mode)
  329. {
  330. case Mode.AddHand:
  331. message = "Select cards to add to your hand.";
  332. break;
  333. case Mode.Discard:
  334. message = "Select cards to trash.";
  335. break;
  336. case Mode.Custom:
  337. message = "Select cards.";
  338. break;
  339. }
  340. if (!string.IsNullOrEmpty(message))
  341. {
  342. GManager.instance.commandText.OpenCommandText(message, _isDigiXros, _isAssembly);
  343. }
  344. }
  345. #endregion
  346. List<CardSource> RootCards = new List<CardSource>();
  347. foreach (CardSource cardSource in RootCardList())
  348. {
  349. RootCards.Add(cardSource);
  350. }
  351. #region Sort
  352. if (_root == Root.Library || _root == Root.Trash)
  353. {
  354. RootCards = DeckData.SortedCardsList(RootCards);
  355. List<CardSource> matchConditionCards = new List<CardSource>();
  356. List<CardSource> notMatchConditionCards = new List<CardSource>();
  357. foreach (CardSource cardSource in RootCards)
  358. {
  359. if (CanSelectCard(cardSource))
  360. {
  361. matchConditionCards.Add(cardSource);
  362. }
  363. else
  364. {
  365. notMatchConditionCards.Add(cardSource);
  366. }
  367. }
  368. RootCards = new List<CardSource>();
  369. foreach (CardSource cardSource in matchConditionCards)
  370. {
  371. RootCards.Add(cardSource);
  372. }
  373. foreach (CardSource cardSource in notMatchConditionCards)
  374. {
  375. RootCards.Add(cardSource);
  376. }
  377. }
  378. #endregion
  379. #region Effect in progress/waiting to be activated
  380. if (_cardEffect != null)
  381. {
  382. if (_cardEffect.EffectSourceCard != null)
  383. {
  384. if (_skillInfos.Count == 0)
  385. {
  386. if (_root == Root.Trash)
  387. {
  388. SkillInfo[] skillInfoArray = new SkillInfo[RootCards.Count];
  389. for (int i = 0; i < skillInfoArray.Length; i++)
  390. {
  391. if (0 <= i && i <= RootCards.Count - 1)
  392. {
  393. if (RootCards[i] == _cardEffect.EffectSourceCard)
  394. {
  395. ICardEffect cardEffect = new ChangeBaseDPClass();
  396. cardEffect.SetUpICardEffect("Effect Processing", null, RootCards[i]);
  397. skillInfoArray[i] = new SkillInfo(cardEffect, null, EffectTiming.None);
  398. }
  399. else
  400. {
  401. if (GManager.instance.autoProcessing.executingMultipleSkills != null)
  402. {
  403. bool isEffectWaiting(SkillInfo skillInfo)
  404. {
  405. if (skillInfo != null)
  406. {
  407. if (skillInfo.CardEffect != null)
  408. {
  409. if (skillInfo.CardEffect.EffectSourceCard != null)
  410. {
  411. if (skillInfo.CardEffect.EffectSourceCard == RootCards[i])
  412. {
  413. return true;
  414. }
  415. }
  416. }
  417. }
  418. return false;
  419. }
  420. if (GManager.instance.autoProcessing.executingMultipleSkills.StackedSkillInfos.Count(isEffectWaiting) >= 1)
  421. {
  422. ICardEffect cardEffect = new ChangeBaseDPClass();
  423. cardEffect.SetUpICardEffect("Effect Waiting", null, RootCards[i]);
  424. skillInfoArray[i] = new SkillInfo(cardEffect, null, EffectTiming.None);
  425. }
  426. }
  427. }
  428. }
  429. }
  430. _skillInfos = skillInfoArray.ToList();
  431. }
  432. }
  433. }
  434. }
  435. #endregion
  436. GManager.instance.selectCardPanel._customCountText = _customCountText;
  437. yield return StartCoroutine(GManager.instance.selectCardPanel.OpenSelectCardPanel(
  438. Message: _message,
  439. RootCardSources: RootCards,
  440. _CanTargetCondition: CanSelectCard,
  441. _CanTargetCondition_ByPreSelecetedList: _canTargetCondition_ByPreSelecetedList,
  442. _CanEndSelectCondition: _canEndSelectCondition,
  443. _MaxCount: _maxCount,
  444. _CanEndNotMax: _canEndNotMax,
  445. _CanNoSelect: _canNoSelect,
  446. CanLookReverseCard: _canLookReverseCard,
  447. skillInfos: _skillInfos,
  448. root: _root));
  449. foreach (CardSource selectedCard in GManager.instance.selectCardPanel.SelectedList)
  450. {
  451. targetCardIDs.Add(selectedCard.CardIndex);
  452. }
  453. foreach (int selectedIndex in GManager.instance.selectCardPanel.SelectedIndex)
  454. {
  455. _slectedInexesInList.Add(selectedIndex);
  456. }
  457. photonView.RPC("SetTargetIndicies", RpcTarget.All, _slectedInexesInList.ToArray());
  458. photonView.RPC("SetTargetCard", RpcTarget.All, targetCardIDs.ToArray());
  459. }
  460. }
  461. else
  462. {
  463. if (!string.IsNullOrEmpty(_customMessage_Enemy))
  464. {
  465. GManager.instance.commandText.OpenCommandText(_customMessage_Enemy, _isDigiXros, _isAssembly);
  466. }
  467. else
  468. {
  469. GManager.instance.commandText.OpenCommandText("The opponent is selecting cards.", _isDigiXros, _isAssembly);
  470. }
  471. #region AI
  472. if (GManager.instance.IsAI)
  473. {
  474. AutoSelect();
  475. }
  476. #endregion
  477. }
  478. void AutoSelect()
  479. {
  480. List<CardSource> ValidCards = new List<CardSource>();
  481. foreach (CardSource cardSource in RootCardList())
  482. {
  483. if (CanSelectCard(cardSource))
  484. {
  485. ValidCards.Add(cardSource);
  486. }
  487. }
  488. IList<int> indexList = Enumerable.Range(0, ValidCards.Count).ToList();
  489. if (ValidCards.Count >= _maxCount)
  490. {
  491. for (int i = 0; i < 1000; i++)
  492. {
  493. List<int> GetIndexes = indexList.GetRandom(_maxCount).ToList();
  494. List<CardSource> GetCards = new List<CardSource>();
  495. foreach (int index in GetIndexes)
  496. {
  497. GetCards.Add(ValidCards[index]);
  498. }
  499. if (_canEndSelectCondition != null)
  500. {
  501. if (!_canEndSelectCondition(GetCards))
  502. {
  503. continue;
  504. }
  505. }
  506. List<int> CardIDs = new List<int>();
  507. foreach (CardSource cardSource in GetCards)
  508. {
  509. CardIDs.Add(cardSource.CardIndex);
  510. }
  511. if (GManager.instance.IsAI)
  512. {
  513. SetTargetCard(CardIDs.ToArray());
  514. }
  515. else
  516. {
  517. photonView.RPC("SetTargetCard", RpcTarget.All, CardIDs.ToArray());
  518. }
  519. break;
  520. }
  521. }
  522. if (GManager.instance.IsAI)
  523. {
  524. _endSelect = true;
  525. }
  526. }
  527. yield return new WaitWhile(() => !_endSelect);
  528. _endSelect = false;
  529. GManager.instance.commandText.CloseCommandText();
  530. yield return new WaitWhile(() => GManager.instance.commandText.gameObject.activeSelf);
  531. #region Show selected card
  532. if (_targetCards.Count > 0 && _showCard)
  533. {
  534. if (_targetCards.Count((cardSource) => cardSource.IsFlipped) > 0 && !_showReverseCard)
  535. {
  536. //表示しない
  537. }
  538. else
  539. {
  540. if (_isShowOpponent || (_selectPlayer.isYou && _targetCards.Count((cardSource) => cardSource.Owner == _selectPlayer) > 0))
  541. {
  542. if (!string.IsNullOrEmpty(_customMessage_ShowCard))
  543. {
  544. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(_targetCards, _customMessage_ShowCard, true, true));
  545. }
  546. else
  547. {
  548. switch (_mode)
  549. {
  550. case Mode.AddHand:
  551. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(_targetCards, "Cards added to hand", true, true));
  552. break;
  553. case Mode.Discard:
  554. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(_targetCards, "Cards put on the trash", true, true));
  555. break;
  556. case Mode.Custom:
  557. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(_targetCards, "Selected Cards", true, true));
  558. break;
  559. }
  560. }
  561. }
  562. }
  563. }
  564. #endregion
  565. Hashtable hashtable = CardEffectCommons.CardEffectHashtable(_cardEffect);
  566. string log = "";
  567. if (_mode == Mode.AddHand)
  568. {
  569. log += $"\nCard{Utils.PluralFormSuffix(_targetCards.Count)} added to hand:";
  570. }
  571. else if (_mode == Mode.AddHand)
  572. {
  573. log += $"\nTrash Card{Utils.PluralFormSuffix(_targetCards.Count)}:";
  574. }
  575. else
  576. {
  577. log += $"\nSelected Card{Utils.PluralFormSuffix(_targetCards.Count)}:";
  578. }
  579. if (_root == Root.Library)
  580. {
  581. yield return ContinuousController.instance.StartCoroutine(CardObjectController.Shuffle(_selectPlayer));
  582. }
  583. foreach (CardSource cardSource in _targetCards)
  584. {
  585. log += $"\n{cardSource.BaseENGCardNameFromEntity}({cardSource.CardID})";
  586. }
  587. switch (_mode)
  588. {
  589. case Mode.AddHand:
  590. foreach (CardSource cardSource in _targetCards)
  591. {
  592. cardSource.SetFace("SelectCardEffect.Activate.AddHand");
  593. if (cardSource.IsDigiEgg) yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(new List<CardSource> { cardSource }));
  594. else
  595. {
  596. if (cardSource.PermanentOfThisCard() != null)
  597. {
  598. if (cardSource.PermanentOfThisCard().DigivolutionCards.Contains(cardSource))
  599. {
  600. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(cardSource, cardSource.PermanentOfThisCard()));
  601. }
  602. }
  603. handCards.Add(cardSource);
  604. }
  605. }
  606. break;
  607. case Mode.Discard:
  608. foreach (CardSource cardSource in _targetCards)
  609. {
  610. if (CardEffectCommons.IsExistOnHand(cardSource))
  611. {
  612. List<IDiscardHand> discardHands = _targetCards.Map(cardSource => new IDiscardHand(cardSource, hashtable));
  613. yield return ContinuousController.instance.StartCoroutine(new IDiscardHands(discardHands, _cardEffect).DiscardHands());
  614. }
  615. else if (CardEffectCommons.IsExistLinked(cardSource))
  616. {
  617. yield return ContinuousController.instance.StartCoroutine(cardSource.PermanentOfThisCard().RemoveLinkedCard(cardSource));
  618. }
  619. else
  620. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(cardSource));
  621. }
  622. break;
  623. case Mode.Custom:
  624. if (_selectCardCoroutine != null)
  625. {
  626. foreach (CardSource cardSource in _targetCards)
  627. {
  628. yield return StartCoroutine(_selectCardCoroutine(cardSource));
  629. }
  630. }
  631. break;
  632. }
  633. if (handCards.Count >= 1)
  634. {
  635. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(handCards, false, _cardEffect));
  636. }
  637. #region ログ追加
  638. if (!_notAddLog)
  639. {
  640. if (_isShowOpponent || _selectPlayer.isYou)
  641. {
  642. if (_targetCards.Count >= 1)
  643. {
  644. log += "\n";
  645. PlayLog.OnAddLog?.Invoke(log);
  646. }
  647. }
  648. }
  649. #endregion
  650. }
  651. if (_afterSelectCardCoroutine != null)
  652. {
  653. yield return StartCoroutine(_afterSelectCardCoroutine(_targetCards));
  654. }
  655. if (_afterSelectIndexCoroutine != null)
  656. {
  657. yield return StartCoroutine(_afterSelectIndexCoroutine(_slectedInexesInList));
  658. }
  659. GManager.instance.turnStateMachine.gameContext.IsSecurityLooking = false;
  660. GManager.instance.turnStateMachine.IsSelecting = oldIsSelecting;
  661. }
  662. [PunRPC]
  663. public void SetTargetCard(int[] CardIDs)
  664. {
  665. _targetCards = new List<CardSource>();
  666. foreach (int CardID in CardIDs)
  667. {
  668. _targetCards.Add(GManager.instance.turnStateMachine.gameContext.ActiveCardList[CardID]);
  669. }
  670. _endSelect = true;
  671. }
  672. [PunRPC]
  673. public void SetTargetIndicies(int[] CardIDs)
  674. {
  675. _slectedInexesInList = new List<int>();
  676. foreach (int index in CardIDs)
  677. {
  678. _slectedInexesInList.Add(index);
  679. }
  680. }
  681. }