void DrawText() { string luaFile = File.ReadAllText(assetPath); string text; if (base.targets.Length > 1) { text = Path.GetFileName(assetPath); } else { var MaxTextPreviewLength = EditorConfig.Instance().MConfig.MaxTextPreviewLength; text = luaFile; if (text.Length > MaxTextPreviewLength + 3) { text = text.Substring(0, MaxTextPreviewLength) + "..."; } } GUIStyle style = "ScriptText"; Rect rect = GUILayoutUtility.GetRect(new GUIContent(text), style); rect.x = 0f; rect.y -= 3f; rect.width = EditorGUIUtility.currentViewWidth + 1f; GUI.Box(rect, text, style); }
public override void OnInspectorGUI() { Inspector.DrawComObj("EditorConfig", EditorConfig.Instance().MConfig); bool enabled = GUI.enabled; GUI.enabled = true; if (!File.Exists(assetPath)) { return; } if (assetPath.IsExcel()) { if (mTarget != null) { (mTarget as BookStruct).DrawInspector(); } } else if (assetPath.IsText()) { DrawText(); } GUI.enabled = enabled; }