Upgrade renderer to the universal render pipeline

This commit is contained in:
Braedon
2022-01-30 04:09:26 -05:00
parent df5a64622e
commit 7330d19ff6
17 changed files with 1051 additions and 274 deletions

View File

@ -58,8 +58,16 @@ namespace RhythmHeavenMania
sp.sortingOrder = 30000;
this.gameObject.layer = 3;
string json = txt.text;
Beatmap = JsonConvert.DeserializeObject<Beatmap>(json);
if (txt != null)
{
string json = txt.text;
Beatmap = JsonConvert.DeserializeObject<Beatmap>(json);
}
else
{
Beatmap = new Beatmap();
Beatmap.bpm = 120f;
}
SortEventsList();
@ -82,6 +90,10 @@ namespace RhythmHeavenMania
SetCurrentGame(Beatmap.entities[0].datamodel.Split(0));
SetGame(Beatmap.entities[0].datamodel.Split(0));
}
else
{
SetGame("noGame");
}
}
// LateUpdate works a bit better but causes a bit of bugs, so remind me to fix those eventually
@ -223,6 +235,10 @@ namespace RhythmHeavenMania
SetGame(newGame);
}
else
{
SetGame("noGame");
}
if (Beatmap.tempoChanges.Count > 0)
{
@ -285,13 +301,11 @@ namespace RhythmHeavenMania
currentGameO.name = game;
}
GameCamera.orthographic = true;
if (onGameSwitch)
/*if (onGameSwitch)
{
if (GetGame(currentGame).GetComponent<Minigame>() != null)
GetGame(game).GetComponent<Minigame>().OnGameSwitch();
}
}*/
SetCurrentGame(game);
}
@ -331,7 +345,9 @@ namespace RhythmHeavenMania
public void SetCurrentGame(string game)
{
currentGame = game;
CircleCursor.InnerCircle.GetComponent<SpriteRenderer>().color = Colors.Hex2RGB(GetGameInfo(currentGame).color);
if (GetGameInfo(currentGame) != null) CircleCursor.InnerCircle.GetComponent<SpriteRenderer>().color = Colors.Hex2RGB(GetGameInfo(currentGame).color);
else
CircleCursor.InnerCircle.GetComponent<SpriteRenderer>().color = Color.white;
}
private bool SongPosLessThanClipLength(float t)

View File

@ -115,11 +115,17 @@ namespace RhythmHeavenMania.Games.KarateMan
p.hitSnd = "karateman/lightbulbHit";
break;
case 2:
outSnd = "karateman/objectOut";
if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f)
outSnd = "karateman/objectOut";
else
outSnd = "karateman/offbeatObjectOut";
p.hitSnd = "karateman/rockHit";
break;
case 3:
outSnd = "karateman/objectOut";
if (Starpelly.Mathp.GetDecimalFromFloat(beat) == 0f)
outSnd = "karateman/objectOut";
else
outSnd = "karateman/offbeatObjectOut";
p.hitSnd = "karateman/soccerHit";
break;
case 4:

View File

@ -12,6 +12,7 @@ namespace RhythmHeavenMania.Editor
public class BoxSelection : MonoBehaviour
{
[SerializeField] private RectTransform boxVisual;
[SerializeField] private RectTransform timelineContent;
private Rect selectionBox;
private Vector2 startPosition = Vector2.zero;
@ -73,8 +74,8 @@ namespace RhythmHeavenMania.Editor
{
startPosition = Vector2.zero;
endPosition = Vector2.zero;
DrawVisual();
SelectEvents();
DrawVisual();
}
// selecting = (selectionBox.size != Vector2.zero); -- doesn't work really
@ -92,7 +93,8 @@ namespace RhythmHeavenMania.Editor
Vector2 boxSize = new Vector2(Mathf.Abs(boxStart.x - boxEnd.x), Mathf.Abs(boxStart.y - boxEnd.y));
boxVisual.sizeDelta = boxSize;
// boxVisual.sizeDelta = new Vector2(boxSize.x / boxVisual.localScale.x, boxSize.y / boxVisual.localScale.y);
boxVisual.sizeDelta = new Vector2(boxSize.x, boxSize.y);
}
private void DrawSelection()
@ -128,14 +130,14 @@ namespace RhythmHeavenMania.Editor
private void SelectEvents()
{
if (!Input.GetKey(KeyCode.LeftShift)) Selections.instance.DeselectAll();
int selected = 0;
// if (!Input.GetKeyDown(KeyCode.LeftShift)) Selections.instance.DeselectAll();
for (int i = 0; i < GameManager.instance.Beatmap.entities.Count; i++)
{
TimelineEventObj e = GameManager.instance.Beatmap.entities[i].eventObj;
if (selectionBox.Overlaps(GetWorldRect(e.GetComponent<RectTransform>())))
{
Selections.instance.DragSelect(e);
@ -149,6 +151,8 @@ namespace RhythmHeavenMania.Editor
public Vector3 MousePosition()
{
var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
// var mousePos = new Vector2();
// RectTransformUtility.ScreenPointToLocalPointInRectangle(timelineContent, Input.mousePosition, Camera.main, out mousePos);
return new Vector3(mousePos.x, mousePos.y, 0);
}

View File

@ -36,6 +36,7 @@ namespace RhythmHeavenMania.Editor
[SerializeField] private Button RedoBTN;
[SerializeField] private Button MusicSelectBTN;
[SerializeField] private Button EditorSettingsBTN;
[SerializeField] private Button EditorThemeBTN;
public static List<TimelineEventObj> EventObjs = new List<TimelineEventObj>();
@ -71,6 +72,7 @@ namespace RhythmHeavenMania.Editor
Tooltip.AddTooltip(RedoBTN.gameObject, "Redo <color=#adadad>[Ctrl+Y or Ctrl+Shift+Z]</color>");
Tooltip.AddTooltip(MusicSelectBTN.gameObject, "Music Select");
Tooltip.AddTooltip(EditorSettingsBTN.gameObject, "Editor Settings <color=#adadad>[Ctrl+Shift+O]</color>");
Tooltip.AddTooltip(EditorThemeBTN.gameObject, "Editor Theme");
}
public void Update()