华佗热更新模块

HotfixManagerInsoector.cs 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using TFramework;
  5. using TModule.Runtime;
  6. using UnityEditor;
  7. using UnityEngine;
  8. namespace Tmodule.Editor
  9. {
  10. [CustomEditor(typeof(HotfixManager))]
  11. public class HotfixManagerInsoector : UnityEditor.Editor
  12. {
  13. private SerializedProperty isHotfix;
  14. private GUIContent isHotfixGC = new GUIContent("启用热更");
  15. private SerializedProperty resServerUrl;
  16. private GUIContent resServerUrlGC = new GUIContent("热更服务器地址");
  17. private SerializedProperty loadMode;
  18. private GUIContent loadModeGC = new GUIContent("加载模式", "Editor:编辑器模式(不加载AB包)\n Loacl:本地热更模式(加载StreamingAssets下AB包)\n Bulid:打包热更模式(从服务器下载并加载AB包)\n 打包版本在启用热更情况下强制Build模式");
  19. private SerializedProperty hotfixDllName;
  20. private GUIContent hotfixDllNameGC = new GUIContent("热更程序集");
  21. private SerializedProperty hotfixClass;
  22. private GUIContent hotfixClassGC = new GUIContent("热更启动类","注意!应填入类的完全限定名(带命名空间)");
  23. private void OnEnable()
  24. {
  25. isHotfix = serializedObject.FindProperty("isHotfix");
  26. resServerUrl = serializedObject.FindProperty("resServerUrl");
  27. loadMode = serializedObject.FindProperty("loadMode");
  28. hotfixDllName = serializedObject.FindProperty("hotfixDllName");
  29. hotfixClass = serializedObject.FindProperty("hotfixClass");
  30. }
  31. public override void OnInspectorGUI()
  32. {
  33. //base.OnInspectorGUI();
  34. serializedObject.Update();
  35. EditorGUILayout.PropertyField(isHotfix, isHotfixGC);
  36. EditorGUILayout.PropertyField(resServerUrl, resServerUrlGC);
  37. EditorGUILayout.PropertyField(loadMode, loadModeGC);
  38. EditorGUILayout.PropertyField(hotfixDllName, hotfixDllNameGC);
  39. EditorGUILayout.PropertyField(hotfixClass, hotfixClassGC);
  40. serializedObject.ApplyModifiedProperties();
  41. }
  42. }
  43. }