1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
using UnityEngine;
using UnityEditor;
using System.IO;
namespace Cinemachine.Editor
{
[InitializeOnLoad]
public class AboutWindow : EditorWindow
{
private const string kLastVersionOpened = "CNMCN_Last_Version_Loaded";
private const string kInvalidVersionNumber = "0.0";
private static readonly Vector2 kMinWindowSize = new Vector2(550f, 550f);
private static string LastVersionLoaded
{
get { return EditorPrefs.GetString(kLastVersionOpened, kInvalidVersionNumber); }
set { EditorPrefs.SetString(kLastVersionOpened, value); }
}
private GUIStyle mButtonStyle;
private GUIStyle mLabelStyle;
private GUIStyle mHeaderStyle;
private GUIStyle mNotesStyle;
private Vector2 mReleaseNoteScrollPos = Vector2.zero;
string mReleaseNotes;
private void OnEnable()
{
string path = ScriptableObjectUtility.CinemachineInstallPath + "/ReleaseNotes.txt";
try
{
StreamReader reader = new StreamReader(path);
mReleaseNotes = reader.ReadToEnd();
reader.Close();
}
catch (System.Exception)
{
mReleaseNotes = path + " not found";
}
}
private void OnGUI()
{
if (EditorApplication.isCompiling)
{
Close();
}
if (mButtonStyle == null)
{
mButtonStyle = new GUIStyle(GUI.skin.button);
mButtonStyle.richText = true;
}
if (mLabelStyle == null)
{
mLabelStyle = new GUIStyle(EditorStyles.label);
mLabelStyle.wordWrap = true;
mLabelStyle.richText = true;
}
if (mHeaderStyle == null)
{
mHeaderStyle = new GUIStyle(EditorStyles.boldLabel);
mHeaderStyle.wordWrap = true;
}
if (mNotesStyle == null)
{
mNotesStyle = new GUIStyle(EditorStyles.textArea);
mNotesStyle.richText = true;
mNotesStyle.wordWrap = true;
}
using (var vertScope = new EditorGUILayout.VerticalScope())
{
if (CinemachineSettings.CinemachineHeader != null)
{
float headerWidth = position.width;
float aspectRatio = (float)CinemachineSettings.CinemachineHeader.height / (float)CinemachineSettings.CinemachineHeader.width;
GUILayout.BeginScrollView(Vector2.zero, false, false, GUILayout.Width(headerWidth), GUILayout.Height(headerWidth * aspectRatio));
Rect texRect = new Rect(0f, 0f, headerWidth, headerWidth * aspectRatio);
GUILayout.FlexibleSpace();
GUILayout.BeginArea(texRect);
GUI.DrawTexture(texRect, CinemachineSettings.CinemachineHeader, ScaleMode.ScaleToFit);
GUILayout.EndArea();
GUILayout.FlexibleSpace();
GUILayout.EndScrollView();
}
EditorGUILayout.LabelField("Welcome to Cinemachine!", mLabelStyle);
EditorGUILayout.LabelField("Smart camera tools for passionate creators.", mLabelStyle);
EditorGUILayout.LabelField("Below are links to the forums, please reach out if you have any questions or feedback", mLabelStyle);
if (GUILayout.Button("<b>Forum</b>\n<i>Discuss</i>", mButtonStyle))
{
Application.OpenURL("https://forum.unity3d.com/forums/cinemachine.136/");
}
if (GUILayout.Button("<b>Rate it!</b>\nUnity Asset Store", mButtonStyle))
{
Application.OpenURL("https://www.assetstore.unity3d.com/en/#!/content/79898");
}
if (GUILayout.Button("<b>Documentation</b>\nRead it", mButtonStyle))
{
string filename = ScriptableObjectUtility.CinemachineInstallPath
+ "/CINEMACHINE_install.pdf";
if (!File.Exists(filename))
Debug.LogError("Missing file " + filename);
Application.OpenURL("file://" + filename);
}
}
EditorGUILayout.LabelField("Release Notes", mHeaderStyle);
using (var scrollScope = new EditorGUILayout.ScrollViewScope(mReleaseNoteScrollPos, GUI.skin.box))
{
mReleaseNoteScrollPos = scrollScope.scrollPosition;
EditorGUILayout.LabelField(mReleaseNotes, mNotesStyle);
}
}
[MenuItem("Cinemachine/About")]
private static void OpenWindow()
{
EditorApplication.update += ShowWindowDeferred;
}
private static void ShowWindowDeferred()
{
string loadedVersion = LastVersionLoaded;
if (loadedVersion != CinemachineCore.kVersionString)
LastVersionLoaded = CinemachineCore.kVersionString;
AboutWindow window = EditorWindow.GetWindow<AboutWindow>();
window.titleContent = new UnityEngine.GUIContent(
"About", CinemachineSettings.CinemachineLogoTexture);
window.minSize = kMinWindowSize;
window.Show(true);
EditorApplication.update -= ShowWindowDeferred;
}
}
}
|