mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 11:45:09 +00:00
Spaceball camera easings
This commit is contained in:
parent
b55a6dcabc
commit
686a8942f5
9 changed files with 2597 additions and 38 deletions
File diff suppressed because it is too large
Load diff
|
@ -2,6 +2,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using RhythmHeavenMania.Util;
|
||||
|
||||
namespace RhythmHeavenMania
|
||||
{
|
||||
[Serializable]
|
||||
|
@ -19,6 +21,7 @@ namespace RhythmHeavenMania
|
|||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float length;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valA;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public EasingFunction.Ease ease;
|
||||
public string datamodel;
|
||||
[JsonIgnore] public Editor.Track.TimelineEventObj eventObj;
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace RhythmHeavenMania.Games.Spaceball
|
|||
|
||||
public Alien alien;
|
||||
|
||||
private EasingFunction.Ease lastEase;
|
||||
|
||||
public static Spaceball instance { get; set; }
|
||||
|
||||
public override void OnGameSwitch()
|
||||
|
@ -51,7 +53,17 @@ namespace RhythmHeavenMania.Games.Spaceball
|
|||
|
||||
private void Start()
|
||||
{
|
||||
allCameraEvents = EventCaller.GetAllInGameManagerList("spaceball", new string[] { "camera" });
|
||||
var camEvents = EventCaller.GetAllInGameManagerList("spaceball", new string[] { "camera" });
|
||||
List<Beatmap.Entity> tempEvents = new List<Beatmap.Entity>();
|
||||
for (int i = 0; i < camEvents.Count; i++)
|
||||
{
|
||||
if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeats)
|
||||
{
|
||||
tempEvents.Add(camEvents[i]);
|
||||
}
|
||||
}
|
||||
|
||||
allCameraEvents = tempEvents;
|
||||
|
||||
UpdateCameraZoom(); // can't believe this shit actually works
|
||||
}
|
||||
|
@ -71,6 +83,8 @@ namespace RhythmHeavenMania.Games.Spaceball
|
|||
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(currentZoomCamBeat, currentZoomCamLength);
|
||||
|
||||
if (normalizedBeat >= 0)
|
||||
{
|
||||
if (normalizedBeat > Minigame.EndTime())
|
||||
{
|
||||
// lastCamDistance = GameCamera.instance.camera.transform.localPosition.z;
|
||||
|
@ -83,11 +97,20 @@ namespace RhythmHeavenMania.Games.Spaceball
|
|||
}
|
||||
else
|
||||
{
|
||||
float newPosZ = Mathf.Lerp(lastCamDistance, currentZoomCamDistance, normalizedBeat);
|
||||
EasingFunction.Ease ease = EasingFunction.Ease.EaseInOutCirc;
|
||||
EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase);
|
||||
|
||||
float newPosZ = func(lastCamDistance, currentZoomCamDistance, normalizedBeat);
|
||||
GameCamera.instance.camera.transform.localPosition = new Vector3(0, 0, newPosZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ?
|
||||
GameCamera.instance.camera.transform.localPosition = new Vector3(0, 0, -10f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCameraZoom()
|
||||
|
@ -116,6 +139,8 @@ namespace RhythmHeavenMania.Games.Spaceball
|
|||
currentZoomCamDistance = 0;
|
||||
else
|
||||
currentZoomCamDistance = dist;
|
||||
|
||||
lastEase = allCameraEvents[currentZoomIndex].ease;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace RhythmHeavenMania.Editor
|
|||
private bool changedMusic = false;
|
||||
private bool loadedMusic = false;
|
||||
private string currentRemixPath = "";
|
||||
private int lastEditorObjectsCount = 0;
|
||||
private string remixName = "";
|
||||
private bool fullscreen;
|
||||
public bool discordDuringTesting = false;
|
||||
|
||||
|
@ -176,13 +176,6 @@ namespace RhythmHeavenMania.Editor
|
|||
}
|
||||
}
|
||||
|
||||
if (lastEditorObjectsCount != GameManager.instance.BeatmapEntities())
|
||||
{
|
||||
UpdateEditorStatus(false);
|
||||
}
|
||||
|
||||
lastEditorObjectsCount = GameManager.instance.BeatmapEntities();
|
||||
|
||||
if (Application.isEditor)
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.S))
|
||||
|
@ -308,6 +301,9 @@ namespace RhythmHeavenMania.Editor
|
|||
zipStream.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
}
|
||||
|
||||
currentRemixPath = path;
|
||||
UpdateEditorStatus(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,6 +360,8 @@ namespace RhythmHeavenMania.Editor
|
|||
}
|
||||
|
||||
currentRemixPath = path;
|
||||
remixName = Path.GetFileName(path);
|
||||
UpdateEditorStatus(false);
|
||||
CommandManager.instance.Clear();
|
||||
}
|
||||
});
|
||||
|
@ -394,7 +392,7 @@ namespace RhythmHeavenMania.Editor
|
|||
private void UpdateEditorStatus(bool updateTime)
|
||||
{
|
||||
if (discordDuringTesting || !Application.isEditor)
|
||||
DiscordRPC.DiscordRPC.UpdateActivity("In Editor", $"Objects: {GameManager.instance.Beatmap.entities.Count + GameManager.instance.Beatmap.tempoChanges.Count}", updateTime);
|
||||
DiscordRPC.DiscordRPC.UpdateActivity("In Editor", $"{remixName}", updateTime);
|
||||
}
|
||||
|
||||
public string GetJson()
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace RhythmHeavenMania.Editor
|
|||
|
||||
[Header("Property Prefabs")]
|
||||
[SerializeField] private GameObject IntegerP;
|
||||
[SerializeField] private GameObject DropdownP;
|
||||
|
||||
public Beatmap.Entity entity;
|
||||
|
||||
|
@ -88,6 +89,10 @@ namespace RhythmHeavenMania.Editor
|
|||
{
|
||||
prefab = IntegerP;
|
||||
}
|
||||
else if (type.GetType() == typeof(RhythmHeavenMania.Util.EasingFunction.Ease))
|
||||
{
|
||||
prefab = DropdownP;
|
||||
}
|
||||
|
||||
GameObject input = Instantiate(prefab);
|
||||
input.transform.SetParent(this.gameObject.transform);
|
||||
|
@ -101,7 +106,7 @@ namespace RhythmHeavenMania.Editor
|
|||
private void DestroyParams()
|
||||
{
|
||||
active = false;
|
||||
for (int i = 1; i < transform.childCount; i++)
|
||||
for (int i = 2; i < transform.childCount; i++)
|
||||
{
|
||||
Destroy(transform.GetChild(i).gameObject);
|
||||
}
|
||||
|
|
|
@ -5,23 +5,34 @@ using UnityEngine.UI;
|
|||
|
||||
using TMPro;
|
||||
|
||||
using RhythmHeavenMania.Util;
|
||||
|
||||
namespace RhythmHeavenMania.Editor
|
||||
{
|
||||
public class EventPropertyPrefab : MonoBehaviour
|
||||
{
|
||||
public TMP_Text caption;
|
||||
[SerializeField] private EventParameterManager parameterManager;
|
||||
|
||||
[Header("Integer and Float")]
|
||||
[Space(10)]
|
||||
public Slider slider;
|
||||
public TMP_InputField inputField;
|
||||
|
||||
[Header("Dropdown")]
|
||||
[Space(10)]
|
||||
public TMP_Dropdown dropdown;
|
||||
|
||||
private string propertyName;
|
||||
|
||||
[SerializeField] private EventParameterManager parameterManager;
|
||||
|
||||
public void SetProperties(string propertyName, object type, string caption)
|
||||
{
|
||||
this.propertyName = propertyName;
|
||||
this.caption.text = caption;
|
||||
|
||||
if (type.GetType() == typeof(EntityTypes.Integer))
|
||||
{
|
||||
var integer = ((EntityTypes.Integer)type);
|
||||
|
||||
slider.minValue = integer.min;
|
||||
|
@ -30,14 +41,32 @@ namespace RhythmHeavenMania.Editor
|
|||
slider.value = Mathf.RoundToInt(System.Convert.ToSingle(parameterManager.entity[propertyName]));
|
||||
inputField.text = slider.value.ToString();
|
||||
|
||||
slider.onValueChanged.AddListener(delegate { TestChange(); });
|
||||
}
|
||||
|
||||
public void TestChange()
|
||||
slider.onValueChanged.AddListener(delegate
|
||||
{
|
||||
print("bru");
|
||||
inputField.text = slider.value.ToString();
|
||||
parameterManager.entity[propertyName] = (int)slider.value;
|
||||
});
|
||||
}
|
||||
else if (type.GetType() == typeof(EasingFunction.Ease))
|
||||
{
|
||||
List<TMP_Dropdown.OptionData> dropDownData = new List<TMP_Dropdown.OptionData>();
|
||||
for (int i = 0; i < System.Enum.GetValues(typeof(EasingFunction.Ease)).Length; i++)
|
||||
{
|
||||
string name = System.Enum.GetNames(typeof(EasingFunction.Ease))[i];
|
||||
TMP_Dropdown.OptionData optionData = new TMP_Dropdown.OptionData();
|
||||
|
||||
optionData.text = name;
|
||||
|
||||
dropDownData.Add(optionData);
|
||||
}
|
||||
dropdown.AddOptions(dropDownData);
|
||||
dropdown.value = ((int)(EasingFunction.Ease)parameterManager.entity[propertyName]);
|
||||
|
||||
dropdown.onValueChanged.AddListener(delegate
|
||||
{
|
||||
parameterManager.entity[propertyName] = (EasingFunction.Ease)dropdown.value;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -127,7 +127,7 @@ namespace RhythmHeavenMania
|
|||
new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(eventCaller.currentBeat, true, eventCaller.currentType); }, 3),
|
||||
new GameAction("costume", delegate { Spaceball.instance.Costume(eventCaller.currentType); }, 1f, false, new List<Param>() { new Param("type", new EntityTypes.Integer(0, 2), "type") } ),
|
||||
new GameAction("alien", delegate { Spaceball.instance.alien.Show(eventCaller.currentBeat); } ),
|
||||
new GameAction("camera", delegate { Spaceball.instance.OverrideCurrentZoom(); }, 4, true, new List<Param>() { new Param("valA", new EntityTypes.Integer(1, 320, 10), "zoom") } ),
|
||||
new GameAction("camera", delegate { Spaceball.instance.OverrideCurrentZoom(); }, 4, true, new List<Param>() { new Param("valA", new EntityTypes.Integer(1, 320, 10), "zoom"), new Param("ease", EasingFunction.Ease.Linear, "ease") } ),
|
||||
new GameAction("prepare dispenser", delegate { Spaceball.instance.PrepareDispenser(); }, 1 ),
|
||||
}),
|
||||
new Minigame("karateman", "Karate Man", "70A8D8", false, false, new List<GameAction>()
|
||||
|
|
1110
Assets/Scripts/Util/EasingFunctions.cs
Normal file
1110
Assets/Scripts/Util/EasingFunctions.cs
Normal file
File diff suppressed because it is too large
Load diff
11
Assets/Scripts/Util/EasingFunctions.cs.meta
Normal file
11
Assets/Scripts/Util/EasingFunctions.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 469bc36024b0e9746b909a02559d8b8a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in a new issue