add cursor toggle, master volume

This commit is contained in:
minenice55 2022-07-10 17:39:14 -04:00
parent 7fd1617ea7
commit a7bea351c5
57 changed files with 48810 additions and 3410 deletions

8
Assets/GUIWindows.meta Normal file
View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0213bb2af6cda644f97e3dc22e5d5815
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9e2cc9380e05e994ca36eafd84612971
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 5b69212126b91114ea8f0a926d77c519
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 1
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
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: 1
spriteTessellationDetail: -1
textureType: 7
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
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
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 2b62059c6b03f004db5a180b61188820
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 1
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
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: 1
spriteTessellationDetail: -1
textureType: 7
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
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
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 5704ce039ab9a4d41bce815832591a2f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 1
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
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: 1
spriteTessellationDetail: -1
textureType: 7
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
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
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 40a8ef17dc9780c4085eb2001e1c9ac1
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 1
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
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: 1
spriteTessellationDetail: -1
textureType: 7
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
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
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a10780de139895143a5169586497425c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4e35aeb23d52d724cb7fe53502b35ed6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8883473590307544898c90d1e7efef00
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 074e01de92c223544965cecb3408cd66
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,35 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
namespace Rellac.Windows
{
[CustomEditor(typeof(GUIPointerObject))]
[CanEditMultipleObjects]
public class GUIPointerObjectEditor : Editor
{
SerializedProperty onPointerUp;
SerializedProperty onPointerDown;
SerializedProperty onPointerEnter;
SerializedProperty onPointerExit;
void OnEnable()
{
onPointerUp = serializedObject.FindProperty("onPointerUp");
onPointerDown = serializedObject.FindProperty("onPointerDown");
onPointerEnter = serializedObject.FindProperty("onPointerEnter");
onPointerExit = serializedObject.FindProperty("onPointerExit");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(onPointerUp);
EditorGUILayout.PropertyField(onPointerDown);
EditorGUILayout.PropertyField(onPointerEnter);
EditorGUILayout.PropertyField(onPointerExit);
serializedObject.ApplyModifiedProperties();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e208f13f49d1a4c42b716cbde5c0ba97
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,29 @@
using UnityEngine;
namespace Rellac.Windows
{
/// <summary>
/// Contains a reference to all GUIWindowHandle objects below this Transform for ease of referencing
/// </summary>
public class GUIBorderParent : MonoBehaviour
{
private GUIWindowHandle[] handles;
// Use this for initialization
void Start()
{
handles = GetComponentsInChildren<GUIWindowHandle>();
}
/// <summary>
/// Toggle interactivity of handles
/// </summary>
/// <param name="input">is interactive</param>
public void SetIsLocked(bool input)
{
for (int i = 0; i < handles.Length; i++)
{
handles[i].SetIsLocked(input);
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7522e6e31c695a24eab781c580d37a59
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,66 @@
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
namespace Rellac.Windows
{
/// <summary>
/// Contains events referencing IPointerHandlers
/// </summary>
public class GUIPointerObject : MonoBehaviour, IPointerUpHandler, IPointerDownHandler, IPointerEnterHandler, IPointerExitHandler
{
/// <summary>
/// Fires when a pointer up is detected
/// </summary>
[HideInInspector]
[Tooltip("Fires when a pointer up is detected")]
public UnityEvent onPointerUp = null;
/// <summary>
/// Fires when a pointer down is detected
/// </summary>
[HideInInspector]
[Tooltip("Fires when a pointer down is detected")]
public UnityEvent onPointerDown = null;
/// <summary>
/// Fires when a pointer enter is detected
/// </summary>
[HideInInspector]
[Tooltip("Fires when a pointer enter is detected")]
public UnityEvent onPointerEnter = null;
/// <summary>
/// Fires when a pointer exit is detected
/// </summary>
[HideInInspector]
[Tooltip("Fires when a pointer exit is detected")]
public UnityEvent onPointerExit = null;
public void OnPointerUp(PointerEventData eventData)
{
if (onPointerUp != null)
{
onPointerUp.Invoke();
}
}
public void OnPointerDown(PointerEventData eventData)
{
if (onPointerDown != null)
{
onPointerDown.Invoke();
}
}
public void OnPointerEnter(PointerEventData eventData)
{
if (onPointerEnter != null)
{
onPointerEnter.Invoke();
}
}
public void OnPointerExit(PointerEventData eventData)
{
if (onPointerExit != null)
{
onPointerExit.Invoke();
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4817080b0d03dd846b5ee72dfd97c993
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
using UnityEngine;
namespace Rellac.Windows
{
/// <summary>
/// Simple script to destroy the target GameObject when window is closed
/// </summary>
public class GUIWindow : MonoBehaviour
{
/// <summary>
/// Close window by destroying this GameObject
/// </summary>
public void CloseWindow()
{
Destroy(gameObject);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 53f10846845fcf9489fc69eccfbd24c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,186 @@
using UnityEngine;
using UnityEngine.Events;
namespace Rellac.Windows
{
/// <summary>
/// Script to handle expanding and restoring a window to/from screen size
/// </summary>
public class GUIWindowExpander : GUIPointerObject
{
private const float MaxTimeForDoubleClick = 0.5f;
/// <summary>
/// Window to apply expand effect to
/// </summary>
[Tooltip("")]
[SerializeField] private RectTransform parentWindow = null;
/// <summary>
/// Expander is locked and unusable
/// </summary>
[Tooltip("")]
[SerializeField] private bool isLocked = false;
/// <summary>
/// Allows you to double click this target image to minimise/maximise
/// </summary>
[Tooltip("Allows you to double click this target image to minimise/maximise")]
[SerializeField] private bool doubleClick = true;
/// <summary>
/// Fires when window starts restoring to a smaller size
/// </summary>
public UnityEvent onMinimised = null;
/// <summary>
/// Fires when window starts expanding
/// </summary>
public UnityEvent onMaximised = null;
private bool isMaximised = false;
private bool doAction = false;
private Vector2 initialPosition;
private Vector2 initialMinAnchor;
private Vector2 initialMaxAnchor;
private Vector2 initialSize;
private Vector2 initialPivot = Vector2.one * -1;
private Vector2 targetPosition;
private Vector2 targetSize;
private int numClicks;
void Start()
{
onPointerDown.AddListener(parentWindow.SetAsLastSibling);
onPointerDown.AddListener(TryDoubleClick);
}
// Update is called once per frame
void Update()
{
if (doAction)
{
// Lerp to position & size
parentWindow.sizeDelta = Vector2.MoveTowards(parentWindow.sizeDelta, targetSize, Time.deltaTime * 10000);
parentWindow.anchoredPosition = Vector2.MoveTowards(parentWindow.anchoredPosition, targetPosition, Time.deltaTime * 5000);
// reached target
if (parentWindow.sizeDelta == targetSize && parentWindow.anchoredPosition == targetPosition)
{
doAction = false;
if (isMaximised)
{ // set to a full stretched rect
parentWindow.anchorMin = Vector2.zero;
parentWindow.anchorMax = Vector2.one;
parentWindow.sizeDelta = Vector2.zero;
parentWindow.anchoredPosition = Vector2.zero;
if (onMaximised != null)
{
onMaximised.Invoke();
}
}
else
{ // just invoke the event for a minimised window
if (onMinimised != null)
{
onMinimised.Invoke();
}
}
}
}
}
/// <summary>
/// Toggle interactivity of expander
/// </summary>
/// <param name="input">is interactive</param>
public void SetIsLocked(bool input)
{
isLocked = input;
parentWindow.SetAsLastSibling();
}
/// <summary>
/// Set window to fill screen
/// </summary>
public void MaximiseWindow()
{
if (isLocked) return;
initialPosition = parentWindow.anchoredPosition;
initialMinAnchor = parentWindow.anchorMin;
initialMaxAnchor = parentWindow.anchorMax;
initialSize = parentWindow.sizeDelta;
initialPivot = parentWindow.pivot;
parentWindow.SetPivot(Vector2.one * 0.5f);
targetPosition = Vector2.zero;
targetSize = new Vector2(Screen.width, Screen.height);
isMaximised = true;
doAction = true;
parentWindow.SetAsLastSibling();
}
/// <summary>
/// Set window to small size
/// </summary>
public void MinimiseWindow()
{
if (isLocked) return;
parentWindow.anchorMin = initialMinAnchor;
parentWindow.anchorMax = initialMaxAnchor;
parentWindow.sizeDelta = new Vector2(Screen.width, Screen.height);
if (initialPivot != Vector2.one * -1)
{
parentWindow.SetPivot(initialPivot);
}
targetPosition = initialPosition;
targetSize = initialSize;
isMaximised = false;
doAction = true;
parentWindow.SetAsLastSibling();
}
/// <summary>
/// Do a click for attempting to expand by double click
/// </summary>
public void TryDoubleClick()
{
parentWindow.SetAsLastSibling();
if (isLocked || !doubleClick) return;
numClicks++;
if (numClicks == 1)
{
Invoke("ResetDoubleClick", MaxTimeForDoubleClick);
}
else if (numClicks >= 2)
{
Invoke("Swap", 0.1f); // wait in case we're interrupting a mover
}
}
/// <summary>
/// Swap between minimised and maximised
/// </summary>
public void Swap()
{
if (isMaximised)
{
MinimiseWindow();
}
else
{
MaximiseWindow();
}
}
private void ResetDoubleClick()
{
numClicks = 0;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 14001084fe201b84d9804ee3eafd2b7a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,278 @@
using UnityEngine;
using UnityEngine.Events;
namespace Rellac.Windows
{
/// <summary>
/// Script to handle pull handles to expand the windows
/// </summary>
public class GUIWindowHandle : GUIPointerObject
{
/// <summary>
/// Window to apply pull effect to
/// </summary>
[Tooltip("Window to apply pull effect to")]
[SerializeField] private RectTransform parentWindow = null;
/// <summary>
/// Handle is locked and unusable
/// </summary>
[Tooltip("Handle is locked and unusable")]
[SerializeField] private bool isLocked = false;
/// <summary>
/// Minimum width parent window can be set to
/// </summary>
[Tooltip("Minimum width parent window can be set to")]
[SerializeField] private float minWidth = 50;
/// <summary>
/// Minimum height parent window can be set to
/// </summary>
[Tooltip("Minimum height parent window can be set to")]
[SerializeField] private float minHeight = 50;
/// <summary>
/// Sprite to show for cursor when this handle is highlighted
/// </summary>
[Tooltip("Sprite to show for cursor when this handle is highlighted")]
[SerializeField] private Texture2D cursor = null;
/// <summary>
/// Directional axis to pull window with this handle
/// </summary>
[Tooltip("Directional axis to pull window with this handle")]
[SerializeField] private Axis axis = Axis.Horizontal;
/// <summary>
/// Fired when user pulls on the handle
/// </summary>
public UnityEvent onWindowPulled = null;
Direction direction;
private bool isGrabbed = false;
private Vector2 initialMousePos;
private Vector2 initialSize;
private Vector2 initialPivot;
void Start()
{
//register to pointer events
onPointerDown.AddListener(SetIsGrabbed);
onPointerDown.AddListener(parentWindow.SetAsLastSibling);
// onPointerEnter.AddListener(ShowCursor);
// onPointerExit.AddListener(ResetCursor);
// find what direction we're pulling with this handle
switch (axis)
{
case Axis.Horizontal:
if (transform.position.x > parentWindow.position.x)
{
direction = Direction.Right;
}
else
{
direction = Direction.Left;
}
break;
case Axis.Vertical:
if (transform.position.y > parentWindow.position.y)
{
direction = Direction.Up;
}
else
{
direction = Direction.Down;
}
break;
case Axis.Diagonal:
if (transform.position.y > parentWindow.position.y)
{
if (transform.position.x > parentWindow.position.x)
{
direction = Direction.UpRight;
}
else
{
direction = Direction.UpLeft;
}
}
else
{
if (transform.position.x > parentWindow.position.x)
{
direction = Direction.DownRight;
}
else
{
direction = Direction.DownLeft;
}
}
break;
}
}
void Update()
{
if (!isGrabbed)
return;
if (Input.GetMouseButtonUp(0))
{
isGrabbed = false;
parentWindow.SetPivot(initialPivot);
if (onWindowPulled != null)
{
onWindowPulled.Invoke();
}
return;
}
Vector2 scaleOffset = (Vector2.one - (Vector2)transform.lossyScale) + Vector2.one;
Vector2 parentScale = parentWindow.transform.parent.GetComponent<RectTransform>().rect.size;
Vector2 mouseDelta = Vector2.Scale((Vector2)Camera.main.ScreenToWorldPoint(GUIWindowUtils.MousePosition()) - initialMousePos, scaleOffset*parentScale);
Vector2 size = initialSize;
switch (direction)
{
case Direction.Up:
size += new Vector2(0, mouseDelta.y);
break;
case Direction.Down:
size -= new Vector2(0, mouseDelta.y);
break;
case Direction.Left:
size -= new Vector2(mouseDelta.x, 0);
break;
case Direction.Right:
size += new Vector2(mouseDelta.x, 0);
break;
case Direction.UpRight:
size += new Vector2(mouseDelta.x, mouseDelta.y);
break;
case Direction.UpLeft:
size += new Vector2(-mouseDelta.x, mouseDelta.y);
break;
case Direction.DownRight:
size += new Vector2(mouseDelta.x, -mouseDelta.y);
break;
case Direction.DownLeft:
size += new Vector2(-mouseDelta.x, -mouseDelta.y);
break;
}
// Keep Window within minimum size
if (size.x < minWidth || size.y < minHeight)
{
Vector2 newsize = size;
if (size.x < minWidth)
{
newsize.x = minWidth;
}
if (size.y < minHeight)
{
newsize.y = minHeight;
}
parentWindow.sizeDelta = newsize;
return;
}
// set position & size
parentWindow.sizeDelta = size;
}
/// <summary>
/// Toggle interactivity of handle
/// </summary>
/// <param name="input">is interactive</param>
public void SetIsLocked(bool input)
{
isLocked = input;
parentWindow.SetAsLastSibling();
}
/// <summary>
/// Trigger that this handle has been grabbed
/// </summary>
public void SetIsGrabbed()
{
if (isLocked) return;
isGrabbed = true;
initialMousePos = Camera.main.ScreenToWorldPoint(GUIWindowUtils.MousePosition());
initialSize = parentWindow.sizeDelta;
initialPivot = parentWindow.pivot;
// Set Pivot to correct value based on direction so we don't need to offset movement
switch (direction)
{
case Direction.Up:
parentWindow.SetPivot(new Vector2(0.5f, 0));
break;
case Direction.Down:
parentWindow.SetPivot(new Vector2(0.5f, 1));
break;
case Direction.Left:
parentWindow.SetPivot(new Vector2(1, 0.5f));
break;
case Direction.Right:
parentWindow.SetPivot(new Vector2(0, 0.5f));
break;
case Direction.UpRight:
parentWindow.SetPivot(new Vector2(0, 0));
break;
case Direction.UpLeft:
parentWindow.SetPivot(new Vector2(1, 0));
break;
case Direction.DownRight:
parentWindow.SetPivot(new Vector2(0, 1));
break;
case Direction.DownLeft:
parentWindow.SetPivot(new Vector2(1, 1));
break;
}
parentWindow.SetAsLastSibling();
}
/// <summary>
/// Show the changed cursor when this handle is highlighted
/// </summary>
public void ShowCursor()
{
if (!isLocked && cursor != null)
{
Cursor.SetCursor(cursor, new Vector2(16, 16), CursorMode.Auto);
}
}
/// <summary>
/// Return the cursor to the default state
/// </summary>
public void ResetCursor()
{
if (cursor != null)
{
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
}
}
private enum Axis
{
Horizontal,
Vertical,
Diagonal
}
private enum Direction
{
Up,
Down,
Left,
Right,
UpLeft,
UpRight,
DownLeft,
DownRight
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ff5cd5446e2fdea43a48057e3e0e0b8b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,70 @@
using UnityEngine;
using UnityEngine.Events;
namespace Rellac.Windows
{
/// <summary>
/// Script to handle moving windows
/// </summary>
public class GUIWindowMover : GUIPointerObject
{
/// <summary>
/// Window to move
/// </summary>
[Tooltip("Window to move")]
[SerializeField] private RectTransform parentWindow = null;
/// <summary>
/// Mover is locked and unusable
/// </summary>
[Tooltip("Mover is locked and unusable")]
[SerializeField] private bool isLocked = false;
/// <summary>
/// Fires when a window has been moved
/// </summary>
[Tooltip("Fires when a window has been moved")]
[SerializeField] private UnityEvent onWindowMoved = null;
private Vector2 mouseOffset;
private bool isGrabbed = false;
void Start()
{
onPointerDown.AddListener(SetIsGrabbed);
}
void Update()
{
if (!isGrabbed || isLocked) return;
parentWindow.position = (Vector2)GUIWindowUtils.MousePosition() + mouseOffset;
if (Input.GetMouseButtonUp(0))
{
isGrabbed = false;
if (onWindowMoved != null)
{
onWindowMoved.Invoke();
}
}
}
/// <summary>
/// Toggle interactivity of handle
/// </summary>
/// <param name="input">is interactive</param>
public void SetIsLocked(bool input)
{
isLocked = input;
isGrabbed = false;
}
/// <summary>
/// Trigger that window has started to be moved
/// </summary>
public void SetIsGrabbed()
{
mouseOffset = parentWindow.position - GUIWindowUtils.MousePosition();
isGrabbed = true;
parentWindow.SetAsLastSibling();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: afc20c44b0e31b64193a5ccaa228b5f8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,67 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace Rellac.Windows
{
public static class GUIWindowUtils
{
#if UNITY_EDITOR
[MenuItem("GameObject/UI/Window")]
public static void InstantiateWindow()
{
NewWindow();
}
#endif
public static GameObject NewWindow()
{
Object prefab = Resources.Load("WindowUIComponent");
Canvas canvas = GameObject.FindObjectOfType<Canvas>();
if (canvas == null)
{
// Create default canvas
GameObject newCanvas = new GameObject("Canvas");
canvas = newCanvas.AddComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
newCanvas.AddComponent<CanvasScaler>();
newCanvas.AddComponent<GraphicRaycaster>();
if (GameObject.FindObjectOfType<EventSystem>() == null)
{
// Create defalut EventSystem
new GameObject("EventSystem").AddComponent<EventSystem>(). // create new GameObject with EventSystem
gameObject.AddComponent<StandaloneInputModule>() // add Input Module
#if UNITY_5_3_OR_NEWER
; // we don't need the Touch Input Module at 5.3+
#else
.gameObject.AddComponent<TouchInputModule>();
#endif
}
}
GameObject go = (GameObject)GameObject.Instantiate(prefab);
go.transform.SetParent(canvas.transform);
go.transform.localPosition = Vector2.zero;
go.name = "Window";
return go;
}
public static void SetPivot(this RectTransform rectTransform, Vector2 pivot)
{
if (rectTransform == null) return;
Vector2 size = rectTransform.rect.size;
Vector2 deltaPivot = rectTransform.pivot - pivot;
Vector3 deltaPosition = new Vector3(deltaPivot.x * size.x, deltaPivot.y * size.y);
rectTransform.pivot = pivot;
rectTransform.localPosition -= deltaPosition;
}
public static Vector3 MousePosition()
{
var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
return new Vector3(mousePos.x, mousePos.y, 0);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8f1db78fc458ea44ebcab0c6ce456cfe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,5 +1,31 @@
%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1102 &-7358310358408031479
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: PoseL
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 2b1031aa0cd6ad746a872d7502906375, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &-2547331504343513316 --- !u!1102 &-2547331504343513316
AnimatorState: AnimatorState:
serializedVersion: 6 serializedVersion: 6
@ -74,6 +100,32 @@ AnimatorController:
m_IKPass: 0 m_IKPass: 0
m_SyncedLayerAffectsTiming: 0 m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000} m_Controller: {fileID: 9100000}
--- !u!1102 &4458562493945474950
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: DanceTest
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: ec2ffde2ca84482428ad2c9f211c8eb1, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &5646467201381534092 --- !u!1102 &5646467201381534092
AnimatorState: AnimatorState:
serializedVersion: 6 serializedVersion: 6
@ -118,6 +170,15 @@ AnimatorStateMachine:
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: 5646467201381534092} m_State: {fileID: 5646467201381534092}
m_Position: {x: 270, y: 130, z: 0} m_Position: {x: 270, y: 130, z: 0}
- serializedVersion: 1
m_State: {fileID: -7358310358408031479}
m_Position: {x: 305, y: 195, z: 0}
- serializedVersion: 1
m_State: {fileID: 4458562493945474950}
m_Position: {x: 340, y: 260, z: 0}
- serializedVersion: 1
m_State: {fileID: 7185868682324471420}
m_Position: {x: 375, y: 325, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: [] m_AnyStateTransitions: []
m_EntryTransitions: [] m_EntryTransitions: []
@ -127,4 +188,30 @@ AnimatorStateMachine:
m_EntryPosition: {x: 50, y: 120, z: 0} m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0} m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -1776475060856592369} m_DefaultState: {fileID: -7358310358408031479}
--- !u!1102 &7185868682324471420
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: PoseR
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: bf9a58fcd3926614ca80acdeee591cc5, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ec2ffde2ca84482428ad2c9f211c8eb1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -83,7 +83,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: {x: 0, y: 0, z: 0} value: {x: 0, y: 0, z: -66}
inSlope: {x: 0, y: 0, z: 0} inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0 tangentMode: 0
@ -131,7 +131,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: {x: 0, y: 0, z: 0} value: {x: 0, y: 0, z: 66}
inSlope: {x: 0, y: 0, z: 0} inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0 tangentMode: 0
@ -276,7 +276,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: {x: -0.45, y: 1.41, z: 0} value: {x: -0.827, y: 1.94, z: 0}
inSlope: {x: 0, y: 0, z: 0} inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0 tangentMode: 0
@ -324,7 +324,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: {x: 0.45, y: 1.41, z: 0} value: {x: 0.827, y: 1.94, z: 0}
inSlope: {x: 0, y: 0, z: 0} inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0 tangentMode: 0
@ -862,7 +862,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: 0 value: -1
inSlope: Infinity inSlope: Infinity
outSlope: Infinity outSlope: Infinity
tangentMode: 103 tangentMode: 103
@ -1137,7 +1137,7 @@ AnimationClip:
script: {fileID: 0} script: {fileID: 0}
- curve: - curve:
- time: 0 - time: 0
value: {fileID: 8686924115327304628, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3} value: {fileID: -225954005119175787, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3}
attribute: m_Sprite attribute: m_Sprite
path: Head path: Head
classID: 212 classID: 212
@ -1689,7 +1689,7 @@ AnimationClip:
- {fileID: -4069819626392588860, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3} - {fileID: -4069819626392588860, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3}
- {fileID: -4069819626392588860, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3} - {fileID: -4069819626392588860, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3}
- {fileID: 9090138327996896252, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3} - {fileID: 9090138327996896252, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3}
- {fileID: 8686924115327304628, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3} - {fileID: -225954005119175787, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3}
- {fileID: 5850673630285665839, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3} - {fileID: 5850673630285665839, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3}
- {fileID: -635505316817552075, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3} - {fileID: -635505316817552075, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3}
- {fileID: 2848929583589385298, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3} - {fileID: 2848929583589385298, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3}
@ -1704,7 +1704,7 @@ AnimationClip:
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0
m_HasAdditiveReferencePose: 0 m_HasAdditiveReferencePose: 0
m_LoopTime: 1 m_LoopTime: 0
m_LoopBlend: 0 m_LoopBlend: 0
m_LoopBlendOrientation: 0 m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0 m_LoopBlendPositionY: 0
@ -2005,7 +2005,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: -0.45 value: -0.827
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
tangentMode: 136 tangentMode: 136
@ -2024,7 +2024,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: 1.41 value: 1.94
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
tangentMode: 136 tangentMode: 136
@ -2176,7 +2176,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: 0.45 value: 0.827
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
tangentMode: 136 tangentMode: 136
@ -2195,7 +2195,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: 1.41 value: 1.94
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
tangentMode: 136 tangentMode: 136
@ -2670,7 +2670,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: 0 value: -66
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
tangentMode: 136 tangentMode: 136
@ -2841,7 +2841,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: 0 value: 66
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
tangentMode: 136 tangentMode: 136
@ -3544,7 +3544,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: 0 value: -1
inSlope: Infinity inSlope: Infinity
outSlope: Infinity outSlope: Infinity
tangentMode: 103 tangentMode: 103
@ -3894,8 +3894,8 @@ AnimationClip:
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
attribute: m_LocalEulerAngles.x attribute: m_LocalEulerAngles.z
path: ArmR path: ArmL
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve: - curve:
@ -3905,7 +3905,7 @@ AnimationClip:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
attribute: m_LocalEulerAngles.y attribute: m_LocalEulerAngles.y
path: ArmR path: ArmL
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve: - curve:
@ -3914,8 +3914,8 @@ AnimationClip:
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
attribute: m_LocalEulerAngles.z attribute: m_LocalEulerAngles.x
path: ArmR path: ArmL
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve: - curve:
@ -3984,8 +3984,8 @@ AnimationClip:
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
attribute: m_LocalEulerAngles.x attribute: m_LocalEulerAngles.z
path: ArmL path: Body
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve: - curve:
@ -3995,7 +3995,7 @@ AnimationClip:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
attribute: m_LocalEulerAngles.y attribute: m_LocalEulerAngles.y
path: ArmL path: Body
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve: - curve:
@ -4004,8 +4004,8 @@ AnimationClip:
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
attribute: m_LocalEulerAngles.z attribute: m_LocalEulerAngles.x
path: ArmL path: Body
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve: - curve:
@ -4105,7 +4105,7 @@ AnimationClip:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
attribute: m_LocalEulerAngles.x attribute: m_LocalEulerAngles.x
path: Body path: ArmR
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve: - curve:
@ -4115,7 +4115,7 @@ AnimationClip:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
attribute: m_LocalEulerAngles.y attribute: m_LocalEulerAngles.y
path: Body path: ArmR
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve: - curve:
@ -4125,7 +4125,7 @@ AnimationClip:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
attribute: m_LocalEulerAngles.z attribute: m_LocalEulerAngles.z
path: Body path: ArmR
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
m_HasGenericRootTransform: 0 m_HasGenericRootTransform: 0

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2b1031aa0cd6ad746a872d7502906375
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bf9a58fcd3926614ca80acdeee591cc5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -28,7 +28,7 @@ Transform:
m_LocalPosition: {x: 0.18, y: 0.51, z: 0} m_LocalPosition: {x: 0.18, y: 0.51, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 3474138550947469853} m_Father: {fileID: 3517870697961505299}
m_RootOrder: 5 m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &5458371096400718163 --- !u!212 &5458371096400718163
@ -192,7 +192,7 @@ Transform:
m_LocalPosition: {x: -0.18, y: 0.51, z: 0} m_LocalPosition: {x: -0.18, y: 0.51, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 3474138550947469853} m_Father: {fileID: 3517870697961505299}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &557025351280167168 --- !u!212 &557025351280167168
@ -275,7 +275,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 6527505363066208356} - {fileID: 6527505363066208356}
m_Father: {fileID: 3474138550947469853} m_Father: {fileID: 3517870697961505299}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &6312424392463044102 --- !u!212 &6312424392463044102
@ -419,8 +419,9 @@ GameObject:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 3474138550947469853} - component: {fileID: 3517870697961505299}
- component: {fileID: 64880960188446444} - component: {fileID: 64880960188446444}
- component: {fileID: 8921318804363366668}
m_Layer: 0 m_Layer: 0
m_Name: Arisa m_Name: Arisa
m_TagString: Untagged m_TagString: Untagged
@ -428,7 +429,7 @@ GameObject:
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!4 &3474138550947469853 --- !u!4 &3517870697961505299
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@ -467,6 +468,18 @@ Animator:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0 m_KeepAnimatorControllerStateOnDisable: 0
--- !u!114 &8921318804363366668
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5114180900129687738}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e57f95bd19852bc46a88eb6f67404fce, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &5151345010187160570 --- !u!1 &5151345010187160570
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -537,7 +550,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: -1
m_Sprite: {fileID: -7448459852879131668, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3} m_Sprite: {fileID: -7448459852879131668, guid: 62713d17eb1e1404bbafeb45c8b4b5b8, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0 m_FlipX: 0
@ -580,7 +593,7 @@ Transform:
- {fileID: 2718293722777145542} - {fileID: 2718293722777145542}
- {fileID: 1083994433150499968} - {fileID: 1083994433150499968}
- {fileID: 2110027195199092298} - {fileID: 2110027195199092298}
m_Father: {fileID: 3474138550947469853} m_Father: {fileID: 3517870697961505299}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &3554116500381240446 --- !u!212 &3554116500381240446
@ -909,7 +922,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 2039106335442564576} - {fileID: 2039106335442564576}
m_Father: {fileID: 3474138550947469853} m_Father: {fileID: 3517870697961505299}
m_RootOrder: 3 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &6366747730854244537 --- !u!212 &6366747730854244537
@ -992,7 +1005,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 5005212596909708348} - {fileID: 5005212596909708348}
m_Father: {fileID: 3474138550947469853} m_Father: {fileID: 3517870697961505299}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &7073094819256516695 --- !u!212 &7073094819256516695

View file

@ -0,0 +1,38 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: StudioDanceRender
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 3
m_Width: 1280
m_Height: 1280
m_AntiAliasing: 1
m_MipCount: -1
m_DepthFormat: 2
m_ColorFormat: 8
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 606c17c39d2c0854eac51a94b505ddf0
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -28,6 +28,8 @@ namespace HeavenStudio
public static readonly string[] DEFAULT_SCREEN_SIZES_STRING = new[] { "1280x720", "1920x1080", "2560x1440", "3840x2160", "Custom" }; public static readonly string[] DEFAULT_SCREEN_SIZES_STRING = new[] { "1280x720", "1920x1080", "2560x1440", "3840x2160", "Custom" };
public static int ScreenSizeIndex = 0; public static int ScreenSizeIndex = 0;
public static float MasterVolume = 0.8f;
public enum Scenes : int public enum Scenes : int
{ {
SplashScreen = 0, SplashScreen = 0,
@ -133,5 +135,11 @@ namespace HeavenStudio
Screen.SetResolution(DEFAULT_SCREEN_SIZES[ScreenSizeIndex].width, DEFAULT_SCREEN_SIZES[ScreenSizeIndex].height, mode); Screen.SetResolution(DEFAULT_SCREEN_SIZES[ScreenSizeIndex].width, DEFAULT_SCREEN_SIZES[ScreenSizeIndex].height, mode);
} }
} }
public static void ChangeMasterVolume(float value)
{
MasterVolume = value;
AudioListener.volume = MasterVolume;
}
} }
} }

View file

@ -13,6 +13,7 @@ using TMPro;
using Starpelly; using Starpelly;
using SFB; using SFB;
using HeavenStudio.Editor;
using HeavenStudio.Editor.Track; using HeavenStudio.Editor.Track;
using HeavenStudio.Util; using HeavenStudio.Util;
@ -63,10 +64,11 @@ namespace HeavenStudio.Editor
private bool loadedMusic = false; private bool loadedMusic = false;
private string currentRemixPath = ""; private string currentRemixPath = "";
private string remixName = ""; private string remixName = "";
private bool fullscreen; public bool fullscreen;
public bool discordDuringTesting = false; public bool discordDuringTesting = false;
public bool canSelect = true; public bool canSelect = true;
public bool editingInputField = false; public bool editingInputField = false;
public bool isCursorEnabled = true;
public static Editor instance { get; private set; } public static Editor instance { get; private set; }
@ -456,7 +458,7 @@ namespace HeavenStudio.Editor
MainCanvas.enabled = true; MainCanvas.enabled = true;
EditorCamera.enabled = true; EditorCamera.enabled = true;
GameCamera.instance.camera.targetTexture = ScreenRenderTexture; GameCamera.instance.camera.targetTexture = ScreenRenderTexture;
GameManager.instance.CursorCam.enabled = true; GameManager.instance.CursorCam.enabled = true && isCursorEnabled;
GameManager.instance.OverlayCamera.targetTexture = ScreenRenderTexture; GameManager.instance.OverlayCamera.targetTexture = ScreenRenderTexture;
fullscreen = false; fullscreen = false;

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using HeavenStudio.Editor.Track; using HeavenStudio.Editor.Track;
using HeavenStudio.Util; using HeavenStudio.Util;
using HeavenStudio.StudioDance;
using TMPro; using TMPro;
@ -11,8 +12,9 @@ namespace HeavenStudio.Editor
public class CreditsLegalSettings : MonoBehaviour public class CreditsLegalSettings : MonoBehaviour
{ {
private int SecretCounter = 0; private int SecretCounter = 0;
private static bool SecretActive = false; private bool SecretActive = false;
[SerializeField] private GameObject secretObject; [SerializeField] private GameObject secretObject;
[SerializeField] private StudioDanceManager secretContent;
private void Start() private void Start()
{ {
@ -37,6 +39,16 @@ namespace HeavenStudio.Editor
SecretActive = true; SecretActive = true;
Jukebox.PlayOneShot("applause"); Jukebox.PlayOneShot("applause");
Debug.Log("Activating Studio Dance..."); Debug.Log("Activating Studio Dance...");
secretContent.OpenDanceWindow();
}
public void MakeSecretInactive()
{
SecretCounter = 0;
secretObject.SetActive(false);
SecretActive = false;
secretContent.CloseDanceWindow();
} }
} }
} }

View file

@ -1,7 +1,6 @@
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using HeavenStudio.Editor.Track; using UnityEngine.UI;
using TMPro; using TMPro;
@ -13,6 +12,10 @@ namespace HeavenStudio.Editor
public GameObject customSetter; public GameObject customSetter;
public TMP_InputField widthInputField, heightInputField; public TMP_InputField widthInputField, heightInputField;
public Slider volSlider;
public TMP_InputField volLabel;
private void Start() { private void Start() {
List<TMP_Dropdown.OptionData> dropDownData = new List<TMP_Dropdown.OptionData>(); List<TMP_Dropdown.OptionData> dropDownData = new List<TMP_Dropdown.OptionData>();
var vals = GlobalGameManager.DEFAULT_SCREEN_SIZES_STRING; var vals = GlobalGameManager.DEFAULT_SCREEN_SIZES_STRING;
@ -42,6 +45,9 @@ namespace HeavenStudio.Editor
GlobalGameManager.CustomScreenHeight = System.Math.Max(int.Parse(heightInputField.text), 64); GlobalGameManager.CustomScreenHeight = System.Math.Max(int.Parse(heightInputField.text), 64);
heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString(); heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString();
}); });
volSlider.value = GlobalGameManager.MasterVolume;
volLabel.text = System.Math.Round(volSlider.value * 100, 2).ToString();
} }
public void WindowFullScreen() public void WindowFullScreen()
@ -53,5 +59,17 @@ namespace HeavenStudio.Editor
{ {
GlobalGameManager.ChangeScreenSize(); GlobalGameManager.ChangeScreenSize();
} }
public void OnVolSliderChanged()
{
GlobalGameManager.ChangeMasterVolume(volSlider.value);
volLabel.text = System.Math.Round(volSlider.value * 100, 2).ToString();
}
public void OnVolLabelChanged()
{
volSlider.value = (float)System.Math.Round(System.Convert.ToSingle(volLabel.text), 2);
GlobalGameManager.ChangeMasterVolume(volSlider.value);
}
} }
} }

View file

@ -0,0 +1,20 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
namespace HeavenStudio.Editor
{
public class EditorSettings : MonoBehaviour
{
public Toggle cursorCheckbox;
public void OnCursorCheckboxChanged()
{
Editor.instance.isCursorEnabled = cursorCheckbox.isOn;
if (!Editor.instance.fullscreen)
{
GameManager.instance.CursorCam.enabled = Editor.instance.isCursorEnabled;
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4dcd15958462e4e488a04ef094e7ffcb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 865b25422d0ff654cacdd7387de6873c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,57 @@
using UnityEngine;
using HeavenStudio.Util;
namespace HeavenStudio.StudioDance
{
public class Dancer : MonoBehaviour
{
private Animator animator;
private float lastReportedBeat = 0f;
private float currentBeat = 0f;
private bool isDance = false;
private void Start()
{
animator = GetComponent<Animator>();
}
private void Update()
{
var cond = Conductor.instance;
if (cond == null || !cond.isPlaying)
{
if (!isDance) return;
if (currentBeat % 2 != 0)
{
animator.DoScaledAnimationAsync("PoseL");
}
else
{
animator.DoScaledAnimationAsync("PoseR");
}
isDance = false;
return;
}
isDance = true;
if (cond.ReportBeat(ref lastReportedBeat))
{
currentBeat = lastReportedBeat;
}
else if (cond.songPositionInBeats < lastReportedBeat)
{
lastReportedBeat = Mathf.Round(cond.songPositionInBeats);
}
if (currentBeat % 2 != 0)
{
animator.DoScaledAnimation("DanceL", currentBeat);
}
else
{
animator.DoScaledAnimation("DanceR", currentBeat);
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e57f95bd19852bc46a88eb6f67404fce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio;
namespace HeavenStudio.StudioDance
{
public class StudioDanceManager : MonoBehaviour
{
[SerializeField] private GameObject windowBase;
[SerializeField] private Transform windowHolder;
[SerializeField] private GameObject content;
public void OpenDanceWindow()
{
var mobj = GameObject.Instantiate(windowBase, windowHolder);
mobj.SetActive(true);
content.SetActive(true);
}
public void CloseDanceWindow()
{
content.SetActive(false);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f906c9e16af974d409dd19d0836bb9c6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -19,7 +19,7 @@ TagManager:
- 3DAlt - 3DAlt
- Flash - Flash
- Textboxes - Textboxes
- - StudioDanceRender
- -
- -
- -
@ -44,3 +44,6 @@ TagManager:
- name: Textboxes - name: Textboxes
uniqueID: 610346305 uniqueID: 610346305
locked: 0 locked: 0
- name: StudioDance
uniqueID: 2311759579
locked: 0