11 public const int WindowWidth = 720;
12 public const int WindowHeight = 500;
13 public static readonly GUIStyle HeaderStyle =
new GUIStyle(
"label") { fontSize = 19, fontStyle = FontStyle.Bold, margin =
new RectOffset(10, 10, 5, 5) };
14 public static readonly GUIStyle SubHeaderStyle =
new GUIStyle(
"label") { margin =
new RectOffset(10, 10, 5, 5), fontStyle = FontStyle.Bold };
15 public static readonly GUIStyle TextStyle =
new GUIStyle(
"label") { margin =
new RectOffset(20, 20, 5, 5) };
16 public static readonly GUIStyle TextAreaStyle =
new GUIStyle(TextStyle) { wordWrap =
true };
17 public static readonly GUIStyle ButtonStyle =
new GUIStyle(
"button") { margin =
new RectOffset(10, 10, 5, 5) };
20 private const string SkipVersionInfoKey =
"TriLibSkipVersionInfo";
24 private Vector2 _changeLogScrollPosition;
25 private Vector2 _notesScrollPosition;
31 var window = GetWindow<TriLibVersionNotes>();
32 window.titleContent =
new GUIContent(
"TriLib Version Notes");
33 window.minSize =
new Vector2(Styles.WindowWidth, Styles.WindowHeight);
38 [InitializeOnLoadMethod]
41 if (!EditorPrefs.GetBool(SkipVersionInfoKey))
52 private void OnDestroy()
54 EditorPrefs.SetBool(SkipVersionInfoKey,
true);
61 var guids = AssetDatabase.FindAssets(
"TriLibReleaseNotes");
65 var assetPath = AssetDatabase.GUIDToAssetPath(guid);
66 var textAsset = AssetDatabase.LoadAssetAtPath<TextAsset>(assetPath);
67 if (textAsset ==
null || textAsset.text ==
null)
69 AssetDatabase.Refresh();
70 textAsset = AssetDatabase.LoadAssetAtPath<TextAsset>(assetPath);
71 if (textAsset ==
null)
77 _text = textAsset.text.Replace(
"\\n",
"\n");
85 EditorGUILayout.BeginVertical();
86 using (var stringReader =
new StringReader(_text))
88 var changeLogOpen =
false;
89 var version = stringReader.ReadLine();
90 GUILayout.Label($
"TriLib {version}", Styles.HeaderStyle);
93 var line = stringReader.ReadLine();
98 if (line.ToLowerInvariant() ==
"changelog:")
100 EditorGUILayout.Space();
101 GUILayout.Label(
"Changelog", Styles.SubHeaderStyle);
102 _changeLogScrollPosition = GUILayout.BeginScrollView(_changeLogScrollPosition, GUILayout.Height(260f));
103 changeLogOpen =
true;
105 else if (line.ToLowerInvariant() ==
"version notes:")
109 GUILayout.EndScrollView();
110 changeLogOpen =
false;
112 EditorGUILayout.Space();
113 GUILayout.Label(
"Version Notes", Styles.SubHeaderStyle);
114 var versionInfo = stringReader.ReadToEnd();
115 _notesScrollPosition = EditorGUILayout.BeginScrollView(_notesScrollPosition);
116 EditorGUILayout.TextArea(versionInfo, Styles.TextAreaStyle);
117 EditorGUILayout.EndScrollView();
122 GUILayout.Label(line, Styles.TextStyle);
127 GUILayout.EndScrollView();
129 EditorGUILayout.EndVertical();
130 EditorGUILayout.Space();
131 GUILayout.Label(
"You can show this window on the Project Settings/TriLib area", Styles.SubHeaderStyle);
132 EditorGUILayout.BeginHorizontal();
133 GUILayout.FlexibleSpace();
134 if (GUILayout.Button(
"Close", Styles.ButtonStyle))
138 EditorGUILayout.EndHorizontal();