TestEditor.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. [CustomEditor(typeof(Test))]
  11. public class TestEditor : Editor
  12. {
  13. #region Variable
  14. public Test Script;
  15. #endregion
  16. public void OnEnable()
  17. {
  18. Script = (Test) target;
  19. }
  20. public override void OnInspectorGUI()
  21. {
  22. base.OnInspectorGUI();
  23. if (GUILayout.Button("Test"))
  24. {
  25. List<string> lines = new List<string>();
  26. StreamReader streamReader = new StreamReader(@"C:\Users\Administrator\Desktop\新建文本文档.txt");
  27. string line = "";
  28. while (!string.IsNullOrEmpty(line = streamReader.ReadLine()))
  29. {
  30. lines.Add(line);
  31. }
  32. streamReader.Close();
  33. // lines.Insert("if ([url.host isEqualToString:@"safepay"]) {
  34. ////跳转支付宝钱包进行支付,处理支付结果
  35. //[[AlipaySDK defaultService] processOrderWithPaymentResult: url standbyCallback:^ (NSDictionary * resultDic) {
  36. // NSLog(@"result 1 = %@", resultDic);
  37. // }];
  38. // }
  39. // ");
  40. StreamWriter streamWriter = new StreamWriter(@"C:\Users\Administrator\Desktop\新建文本文档.txt");
  41. streamWriter.Close();
  42. //Texture2D texture2D = new Texture2D(Script.Texture2D.width, Script.Texture2D.height, TextureFormat.RGBA32, false);
  43. //for (int i = 0; i < texture2D.width; i++)
  44. //{
  45. // for (int j = 0; j < texture2D.height; j++)
  46. // {
  47. // texture2D.SetPixel(i, j, Script.Texture2D.GetPixel(i, j));
  48. // }
  49. //}
  50. //texture2D.Apply();
  51. //File.WriteAllBytes("Assets/Test.png", texture2D.EncodeToPNG());
  52. //PlayerPrefs.SetString("AtlasUtility_ReferenceTableText", "");
  53. //PlayerPrefs.SetString("AtlasUtility_ReferenceTableGUID", "");
  54. //PlayerPrefs.SetString("AtlasUtility_SerializeObjectGUID", "");
  55. }
  56. }
  57. }
  58. }