menu
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Ichni.UI;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
@@ -21,6 +22,8 @@ namespace Ichni.RhythmGame
|
||||
public float perspectiveAngle;
|
||||
public float orthographicSize;
|
||||
|
||||
public float perspectiveOffset;
|
||||
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
private static CameraManager cameraManager => GameManager.instance.cameraManager;
|
||||
@@ -42,6 +45,17 @@ namespace Ichni.RhythmGame
|
||||
gameCamera.orthographicSize = orthographicSize;
|
||||
gameCamera.cameraTransform = gameCamera.transform;
|
||||
|
||||
float ratioDifference = UIManager.GetScreenRatio() - UIManager.StandardRatio;
|
||||
if (ratioDifference > 0)
|
||||
{
|
||||
gameCamera.perspectiveOffset = -22f * ratioDifference;
|
||||
}
|
||||
else
|
||||
{
|
||||
//gameCamera.perspectiveOffset = 11f * ratioDifference;
|
||||
}
|
||||
|
||||
gameCamera.gameCamera.fieldOfView = perspectiveAngle + gameCamera.perspectiveOffset;
|
||||
return gameCamera;
|
||||
}
|
||||
|
||||
@@ -71,39 +85,38 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public void SetTransformObserver()
|
||||
{
|
||||
Observable.EveryLateUpdate().Subscribe(_ =>
|
||||
transformSubmodule.observer = Observable.EveryLateUpdate()
|
||||
.Where(_=>GameManager.instance.audioManager.isUpdating)
|
||||
.Subscribe(_ => UpdateTransform())
|
||||
.AddTo(transformSubmodule.attachedGameElement);
|
||||
}
|
||||
|
||||
public void UpdateTransform(bool refreshAll = true)
|
||||
{
|
||||
bool willRefresh = false;
|
||||
|
||||
if (!transformSubmodule.eulerAnglesOffsetLock && transformSubmodule.eulerAnglesDirtyMark)
|
||||
{
|
||||
if (transformSubmodule == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
transformSubmodule.currentEulerAngles = transformSubmodule.originalEulerAngles + transformSubmodule.eulerAnglesOffset;
|
||||
transform.localEulerAngles = transformSubmodule.currentEulerAngles;
|
||||
transformSubmodule.eulerAnglesDirtyMark = false;
|
||||
willRefresh = true;
|
||||
transformSubmodule.eulerAnglesOffset = Vector3.zero;
|
||||
}
|
||||
|
||||
bool willRefresh = false;
|
||||
if (transformSubmodule.positionDirtyMark)
|
||||
{
|
||||
transformSubmodule.currentPosition = transformSubmodule.originalPosition + transformSubmodule.positionOffset;
|
||||
transform.localPosition = transformSubmodule.currentPosition;
|
||||
transformSubmodule.positionDirtyMark = false;
|
||||
willRefresh = true;
|
||||
transformSubmodule.positionOffset = Vector3.zero;
|
||||
}
|
||||
|
||||
if (!transformSubmodule.eulerAnglesOffsetLock && transformSubmodule.eulerAnglesDirtyMark)
|
||||
{
|
||||
transformSubmodule.currentEulerAngles = transformSubmodule.originalEulerAngles + transformSubmodule.eulerAnglesOffset;
|
||||
transform.localEulerAngles = transformSubmodule.currentEulerAngles;
|
||||
transformSubmodule.eulerAnglesDirtyMark = false;
|
||||
willRefresh = true;
|
||||
transformSubmodule.eulerAnglesOffset = Vector3.zero;
|
||||
}
|
||||
|
||||
if (transformSubmodule.positionDirtyMark)
|
||||
{
|
||||
transformSubmodule.currentPosition = transformSubmodule.originalPosition + transformSubmodule.positionOffset;
|
||||
transform.localPosition = transformSubmodule.currentPosition;
|
||||
transformSubmodule.positionDirtyMark = false;
|
||||
willRefresh = true;
|
||||
transformSubmodule.positionOffset = Vector3.zero;
|
||||
}
|
||||
|
||||
if (willRefresh)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
|
||||
}).AddTo(gameObject);
|
||||
if (refreshAll && willRefresh)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user