Skip to content

Commit

Permalink
Merge pull request #2 from ckosmic/update/1.20.0
Browse files Browse the repository at this point in the history
Update for Beat Saber 1.20.0
  • Loading branch information
ckosmic authored Mar 17, 2022
2 parents d0233a8 + 4b70344 commit b792be1
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 17 deletions.
8 changes: 7 additions & 1 deletion IForgor/Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
using IForgor.Installers;
using IPA;
using IPA.Logging;
using ModestTree;
using SiraUtil.Zenject;

namespace IForgor
{
[Plugin(RuntimeOptions.DynamicInit), NoEnableDisable]
public class Plugin
{
internal static Logger Log { get; private set; }

[Init]
/// <summary>
/// Called when the plugin is first loaded by IPA (either when the game starts or when the plugin is enabled if it starts disabled).
/// [Init] methods that use a Constructor or called before regular methods like InitWithConfig.
/// Only use [Init] with one Constructor.
/// </summary>
public void Init(Zenjector zenject)
public void Init(Logger logger, Zenjector zenject)
{
Log = logger;

zenject.Install<IFAppInstaller>(Location.App);
zenject.Install<IFGameInstaller>(Location.StandardPlayer);
}
Expand Down
32 changes: 20 additions & 12 deletions IForgor/Recorders/NoteRecorder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using Zenject;

namespace IForgor.Recorders
Expand Down Expand Up @@ -32,24 +34,30 @@ public void Dispose() {
}

private void OnNoteWasCut(NoteController noteController, in NoteCutInfo noteCutInfo) {
ProcessNote(noteController.noteData, noteCutInfo);
if (noteController.noteData == null || noteController.noteData.colorType == ColorType.None) return;
if (!noteCutInfo.saberTypeOK)
{
ProcessNote(noteController.noteData, null);
}
else
{
ProcessNote(noteController.noteData, noteCutInfo);
}
}
private void OnNoteWasMissed(NoteController noteController) {
ProcessNote(noteController.noteData, null);
}

private void ProcessNote(NoteData noteData, NoteCutInfo? noteCutInfo) {
if (noteData != null) {
if (noteData.colorType == ColorType.ColorA)
{
noteAData = noteData;
noteACutInfo = noteCutInfo;
}
else if (noteData.colorType == ColorType.ColorB)
{
noteBData = noteData;
noteBCutInfo = noteCutInfo;
}
if (noteData.colorType == ColorType.ColorA)
{
noteAData = noteData;
noteACutInfo = noteCutInfo;
}
else if (noteData.colorType == ColorType.ColorB)
{
noteBData = noteData;
noteBCutInfo = noteCutInfo;
}
}
}
Expand Down
Binary file modified IForgor/Resources/layers.psd
Binary file not shown.
Binary file added IForgor/Resources/slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IForgor/Resources/slider_dots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions IForgor/UI/AssetLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ namespace IForgor.UI
internal class AssetLoader
{
public Sprite spr_bloq { get; }
public Sprite spr_slider { get; }
public Sprite spr_arrow { get; }
public Sprite spr_dot { get; }
public Sprite spr_slider_dots { get; }
public Sprite spr_cut_arrow { get; }
public Sprite spr_saber_bg { get; }
public Sprite spr_saber_fg { get; }
Expand All @@ -19,8 +21,10 @@ internal class AssetLoader
public AssetLoader()
{
spr_bloq = LoadSpriteFromResource("IForgor.Resources.bloq.png");
spr_slider = LoadSpriteFromResource("IForgor.Resources.slider.png");
spr_arrow = LoadSpriteFromResource("IForgor.Resources.arrow.png");
spr_dot = LoadSpriteFromResource("IForgor.Resources.dot.png");
spr_slider_dots = LoadSpriteFromResource("IForgor.Resources.slider_dots.png");
spr_cut_arrow = LoadSpriteFromResource("IForgor.Resources.cut_arrow.png");
spr_saber_bg = LoadSpriteFromResource("IForgor.Resources.saber_bg.png");
spr_saber_fg = LoadSpriteFromResource("IForgor.Resources.saber_fg.png");
Expand Down
9 changes: 7 additions & 2 deletions IForgor/UI/UIGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public void Initialize() {
public void SetNoteData(NoteData noteData) {
this.noteData = noteData;

bloqImage.sprite = _assetLoader.spr_bloq;
directionImage.sprite = _assetLoader.spr_arrow;

RectTransform bloqRootTransform = bloqImage.rectTransform;
Expand Down Expand Up @@ -108,8 +109,12 @@ public void SetNoteData(NoteData noteData) {
bloqRootTransform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 135f));
break;
case NoteCutDirection.Any:
bloqRootTransform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f));
directionImage.sprite = _assetLoader.spr_dot;
bloqRootTransform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, noteData.cutDirectionAngleOffset));
if (noteData.gameplayType == NoteData.GameplayType.BurstSliderElement)
{
bloqImage.sprite = _assetLoader.spr_slider;
directionImage.sprite = _assetLoader.spr_slider_dots;
}
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions IForgor/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"id": "I Forgor",
"name": "IForgor",
"author": "ckosmic",
"version": "1.1.1",
"version": "1.3.0",
"description": "A mod that displays the last notes and saber angles before you paused in the pause menu.",
"gameVersion": "1.19.0",
"gameVersion": "1.20.0",
"dependsOn": {
"BSIPA": "^4.2.1",
"SiraUtil": "^3.0.0"
Expand Down

0 comments on commit b792be1

Please sign in to comment.