SelectCardEffect.cs 27 KB

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