Chris Gregan
10 years ago
9 changed files with 306 additions and 9 deletions
@ -0,0 +1,53 @@ |
|||||||
|
using UnityEngine; |
||||||
|
using System.Collections; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
[CommandInfo("Sprite", |
||||||
|
"Set Mouse Cursor", |
||||||
|
"Sets the mouse cursor sprite.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class SetMouseCursor : Command |
||||||
|
{ |
||||||
|
[Tooltip("Texture to use for cursor. Will use default mouse cursor if no sprite is specified")] |
||||||
|
public Texture2D cursorTexture; |
||||||
|
|
||||||
|
[Tooltip("The offset from the top left of the texture to use as the target point")] |
||||||
|
public Vector2 hotSpot; |
||||||
|
|
||||||
|
// Cached static cursor settings |
||||||
|
protected static Texture2D activeCursorTexture; |
||||||
|
protected static Vector2 activeHotspot; |
||||||
|
|
||||||
|
public static void ResetMouseCursor() |
||||||
|
{ |
||||||
|
// Change mouse cursor back to most recent settings |
||||||
|
Cursor.SetCursor(activeCursorTexture, activeHotspot, CursorMode.Auto); |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
Cursor.SetCursor(cursorTexture, hotSpot, CursorMode.Auto); |
||||||
|
|
||||||
|
activeCursorTexture = cursorTexture; |
||||||
|
activeHotspot = hotSpot; |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (cursorTexture == null) |
||||||
|
{ |
||||||
|
return "Error: No cursor sprite selected"; |
||||||
|
} |
||||||
|
|
||||||
|
return cursorTexture.name; |
||||||
|
} |
||||||
|
|
||||||
|
public override Color GetButtonColor() |
||||||
|
{ |
||||||
|
return new Color32(235, 191, 217, 255); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: fb6f88496f37c444a91acef47749f723 |
||||||
|
timeCreated: 1439302629 |
||||||
|
licenseType: Free |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
After Width: | Height: | Size: 6.9 KiB |
@ -0,0 +1,55 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 22eb050bacf8c401ca8503e24bff3570 |
||||||
|
timeCreated: 1439303347 |
||||||
|
licenseType: Free |
||||||
|
TextureImporter: |
||||||
|
fileIDToRecycleName: {} |
||||||
|
serializedVersion: 2 |
||||||
|
mipmaps: |
||||||
|
mipMapMode: 0 |
||||||
|
enableMipMap: 1 |
||||||
|
linearTexture: 0 |
||||||
|
correctGamma: 0 |
||||||
|
fadeOut: 0 |
||||||
|
borderMipMap: 0 |
||||||
|
mipMapFadeDistanceStart: 1 |
||||||
|
mipMapFadeDistanceEnd: 3 |
||||||
|
bumpmap: |
||||||
|
convertToNormalMap: 0 |
||||||
|
externalNormalMap: 0 |
||||||
|
heightScale: .25 |
||||||
|
normalMapFilter: 0 |
||||||
|
isReadable: 0 |
||||||
|
grayScaleToAlpha: 0 |
||||||
|
generateCubemap: 0 |
||||||
|
cubemapConvolution: 0 |
||||||
|
cubemapConvolutionSteps: 8 |
||||||
|
cubemapConvolutionExponent: 1.5 |
||||||
|
seamlessCubemap: 0 |
||||||
|
textureFormat: -1 |
||||||
|
maxTextureSize: 2048 |
||||||
|
textureSettings: |
||||||
|
filterMode: -1 |
||||||
|
aniso: -1 |
||||||
|
mipBias: -1 |
||||||
|
wrapMode: 1 |
||||||
|
nPOTScale: 0 |
||||||
|
lightmap: 0 |
||||||
|
rGBM: 0 |
||||||
|
compressionQuality: 50 |
||||||
|
spriteMode: 1 |
||||||
|
spriteExtrude: 1 |
||||||
|
spriteMeshType: 1 |
||||||
|
alignment: 0 |
||||||
|
spritePivot: {x: .5, y: .5} |
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
||||||
|
spritePixelsToUnits: 100 |
||||||
|
alphaIsTransparency: 1 |
||||||
|
textureType: 8 |
||||||
|
buildTargetSettings: [] |
||||||
|
spriteSheet: |
||||||
|
sprites: [] |
||||||
|
spritePackingTag: |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,55 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 502e0c9b755f34db0b90bf78857d8a1c |
||||||
|
timeCreated: 1439303347 |
||||||
|
licenseType: Free |
||||||
|
TextureImporter: |
||||||
|
fileIDToRecycleName: {} |
||||||
|
serializedVersion: 2 |
||||||
|
mipmaps: |
||||||
|
mipMapMode: 0 |
||||||
|
enableMipMap: 1 |
||||||
|
linearTexture: 0 |
||||||
|
correctGamma: 0 |
||||||
|
fadeOut: 0 |
||||||
|
borderMipMap: 0 |
||||||
|
mipMapFadeDistanceStart: 1 |
||||||
|
mipMapFadeDistanceEnd: 3 |
||||||
|
bumpmap: |
||||||
|
convertToNormalMap: 0 |
||||||
|
externalNormalMap: 0 |
||||||
|
heightScale: .25 |
||||||
|
normalMapFilter: 0 |
||||||
|
isReadable: 0 |
||||||
|
grayScaleToAlpha: 0 |
||||||
|
generateCubemap: 0 |
||||||
|
cubemapConvolution: 0 |
||||||
|
cubemapConvolutionSteps: 8 |
||||||
|
cubemapConvolutionExponent: 1.5 |
||||||
|
seamlessCubemap: 0 |
||||||
|
textureFormat: -1 |
||||||
|
maxTextureSize: 2048 |
||||||
|
textureSettings: |
||||||
|
filterMode: -1 |
||||||
|
aniso: -1 |
||||||
|
mipBias: -1 |
||||||
|
wrapMode: 1 |
||||||
|
nPOTScale: 0 |
||||||
|
lightmap: 0 |
||||||
|
rGBM: 0 |
||||||
|
compressionQuality: 50 |
||||||
|
spriteMode: 1 |
||||||
|
spriteExtrude: 1 |
||||||
|
spriteMeshType: 1 |
||||||
|
alignment: 0 |
||||||
|
spritePivot: {x: .5, y: .5} |
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
||||||
|
spritePixelsToUnits: 100 |
||||||
|
alphaIsTransparency: 1 |
||||||
|
textureType: 8 |
||||||
|
buildTargetSettings: [] |
||||||
|
spriteSheet: |
||||||
|
sprites: [] |
||||||
|
spritePackingTag: |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
Loading…
Reference in new issue