GetLowestCardIndex.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using UnityEditor.SceneManagement;
  5. using UnityEditor;
  6. using UnityEngine;
  7. using UnityEngine.SceneManagement;
  8. using DCGO.CardEntities;
  9. using static UnityEditor.ShaderGraph.Internal.KeywordDependentCollection;
  10. namespace DCGO.Tools
  11. {
  12. public class GetLowestCardIndex : MonoBehaviour
  13. {
  14. [MenuItem("Window/DCGO/Get Index/Get Lowest Card Index")]
  15. static void GetIndex()
  16. {
  17. string path = "";
  18. int minValue = 0;
  19. if (Selection.assetGUIDs.Length != 0)
  20. path = AssetDatabase.GUIDToAssetPath(Selection.assetGUIDs[0]);
  21. if (path != "")
  22. {
  23. List<CEntity_Base> List = GetAsset.LoadAll<CEntity_Base>(path)
  24. .OrderBy(x => x.CardIndex).ToList();
  25. minValue = List[0].CardIndex;
  26. }
  27. List<CEntity_Base> Entities = GetAsset.LoadAll<CEntity_Base>("Assets/CardBaseEntity/")
  28. .Filter(entity => !entity.CardID.Contains("P-"))
  29. .Filter(entity => entity.CardIndex >= minValue);
  30. int cardIndex = 0;
  31. string name = "";
  32. foreach (CEntity_Base card in Entities)
  33. {
  34. if (card.CardID.Contains("P-"))
  35. continue;
  36. if (cardIndex == card.CardIndex)
  37. Debug.LogWarning($"DUPLICATE INDEX FOUND: {card.CardSpriteName} - {cardIndex}");
  38. if (card.CardIndex < cardIndex || cardIndex == 0)
  39. {
  40. cardIndex = card.CardIndex;
  41. name = card.CardSpriteName;
  42. }
  43. }
  44. Debug.Log($"Lowest Card Index: {cardIndex} - {name}");
  45. }
  46. }
  47. public class GetLowestPromoCardIndex : MonoBehaviour
  48. {
  49. [MenuItem("Window/DCGO/Get Index/Get Lowest Promo Index")]
  50. static void GetIndex()
  51. {
  52. string path = "";
  53. int minValue = 0;
  54. if (Selection.assetGUIDs.Length != 0)
  55. path = AssetDatabase.GUIDToAssetPath(Selection.assetGUIDs[0]);
  56. if(path != "")
  57. {
  58. CEntity_Base entity = GetAsset.Load<CEntity_Base>(path);
  59. minValue = entity.CardIndex;
  60. }
  61. List<CEntity_Base> Entities = GetAsset.LoadAll<CEntity_Base>("Assets/CardBaseEntity/")
  62. .Filter(entity => entity.CardID.Contains("P-"))
  63. .Filter(entity => entity.CardIndex > minValue);
  64. int cardIndex = 0;
  65. string name = "";
  66. Debug.Log($"CARD COUNT: {Entities.Count}");
  67. foreach (CEntity_Base card in Entities)
  68. {
  69. if (cardIndex == card.CardIndex)
  70. Debug.LogWarning($"DUPLICATE INDEX FOUND: {card.CardSpriteName} - {cardIndex}");
  71. if ((card.CardIndex < cardIndex || cardIndex == 0))
  72. {
  73. cardIndex = card.CardIndex;
  74. name = card.CardSpriteName;
  75. }
  76. }
  77. Debug.Log($"Lowest Card Index: {cardIndex} - {name}");
  78. }
  79. }
  80. }