chore: initial commit
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using MoreMountains.Tools;
|
||||
using UnityEditor;
|
||||
|
||||
namespace MoreMountains.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// An editor class used to display menu items
|
||||
/// </summary>
|
||||
public class MMDebugEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds a menu item to enable debug logs
|
||||
/// </summary>
|
||||
[MenuItem("Tools/More Mountains/Enable Debug Logs", false, 100)]
|
||||
private static void EnableDebugLogs()
|
||||
{
|
||||
MMDebug.SetDebugLogsEnabled(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conditional method to determine if the "enable debug log" entry should be greyed or not
|
||||
/// </summary>
|
||||
[MenuItem("Tools/More Mountains/Enable Debug Logs", true)]
|
||||
private static bool EnableDebugLogsValidation()
|
||||
{
|
||||
return !MMDebug.DebugLogsEnabled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a menu item to disable debug logs
|
||||
/// </summary>
|
||||
[MenuItem("Tools/More Mountains/Disable Debug Logs", false, 101)]
|
||||
private static void DisableDebugLogs()
|
||||
{
|
||||
MMDebug.SetDebugLogsEnabled(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conditional method to determine if the "disable debug log" entry should be greyed or not
|
||||
/// </summary>
|
||||
[MenuItem("Tools/More Mountains/Disable Debug Logs", true)]
|
||||
private static bool DisableDebugLogsValidation()
|
||||
{
|
||||
return MMDebug.DebugLogsEnabled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a menu item to enable debug logs
|
||||
/// </summary>
|
||||
[MenuItem("Tools/More Mountains/Enable Debug Draws", false, 102)]
|
||||
private static void EnableDebugDraws()
|
||||
{
|
||||
MMDebug.SetDebugDrawEnabled(true);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/More Mountains/Enable Debug Draws", true)]
|
||||
/// <summary>
|
||||
/// Conditional method to determine if the "enable debug log" entry should be greyed or not
|
||||
/// </summary>
|
||||
private static bool EnableDebugDrawsValidation()
|
||||
{
|
||||
return !MMDebug.DebugDrawEnabled;
|
||||
}
|
||||
|
||||
[MenuItem("Tools/More Mountains/Disable Debug Draws", false, 103)]
|
||||
/// <summary>
|
||||
/// Adds a menu item to disable debug logs
|
||||
/// </summary>
|
||||
private static void DisableDebugDraws()
|
||||
{
|
||||
MMDebug.SetDebugDrawEnabled(false);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/More Mountains/Disable Debug Draws", true)]
|
||||
/// <summary>
|
||||
/// Conditional method to determine if the "disable debug log" entry should be greyed or not
|
||||
/// </summary>
|
||||
private static bool DisableDebugDrawsValidation()
|
||||
{
|
||||
return MMDebug.DebugDrawEnabled;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75f9cc4cf2ef4324d99f4dc9d5709b63
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MoreMountains.Tools
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(MMLayer))]
|
||||
public class MMLayerPropertyDrawer : PropertyDrawer
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
EditorGUI.BeginProperty(position, GUIContent.none, property);
|
||||
SerializedProperty layerIndex = property.FindPropertyRelative("_layerIndex");
|
||||
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
|
||||
if (layerIndex != null)
|
||||
{
|
||||
layerIndex.intValue = EditorGUI.LayerField(position, layerIndex.intValue);
|
||||
}
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d8d3d62d1a2e8f429db2998bbdeb237
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.IO;
|
||||
|
||||
namespace MoreMountains.Tools
|
||||
{
|
||||
[CustomEditor(typeof(MMAspectRatioSafeZones), true)]
|
||||
public class MMScreenshotEditor : Editor
|
||||
{
|
||||
static string FolderName = "Screenshots";
|
||||
|
||||
[MenuItem("Tools/More Mountains/Screenshot/Take Screenshot Real Size", false, 801)]
|
||||
public static void MenuScreenshotSize1()
|
||||
{
|
||||
string savePath = TakeScreenCaptureScreenshot(1);
|
||||
}
|
||||
[MenuItem("Tools/More Mountains/Screenshot/Take Screenshot Size x2", false, 802)]
|
||||
public static void MenuScreenshotSize2()
|
||||
{
|
||||
string savePath = TakeScreenCaptureScreenshot(2);
|
||||
}
|
||||
[MenuItem("Tools/More Mountains/Screenshot/Take Screenshot Size x3 %k", false, 803)]
|
||||
public static void MenuScreenshotSize3()
|
||||
{
|
||||
string savePath = TakeScreenCaptureScreenshot(3);
|
||||
}
|
||||
|
||||
protected static string TakeScreenCaptureScreenshot(int gameViewSizeMultiplier)
|
||||
{
|
||||
if (!Directory.Exists(FolderName))
|
||||
{
|
||||
Directory.CreateDirectory(FolderName);
|
||||
}
|
||||
|
||||
float width = Screen.width * gameViewSizeMultiplier;
|
||||
float height = Screen.height * gameViewSizeMultiplier;
|
||||
string savePath = FolderName + "/screenshot_" + width + "x" + height + "_" + System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".png";
|
||||
|
||||
ScreenCapture.CaptureScreenshot(savePath, gameViewSizeMultiplier);
|
||||
MMDebug.DebugLogInfo("[MMScreenshot] Screenshot taken with size multiplier of " + gameViewSizeMultiplier + " and saved at " + savePath);
|
||||
return savePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82c6a6e2f2e591a498214d03f76d9f09
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace MoreMountains.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom editor for the MMTransformRandomizer class
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(MMTransformRandomizer), true)]
|
||||
[CanEditMultipleObjects]
|
||||
public class MMTransformRandomizerEditor : Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// On inspector we handle undo and display a test button
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
Undo.RecordObject(target, "Modified MMTransformRandomizer");
|
||||
DrawDefaultInspector();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Test", EditorStyles.boldLabel);
|
||||
|
||||
if (GUILayout.Button("Randomize"))
|
||||
{
|
||||
foreach (MMTransformRandomizer randomizer in targets)
|
||||
{
|
||||
randomizer.Randomize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6dbf82cbd8a266041acbda8137fc5b9d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,26 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections;
|
||||
|
||||
namespace MoreMountains.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// This class adds names for each LevelMapPathElement next to it on the scene view, for easier setup
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(MMSceneViewIcon))]
|
||||
[InitializeOnLoad]
|
||||
public class SceneViewIconEditor : Editor
|
||||
{
|
||||
//protected SceneViewIcon _sceneViewIcon;
|
||||
|
||||
[DrawGizmo(GizmoType.InSelectionHierarchy | GizmoType.NotInSelectionHierarchy)]
|
||||
static void DrawGameObjectName(MMSceneViewIcon sceneViewIcon, GizmoType gizmoType)
|
||||
{
|
||||
GUIStyle style = new GUIStyle();
|
||||
style.normal.textColor = Color.blue;
|
||||
Handles.Label(sceneViewIcon.transform.position, sceneViewIcon.gameObject.name,style);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22acaeb1b9f9e4fbbb6486133e649e67
|
||||
timeCreated: 1456229446
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user