This commit is contained in:
Firerise9402 2023-08-12 12:26:08 -04:00
parent f540241fb7
commit d0220611bb
3 changed files with 177 additions and 4 deletions

View file

@ -13774,14 +13774,34 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1535126665250126034, guid: 720073bc7682b1441bece7116681f72c, type: 3}
propertyPath: m_ConstrainProportionsScale
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3558106557710386107, guid: 720073bc7682b1441bece7116681f72c, type: 3}
propertyPath: m_BlockingMask.m_Bits
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3741076794236313655, guid: 720073bc7682b1441bece7116681f72c, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3788593923839736097, guid: 720073bc7682b1441bece7116681f72c, type: 3}
propertyPath: m_RaycastTarget
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4035854539513523048, guid: 720073bc7682b1441bece7116681f72c, type: 3}
propertyPath: maskObj
value:
objectReference: {fileID: 2105509200}
- target: {fileID: 4035854539513523048, guid: 720073bc7682b1441bece7116681f72c, type: 3}
propertyPath: canvasObj
value:
objectReference: {fileID: 1638236449}
- target: {fileID: 4035854539513523048, guid: 720073bc7682b1441bece7116681f72c, type: 3}
propertyPath: letterboxMask
value:
objectReference: {fileID: 2105509201}
- target: {fileID: 4820152107260776423, guid: 720073bc7682b1441bece7116681f72c, type: 3}
propertyPath: m_RaycastTarget
value: 0
@ -33660,6 +33680,45 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1637160319}
m_CullTransparentMesh: 1
--- !u!1 &1638236449 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2464883521749415129, guid: 720073bc7682b1441bece7116681f72c, type: 3}
m_PrefabInstance: {fileID: 631525709}
m_PrefabAsset: {fileID: 0}
--- !u!1818360610 &1638236453
ScaleConstraint:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1638236449}
m_Enabled: 1
m_Weight: 1
m_ScaleAtRest: {x: 1, y: 1, z: 1}
m_ScaleOffset: {x: 1, y: 1, z: 1}
m_AffectScalingX: 1
m_AffectScalingY: 1
m_AffectScalingZ: 1
m_IsContraintActive: 1
m_IsLocked: 1
m_Sources: []
--- !u!1818360608 &1638236454
PositionConstraint:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1638236449}
m_Enabled: 1
m_Weight: 1
m_TranslationAtRest: {x: 0, y: 0, z: 0}
m_TranslationOffset: {x: 0, y: 0, z: 0}
m_AffectTranslationX: 1
m_AffectTranslationY: 1
m_AffectTranslationZ: 1
m_IsContraintActive: 0
m_IsLocked: 0
m_Sources: []
--- !u!1 &1647324172
GameObject:
m_ObjectHideFlags: 0
@ -41557,6 +41616,16 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2098678239}
m_CullTransparentMesh: 1
--- !u!1 &2105509200 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7051539713125569525, guid: 720073bc7682b1441bece7116681f72c, type: 3}
m_PrefabInstance: {fileID: 631525709}
m_PrefabAsset: {fileID: 0}
--- !u!224 &2105509201 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 8925473620302868482, guid: 720073bc7682b1441bece7116681f72c, type: 3}
m_PrefabInstance: {fileID: 631525709}
m_PrefabAsset: {fileID: 0}
--- !u!1 &2125404435
GameObject:
m_ObjectHideFlags: 0

View file

@ -706,7 +706,6 @@ namespace HeavenStudio
new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to scale the viewport in" )
}
),
new GameAction("screen shake", "Screen Shake", 1f, true,
new List<Param>()
{
@ -714,6 +713,15 @@ namespace HeavenStudio
new Param("valB", new EntityTypes.Float(0, 10, 1), "Vertical Intensity")
}
),
new GameAction("scale letterbox", "Scale Letterbox", 1f, true, new List<Param>()
{
new Param("valA", new EntityTypes.Float(0, 50, 1), "Scale Letterbox X"),
new Param("valB", new EntityTypes.Float(0, 50, 1), "Scale Letterbox Y"),
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"),
new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to scale the letterbox in"),
new Param("toggle", true, "Mirror scaling", "Mirror the scaling of the letterbox via scaling the minigame as well.")
}
),
new GameAction("display textbox", "Display Textbox", 1f, true, new List<Param>()
{

View file

@ -20,6 +20,8 @@ namespace HeavenStudio
[SerializeField] Image ambientBg;
[SerializeField] GameObject ambientBgGO;
[SerializeField] GameObject letterboxBgGO;
[SerializeField] RectTransform letterboxMask;
[SerializeField] GameObject maskObj;
public static StaticCamera instance { get; private set; }
public new Camera camera;
@ -37,18 +39,27 @@ namespace HeavenStudio
private List<RiqEntity> panEvents = new();
private List<RiqEntity> scaleEvents = new();
private List<RiqEntity> rotationEvents = new();
private List<RiqEntity> letterboxEvents = new();
static Vector3 defaultPan = new Vector3(0, 0, 0);
static Vector3 defaultScale = new Vector3(1, 1, 1);
static float defaultRotation = 0;
static Vector3 defaultLetterbox = new Vector3(1, 1, 1);
private static Vector3 pan;
private static Vector3 scale;
private static float rotation;
private static Vector3 letterbox;
private static Vector3 panInv;
private static Vector3 scaleInv;
private static bool toggle;
private Transform[] children = null;
private static Vector3 panLast;
private static Vector3 scaleLast;
private static float rotationLast;
private static Vector3 letterboxLast;
private void Awake()
{
@ -64,11 +75,16 @@ namespace HeavenStudio
Reset();
panLast = defaultPan;
letterboxLast = defaultLetterbox;
scaleLast = defaultScale;
rotationLast = defaultRotation;
ToggleLetterboxBg(PersistentDataManager.gameSettings.letterboxBgEnable);
ToggleLetterboxGlow(PersistentDataManager.gameSettings.letterboxFxEnable);
/*
children = new Transform[ maskObj.transform.childCount ];
foreach(Transform T in transform)
children.add(T);*/
}
public void OnBeatChanged(double beat)
@ -78,26 +94,54 @@ namespace HeavenStudio
panEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "pan view" });
scaleEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "scale view" });
rotationEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "rotate view" });
letterboxEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "scale letterbox" });
panLast = defaultPan;
letterboxLast = defaultLetterbox;
scaleLast = defaultScale;
rotationLast = defaultRotation;
UpdatePan();
UpdateRotation();
UpdateScale();
UpdateLetterbox();
}
// Update is called once per frame
void Update()
{
UpdateLetterbox();
UpdatePan();
UpdateRotation();
UpdateScale();
canvas.localPosition = pan;
canvas.eulerAngles = new Vector3(0, 0, rotation);
canvas.localScale = scale;
canvas.eulerAngles = new Vector3(0, 0, rotation);
//if(!toggle)canvas.localPosition = panInv;
//if(!toggle)canvas.localScale = scaleInv;
if(!toggle)
{
//canvas.transform.SetParent(null); dont do that
letterboxMask.localScale = letterbox;
canvas.transform.localScale = scale;
//letterboxMask.localScale = letterbox;
} //heyo future me FIX THIS MESS PLEASEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
//canvas.localScale = canvas.InverseTransformDirection(scaleInv);
/*if(!toggle)
{
canvas.localPosition = canvas.InverseTransformVector(panInv);
canvas.eulerAngles = canvas.TransformVector(new Vector3(0, 0, rotation));
toggle = true;
}else{
canvas.localPosition = pan;
canvas.localScale = scale;
canvas.eulerAngles = new Vector3(0, 0, rotation);
}
*/
}
private void UpdatePan()
@ -199,11 +243,63 @@ namespace HeavenStudio
}
}
private void UpdateLetterbox()
{
foreach (var e in letterboxEvents)
{
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
if (prog >= 0f)
{
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]);
switch (e["axis"])
{
case (int) ViewAxis.X:
letterbox.x = func(letterboxLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth;
panInv = pan;
scaleInv = scale;
toggle = e["toggle"];
break;
case (int) ViewAxis.Y:
letterbox.y = func(letterboxLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight;
panInv = pan;
scaleInv = scale;
toggle = e["toggle"];
break;
default:
float dx = func(letterboxLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth;
float dy = func(letterboxLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight;
letterbox = new Vector3(dx, dy, 1);
panInv = pan;
scaleInv = scale;
toggle = e["toggle"];
break;
}
}
if (prog > 1f)
{
switch (e["axis"])
{
case (int) ViewAxis.X:
letterboxLast.x = e["valA"] * AspectRatioWidth;
break;
case (int) ViewAxis.Y:
letterboxLast.y = e["valB"] * AspectRatioHeight;
break;
default:
letterboxLast = new Vector3(e["valA"] * AspectRatioWidth, e["valB"] * AspectRatioHeight, 1);
break;
}
}
}
}
public static void Reset()
{
pan = defaultPan;
scale = defaultScale;
rotation = defaultRotation;
letterbox = defaultLetterbox;
toggle = true;
}
public void ToggleOverlayView(bool toggle)