FieldPermanentCard.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  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. }
  360. else
  361. {
  362. cardColor = ThisPermanent.TopCard.CardColors[0];
  363. }
  364. if (DPBackground_color[i].color != DataBase.CardColor_ColorLightDictionary[cardColor])
  365. DPBackground_color[i].color = DataBase.CardColor_ColorLightDictionary[cardColor];
  366. }
  367. }
  368. else
  369. {
  370. DPText.transform.parent.gameObject.SetActive(false);
  371. }
  372. //Level
  373. if (ThisPermanent.IsDigimon && ThisPermanent.TopCard.HasLevel)
  374. {
  375. LevelText.transform.parent.gameObject.SetActive(true);
  376. if(LevelText.text != ThisPermanent.Level.ToString())
  377. LevelText.text = ThisPermanent.Level.ToString();
  378. foreach (TextCardColorMaterial textCardColorMaterial in textCardColorMaterials)
  379. {
  380. if (textCardColorMaterial.cardColor == ThisPermanent.TopCard.CardColors[0])
  381. {
  382. LevelText.fontSharedMaterial = new Material(textCardColorMaterial.material);
  383. break;
  384. }
  385. }
  386. }
  387. else
  388. {
  389. LevelText.transform.parent.gameObject.SetActive(false);
  390. }
  391. if (EvoRootCountText != null)
  392. {
  393. if (ThisPermanent.DigivolutionCards.Count >= 1)
  394. {
  395. EvoRootCountText.transform.parent.gameObject.SetActive(true);
  396. if(EvoRootCountText.text != $"×{ThisPermanent.DigivolutionCards.Count}")
  397. EvoRootCountText.text = $"×{ThisPermanent.DigivolutionCards.Count}";
  398. if(EvoRootCountBackground.color != DataBase.CardColor_ColorLightDictionary[ThisPermanent.TopCard.CardColors[0]])
  399. EvoRootCountBackground.color = DataBase.CardColor_ColorLightDictionary[ThisPermanent.TopCard.CardColors[0]];
  400. }
  401. else
  402. {
  403. EvoRootCountText.transform.parent.gameObject.SetActive(false);
  404. }
  405. }
  406. if (SummonSicknessObject != null)
  407. {
  408. bool isActive = false;
  409. if (ThisPermanent.EnterFieldTurnCount == GManager.instance.turnStateMachine.TurnCount)
  410. {
  411. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer == ThisPermanent.TopCard.Owner)
  412. {
  413. if (!ThisPermanent.HasRush)
  414. {
  415. if (ThisPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(ThisPermanent))
  416. {
  417. isActive = true;
  418. }
  419. }
  420. }
  421. }
  422. SummonSicknessObject.SetActive(isActive);
  423. }
  424. if (BlockerEffect != null)
  425. {
  426. bool isActive = false;
  427. if (ThisPermanent.IsDigimon)
  428. {
  429. if (ThisPermanent.HasBlocker)
  430. {
  431. //if (thisPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(thisPermanent))
  432. {
  433. isActive = true;
  434. }
  435. }
  436. }
  437. BlockerEffect.SetActive(isActive);
  438. }
  439. }
  440. }
  441. #endregion
  442. #region Automatically reflect card data
  443. int _frameCount = 0;
  444. int _updateFrame = 75;
  445. public bool destroyed { get; set; } = false;
  446. public bool skipDestroy { get; set; } = false;
  447. public bool skipUpdate { get; set; } = false;
  448. //TODO: Pretty poor gargage collection, need to optimize - MB
  449. private void LateUpdate()
  450. {
  451. if (skipUpdate)
  452. {
  453. return;
  454. }
  455. #region exception check
  456. if (destroyed)
  457. {
  458. return;
  459. }
  460. if (ThisPermanent == null)
  461. {
  462. return;
  463. }
  464. if (ThisPermanent.TopCard == null)
  465. {
  466. if (!destroyed && !skipDestroy)
  467. {
  468. StartCoroutine(DestroyCoroutine());
  469. return;
  470. }
  471. }
  472. #endregion
  473. //Skill name
  474. if (SkillNameText.transform.parent.gameObject.activeSelf)
  475. {
  476. RotateSkillNameText();
  477. }
  478. if (DirectStrikeText != null)
  479. {
  480. if (ThisPermanent.IsSuspended)
  481. {
  482. DirectStrikeText.transform.parent.parent.transform.localPosition = new Vector2(DirectStrikeText.transform.parent.parent.transform.localPosition.x, 24);
  483. }
  484. else
  485. {
  486. DirectStrikeText.transform.parent.parent.transform.localPosition = new Vector2(DirectStrikeText.transform.parent.parent.transform.localPosition.x, 78);
  487. }
  488. DirectStrikeText.transform.parent.parent.localRotation = Quaternion.Euler(0, 0, -1 * this.transform.localRotation.eulerAngles.z);
  489. }
  490. if (ThisPermanent.TopCard.Owner.GetFieldPermanents().Count >= ThisPermanent.TopCard.Owner.fieldCardFrames.Count * 0.7f)
  491. {
  492. _updateFrame = 115;
  493. }
  494. else
  495. {
  496. _updateFrame = 75;
  497. }
  498. #region Get long press
  499. #if !UNITY_EDITOR && UNITY_ANDROID
  500. if (pressing)
  501. {
  502. if(requiredTime < Time.time)
  503. {
  504. OnRightClicked();
  505. pressing = false;
  506. }
  507. }
  508. #endif
  509. #endregion
  510. #region Reflected only once every few frames
  511. _frameCount++;
  512. if (_frameCount < _updateFrame)
  513. {
  514. return;
  515. }
  516. else
  517. {
  518. _frameCount = 0;
  519. }
  520. #endregion
  521. ShowPermanentData(true);
  522. }
  523. #endregion
  524. public void PointerDown(BaseEventData eventData)
  525. {
  526. if (!_pressing)
  527. {
  528. _pressing = true;
  529. _requiredTime = Time.time + _validPressTime;
  530. }
  531. else
  532. {
  533. _pressing = false;
  534. }
  535. }
  536. public void PointerUp(BaseEventData eventData)
  537. {
  538. if (_pressing)
  539. {
  540. _pressing = false;
  541. }
  542. }
  543. public void PointerExit(BaseEventData eventData)
  544. {
  545. if (_pressing)
  546. {
  547. _pressing = false;
  548. }
  549. }
  550. #region このオブジェクトを削除
  551. IEnumerator DestroyCoroutine()
  552. {
  553. yield return null;
  554. destroyed = true;
  555. Destroy(this.gameObject);
  556. }
  557. #endregion
  558. #region 選択状態
  559. public bool isExpand { get; set; }
  560. #region 選択状態
  561. public void OnSelectEffect(float expand)
  562. {
  563. if (isExpand)
  564. {
  565. return;
  566. }
  567. Outline_Select.gameObject.SetActive(true);
  568. if (this.gameObject.activeSelf)
  569. {
  570. StartCoroutine(ExpandCoroutine(expand));
  571. }
  572. isExpand = true;
  573. SetOrangeOutline();
  574. }
  575. #endregion
  576. #region オレンジアウトライン
  577. public void SetOrangeOutline()
  578. {
  579. Outline_Select.color = DataBase.SelectColor_Orange;
  580. }
  581. #endregion
  582. #region ブルーアウトライン
  583. public void SetBlueOutline()
  584. {
  585. Outline_Select.color = DataBase.SelectColor_Blue;
  586. }
  587. #endregion
  588. #region 大きくする
  589. IEnumerator ExpandCoroutine(float expand)
  590. {
  591. float ExpandTime = 0.06f;
  592. float targetScale = StartScale.x * expand;
  593. float expandSpeed = (targetScale - transform.localScale.x) / ExpandTime;
  594. while (transform.localScale.x < targetScale)
  595. {
  596. transform.localScale += new Vector3(expandSpeed * Time.deltaTime, expandSpeed * Time.deltaTime, 0);
  597. yield return new WaitForSeconds(Time.deltaTime);
  598. if (!isExpand)
  599. {
  600. transform.localScale = StartScale;
  601. yield break;
  602. }
  603. }
  604. transform.localScale = new Vector3(targetScale, targetScale, 1);
  605. if (!isExpand)
  606. {
  607. transform.localScale = StartScale;
  608. yield break;
  609. }
  610. }
  611. #endregion
  612. #region 選択状態リセット
  613. public void RemoveSelectEffect()
  614. {
  615. Outline_Select.gameObject.SetActive(false);
  616. if (!isExpand)
  617. {
  618. return;
  619. }
  620. transform.localScale = StartScale;
  621. isExpand = false;
  622. }
  623. #endregion
  624. #endregion
  625. #region キャンバス座標への変換
  626. public Vector3 GetLocalCanvasPosition()
  627. {
  628. return this.transform.localPosition + this.transform.parent.localPosition;
  629. }
  630. #endregion
  631. #region コマンドパネルを閉じる
  632. public void CloseCommandPanel()
  633. {
  634. if (fieldUnitCommandPanel != null)
  635. {
  636. fieldUnitCommandPanel.CloseCommandPanel();
  637. }
  638. }
  639. #endregion
  640. #region ドラッグ
  641. public UnityAction<FieldPermanentCard> OnBeginDragAction { get; set; }
  642. public UnityAction<FieldPermanentCard, List<DropArea>> OnDragAction { get; set; }
  643. public UnityAction<FieldPermanentCard, List<DropArea>> OnEndDragAction { get; set; }
  644. public void RemoveDragTarget()
  645. {
  646. this.OnBeginDragAction = null;
  647. this.OnDragAction = null;
  648. this.OnEndDragAction = null;
  649. }
  650. public void AddDragTarget(UnityAction<FieldPermanentCard> OnBeginDragAction, UnityAction<FieldPermanentCard, List<DropArea>> OnDragAction, UnityAction<FieldPermanentCard, List<DropArea>> OnEndDragAction)
  651. {
  652. this.OnBeginDragAction = OnBeginDragAction;
  653. this.OnDragAction = OnDragAction;
  654. this.OnEndDragAction = OnEndDragAction;
  655. }
  656. public void OnBeginDrag()
  657. {
  658. OnBeginDragAction?.Invoke(this);
  659. }
  660. public void OnDrag()
  661. {
  662. OnDragAction?.Invoke(this, Draggable.GetRaycastArea());
  663. }
  664. public void OnEndDrag()
  665. {
  666. OnEndDragAction?.Invoke(this, Draggable.GetRaycastArea());
  667. }
  668. #endregion
  669. }
  670. [System.Serializable]
  671. public class TextCardColorMaterial
  672. {
  673. public CardColor cardColor;
  674. public Material material;
  675. }