Skip to content

Commit

Permalink
ㅅㅣㅈㅏㄱ
Browse files Browse the repository at this point in the history
  • Loading branch information
threewheel committed Aug 12, 2021
0 parents commit 3a63d61
Show file tree
Hide file tree
Showing 4,084 changed files with 185,938 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
82 changes: 82 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Mm]emoryCaptures/



# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta



# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*



# Autogenerated Jetbrains Rider plugin
[Aa]ssets/Plugins/Editor/JetBrains*



# Visual Studio cache directory
.vs/



# Gradle cache directory
.gradle/



# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db



# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta



# Unity3D generated file on crash reports
sysinfo.txt



# Builds
*.apk



# Crashlytics generated file
crashlytics-build.properties



*.idea
8 changes: 8 additions & 0 deletions PatchTestProject/Assets/MHLab.meta

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

8 changes: 8 additions & 0 deletions PatchTestProject/Assets/MHLab/Patch.meta

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

8 changes: 8 additions & 0 deletions PatchTestProject/Assets/MHLab/Patch/Admin.meta

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

8 changes: 8 additions & 0 deletions PatchTestProject/Assets/MHLab/Patch/Admin/Editor.meta

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

163 changes: 163 additions & 0 deletions PatchTestProject/Assets/MHLab/Patch/Admin/Editor/AdminWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
using System;
using System.IO;
using MHLab.Patch.Admin.Editor.Components;
using MHLab.Patch.Admin.Editor.EditorHelpers;
using MHLab.Patch.Admin.Editor.Localization;
using MHLab.Patch.Core.Admin;
using MHLab.Patch.Core.Admin.Localization;
using MHLab.Patch.Core.IO;
using UnityEditor;
using UnityEngine;

namespace MHLab.Patch.Admin.Editor
{
public sealed class AdminWindow : EditorWindow
{
public static class AdminWindowMenu
{
[MenuItem("Window/PATCH/Admin Tool #&p")]
public static void ShowAdminWindow()
{
ShowWindow();
}

[MenuItem("Window/PATCH/Go to workspace folder #&o")]
public static void OpenWorkspaceFolder()
{
System.Diagnostics.Process.Start(Path.Combine(Path.GetDirectoryName(Application.dataPath), WorkspaceFolderName));
}

[MenuItem("Window/PATCH/Read the manual")]
public static void OpenDocumentation()
{
System.Diagnostics.Process.Start("https://github.com/manhunterita/PATCH/wiki");
}
}

private static EditorWindow _currentWindow;
private static bool _isInitialized = false;
private const string WorkspaceFolderName = "PATCHWorkspace";

public IAdminSettings AdminSettings;
public IAdminLocalizedMessages Localization;

private WidgetContainer _widgets;

private static void ShowWindow()
{
const int minWidth = 800;
const int minHeight = 600;
const string windowTitle = "PATCH - Admin Tool";

var window = GetWindow<AdminWindow>(false, windowTitle);
window.minSize = GetWindowSize(minWidth, minHeight);
_currentWindow = window;

window.Initialize();

window.Show();
}

private static Vector2 GetWindowSize(int minWidth, int minHeight)
{
if (Screen.currentResolution.width < minWidth)
minWidth = Screen.currentResolution.width;
if (Screen.currentResolution.height < minHeight)
minHeight = Screen.currentResolution.height;

return new Vector2(minWidth, minHeight);
}

private void Initialize()
{
if (!_isInitialized)
{
InitializeSettings();

InitializeInterface();

_isInitialized = true;
}
}

private void InitializeSettings()
{
AdminSettings = new AdminSettings();

AdminSettings.RootPath = Path.Combine(Path.GetDirectoryName(Application.dataPath), WorkspaceFolderName);
AdminSettings.AppDataPath = PathsManager.GetSpecialPath(Environment.SpecialFolder.ApplicationData);

Localization = new EnglishAdminLocalizedMessages();
}

private void InitializeInterface()
{
_widgets = WidgetContainer.Create(this);
_widgets.MinSize = _currentWindow.minSize;

_widgets.AddSkin(ThemeHelper.MainColorName, Resources.Load<GUISkin>("PatchMainGUISkin"));
_widgets.AddSkin(ThemeHelper.SecondaryColorName, Resources.Load<GUISkin>("PatchSecondaryGUISkin"));
_widgets.AddSkin(ThemeHelper.DarkColorName, Resources.Load<GUISkin>("PatchDarkGUISkin"));
_widgets.AddSkin(ThemeHelper.PopupColorName, Resources.Load<GUISkin>("PatchPopupGUISkin"));

ThemeHelper.InitializeContent(_widgets);

SetContainerComponents(_widgets);
}

public static void SetContainerComponents(WidgetContainer widgets)
{
widgets.ClearComponents();

if (ThemeHelper.HasToShowErrorPopup(out var type))
{
widgets.Push<PatchErrorPopup>();
}
/*else if (ThemeHelper.HasToSetProjectName())
{
widgets.Push<PatchProjectSettings>();
}*/
else if (ThemeHelper.HasToShowTutorial())
{
widgets.Push<PatchTutorial>();
}
else
{
widgets.Push<PatchTopbar>();
widgets.Push<PatchWindow>();
widgets.Push<PatchSidebar>();
widgets.Push<PatchTipPopup>();
widgets.Push<PatchPopup>();
widgets.Push<PatchErrorPopup>();
}
}

private void OnInspectorUpdate()
{
if (_isInitialized)
{
_widgets.Update();
Repaint();
}

if (EditorApplication.isCompiling)
{
Close();
}
}

private void OnGUI()
{
if (_isInitialized)
{
_widgets.Render();
}
}

private void OnDestroy()
{
_isInitialized = false;
_currentWindow = null;
}
}
}

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

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

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

Loading

0 comments on commit 3a63d61

Please sign in to comment.