FieldPermanentCard.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Events;
  5. using UnityEngine.UI;
  6. using DG.Tweening;
  7. using UnityEngine.EventSystems;
  8. using TMPro;
  9. using System;
  10. using System.Diagnostics;
  11. public class FieldPermanentCard : MonoBehaviour
  12. {
  13. [Header("選択状態アウトライン")]
  14. public Image Outline_Select;
  15. [Header("カード画像")]
  16. public Image CardImage;
  17. [Header("ブロッカーエフェクト")]
  18. public GameObject BlockerEffect;
  19. [Header("エナジー個数Text")]
  20. public Text EnergyCountText;
  21. [Header("コライダー")]
  22. public GameObject Collider;
  23. [Header("アニメーター")]
  24. public Animator anim;
  25. [Header("コマンドパネル")]
  26. public CommandPanel fieldUnitCommandPanel;
  27. [Header("スキル名Text")]
  28. public Text SkillNameText;
  29. [Header("DPテキスト")]
  30. public Text DPText;
  31. [Header("DP枠")]
  32. public List<Image> DPBackground_color = new List<Image>();
  33. [Header("進化元枚テキスト")]
  34. public Text EvoRootCountText;
  35. [Header("進化元枚枠")]
  36. public Image EvoRootCountBackground;
  37. [Header("レベルテキスト")]
  38. public TextMeshProUGUI LevelText;
  39. [Header("表示親")]
  40. public GameObject Parent;
  41. [Header("スキル使用エフェクト")]
  42. public GameObject UsingSkillEffect;
  43. [Header("進化元追加エフェクト")]
  44. public ParticleSystem addDigivolutionCardsEffect;
  45. //初期スケール
  46. public Vector3 StartScale { get; set; }
  47. [Header("パーマネント番号テキスト")]
  48. public TextMeshProUGUI permanentIndexText;
  49. [Header("タップオブジェクト")]
  50. public GameObject TapObject;
  51. [Header("ダメージテキスト")]
  52. public Text DirectStrikeText;
  53. [Header("召喚酔い")]
  54. public GameObject SummonSicknessObject;
  55. [Header("進化予定オブジェクト")]
  56. public GameObject WillEvolutionObject;
  57. [Header("消滅予定オブジェクト")]
  58. public GameObject WillBeDeletedObject;
  59. [Header("デッキバウンス予定オブジェクト")]
  60. public GameObject WillBeDeckBounceObject;
  61. [Header("手札バウンス予定オブジェクト")]
  62. public GameObject WillBeHandBounceObject;
  63. [Header("場を離れる予定オブジェクト")]
  64. public GameObject WillRemoveFieldObject;
  65. [Header("アンタップ予定オブジェクト")]
  66. public GameObject WillUntapObject;
  67. public List<TextCardColorMaterial> textCardColorMaterials = new List<TextCardColorMaterial>();
  68. public UnityAction<FieldPermanentCard> OnClickAction;
  69. public Permanent ThisPermanent { get; set; }
  70. public bool IsEffectPlaying { get; set; }
  71. private void Awake()
  72. {
  73. RemoveSelectEffect();
  74. CloseCommandPanel();
  75. Outline_Select.gameObject.SetActive(false);
  76. OffUsingSkillEffect();
  77. OffSkillName();
  78. if (BlockerEffect != null)
  79. {
  80. BlockerEffect.gameObject.SetActive(false);
  81. }
  82. if (EvoRootCountText != null)
  83. {
  84. EvoRootCountText.transform.parent.gameObject.SetActive(false);
  85. }
  86. if (DirectStrikeText != null)
  87. {
  88. DirectStrikeText.transform.parent.parent.gameObject.SetActive(true);
  89. DirectStrikeText.transform.parent.gameObject.SetActive(false);
  90. }
  91. if (SummonSicknessObject != null)
  92. {
  93. SummonSicknessObject.gameObject.SetActive(false);
  94. }
  95. if (WillEvolutionObject != null)
  96. {
  97. WillEvolutionObject.SetActive(false);
  98. }
  99. if (WillBeDeletedObject != null)
  100. {
  101. WillBeDeletedObject.SetActive(false);
  102. }
  103. if (WillBeDeckBounceObject != null)
  104. {
  105. WillBeDeckBounceObject.SetActive(false);
  106. }
  107. if (WillBeHandBounceObject != null)
  108. {
  109. WillBeHandBounceObject.SetActive(false);
  110. }
  111. if (WillRemoveFieldObject != null)
  112. {
  113. WillRemoveFieldObject.SetActive(false);
  114. }
  115. if (WillUntapObject != null)
  116. {
  117. WillUntapObject.SetActive(false);
  118. }
  119. OffPermanentIndexText();
  120. //Events
  121. GManager.OnReverseOpponentsCardsChanged += SetTransformRotation;
  122. GManager.OnCardFlippedChanged += SetCardIsFlipped;
  123. //GManager.OnCardSuspendedChanged += SetCardSuspended;
  124. }
  125. public IEnumerator ShowAddDigivolutionCardEffect()
  126. {
  127. if (addDigivolutionCardsEffect != null)
  128. {
  129. addDigivolutionCardsEffect.gameObject.SetActive(true);
  130. addDigivolutionCardsEffect.Play();
  131. }
  132. yield return new WaitForSeconds(0.1f);
  133. }
  134. public void OffPermanentIndexText()
  135. {
  136. if (permanentIndexText != null)
  137. {
  138. permanentIndexText.transform.parent.gameObject.SetActive(false);
  139. }
  140. }
  141. public void SetPermanentIndexText(List<Permanent> permanents)
  142. {
  143. if (permanentIndexText != null)
  144. {
  145. if (ThisPermanent != null)
  146. {
  147. if (ThisPermanent.TopCard != null)
  148. {
  149. int index = permanents.IndexOf(ThisPermanent) + 1;
  150. permanentIndexText.transform.parent.parent.gameObject.SetActive(true);
  151. permanentIndexText.transform.parent.gameObject.SetActive(true);
  152. permanentIndexText.text = $"{index}";
  153. }
  154. }
  155. }
  156. }
  157. void RotateSkillNameText()
  158. {
  159. SkillNameText.transform.parent.localRotation = Quaternion.Euler(0, 0, -1 * this.transform.localRotation.eulerAngles.z);
  160. }
  161. public void OnSkillName(ICardEffect cardEffect)
  162. {
  163. if (SkillNameText != null && ThisPermanent != null)
  164. {
  165. RotateSkillNameText();
  166. SkillNameText.transform.parent.gameObject.SetActive(true);
  167. SkillNameText.text = cardEffect.EffectName;
  168. }
  169. }
  170. public void OffSkillName()
  171. {
  172. if (SkillNameText != null)
  173. {
  174. SkillNameText.transform.parent.gameObject.SetActive(false);
  175. }
  176. }
  177. public void OffUsingSkillEffect()
  178. {
  179. if (UsingSkillEffect != null)
  180. {
  181. UsingSkillEffect.SetActive(false);
  182. }
  183. }
  184. public void OnUsingSkillEffect()
  185. {
  186. if (UsingSkillEffect != null)
  187. {
  188. UsingSkillEffect.SetActive(true);
  189. }
  190. }
  191. float _validPressTime = 0.5f;
  192. float _requiredTime = 0.0f;
  193. bool _pressing = false;
  194. #region Processing on click
  195. #region Processing when clicked
  196. public void OnClick()
  197. {
  198. if (ThisPermanent != null)
  199. {
  200. if (ThisPermanent.TopCard != null)
  201. {
  202. if (Input.GetMouseButtonUp(0))
  203. {
  204. OnClickAction?.Invoke(this);
  205. }
  206. else if (Input.GetMouseButtonUp(1))
  207. {
  208. OnRightClicked();
  209. }
  210. }
  211. }
  212. }
  213. void OnRightClicked()
  214. {
  215. if (!ThisPermanent.TopCard.IsFlipped || ThisPermanent.TopCard.Owner.isYou)
  216. {
  217. GManager.instance.pokemonDetail.OpenUnitDetail(ThisPermanent);
  218. }
  219. }
  220. #endregion
  221. #region Added processing when clicked
  222. public void AddClickTarget(UnityAction<FieldPermanentCard> _OnClickAction)
  223. {
  224. OnClickAction = _OnClickAction;
  225. }
  226. #endregion
  227. #region Delete the process when clicked
  228. public void RemoveClickTarget()
  229. {
  230. OnClickAction = null;
  231. }
  232. #endregion
  233. #endregion
  234. #region Set permanent data
  235. public void SetPermanentData(Permanent permanent, bool updateIsTapped)
  236. {
  237. ThisPermanent = permanent;
  238. SetTransformRotation();
  239. SetCardIsFlipped();
  240. ShowPermanentData(updateIsTapped);
  241. }
  242. #endregion
  243. #region Reflect permanent data on UI
  244. bool _oldTurnSuspendedCards = false;
  245. void SetTransformRotation()
  246. {
  247. if (ThisPermanent == null)
  248. return;
  249. if (ThisPermanent.TopCard == null)
  250. return;
  251. if (ThisPermanent.TopCard.Owner.isYou)
  252. return;
  253. if (ContinuousController.instance == null)
  254. return;
  255. if (ContinuousController.instance.reverseOpponentsCards)
  256. Parent.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 180));
  257. else
  258. Parent.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
  259. }
  260. async void SetCardIsFlipped()
  261. {
  262. if (ThisPermanent == null)
  263. return;
  264. if (ThisPermanent.TopCard == null)
  265. return;
  266. if (ContinuousController.instance == null)
  267. return;
  268. if (CardImage == null)
  269. return;
  270. // card image
  271. if (ThisPermanent.TopCard.IsFlipped)
  272. {
  273. if (CardImage.sprite != ContinuousController.instance.ReverseCard)
  274. CardImage.sprite = ContinuousController.instance.ReverseCard;
  275. }
  276. else
  277. {
  278. CardImage.sprite = await ThisPermanent.TopCard.GetCardSprite();
  279. }
  280. CardImage.gameObject.SetActive(true);
  281. }
  282. void SetCardSuspended(bool updateIsTapped)
  283. {
  284. if (ThisPermanent == null)
  285. return;
  286. if (ThisPermanent.TopCard == null)
  287. return;
  288. if (ContinuousController.instance == null)
  289. return;
  290. if (ThisPermanent.IsSuspended)
  291. {
  292. if (TapObject != null)
  293. TapObject.SetActive(true);
  294. if (updateIsTapped)
  295. {
  296. bool turnSuspendedCards = ContinuousController.instance != null && ContinuousController.instance.turnSuspendedCards;
  297. if (anim != null)
  298. {
  299. if (ThisPermanent.OldIsSuspended != ThisPermanent.IsSuspended || _oldTurnSuspendedCards != turnSuspendedCards)
  300. {
  301. ThisPermanent.OldIsSuspended = ThisPermanent.IsSuspended;
  302. _oldTurnSuspendedCards = turnSuspendedCards;
  303. if (turnSuspendedCards)
  304. {
  305. if (anim.GetInteger("Tap") != 1)
  306. anim.SetInteger("Tap", 1);
  307. }
  308. else
  309. {
  310. if (anim.GetInteger("Tap") != -1)
  311. anim.SetInteger("Tap", -1);
  312. }
  313. }
  314. }
  315. }
  316. }
  317. else
  318. {
  319. if (TapObject != null)
  320. TapObject.SetActive(false);
  321. if (ContinuousController.instance != null)
  322. {
  323. if (ContinuousController.instance.turnSuspendedCards)
  324. {
  325. if (ThisPermanent.OldIsSuspended != ThisPermanent.IsSuspended)
  326. {
  327. ThisPermanent.OldIsSuspended = ThisPermanent.IsSuspended;
  328. if (anim != null)
  329. {
  330. if (anim.GetInteger("Tap") != -1)
  331. anim.SetInteger("Tap", -1);
  332. }
  333. }
  334. }
  335. }
  336. }
  337. }
  338. public void ShowPermanentData(bool updateIsTapped)
  339. {
  340. if (ThisPermanent == null)
  341. {
  342. return;
  343. }
  344. if (ThisPermanent.TopCard != null)
  345. {
  346. SetCardSuspended(updateIsTapped);
  347. //DP
  348. if (ThisPermanent.IsDigimon && ThisPermanent.DP >= 0)
  349. {
  350. DPText.transform.parent.gameObject.SetActive(true);
  351. if(DPText.text != ThisPermanent.DP.ToString())
  352. DPText.text = ThisPermanent.DP.ToString();
  353. for (int i = 0; i < DPBackground_color.Count; i++)
  354. {
  355. CardColor cardColor = CardColor.None;
  356. if (i < ThisPermanent.TopCard.CardColors.Count)
  357. {
  358. cardColor = ThisPermanent.TopCard.CardColors[i];
  359. float fillAmount = (float)((i + 1) / (float)ThisPermanent.TopCard.CardColors.Count);
  360. if (DPBackground_color[i].color != DataBase.CardColor_ColorLightDictionary[cardColor])
  361. DPBackground_color[i].color = DataBase.CardColor_ColorLightDictionary[cardColor];
  362. DPBackground_color[i].fillAmount = fillAmount;
  363. DPBackground_color[i].gameObject.SetActive(true);
  364. }
  365. else
  366. {
  367. DPBackground_color[i].gameObject.SetActive(false);
  368. }
  369. }
  370. }
  371. else
  372. {
  373. DPText.transform.parent.gameObject.SetActive(false);
  374. }
  375. //Level
  376. if (ThisPermanent.IsDigimon && ThisPermanent.TopCard.HasLevel)
  377. {
  378. LevelText.transform.parent.gameObject.SetActive(true);
  379. if(LevelText.text != ThisPermanent.Level.ToString())
  380. LevelText.text = ThisPermanent.Level.ToString();
  381. foreach (TextCardColorMaterial textCardColorMaterial in textCardColorMaterials)
  382. {
  383. if (textCardColorMaterial.cardColor == ThisPermanent.TopCard.CardColors[0])
  384. {
  385. LevelText.fontSharedMaterial = new Material(textCardColorMaterial.material);
  386. break;
  387. }
  388. }
  389. }
  390. else
  391. {
  392. LevelText.transform.parent.gameObject.SetActive(false);
  393. }
  394. if (EvoRootCountText != null)
  395. {
  396. if (ThisPermanent.DigivolutionCards.Count >= 1)
  397. {
  398. EvoRootCountText.transform.parent.gameObject.SetActive(true);
  399. if(EvoRootCountText.text != $"×{ThisPermanent.DigivolutionCards.Count}")
  400. EvoRootCountText.text = $"×{ThisPermanent.DigivolutionCards.Count}";
  401. if(EvoRootCountBackground.color != DataBase.CardColor_ColorLightDictionary[ThisPermanent.TopCard.CardColors[0]])
  402. EvoRootCountBackground.color = DataBase.CardColor_ColorLightDictionary[ThisPermanent.TopCard.CardColors[0]];
  403. }
  404. else
  405. {
  406. EvoRootCountText.transform.parent.gameObject.SetActive(false);
  407. }
  408. }
  409. if (SummonSicknessObject != null)
  410. {
  411. bool isActive = false;
  412. if (ThisPermanent.EnterFieldTurnCount == GManager.instance.turnStateMachine.TurnCount)
  413. {
  414. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer == ThisPermanent.TopCard.Owner)
  415. {
  416. if (!ThisPermanent.HasRush)
  417. {
  418. if (ThisPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(ThisPermanent))
  419. {
  420. isActive = true;
  421. }
  422. }
  423. }
  424. }
  425. SummonSicknessObject.SetActive(isActive);
  426. }
  427. if (BlockerEffect != null)
  428. {
  429. bool isActive = false;
  430. if (ThisPermanent.IsDigimon)
  431. {
  432. if (ThisPermanent.HasBlocker)
  433. {
  434. //if (thisPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(thisPermanent))
  435. {
  436. isActive = true;
  437. }
  438. }
  439. }
  440. BlockerEffect.SetActive(isActive);
  441. }
  442. }
  443. }
  444. #endregion
  445. #region Automatically reflect card data
  446. int _frameCount = 0;
  447. int _updateFrame = 75;
  448. public bool destroyed { get; set; } = false;
  449. public bool skipDestroy { get; set; } = false;
  450. public bool skipUpdate { get; set; } = false;
  451. //TODO: Pretty poor gargage collection, need to optimize - MB
  452. private void LateUpdate()
  453. {
  454. if (skipUpdate)
  455. {
  456. return;
  457. }
  458. #region exception check
  459. if (destroyed)
  460. {
  461. return;
  462. }
  463. if (ThisPermanent == null)
  464. {
  465. return;
  466. }
  467. if (ThisPermanent.TopCard == null)
  468. {
  469. if (!destroyed && !skipDestroy)
  470. {
  471. StartCoroutine(DestroyCoroutine());
  472. return;
  473. }
  474. }
  475. #endregion
  476. //Skill name
  477. if (SkillNameText.transform.parent.gameObject.activeSelf)
  478. {
  479. RotateSkillNameText();
  480. }
  481. if (DirectStrikeText != null)
  482. {
  483. if (ThisPermanent.IsSuspended)
  484. {
  485. DirectStrikeText.transform.parent.parent.transform.localPosition = new Vector2(DirectStrikeText.transform.parent.parent.transform.localPosition.x, 24);
  486. }
  487. else
  488. {
  489. DirectStrikeText.transform.parent.parent.transform.localPosition = new Vector2(DirectStrikeText.transform.parent.parent.transform.localPosition.x, 78);
  490. }
  491. DirectStrikeText.transform.parent.parent.localRotation = Quaternion.Euler(0, 0, -1 * this.transform.localRotation.eulerAngles.z);
  492. }
  493. if (ThisPermanent.TopCard.Owner.GetFieldPermanents().Count >= ThisPermanent.TopCard.Owner.fieldCardFrames.Count * 0.7f)
  494. {
  495. _updateFrame = 115;
  496. }
  497. else
  498. {
  499. _updateFrame = 75;
  500. }
  501. #region Get long press
  502. #if !UNITY_EDITOR && UNITY_ANDROID
  503. if (pressing)
  504. {
  505. if(requiredTime < Time.time)
  506. {
  507. OnRightClicked();
  508. pressing = false;
  509. }
  510. }
  511. #endif
  512. #endregion
  513. #region Reflected only once every few frames
  514. _frameCount++;
  515. if (_frameCount < _updateFrame)
  516. {
  517. return;
  518. }
  519. else
  520. {
  521. _frameCount = 0;
  522. }
  523. #endregion
  524. ShowPermanentData(true);
  525. }
  526. #endregion
  527. public void PointerDown(BaseEventData eventData)
  528. {
  529. if (!_pressing)
  530. {
  531. _pressing = true;
  532. _requiredTime = Time.time + _validPressTime;
  533. }
  534. else
  535. {
  536. _pressing = false;
  537. }
  538. }
  539. public void PointerUp(BaseEventData eventData)
  540. {
  541. if (_pressing)
  542. {
  543. _pressing = false;
  544. }
  545. }
  546. public void PointerExit(BaseEventData eventData)
  547. {
  548. if (_pressing)
  549. {
  550. _pressing = false;
  551. }
  552. }
  553. #region このオブジェクトを削除
  554. IEnumerator DestroyCoroutine()
  555. {
  556. yield return null;
  557. destroyed = true;
  558. Destroy(this.gameObject);
  559. }
  560. #endregion
  561. #region 選択状態
  562. public bool isExpand { get; set; }
  563. #region 選択状態
  564. public void OnSelectEffect(float expand)
  565. {
  566. if (isExpand)
  567. {
  568. return;
  569. }
  570. Outline_Select.gameObject.SetActive(true);
  571. if (this.gameObject.activeSelf)
  572. {
  573. StartCoroutine(ExpandCoroutine(expand));
  574. }
  575. isExpand = true;
  576. SetOrangeOutline();
  577. }
  578. #endregion
  579. #region オレンジアウトライン
  580. public void SetOrangeOutline()
  581. {
  582. Outline_Select.color = DataBase.SelectColor_Orange;
  583. }
  584. #endregion
  585. #region ブルーアウトライン
  586. public void SetBlueOutline()
  587. {
  588. Outline_Select.color = DataBase.SelectColor_Blue;
  589. }
  590. #endregion
  591. #region 大きくする
  592. IEnumerator ExpandCoroutine(float expand)
  593. {
  594. float ExpandTime = 0.06f;
  595. float targetScale = StartScale.x * expand;
  596. float expandSpeed = (targetScale - transform.localScale.x) / ExpandTime;
  597. while (transform.localScale.x < targetScale)
  598. {
  599. transform.localScale += new Vector3(expandSpeed * Time.deltaTime, expandSpeed * Time.deltaTime, 0);
  600. yield return new WaitForSeconds(Time.deltaTime);
  601. if (!isExpand)
  602. {
  603. transform.localScale = StartScale;
  604. yield break;
  605. }
  606. }
  607. transform.localScale = new Vector3(targetScale, targetScale, 1);
  608. if (!isExpand)
  609. {
  610. transform.localScale = StartScale;
  611. yield break;
  612. }
  613. }
  614. #endregion
  615. #region 選択状態リセット
  616. public void RemoveSelectEffect()
  617. {
  618. Outline_Select.gameObject.SetActive(false);
  619. if (!isExpand)
  620. {
  621. return;
  622. }
  623. transform.localScale = StartScale;
  624. isExpand = false;
  625. }
  626. #endregion
  627. #endregion
  628. #region キャンバス座標への変換
  629. public Vector3 GetLocalCanvasPosition()
  630. {
  631. return this.transform.localPosition + this.transform.parent.localPosition;
  632. }
  633. #endregion
  634. #region コマンドパネルを閉じる
  635. public void CloseCommandPanel()
  636. {
  637. if (fieldUnitCommandPanel != null)
  638. {
  639. fieldUnitCommandPanel.CloseCommandPanel();
  640. }
  641. }
  642. #endregion
  643. #region ドラッグ
  644. public UnityAction<FieldPermanentCard> OnBeginDragAction { get; set; }
  645. public UnityAction<FieldPermanentCard, List<DropArea>> OnDragAction { get; set; }
  646. public UnityAction<FieldPermanentCard, List<DropArea>> OnEndDragAction { get; set; }
  647. public void RemoveDragTarget()
  648. {
  649. this.OnBeginDragAction = null;
  650. this.OnDragAction = null;
  651. this.OnEndDragAction = null;
  652. }
  653. public void AddDragTarget(UnityAction<FieldPermanentCard> OnBeginDragAction, UnityAction<FieldPermanentCard, List<DropArea>> OnDragAction, UnityAction<FieldPermanentCard, List<DropArea>> OnEndDragAction)
  654. {
  655. this.OnBeginDragAction = OnBeginDragAction;
  656. this.OnDragAction = OnDragAction;
  657. this.OnEndDragAction = OnEndDragAction;
  658. }
  659. public void OnBeginDrag()
  660. {
  661. OnBeginDragAction?.Invoke(this);
  662. }
  663. public void OnDrag()
  664. {
  665. OnDragAction?.Invoke(this, Draggable.GetRaycastArea());
  666. }
  667. public void OnEndDrag()
  668. {
  669. OnEndDragAction?.Invoke(this, Draggable.GetRaycastArea());
  670. }
  671. #endregion
  672. }
  673. [System.Serializable]
  674. public class TextCardColorMaterial
  675. {
  676. public CardColor cardColor;
  677. public Material material;
  678. }