AttachCardData.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System.Collections.Generic;
  2. using UnityEditor;
  3. using UnityEditor.SceneManagement;
  4. using UnityEngine;
  5. using UnityEngine.SceneManagement;
  6. using System.Linq;
  7. using System;
  8. public class AttachCardData : MonoBehaviour
  9. {
  10. [MenuItem("Window/Attach/AttachCardData")]
  11. static void Attach_CardData()
  12. {
  13. List<CEntity_Base> List = GetAsset.LoadAll<CEntity_Base>("Assets/CardBaseEntity/");
  14. List<string> UnimplementedCardSpriteNames = new List<string>() { "P-147", "BT17-085_P3", "BT15-082_P2", "BT15-084_P2", "BT14-085_P2", "BT13-100_P2", "BT11-086_P2", "BT10-042_P5" };
  15. /*
  16. BT17_085 Rika Nonaka
  17. BT15_082 Sora Takenouchi
  18. BT15_084 Kari Kamiya
  19. BT14_085 Mimi Tachikawa
  20. BT13_100 Yoshino Fujieda
  21. BT11_086 Mervamon
  22. BT10_042
  23. */
  24. List<string> DebugCardSpriteNames = new List<string>() { };
  25. foreach (GameObject obj in Selection.gameObjects)
  26. {
  27. if (obj.GetComponent<ContinuousController>() != null)
  28. {
  29. ContinuousController CCtrl = obj.GetComponent<ContinuousController>();
  30. CCtrl.CardList = new CEntity_Base[] { };
  31. CCtrl.SortedCardList = new CEntity_Base[] { };
  32. List<CEntity_Base> cEntity_Bases = new List<CEntity_Base>();
  33. foreach (CEntity_Base cEntity_Base in List)
  34. {
  35. if (UnimplementedCardSpriteNames.Contains(cEntity_Base.CardSpriteName))
  36. {
  37. Debug.Log(cEntity_Base.CardID);
  38. continue;
  39. }
  40. if (String.IsNullOrEmpty(cEntity_Base.CardSpriteName))
  41. {
  42. continue;
  43. }
  44. if (DebugCardSpriteNames.Contains(cEntity_Base.CardSpriteName))
  45. {
  46. Debug.Log(cEntity_Base.CardID);
  47. }
  48. cEntity_Bases.Add(cEntity_Base);
  49. }
  50. EditorGUI.BeginChangeCheck();
  51. CCtrl.CardList = DeckData.SortedCardPoolList(cEntity_Bases).ToArray();
  52. cEntity_Bases.Sort((a, b) => a.CardIndex - b.CardIndex);
  53. CCtrl.SortedCardList = cEntity_Bases.ToArray();
  54. if (EditorGUI.EndChangeCheck())
  55. {
  56. var scene = SceneManager.GetActiveScene();
  57. EditorSceneManager.MarkSceneDirty(scene);
  58. }
  59. return;
  60. }
  61. }
  62. }
  63. }