TestEditor.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. namespace AtlasUtility
  2. {
  3. using LitJson;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Collections.Generic;
  7. using UnityEditor;
  8. using UnityEngine;
  9. using UnityEngine.UI;
  10. using UnityEditor.iOS.Xcode;
  11. [CustomEditor(typeof(Test))]
  12. public class TestEditor : Editor
  13. {
  14. #region Variable
  15. public Test Script;
  16. #endregion
  17. public void OnEnable()
  18. {
  19. Script = (Test) target;
  20. }
  21. public override void OnInspectorGUI()
  22. {
  23. base.OnInspectorGUI();
  24. if (GUILayout.Button("Test"))
  25. {
  26. string plistPath = "C:/Users/Administrator/Desktop/IOS/Info.plist";
  27. PlistDocument plist = new PlistDocument();
  28. plist.ReadFromFile(plistPath);
  29. string projectPath = PBXProject.GetPBXProjectPath("C:/Users/Administrator/Desktop/IOS/");
  30. PBXProject project = new PBXProject();
  31. project.ReadFromFile(projectPath);
  32. //PlistElementDict urlDict = plist.root["CFBundleURLTypes"].AsArray().AddDict();
  33. //urlDict.SetString("CFBundleURLSchemes", "MyLovelyGarden");
  34. //foreach (var array in plist.root["CFBundleURLTypes"].AsArray().values)
  35. //{
  36. // Debug.Log("URLType");
  37. // foreach (var dic in array.AsDict().values)
  38. // {
  39. // if (dic.Value.GetType() == typeof(PlistElementString))
  40. // {
  41. // Debug.Log(" " + dic.Key + " " + dic.Value.AsString());
  42. // }
  43. // else if (dic.Value.GetType() == typeof(PlistElementArray))
  44. // {
  45. // Debug.Log(" URLSchemes");
  46. // foreach (var ele in dic.Value.AsArray().values)
  47. // {
  48. // Debug.Log(" " + ele.AsString());
  49. // }
  50. // }
  51. // }
  52. //}
  53. }
  54. }
  55. }
  56. }