mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 10:07:38 +02:00
Change Project License to MIT (#700)
* license change replace unneeded package * reword this
This commit is contained in:
@ -3,7 +3,6 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using Starpelly;
|
||||
using Jukebox;
|
||||
using HeavenStudio.Util;
|
||||
using System.Data.Common;
|
||||
@ -469,7 +468,7 @@ namespace HeavenStudio
|
||||
{
|
||||
beat = Mathf.Max(beat, 0);
|
||||
}
|
||||
float a = Mathp.Normalize(beat, (float)startBeat, (float)(startBeat + length));
|
||||
float a = MathUtils.Normalize(beat, (float)startBeat, (float)(startBeat + length));
|
||||
return a;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Pool;
|
||||
|
||||
using Starpelly;
|
||||
using Jukebox;
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Games;
|
||||
@ -979,7 +978,7 @@ namespace HeavenStudio
|
||||
}
|
||||
}
|
||||
}
|
||||
// newGame = gameSwitchs[gameSwitchs.IndexOf(gameSwitchs.Find(c => c.beat == Mathp.GetClosestInList(gameSwitchs.Select(c => c.beat).ToList(), beat)))].datamodel.Split(2);
|
||||
// newGame = gameSwitchs[gameSwitchs.IndexOf(gameSwitchs.Find(c => c.beat == MathUtils.GetClosestInList(gameSwitchs.Select(c => c.beat).ToList(), beat)))].datamodel.Split(2);
|
||||
}
|
||||
|
||||
if (!GetGameInfo(newGame).fxOnly)
|
||||
@ -1225,8 +1224,8 @@ namespace HeavenStudio
|
||||
currentGame = game;
|
||||
if (GetGameInfo(currentGame) != null)
|
||||
{
|
||||
colMain = Colors.Hex2RGB(GetGameInfo(currentGame).color);
|
||||
CircleCursor.SetCursorColors(colMain, Colors.Hex2RGB(GetGameInfo(currentGame).splitColorL), Colors.Hex2RGB(GetGameInfo(currentGame).splitColorR));
|
||||
colMain = StringUtils.Hex2RGB(GetGameInfo(currentGame).color);
|
||||
CircleCursor.SetCursorColors(colMain, StringUtils.Hex2RGB(GetGameInfo(currentGame).splitColorL), StringUtils.Hex2RGB(GetGameInfo(currentGame).splitColorR));
|
||||
if (useMinigameColor) HeavenStudio.StaticCamera.instance.SetAmbientGlowColour(colMain, true);
|
||||
else HeavenStudio.StaticCamera.instance.SetAmbientGlowColour(Color.black, false);
|
||||
}
|
||||
@ -1241,7 +1240,7 @@ namespace HeavenStudio
|
||||
private void SetAmbientGlowToCurrentMinigameColor()
|
||||
{
|
||||
if (GetGameInfo(currentGame) != null)
|
||||
HeavenStudio.StaticCamera.instance.SetAmbientGlowColour(Colors.Hex2RGB(GetGameInfo(currentGame).color), true);
|
||||
HeavenStudio.StaticCamera.instance.SetAmbientGlowColour(StringUtils.Hex2RGB(GetGameInfo(currentGame).color), true);
|
||||
}
|
||||
|
||||
private bool SongPosLessThanClipLength(float t)
|
||||
|
@ -1,9 +1,11 @@
|
||||
using Starpelly;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_AirRally
|
||||
{
|
||||
public class IslandsManager : MonoBehaviour
|
||||
@ -37,7 +39,7 @@ namespace HeavenStudio.Games.Scripts_AirRally
|
||||
endZ = -fullLengthZ * loopMult;
|
||||
foreach (var island in islands)
|
||||
{
|
||||
island.normalizedOffset = 1 - Mathp.Normalize(island.startPos.z, minValueZ, maxValueZ);
|
||||
island.normalizedOffset = 1 - MathUtils.Normalize(island.startPos.z, minValueZ, maxValueZ);
|
||||
island.normalizedOffset /= loopMult;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
|
@ -1,14 +1,7 @@
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.InputSystem;
|
||||
using JetBrains.Annotations;
|
||||
using Starpelly.Transformer;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using static HeavenStudio.EntityTypes;
|
||||
using static HeavenStudio.Games.CheerReaders;
|
||||
using Jukebox;
|
||||
|
||||
namespace HeavenStudio.Games.Loaders
|
||||
|
@ -5,7 +5,6 @@ using UnityEngine.Audio;
|
||||
|
||||
using DG.Tweening;
|
||||
using HeavenStudio.Util;
|
||||
using Starpelly;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_DJSchool
|
||||
{
|
||||
|
@ -2,7 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
|
@ -2,7 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
|
@ -2,7 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
|
@ -2,7 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using Starpelly;
|
||||
|
||||
using NaughtyBezierCurves;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
@ -4,7 +4,7 @@ using UnityEngine;
|
||||
|
||||
using DG.Tweening;
|
||||
using HeavenStudio.Util;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_FirstContact
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Starpelly;
|
||||
|
||||
using UnityEngine;
|
||||
using Jukebox;
|
||||
using Jukebox.Legacy;
|
||||
|
@ -2,7 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Util;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_MonkeyWatch
|
||||
{
|
||||
@ -52,12 +52,12 @@ namespace HeavenStudio.Games.Scripts_MonkeyWatch
|
||||
|
||||
if (realAngle <= 180)
|
||||
{
|
||||
float normalizedAngle = Mathp.Normalize(realAngle, 0, 180);
|
||||
float normalizedAngle = MathUtils.Normalize(realAngle, 0, 180);
|
||||
x = Mathf.Lerp(0, shadowXRange, normalizedAngle);
|
||||
}
|
||||
else
|
||||
{
|
||||
float normalizedAngle = Mathp.Normalize(realAngle, 180, 360);
|
||||
float normalizedAngle = MathUtils.Normalize(realAngle, 180, 360);
|
||||
x = Mathf.Lerp(shadowXRange, 0, normalizedAngle);
|
||||
}
|
||||
|
||||
@ -66,12 +66,12 @@ namespace HeavenStudio.Games.Scripts_MonkeyWatch
|
||||
|
||||
if (realAngleY <= 90)
|
||||
{
|
||||
float normalizedAngle = Mathp.Normalize(realAngleY, 0, 90);
|
||||
float normalizedAngle = MathUtils.Normalize(realAngleY, 0, 90);
|
||||
y = Mathf.Lerp(0, shadowYRange, normalizedAngle);
|
||||
}
|
||||
else
|
||||
{
|
||||
float normalizedAngle = Mathp.Normalize(realAngleY, 90, 180);
|
||||
float normalizedAngle = MathUtils.Normalize(realAngleY, 90, 180);
|
||||
y = Mathf.Lerp(shadowYRange, 0, normalizedAngle);
|
||||
}
|
||||
shadowTrans.localPosition = new Vector3(x, y);
|
||||
|
@ -2,7 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Util;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_MonkeyWatch
|
||||
{
|
||||
@ -78,10 +78,10 @@ namespace HeavenStudio.Games.Scripts_MonkeyWatch
|
||||
|
||||
private void SetArrowsToTime(int hours, int minutes, int seconds)
|
||||
{
|
||||
float normalizedHour = Mathp.Normalize(hours + (minutes / 60f) + (seconds / 3600f), 0f, 12f);
|
||||
float normalizedHour = MathUtils.Normalize(hours + (minutes / 60f) + (seconds / 3600f), 0f, 12f);
|
||||
anchorHour.localEulerAngles = new Vector3(0, 0, -Mathf.LerpUnclamped(0, 360, normalizedHour));
|
||||
|
||||
float normalizedMinute = Mathp.Normalize(minutes + (seconds / 60f), 0, 60);
|
||||
float normalizedMinute = MathUtils.Normalize(minutes + (seconds / 60f), 0, 60);
|
||||
anchorMinute.localEulerAngles = new Vector3(0, 0, -Mathf.LerpUnclamped(0, 360, normalizedMinute));
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using Starpelly;
|
||||
|
||||
using DG.Tweening;
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.InputSystem;
|
||||
@ -253,7 +253,7 @@ namespace HeavenStudio.Games
|
||||
spawnedHairs.Add(hair);
|
||||
hair.gameObject.SetActive(true);
|
||||
hair.GetComponent<Animator>().Play("SmallAppear", 0, 1);
|
||||
float rot = -58f + 116 * Mathp.Normalize((float)crEvent.relativeBeat, 0, crHandlerInstance.intervalLength - 1);
|
||||
float rot = -58f + 116 * MathUtils.Normalize((float)crEvent.relativeBeat, 0, crHandlerInstance.intervalLength - 1);
|
||||
hair.transform.eulerAngles = new Vector3(0, 0, rot);
|
||||
hair.createBeat = crEvent.beat;
|
||||
}
|
||||
@ -263,7 +263,7 @@ namespace HeavenStudio.Games
|
||||
spawnedLongs.Add(hair);
|
||||
hair.gameObject.SetActive(true);
|
||||
hair.GetComponent<Animator>().Play("LongAppear", 0, 1);
|
||||
float rot = -58f + 116 * Mathp.Normalize((float)crEvent.relativeBeat, 0, crHandlerInstance.intervalLength - 1);
|
||||
float rot = -58f + 116 * MathUtils.Normalize((float)crEvent.relativeBeat, 0, crHandlerInstance.intervalLength - 1);
|
||||
hair.transform.eulerAngles = new Vector3(0, 0, rot);
|
||||
hair.createBeat = crEvent.beat;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ using UnityEngine;
|
||||
using System;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_RhythmTweezers
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.InputSystem;
|
||||
|
@ -129,13 +129,10 @@ namespace HeavenStudio
|
||||
ChangeMasterVolume(PersistentDataManager.gameSettings.masterVolume);
|
||||
PlayerInput.InitInputControllers();
|
||||
#if HEAVENSTUDIO_PROD && !UNITY_EDITOR
|
||||
Starpelly.OS.ChangeWindowTitle("Heaven Studio");
|
||||
buildTime = Application.buildGUID.Substring(0, 8) + " " + AppInfo.Date.ToString("dd/MM/yyyy hh:mm:ss");
|
||||
#elif UNITY_EDITOR
|
||||
Starpelly.OS.ChangeWindowTitle("Heaven Studio UNITYEDITOR ");
|
||||
buildTime = "(EDITOR) " + System.DateTime.UtcNow.ToString("dd/MM/yyyy hh:mm:ss");
|
||||
#else
|
||||
Starpelly.OS.ChangeWindowTitle("Heaven Studio (INDEV) " + Application.buildGUID.Substring(0, 8));
|
||||
buildTime = Application.buildGUID.Substring(0, 8) + " " + AppInfo.Date.ToString("dd/MM/yyyy hh:mm:ss");
|
||||
#endif
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Starpelly;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Editor.Track
|
||||
{
|
||||
public class BeatGrid : MonoBehaviour
|
||||
@ -49,8 +50,8 @@ namespace HeavenStudio.Editor.Track
|
||||
{
|
||||
if (Editor.instance.fullscreen) return;
|
||||
|
||||
// var x = Mathp.Round2Nearest(contentPosX, Timeline.instance.PixelsPerBeat);
|
||||
var x = Mathp.Round2Nearest(-scrollRect.content.anchoredPosition.x, Timeline.instance.PixelsPerBeat);
|
||||
// var x = MathUtils.Round2Nearest(contentPosX, Timeline.instance.PixelsPerBeat);
|
||||
var x = MathUtils.Round2Nearest(-scrollRect.content.anchoredPosition.x, Timeline.instance.PixelsPerBeat);
|
||||
var pos = new Vector3(x, transform.localPosition.y, transform.localPosition.z);
|
||||
transform.localPosition = pos;
|
||||
rectTransform.anchoredPosition = new Vector3(rectTransform.anchoredPosition.x, rectTransform.anchoredPosition.y, 0);
|
||||
|
@ -1,10 +1,10 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor.Track;
|
||||
|
||||
using DG.Tweening;
|
||||
using Starpelly;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
|
@ -7,9 +7,8 @@ using UnityEngine.UI;
|
||||
using Newtonsoft.Json;
|
||||
using TMPro;
|
||||
|
||||
using Starpelly;
|
||||
|
||||
using HeavenStudio.Common;
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor.Track;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using Jukebox;
|
||||
|
@ -7,8 +7,8 @@ using UnityEngine.EventSystems;
|
||||
|
||||
using TMPro;
|
||||
using DG.Tweening;
|
||||
using Starpelly;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor.Track;
|
||||
using System.Text;
|
||||
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor.Track;
|
||||
using Newtonsoft.Json;
|
||||
using Starpelly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
namespace HeavenStudio.Editor.Track
|
||||
{
|
||||
|
@ -4,8 +4,9 @@ using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
using Jukebox;
|
||||
using Jukebox.Legacy;
|
||||
|
||||
|
@ -6,11 +6,12 @@ using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
using Jukebox;
|
||||
using Newtonsoft.Json;
|
||||
using System.Linq;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Editor.Track
|
||||
{
|
||||
public class Timeline : MonoBehaviour
|
||||
@ -41,7 +42,7 @@ namespace HeavenStudio.Editor.Track
|
||||
public float VerticalZoom { get; private set; } = 1.0f;
|
||||
public float MousePos2Beat { get; private set; }
|
||||
public float MousePos2Layer { get; private set; }
|
||||
public float MousePos2BeatSnap => Mathp.Round2Nearest(MousePos2Beat + (SnapInterval() * 0.5f), SnapInterval());
|
||||
public float MousePos2BeatSnap => HeavenStudio.Util.MathUtils.Round2Nearest(MousePos2Beat + (SnapInterval() * 0.5f), SnapInterval());
|
||||
public bool MouseInTimeline { get; private set; }
|
||||
|
||||
private Vector2 relativeMousePos;
|
||||
@ -380,11 +381,6 @@ namespace HeavenStudio.Editor.Track
|
||||
}
|
||||
}
|
||||
|
||||
public static string RandomID()
|
||||
{
|
||||
return Starpelly.Random.Strings.RandomString(Starpelly.Enums.Strings.StringType.Alphanumeric, 128);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void Update()
|
||||
@ -435,7 +431,7 @@ namespace HeavenStudio.Editor.Track
|
||||
var left = leftSide;
|
||||
var viewportWidth = TimelineScroll.viewport.rect.width;
|
||||
var localPointRec = Mathf.Lerp(left, left + (viewportWidth / Zoom),
|
||||
Mathp.Normalize(Input.mousePosition.x, viewportPos.x, viewportPos.x + viewportWidth));
|
||||
MathUtils.Normalize(Input.mousePosition.x, viewportPos.x, viewportPos.x + viewportWidth));
|
||||
|
||||
var xPixels = (localPointRec * incre);
|
||||
xPixels *= (Zoom);
|
||||
@ -824,7 +820,7 @@ namespace HeavenStudio.Editor.Track
|
||||
}
|
||||
}
|
||||
int height = 200;
|
||||
Color col = Colors.Hex2RGB("727272");
|
||||
Color col = "727272".Hex2RGB();
|
||||
col.a = 0.25f;
|
||||
|
||||
Texture2D tex = new Texture2D(wave.Length, height, TextureFormat.RGBA32, false);
|
||||
@ -982,7 +978,7 @@ namespace HeavenStudio.Editor.Track
|
||||
public float SnapToLayer(float y)
|
||||
{
|
||||
float size = LayerHeight();
|
||||
return Mathf.Clamp(Mathp.Round2Nearest(y, size), -size * (LayerCount - 1), 0f);
|
||||
return Mathf.Clamp(MathUtils.Round2Nearest(y, size), -size * (LayerCount - 1), 0f);
|
||||
}
|
||||
|
||||
public float LayerHeight()
|
||||
@ -1008,7 +1004,7 @@ namespace HeavenStudio.Editor.Track
|
||||
}
|
||||
else
|
||||
{
|
||||
float spd = Mathp.Round2Nearest(speed, SpeedSnap);
|
||||
float spd = MathUtils.Round2Nearest(speed, SpeedSnap);
|
||||
PlaybackSpeed.transform.GetChild(3).GetComponent<TMP_Text>().text = $"Playback Speed: {spd}x";
|
||||
Conductor.instance.SetTimelinePitch(spd);
|
||||
PlaybackSpeed.value = spd;
|
||||
|
@ -1,7 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using Starpelly;
|
||||
|
||||
using Jukebox;
|
||||
using TMPro;
|
||||
using System.Linq;
|
||||
@ -146,7 +146,7 @@ namespace HeavenStudio.Editor.Track
|
||||
public void UpdateMarker()
|
||||
{
|
||||
mouseOver = Timeline.instance.timelineState.selected && Timeline.instance.MouseInTimeline &&
|
||||
Timeline.instance.MousePos2Beat.IsWithin((float)entity.beat, (float)entity.beat + entity.length) &&
|
||||
HeavenStudio.Util.MathUtils.IsBetween(Timeline.instance.MousePos2Beat, (float)entity.beat, (float)entity.beat + entity.length) &&
|
||||
Timeline.instance.MousePos2Layer == (int)entity["track"];
|
||||
|
||||
eventLabel.overflowMode = (mouseHovering || moving || resizing || inResizeRegion) ? TextOverflowModes.Overflow : TextOverflowModes.Ellipsis;
|
||||
|
@ -6,7 +6,7 @@ using UnityEngine;
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Common;
|
||||
using HeavenStudio.InputSystem;
|
||||
using Starpelly;
|
||||
|
||||
using System.Linq;
|
||||
|
||||
using SFB;
|
||||
@ -472,7 +472,7 @@ namespace HeavenStudio
|
||||
|
||||
public float GetPositionFromBeat(float startBeat, float length)
|
||||
{
|
||||
float a = Mathp.Normalize((float)songPosBeat, startBeat, startBeat + length);
|
||||
float a = MathUtils.Normalize((float)songPosBeat, startBeat, startBeat + length);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
22
Assets/Scripts/Util/MathUtils.cs
Normal file
22
Assets/Scripts/Util/MathUtils.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace HeavenStudio.Util
|
||||
{
|
||||
public static class MathUtils
|
||||
{
|
||||
public static float Round2Nearest(float value, float nearest)
|
||||
{
|
||||
return Mathf.Round(value / nearest) * nearest;
|
||||
}
|
||||
|
||||
public static float Normalize(float value, float min, float max)
|
||||
{
|
||||
return (value - min) / (max - min);
|
||||
}
|
||||
|
||||
public static bool IsBetween(this float value, float min, float max)
|
||||
{
|
||||
return value >= min && value <= max;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Util/MathUtils.cs.meta
Normal file
11
Assets/Scripts/Util/MathUtils.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ecfdacc9bf1519248b0b93009ed2a045
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using Starpelly;
|
||||
|
||||
|
||||
namespace HeavenStudio.Util
|
||||
{
|
||||
@ -287,7 +287,7 @@ namespace HeavenStudio.Util
|
||||
while (bendTimer < bendTime)
|
||||
{
|
||||
bendTimer += Time.deltaTime;
|
||||
float normalizedProgress = Mathp.Normalize(bendTimer, 0, bendTime);
|
||||
float normalizedProgress = MathUtils.Normalize(bendTimer, 0, bendTime);
|
||||
float currentPitch = Mathf.Lerp(startingPitch, bendedPitch, normalizedProgress);
|
||||
audioSource.pitch = Mathf.Min(currentPitch, bendedPitch);
|
||||
yield return null;
|
||||
@ -302,7 +302,7 @@ namespace HeavenStudio.Util
|
||||
while (bendTimer < bendTime)
|
||||
{
|
||||
bendTimer += Time.deltaTime;
|
||||
float normalizedProgress = Mathp.Normalize(bendTimer, 0, bendTime);
|
||||
float normalizedProgress = MathUtils.Normalize(bendTimer, 0, bendTime);
|
||||
float currentPitch = Mathf.Lerp(startingPitch, bendedPitch, 1 - normalizedProgress);
|
||||
audioSource.pitch = Mathf.Max(currentPitch, pitch);
|
||||
yield return null;
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace HeavenStudio.Util
|
||||
{
|
||||
public static class StringUtils
|
||||
@ -28,5 +30,36 @@ namespace HeavenStudio.Util
|
||||
"$1 $2"
|
||||
);
|
||||
}
|
||||
|
||||
public static string Color2Hex(this Color color)
|
||||
{
|
||||
Color32 col = (Color32)color;
|
||||
string hex = col.r.ToString("X2") + col.g.ToString("X2") + col.b.ToString("X2");
|
||||
return hex;
|
||||
}
|
||||
|
||||
public static Color Hex2RGB(this string hex)
|
||||
{
|
||||
if (hex is null or "") return Color.black;
|
||||
try
|
||||
{
|
||||
hex = hex.Replace("0x", "");//in case the string is formatted 0xFFFFFF
|
||||
hex = hex.Replace("#", "");//in case the string is formatted #FFFFFF
|
||||
byte a = 255;//assume fully visible unless specified in hex
|
||||
byte r = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber);
|
||||
byte g = byte.Parse(hex.Substring(2, 2), NumberStyles.HexNumber);
|
||||
byte b = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber);
|
||||
//Only use alpha if the string has enough characters
|
||||
if (hex.Length >= 8)
|
||||
{
|
||||
a = byte.Parse(hex.Substring(6, 2), NumberStyles.HexNumber);
|
||||
}
|
||||
return new Color32(r, g, b, a);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Color.black;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user