ArtResConfEditor.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. #if UNITY_EDITOR
  5. using UnityEditor;
  6. #endif
  7. namespace ShadowStudio.Model
  8. {
  9. /// <summary>
  10. /// 资源
  11. /// </summary>
  12. [InitializeOnLoad]
  13. [CustomEditor(typeof(ArtResConf))]
  14. public class ArtResConfEditor : Editor
  15. {
  16. private ArtResConf artConf;
  17. private bool isForceUpdate;
  18. private void OnEnable()
  19. {
  20. artConf = target as ArtResConf;
  21. }
  22. public override void OnInspectorGUI()
  23. {
  24. base.OnInspectorGUI();
  25. isForceUpdate = GUILayout.Toggle(isForceUpdate, "强制刷新");
  26. if (GUILayout.Button("资源添加到xml", GUILayout.Width(200)))
  27. {
  28. if (artConf.instaceType == InstaceType.UnityBase)
  29. {
  30. ArtInfoMgr.Instance.AddDefaultArt(artConf.artType);
  31. }
  32. else
  33. {
  34. ArtInfoMgr.Instance.AddArtInfo(artConf.resModelList, artConf.artType, artConf.instaceType, isForceUpdate, artConf.name);
  35. }
  36. }
  37. if (GUILayout.Button("删除此列表资源", GUILayout.Width(200)))
  38. {
  39. ArtInfoMgr.Instance.RemoveArtInfo(artConf.resModelList);
  40. }
  41. }
  42. }
  43. }