Last active
March 7, 2017 09:12
-
-
Save JustinFincher/a8694e78c4c26e8cc22d95ef2a8a5c7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Reflection; | |
using System.IO; | |
using RavenTech; | |
namespace RavenTech.Editor | |
{ | |
/// <summary> | |
/// 文档浏览器窗口 | |
/// </summary> | |
[InitializeOnLoad] | |
public class RT_Documentation : ScriptableObject | |
{ | |
static BindingFlags Flags = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy; | |
[MenuItem("Window/RavenTech/Documentation")] | |
static void Open() | |
{ | |
#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) | |
var type = Types.GetType ("UnityEditor.Web.WebViewEditorWindow", "UnityEditor.dll"); | |
var methodInfo = type.GetMethod ("Create", Flags); | |
methodInfo = methodInfo.MakeGenericMethod (typeof(RT_Documentation)); | |
#elif UNITY_5_4 | |
var type = Types.GetType ("UnityEditor.Web.WebViewEditorWindowTabs", "UnityEditor.dll"); | |
var methodInfo = type.GetMethod ("Create", Flags); | |
methodInfo = methodInfo.MakeGenericMethod (type); | |
#else | |
System.Type type = System.Reflection.Assembly.Load("UnityEditor.dll").GetType("UnityEditor.Web.WebViewEditorWindowTabs"); | |
var methodInfo = type.GetMethod ("Create", Flags); | |
methodInfo = methodInfo.MakeGenericMethod (type); | |
#endif | |
string path = Directory.GetParent(Application.dataPath).FullName + "/Doc/html/index.html"; | |
methodInfo.Invoke(null, new object[] | |
{ | |
"Documentation", | |
path, | |
200, 530, 800, 600 | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment