add: crosshair
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "OccaSoftware.Crosshairs.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94d06fd1668ab8e4bb8bcebd2cdd165e
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 216732
|
||||
packageName: Crosshairs | 25+ Free Crosshairs Pack
|
||||
packageVersion: 1.1.1
|
||||
assetPath: Assets/OccaSoftware/Crosshairs/Editor/OccaSoftware.Crosshairs.Editor.asmdef
|
||||
uploadId: 586051
|
||||
@@ -0,0 +1,187 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace OccaSoftware.Crosshairs.Editor
|
||||
{
|
||||
public class StartMenu : EditorWindow
|
||||
{
|
||||
// Source for UUID: https://shortunique.id/
|
||||
private static string modalId = "ShowCrosshairsModal=qtN0wW";
|
||||
private Texture2D logo;
|
||||
private GUIStyle header,
|
||||
button,
|
||||
contentSection;
|
||||
private GUILayoutOption[] contentLayoutOptions;
|
||||
private static bool listenToEditorUpdates;
|
||||
private static StartMenu startMenu;
|
||||
|
||||
[MenuItem("OccaSoftware/Start Menu (Crosshairs)")]
|
||||
public static void SetupMenu()
|
||||
{
|
||||
startMenu = CreateWindow();
|
||||
CenterWindowInEditor(startMenu);
|
||||
LoadLogo(startMenu);
|
||||
}
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
private static void Initialize()
|
||||
{
|
||||
RegisterModal();
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
SetupHeaderStyle(startMenu);
|
||||
SetupButtonStyle(startMenu);
|
||||
SetupContentSectionStyle(startMenu);
|
||||
|
||||
DrawHeader();
|
||||
DrawReviewRequest();
|
||||
DrawHelpLinks();
|
||||
DrawUpgradeLinks();
|
||||
}
|
||||
|
||||
#region Setup
|
||||
private static StartMenu CreateWindow()
|
||||
{
|
||||
StartMenu startMenu = (StartMenu)GetWindow(typeof(StartMenu));
|
||||
startMenu.position = new Rect(0, 0, 270, 480);
|
||||
return startMenu;
|
||||
}
|
||||
|
||||
private static void CenterWindowInEditor(EditorWindow startMenu)
|
||||
{
|
||||
Rect mainWindow = EditorGUIUtility.GetMainWindowPosition();
|
||||
Rect currentWindowPosition = startMenu.position;
|
||||
float centerX = (mainWindow.width - currentWindowPosition.width) * 0.5f;
|
||||
float centerY = (mainWindow.height - currentWindowPosition.height) * 0.5f;
|
||||
currentWindowPosition.x = mainWindow.x + centerX;
|
||||
currentWindowPosition.y = mainWindow.y + centerY;
|
||||
startMenu.position = currentWindowPosition;
|
||||
}
|
||||
|
||||
private static void LoadLogo(StartMenu startMenu)
|
||||
{
|
||||
startMenu.logo = (Texture2D)
|
||||
AssetDatabase.LoadAssetAtPath(
|
||||
"Assets/OccaSoftware/Crosshairs/Editor/Textures/Logo.png",
|
||||
typeof(Texture2D)
|
||||
);
|
||||
}
|
||||
|
||||
private static void SetupHeaderStyle(StartMenu startMenu)
|
||||
{
|
||||
startMenu.header = new GUIStyle(EditorStyles.boldLabel);
|
||||
startMenu.header.fontSize = 18;
|
||||
startMenu.header.wordWrap = true;
|
||||
startMenu.header.padding = new RectOffset(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
private static void SetupButtonStyle(StartMenu startMenu)
|
||||
{
|
||||
startMenu.button = new GUIStyle("button");
|
||||
startMenu.button.fontSize = 18;
|
||||
startMenu.button.fontStyle = FontStyle.Bold;
|
||||
startMenu.button.fixedHeight = 40;
|
||||
}
|
||||
|
||||
private static void SetupContentSectionStyle(StartMenu startMenu)
|
||||
{
|
||||
startMenu.contentSection = new GUIStyle("label");
|
||||
startMenu.contentSection.margin = new RectOffset(20, 20, 20, 20);
|
||||
startMenu.contentSection.padding = new RectOffset(0, 0, 0, 0);
|
||||
startMenu.contentLayoutOptions = new GUILayoutOption[] { GUILayout.MinWidth(230) };
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Modal Handler
|
||||
private static void RegisterModal()
|
||||
{
|
||||
if (!listenToEditorUpdates && !EditorApplication.isPlayingOrWillChangePlaymode)
|
||||
{
|
||||
listenToEditorUpdates = true;
|
||||
EditorApplication.update += PopModal;
|
||||
}
|
||||
}
|
||||
|
||||
private static void PopModal()
|
||||
{
|
||||
EditorApplication.update -= PopModal;
|
||||
|
||||
bool showModal = EditorPrefs.GetBool(modalId, true);
|
||||
if (showModal)
|
||||
{
|
||||
EditorPrefs.SetBool(modalId, false);
|
||||
SetupMenu();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region UI Drawer
|
||||
private void DrawHeader()
|
||||
{
|
||||
GUILayout.BeginVertical(contentSection, contentLayoutOptions);
|
||||
GUIStyle logoStyle = new GUIStyle("label");
|
||||
GUILayoutOption[] logoOptions = new GUILayoutOption[] { GUILayout.Width(230) };
|
||||
logoStyle.padding = new RectOffset(0, 0, 0, 0);
|
||||
logoStyle.margin = new RectOffset(0, 0, 0, 0);
|
||||
logoStyle.alignment = TextAnchor.MiddleCenter;
|
||||
GUILayout.Label(logo, logoStyle, logoOptions);
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void DrawReviewRequest()
|
||||
{
|
||||
GUILayout.BeginVertical(contentSection, contentLayoutOptions);
|
||||
GUILayout.Label("What do you think about my free Crosshair pack?", header);
|
||||
|
||||
if (
|
||||
GUILayout.Button(
|
||||
"Leave a review",
|
||||
button,
|
||||
new GUILayoutOption[] { GUILayout.MaxWidth(300) }
|
||||
)
|
||||
)
|
||||
{
|
||||
Application.OpenURL("https://assetstore.unity.com/packages/slug/216732");
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void DrawHelpLinks()
|
||||
{
|
||||
GUILayout.BeginVertical(contentSection, contentLayoutOptions);
|
||||
GUILayout.Label("I am here to help.", header);
|
||||
if (EditorGUILayout.LinkButton("Website"))
|
||||
{
|
||||
Application.OpenURL("https://www.occasoftware.com/assets/crosshairs");
|
||||
}
|
||||
|
||||
if (EditorGUILayout.LinkButton("Discord"))
|
||||
{
|
||||
Application.OpenURL("https://www.occasoftware.com/discord");
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void DrawUpgradeLinks()
|
||||
{
|
||||
GUILayout.BeginVertical(contentSection, contentLayoutOptions);
|
||||
|
||||
GUILayout.Label("Make your game a success.", header);
|
||||
if (EditorGUILayout.LinkButton("Upgrade to Crosshairs Pro"))
|
||||
{
|
||||
Application.OpenURL("https://assetstore.unity.com/packages/slug/239049");
|
||||
}
|
||||
if (EditorGUILayout.LinkButton("Join my Newsletter"))
|
||||
{
|
||||
Application.OpenURL("https://www.occasoftware.com/newsletter");
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b101b242ded8fe40b2544ce18bea6ba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 216732
|
||||
packageName: Crosshairs | 25+ Free Crosshairs Pack
|
||||
packageVersion: 1.1.1
|
||||
assetPath: Assets/OccaSoftware/Crosshairs/Editor/StartMenu.cs
|
||||
uploadId: 586051
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 880b3f10f71451749b1b71400b47293a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,165 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 071975048195e45478df8f4a898773cf
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 1
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 1
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 216732
|
||||
packageName: Crosshairs | 25+ Free Crosshairs Pack
|
||||
packageVersion: 1.1.1
|
||||
assetPath: Assets/OccaSoftware/Crosshairs/Editor/Textures/logo.png
|
||||
uploadId: 586051
|
||||
Reference in New Issue
Block a user