Merge pull request #132 from minenice55/settings-expansion

Settings Expansion
This commit is contained in:
minenice55 2022-07-10 18:10:37 -04:00 committed by GitHub
commit 813751fb84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 85370 additions and 1219 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

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

View file

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

View file

@ -0,0 +1,217 @@
%YAML 1.1
%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
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: DanceL
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: 6560f86f9a92eb8408c526aea35203ac, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &-1776475060856592369
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: NoPose
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: f14ac5facbc65864fa6dcc00318fb6a9, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Arisa
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: 5901783015612607709}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
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
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: DanceR
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: d3345b698d6430c488d06ede51e6b92f, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1107 &5901783015612607709
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -1776475060856592369}
m_Position: {x: 200, y: 0, z: 0}
- serializedVersion: 1
m_State: {fileID: -2547331504343513316}
m_Position: {x: 235, y: 65, z: 0}
- serializedVersion: 1
m_State: {fileID: 5646467201381534092}
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_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
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:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 03ffd3f8a18e4914996b993e9f2f45b9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6560f86f9a92eb8408c526aea35203ac
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: d3345b698d6430c488d06ede51e6b92f
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: ec2ffde2ca84482428ad2c9f211c8eb1
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: f14ac5facbc65864fa6dcc00318fb6a9
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: 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:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 95191001fa72f7d46b078c04c4e4f9b2
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

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:

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

View file

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: d8a7801991b67b441a0f24aa1b61a191
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 1024
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: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
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; }
@ -413,6 +415,7 @@ namespace HeavenStudio.Editor
bytes = ms.ToArray(); bytes = ms.ToArray();
Conductor.instance.musicSource.clip = OggVorbis.VorbisPlugin.ToAudioClip(bytes, "music"); Conductor.instance.musicSource.clip = OggVorbis.VorbisPlugin.ToAudioClip(bytes, "music");
loadedMusic = true; loadedMusic = true;
Timeline.FitToSong();
} }
} }
} }
@ -456,7 +459,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

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Editor.Track;
using TMPro;
namespace HeavenStudio.Editor
{
public class TabButton : MonoBehaviour
{
[SerializeField] GameObject Content;
public void OnClick()
{
var tabsManager = transform.parent.GetComponent<TabsManager>();
tabsManager.SetActiveContent(Content);
}
}
}

View file

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

View file

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

View file

@ -0,0 +1,54 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Editor.Track;
using HeavenStudio.Util;
using HeavenStudio.StudioDance;
using TMPro;
namespace HeavenStudio.Editor
{
public class CreditsLegalSettings : MonoBehaviour
{
private int SecretCounter = 0;
private bool SecretActive = false;
[SerializeField] private GameObject secretObject;
[SerializeField] private StudioDanceManager secretContent;
private void Start()
{
SecretCounter = 0;
secretObject.SetActive(false);
}
public void OnClickCountUp()
{
SecretCounter++;
Debug.Log("SecretCounter: " + SecretCounter);
if (SecretCounter == 10)
{
secretObject.SetActive(true);
}
}
public void OnClickSecret()
{
if (SecretActive) return;
SecretActive = true;
Jukebox.PlayOneShot("applause");
Debug.Log("Activating Studio Dance...");
secretContent.OpenDanceWindow();
}
public void MakeSecretInactive()
{
SecretCounter = 0;
secretObject.SetActive(false);
SecretActive = false;
secretContent.CloseDanceWindow();
}
}
}

View file

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

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,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Editor.Track;
using TMPro;
namespace HeavenStudio.Editor
{
public class TabsManager : MonoBehaviour
{
[SerializeField] GameObject activeContent;
public void SetActiveContent(GameObject content)
{
if (activeContent != null)
{
activeContent.SetActive(false);
}
activeContent = content;
activeContent.SetActive(true);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 113bf5aff4fe7ee408630b5e487451af
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