Skip to content

Commit

Permalink
优化:制订版本规则。
Browse files Browse the repository at this point in the history
  • Loading branch information
SaiTingHu committed Jun 16, 2020
1 parent 9896023 commit a2d78d1
Show file tree
Hide file tree
Showing 18 changed files with 555 additions and 42 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions Editor/Utility/AdminLogin/AdminLoginWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
using UnityEditor;
using UnityEngine;

namespace HT.Framework
{
/// <summary>
/// 管理员身份登录窗口
/// </summary>
public sealed class AdminLoginWindow : HTFEditorWindow
{
public static void OpenWindow(IAdminLoginWindow parent)
{
AdminLoginWindow window = GetWindow<AdminLoginWindow>();
window._parent = parent;
window.titleContent.text = "Admin Login";
window.minSize = new Vector2(250, 50);
window.maxSize = new Vector2(250, 50);
window.Show();
}

private IAdminLoginWindow _parent;
private string _password = "";

protected override bool IsEnableTitleGUI
{
get
{
return false;
}
}

protected override void OnBodyGUI()
{
base.OnBodyGUI();

EventHandle();

GUILayout.BeginVertical();
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();

GUILayout.Label("Password:");
_password = EditorGUILayout.PasswordField(_password, GUILayout.Width(100));
GUI.enabled = _password != "";
if (GUILayout.Button("Login", EditorStyles.miniButton))
{
_parent.AdminCheck(_password);
Close();
}
GUI.enabled = true;

GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
GUILayout.EndVertical();
}

private void EventHandle()
{
if (Event.current == null)
{
return;
}

switch (Event.current.rawType)
{
case EventType.KeyDown:
switch (Event.current.keyCode)
{
case KeyCode.Return:
case KeyCode.KeypadEnter:
if (_password != "")
{
_parent.AdminCheck(_password);
Close();
}
break;
}
break;
}
}

private void Update()
{
if (_parent == null)
{
Close();
}
}
}
}
11 changes: 11 additions & 0 deletions Editor/Utility/AdminLogin/AdminLoginWindow.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions Editor/Utility/AdminLogin/IAdminLoginWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace HT.Framework
{
/// <summary>
/// 拥有管理员模式的窗口
/// </summary>
public interface IAdminLoginWindow
{
/// <summary>
/// 是否是管理员模式
/// </summary>
bool IsAdminMode { get; set; }
/// <summary>
/// 管理员密码
/// </summary>
string Password { get; }

/// <summary>
/// 管理员身份验证
/// </summary>
/// <param name="password">密码</param>
void AdminCheck(string password);
}
}
11 changes: 11 additions & 0 deletions Editor/Utility/AdminLogin/IAdminLoginWindow.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions Editor/Utility/Config/Config.ini

This file was deleted.

77 changes: 43 additions & 34 deletions Editor/Utility/System/About.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ private static void OnEditorStart()
private GUIContent _pcGUIContent;
private GUIContent _androidGUIContent;
private GUIContent _webglGUIContent;
private VersionInfo _versionInfo;
private string _version;
private string _supported;
private string _scripting;
private string _api;
private bool _isShowOnStart;
private string _configPath;
private Vector2 _scroll;

protected override bool IsEnableTitleGUI
{
get
Expand Down Expand Up @@ -68,21 +66,14 @@ private void OnEnable()
_webglGUIContent.image = EditorGUIUtility.IconContent("BuildSettings.WebGL.Small").image;
_webglGUIContent.text = "WebGL";

ReadConfig();
ReadCurrentVersion();
}

private void ReadConfig()
private void ReadCurrentVersion()
{
_configPath = Application.dataPath + "/HTFramework/Editor/Utility/Config/Config.ini";

INIParser ini = new INIParser();
ini.Open(_configPath);
_version = ini.ReadValue("HTFrameworkEditor", "Version", "<None>");
_supported = ini.ReadValue("HTFrameworkEditor", "Supported", "<None>");
_scripting = ini.ReadValue("HTFrameworkEditor", "Scripting", "<None>");
_api = ini.ReadValue("HTFrameworkEditor", "Api", "<None>");
_versionInfo = AssetDatabase.LoadAssetAtPath<VersionInfo>("Assets/HTFramework/Editor/Utility/Version/Version.asset");
_version = _versionInfo.CurrentVersion.GetFullNumber();
_isShowOnStart = EditorPrefs.GetBool(EditorPrefsTable.AboutIsShowOnStart, true);
ini.Close();
}

protected override void OnBodyGUI()
Expand All @@ -97,7 +88,11 @@ protected override void OnBodyGUI()
private void LOGOGUI()
{
GUI.DrawTexture(new Rect(10, 0, 400, 100), _frameworkLogo);
GUI.Label(new Rect(80, 100, 200, 20), "Version: " + _version);
GUI.Label(new Rect(80, 100, 100, 20), "Version: " + _version);
if (GUI.Button(new Rect(200, 100, 120, 16), "Previous Versions", EditorGlobalTools.Styles.MiniPopup))
{
VersionViewer.OpenWindow(_versionInfo);
}
}

private void AboutGUI()
Expand All @@ -121,44 +116,58 @@ private void AboutGUI()
GUILayout.FlexibleSpace();

GUILayout.BeginHorizontal();
GUILayout.Label("Unity HTFramework, A framework of client to the unity.");
GUI.color = Color.yellow;
if (GUILayout.Button("Check for the latest updates", EditorGlobalTools.Styles.Label))
{
Application.OpenURL("https://github.com/SaiTingHu/HTFramework/commits/master");
}
EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
GUI.color = Color.white;
GUILayout.FlexibleSpace();
GUILayout.Label("Release Notes:");
GUILayout.EndHorizontal();

GUILayout.Space(60);

GUILayout.BeginVertical(GUILayout.Height(100));
_scroll = GUILayout.BeginScrollView(_scroll);
GUILayout.Label(_versionInfo.CurrentVersion.ReleaseNotes);
GUILayout.EndScrollView();
GUILayout.EndVertical();

GUILayout.BeginHorizontal();
GUILayout.Label("Supported Runtime Platforms: ");
GUILayout.Label(_pcGUIContent, EditorGlobalTools.Styles.Wordwrapminibutton);
GUILayout.Label(_androidGUIContent, EditorGlobalTools.Styles.Wordwrapminibutton);
GUILayout.Label(_webglGUIContent, EditorGlobalTools.Styles.Wordwrapminibutton);
for (int i = 0; i < _versionInfo.CurrentVersion.Platforms.Count; i++)
{
switch (_versionInfo.CurrentVersion.Platforms[i])
{
case Platform.PC:
GUILayout.Label(_pcGUIContent, EditorGlobalTools.Styles.Wordwrapminibutton);
break;
case Platform.Android:
GUILayout.Label(_androidGUIContent, EditorGlobalTools.Styles.Wordwrapminibutton);
break;
case Platform.WebGL:
GUILayout.Label(_webglGUIContent, EditorGlobalTools.Styles.Wordwrapminibutton);
break;
}
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Supported Unity versions: " + _supported);
GUILayout.Label("Supported Unity Versions: " + _versionInfo.CurrentVersion.UnityVersions);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Scripting Runtime Versions: " + _scripting);
GUILayout.Label("Scripting Runtime Versions: " + _versionInfo.CurrentVersion.ScriptingVersions);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Api Compatibility Level: " + _api);
GUILayout.Label("Api Compatibility Level: " + _versionInfo.CurrentVersion.APIVersions);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUI.color = Color.yellow;
if (GUILayout.Button("Check for the latest updates", EditorGlobalTools.Styles.Label))
{
Application.OpenURL("https://github.com/SaiTingHu/HTFramework/commits/master");
}
EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
GUILayout.Space(10);
if (GUILayout.Button("Copyright (c) 2019 HuTao", EditorGlobalTools.Styles.Label))
{
Application.OpenURL("https://github.com/SaiTingHu/HTFramework/blob/master/LICENSE");
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions Editor/Utility/Version/Version.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5a9413c23c0c1ee459c00a34641d7fab, type: 3}
m_Name: Version
m_EditorClassIdentifier:
CurrentVersion:
MajorNumber: 0
MinorNumber: 1
ReviseNumber: 0
ReleaseNotes: "1.\u53D1\u884C\u7684\u7B2C\u4E00\u4E2A\u7A33\u5B9A\u7248\u3002\r\n\u98CE\u534E\u7EDD\u4EE3\u548C\u7FFB\u6C5F\u5012\u6D77\u53D1\u5EFA\u534E\u5927\u8857\r\n\u5C31\u770B\u5F97\u89C1\u98DE\r\n\u5C31\u770B\u5F97\u89C1\u98DE\r\n\u5C31\u770B\u5F97\u89C1\u98DE\r\n\u5C31\u770B\u5F97\u89C1\u98DE\r\n\u5C31\u770B\u5F97\u89C1\u98DE\r\n\u5C31\u770B\u5F97\u89C1\u98DE\r\n\u5C31\u770B\u5F97\u89C1\u98DE\r\n\u5C31\u770B\u5F97\u89C1\u98DE\r\n\u5C31\u770B\u5F97\u89C1\u98DE"
Platforms: 010000000200000003000000
UnityVersions: 2018.3.0 or higher
ScriptingVersions: .NET 4.x Equivalent
APIVersions: .NET 4.x
PreviousVersions:
- MajorNumber: 0
MinorNumber: 1
ReviseNumber: 2
ReleaseNotes: "11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n0"
Platforms:
UnityVersions:
ScriptingVersions:
APIVersions:
- MajorNumber: 0
MinorNumber: 1
ReviseNumber: 3
ReleaseNotes: "11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n1"
Platforms:
UnityVersions:
ScriptingVersions:
APIVersions:
- MajorNumber: 0
MinorNumber: 1
ReviseNumber: 4
ReleaseNotes: "11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n11111111111111111111111\r\n1111111111111111111111111111\r\n111111111111111111111111111111\r\n2"
Platforms:
UnityVersions:
ScriptingVersions:
APIVersions:
8 changes: 8 additions & 0 deletions Editor/Utility/Version/Version.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a2d78d1

Please sign in to comment.