studio dance bugfixing spree
This commit is contained in:
parent
ee8f52d413
commit
8c143c6f8d
|
|
@ -1,18 +1,66 @@
|
|||
using UnityEngine;
|
||||
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);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Simple script to destroy the target GameObject when window is closed
|
||||
/// </summary>
|
||||
public class GUIWindow : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float maxWidth = 0;
|
||||
[SerializeField] private float maxHeight = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Close window by destroying this GameObject
|
||||
/// </summary>
|
||||
public void CloseWindow()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// limit window size
|
||||
RectTransform rectTransform = GetComponent<RectTransform>();
|
||||
if (maxWidth > 0 && rectTransform.rect.width > maxWidth)
|
||||
{
|
||||
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, maxWidth);
|
||||
}
|
||||
if (maxHeight > 0 && rectTransform.rect.height > maxHeight)
|
||||
{
|
||||
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, maxHeight);
|
||||
}
|
||||
|
||||
// keep in bounds of parent
|
||||
RectTransform parent = transform.parent.GetComponent<RectTransform>();
|
||||
if (parent != null)
|
||||
{
|
||||
Vector3[] corners = new Vector3[4];
|
||||
parent.GetWorldCorners(corners);
|
||||
Vector3 min = corners[0];
|
||||
Vector3 max = corners[2];
|
||||
|
||||
Vector3[] myCorners = new Vector3[4];
|
||||
rectTransform.GetWorldCorners(myCorners);
|
||||
|
||||
if (myCorners[0].x < min.x)
|
||||
{
|
||||
rectTransform.localPosition += new Vector3(min.x - myCorners[0].x, 0, 0);
|
||||
}
|
||||
if (myCorners[2].x > max.x)
|
||||
{
|
||||
rectTransform.localPosition -= new Vector3(myCorners[2].x - max.x, 0, 0);
|
||||
}
|
||||
if (myCorners[0].y < min.y)
|
||||
{
|
||||
rectTransform.localPosition += new Vector3(0, min.y - myCorners[0].y, 0);
|
||||
}
|
||||
if (myCorners[2].y > max.y)
|
||||
{
|
||||
rectTransform.localPosition -= new Vector3(0, myCorners[2].y - max.y, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -56,8 +56,8 @@ namespace Rellac.Windows
|
|||
//register to pointer events
|
||||
onPointerDown.AddListener(SetIsGrabbed);
|
||||
onPointerDown.AddListener(parentWindow.SetAsLastSibling);
|
||||
// onPointerEnter.AddListener(ShowCursor);
|
||||
// onPointerExit.AddListener(ResetCursor);
|
||||
onPointerEnter.AddListener(ShowCursor);
|
||||
onPointerExit.AddListener(ResetCursor);
|
||||
|
||||
// find what direction we're pulling with this handle
|
||||
switch (axis)
|
||||
|
|
@ -129,8 +129,9 @@ namespace Rellac.Windows
|
|||
}
|
||||
|
||||
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);
|
||||
Vector3 anchoredPosition = Input.mousePosition;
|
||||
anchoredPosition.z = 0;
|
||||
Vector2 mouseDelta = Vector2.Scale((Vector2)anchoredPosition - initialMousePos, scaleOffset) * 0.5f;
|
||||
Vector2 size = initialSize;
|
||||
|
||||
switch (direction)
|
||||
|
|
@ -199,7 +200,9 @@ namespace Rellac.Windows
|
|||
if (isLocked) return;
|
||||
isGrabbed = true;
|
||||
|
||||
initialMousePos = Camera.main.ScreenToWorldPoint(GUIWindowUtils.MousePosition());
|
||||
Vector3 anchoredPosition = Input.mousePosition;
|
||||
anchoredPosition.z = 0;
|
||||
initialMousePos = anchoredPosition;
|
||||
initialSize = parentWindow.sizeDelta;
|
||||
initialPivot = parentWindow.pivot;
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,9 @@ namespace Rellac.Windows
|
|||
|
||||
public static Vector3 MousePosition()
|
||||
{
|
||||
var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
Vector3 anchoredPosition = Input.mousePosition;
|
||||
anchoredPosition.z = 0;
|
||||
var mousePos = Camera.main.ScreenToWorldPoint(anchoredPosition);
|
||||
return new Vector3(mousePos.x, mousePos.y, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -38,7 +38,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
|
|||
SoundByte.PlayOneShotGame("launchParty/rocket_endBad");
|
||||
string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right";
|
||||
if (!anim.IsPlayingAnimationNames("RocketBarelyLeft", "RocketBarelyRight")) anim.Play("RocketBarely" + leftOrRight, 0, 0);
|
||||
game.ScoreMiss(0.5);
|
||||
game.ScoreMiss(0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -421,6 +421,18 @@ namespace HeavenStudio.Editor.Track
|
|||
if (MouseInTimeline)
|
||||
MouseInTimeline = RectTransformUtility.RectangleContainsScreenPoint(TimelineScroll.viewport,
|
||||
Input.mousePosition, Editor.instance.EditorCamera);
|
||||
|
||||
foreach (var rect in GameObject.FindGameObjectsWithTag("BlocksEditor"))
|
||||
{
|
||||
if (rect.TryGetComponent(out RectTransform rectTransform))
|
||||
{
|
||||
if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, Camera.main))
|
||||
{
|
||||
MouseInTimeline = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (MouseInTimeline)
|
||||
|
|
|
|||
|
|
@ -13,14 +13,15 @@ namespace HeavenStudio.StudioDance
|
|||
|
||||
public void OpenDanceWindow()
|
||||
{
|
||||
var mobj = GameObject.Instantiate(windowBase, windowHolder);
|
||||
mobj.SetActive(true);
|
||||
windowBase.SetActive(true);
|
||||
content.SetActive(true);
|
||||
}
|
||||
|
||||
public void CloseDanceWindow()
|
||||
{
|
||||
windowBase.SetActive(false);
|
||||
content.SetActive(false);
|
||||
Editor.CreditsLegalSettings.MakeSecretInactive();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ namespace HeavenStudio.Editor
|
|||
|
||||
private void Start()
|
||||
{
|
||||
SecretActive = false;
|
||||
SecretCounter = 0;
|
||||
secretObject.SetActive(false);
|
||||
}
|
||||
|
|
@ -33,7 +34,7 @@ namespace HeavenStudio.Editor
|
|||
}
|
||||
}
|
||||
|
||||
public void OnClickSecret()
|
||||
public static void OnClickSecret()
|
||||
{
|
||||
if (SecretActive) return;
|
||||
|
||||
|
|
@ -51,25 +52,19 @@ namespace HeavenStudio.Editor
|
|||
}
|
||||
}
|
||||
|
||||
public void MakeSecretInactive()
|
||||
public static void MakeSecretInactive()
|
||||
{
|
||||
SecretCounter = 0;
|
||||
secretObject.SetActive(false);
|
||||
SecretActive = false;
|
||||
|
||||
if (Editor.instance == null)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Editor.instance.StudioDanceManager.CloseDanceWindow();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnOpenTab()
|
||||
{
|
||||
creditsDisplay.text = creditsText.text;
|
||||
if (SecretCounter == 0)
|
||||
{
|
||||
secretObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCloseTab()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
--- !u!78 &1
|
||||
TagManager:
|
||||
serializedVersion: 2
|
||||
tags: []
|
||||
tags:
|
||||
- BlocksEditor
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
|
|
|||
Loading…
Reference in a new issue