8000 1.35.x by denpadokei · Pull Request #59 · denpadokei/HttpSiraStatus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

1.35.x #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions HttpSiraStatus/Enums/EventEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ public enum V3BeatmapEventType
Unknown,
BPM,
ColorBoost,
FloatFx,
LightColor,
LightRotation,
LightTranslation,
SpawnRotation
}
}
9 changes: 7 additions & 2 deletions HttpSiraStatus/Extentions/SaberMovementDataExtentions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ namespace HttpSiraStatus.Extentions
{
public static class SaberMovementDataExtentions
{
public static float ComputeSwingRatingEx(this ISaberMovementData data)
{
return data.ComputeSwingRatingEx(false, 0);
}

/// <summary>
/// BeatLeaderのパッチ除け
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public static float ComputeSwingRatingEx(this ISaberMovementData data)
public static float ComputeSwingRatingEx(this ISaberMovementData data, bool overrideSegmenAngle, float overrideValue)
{
if (data is SaberMovementData saberMovementData) {
if (saberMovementData._validCount < 2) {
Expand All @@ -24,7 +29,7 @@ public static float ComputeSwingRatingEx(this ISaberMovementData data)
var num3 = time;
var num4 = 0f;
var segmentNormal = saberMovementData._data[num2].segmentNormal;
var angleDiff = saberMovementData._data[num2].segmentAngle;
var angleDiff = overrideSegmenAngle ? overrideValue : saberMovementData._data[num2].segmentAngle;
var num5 = 2;
num4 += SaberSwingRating.BeforeCutStepRating(angleDiff, 0f);
while (time - num3 < 0.4f && num5 < saberMovementData._validCount) {
Expand Down
13 changes: 12 additions & 1 deletion HttpSiraStatus/HttpSiraStatus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<LocalRefsDir Condition="Exists('..\Refs')">..\Refs</LocalRefsDir>
<BeatSaberDir>$(LocalRefsDir)</BeatSaberDir>
<ErrorReport>prompt</ErrorReport>
<Version>11.0.0</Version>
<Version>12.0.0</Version>
<WarningLevel>4</WarningLevel>
<AssemblySearchPaths>$(ReferencePath)</AssemblySearchPaths>
</PropertyGroup>
Expand Down Expand Up @@ -59,6 +59,17 @@
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="BGNetCore">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BGNetCore.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="DataModels">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\DataModels.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
<Publicize>True</Publicize>
</Reference>
<Reference Include="Hive.Versioning.dll">
<HintPath>$(BeatSaberDir)\Libs\Hive.Versioning.dll</HintPath>
</Reference>
Expand Down
2 changes: 2 additions & 0 deletions HttpSiraStatus/Interfaces/IGameStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public interface IGameStatus
bool leftHanded { get; }
long length { get; }
string levelAuthorName { get; }
string[] levelAuthorNamesArray { get; }
string[] lighterNamesArray { get; }
string levelId { get; }
int maxCombo { get; }
string maxRank { get; }
Expand Down
45 changes: 28 additions & 17 deletions HttpSiraStatus/Models/GamePlayDataManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using HttpSiraStatus.Configuration;
using HarmonyLib;
using HttpSiraStatus.Configuration;
using HttpSiraStatus.Enums;
using HttpSiraStatus.Extentions;
using HttpSiraStatus.Interfaces;
Expand Down Expand Up @@ -380,6 +381,8 @@ public void DespawnScoringElement(ScoringElement scoringElement)
private NoteDataEntity.Pool _notePool;
private SliderDataEntity.Pool _sliderPool;
private GameplayCoreSceneSetupData _gameplayCoreSceneSetupData;
private BeatmapLevel _beatmapLevel;
private BeatmapKey _beatmapKey;
private PauseController _pauseController;
private IScoreController _scoreController;
private IComboController _comboController;
Expand Down Expand Up @@ -449,6 +452,8 @@ private void Constractor(
SliderDataEntity.Pool sliderDataEntityPool,
CutScoreInfoEntity.Pool cutScoreInfoEntityPool,
GameplayCoreSceneSetupData gameplayCoreSceneSetupData,
BeatmapLevel beatmapLevel,
BeatmapKey beatmapKey,
IScoreController score,
IComboController comboController,
GameplayModifiers gameplayModifiers,
Expand All @@ -471,6 +476,8 @@ private void Constractor(
this._notePool = noteDataEntityPool;
this._sliderPool = sliderDataEntityPool;
this._gameplayCoreSceneSetupData = gameplayCoreSceneSetupData;
this._beatmapLevel = beatmapLevel;
this._beatmapKey = beatmapKey;
this._scoreController = score;
this._gameplayModifiers = gameplayModifiers;
this._audioTimeSource = audioTimeSource;
Expand Down Expand Up @@ -607,8 +614,9 @@ public async Task InitializeAsync(CancellationToken token)
this._levelEndActions.levelFinishedEvent += this.OnLevelFinished;
this._levelEndActions.levelFailedEvent += this.OnLevelFailed;
}
var diff = this._gameplayCoreSceneSetupData.difficultyBeatmap;
var level = diff.level;
//var diff = this._gameplayCoreSceneSetupData..difficultyBeatmap;
var level = this._beatmapLevel;
var beatmapData = level.GetDifficultyBeatmapData(this._beatmapKey.beatmapCharacteristic, this._beatmapKey.difficulty);

this._gameplayModifiers = this._gameplayCoreSceneSetupData.gameplayModifiers;
var playerSettings = this._gameplayCoreSceneSetupData.playerSpecificSettings;
Expand All @@ -621,29 +629,31 @@ public async Task InitializeAsync(CancellationToken token)
this._gameStatus.songName = level.songName;
this._gameStatus.songSubName = level.songSubName;
this._gameStatus.songAuthorName = level.songAuthorName;
this._gameStatus.levelAuthorName = level.levelAuthorName;
this._gameStatus.levelAuthorName = string.Join(",", level.allMappers);
this._gameStatus.levelAuthorNamesArray = level.allMappers;
this._gameStatus.lighterNamesArray = level.allLighters;
this._gameStatus.songBPM = level.beatsPerMinute;
this._gameStatus.noteJumpSpeed = diff.noteJumpMovementSpeed;
this._gameStatus.noteJumpStartBeatOffset = diff.noteJumpStartBeatOffset;
this._gameStatus.noteJumpSpeed = beatmapData.noteJumpMovementSpeed;
this._gameStatus.noteJumpStartBeatOffset = beatmapData.noteJumpStartBeatOffset;
// 13 is "custom_level_" and 40 is the magic number for the length of the SHA-1 hash
this._gameStatus.songHash = Regex.IsMatch(level.levelID, "^custom_level_[0-9A-F]{40}", RegexOptions.IgnoreCase) && !level.levelID.EndsWith(" WIP") ? level.levelID.Substring(13, 40) : null;
this._gameStatus.levelId = level.levelID;
this._gameStatus.songTimeOffset = (long)(level.songTimeOffset * 1000f / songSpeedMul);
this._gameStatus.length = (long)(level.beatmapLevelData.audioClip.length * 1000f / songSpeedMul);
this._gameStatus.length = (long)(_gameplayCoreSceneSetupData.songAudioClip.length * 1000f / songSpeedMul);
this._gameStatus.start = Utility.GetCurrentTime() - (long)(this._audioTimeSource.songTime * 1000f / songSpeedMul);
if (practiceSettings != null) {
this._gameStatus.start -= (long)(practiceSettings.startSongTime * 1000f / songSpeedMul);
}

this._gameStatus.paused = 0;
this._gameStatus.difficulty = diff.difficulty.Name();
this._gameStatus.difficultyEnum = Enum.GetName(typeof(BeatmapDifficulty), diff.difficulty);
this._gameStatus.characteristic = diff.parentDifficultyBeatmapSet.beatmapCharacteristic.serializedName;
var beatmapData = await diff.GetBeatmapDataBasicInfoAsync().ConfigureAwait(true);
this._gameStatus.notesCount = beatmapData.cuttableNotesCount;
this._gameStatus.difficulty = this._beatmapKey.difficulty.Name();
this._gameStatus.difficultyEnum = Enum.GetName(typeof(BeatmapDifficulty), this._beatmapKey.difficulty);
this._gameStatus.characteristic = _beatmapKey.beatmapCharacteristic.serializedName;
//var beatmapData = await beatmapData.GetBeatmapDataBasicInfoAsync().ConfigureAwait(true);
this._gameStatus.notesCount = beatmapData.notesCount;
this._gameStatus.bombsCount = beatmapData.bombsCount;
this._gameStatus.obstaclesCount = beatmapData.obstaclesCount;
this._gameStatus.environmentName = level.environmentInfo.sceneInfo.sceneName;
this._gameStatus.environmentName = beatmapData.environmentName.ToString();
var colorScheme = this._gameplayCoreSceneSetupData.colorScheme ?? new ColorScheme(this._gameplayCoreSceneSetupData.environmentInfo.colorScheme);
this._gameStatus.colorSaberA = colorScheme.saberAColor;
this._gameStatus.colorSaberB = colorScheme.saberBColor;
Expand All @@ -661,8 +671,7 @@ public async Task InitializeAsync(CancellationToken token)
// From https://support.unity3d.com/hc/en-us/articles/206486626-How-can-I-get-pixels-from-unreadable-textures-
// Modified to correctly handle texture atlases. Fixes #82.
var active = RenderTexture.active;

var sprite = await level.GetCoverImageAsync(CancellationToken.None);
var sprite = await level.previewMediaData.GetCoverSpriteAsync(token);
var texture = sprite.texture;
var temporary = RenderTexture.GetTemporary(texture.width, texture.height, 0, RenderTextureFormat.Default, RenderTextureReadWrite.Linear);

Expand Down Expand Up @@ -712,7 +721,7 @@ public async Task InitializeAsync(CancellationToken token)
this._gameStatus.modProMode = this._gameplayModifiers.proMode;
this._gameStatus.modZenMode = this._gameplayModifiers.zenMode;

this._gameStatus.staticLights = (diff.difficulty == BeatmapDifficulty.ExpertPlus ? playerSettings.environmentEffectsFilterExpertPlusPreset : playerSettings.environmentEffectsFilterDefaultPreset) != EnvironmentEffectsFilterPreset.AllEffects;
this._gameStatus.staticLights = (this._beatmapKey.difficulty == BeatmapDifficulty.ExpertPlus ? playerSettings.environmentEffectsFilterExpertPlusPreset : playerSettings.environmentEffectsFilterDefaultPreset) != EnvironmentEffectsFilterPreset.AllEffects;
this._gameStatus.leftHanded = playerSettings.leftHanded;
this._gameStatus.playerHeight = playerSettings.playerHeight;
this._gameStatus.sfxVolume = playerSettings.sfxVolume;
Expand All @@ -721,7 +730,7 @@ public async Task InitializeAsync(CancellationToken token)
this._gameStatus.advancedHUD = playerSettings.advancedHud;
this._gameStatus.autoRestart = playerSettings.autoRestart;
this._gameStatus.saberTrailIntensity = playerSettings.saberTrailIntensity;
this._gameStatus.environmentEffects = (diff.difficulty == BeatmapDifficulty.ExpertPlus ? playerSettings.environmentEffectsFilterExpertPlusPreset : playerSettings.environmentEffectsFilterDefaultPreset).ToString();
this._gameStatus.environmentEffects = (this._beatmapKey.difficulty == BeatmapDifficulty.ExpertPlus ? playerSettings.environmentEffectsFilterExpertPlusPreset : playerSettings.environmentEffectsFilterDefaultPreset).ToString();
this._gameStatus.hideNoteSpawningEffect = playerSettings.hideNoteSpawnEffect;
// Generate NoteData to id mappings for backwards compatiblity with <1.12.1
this._noteToIdMapping.Clear();
Expand Down Expand Up @@ -765,8 +774,10 @@ void __SetupMapping()
break;
case BPMChangeBeatmapEventData bpm:
case ColorBoostBeatmapEventData color:
case FloatFxBeatmapEventData floatFx:
case LightColorBeatmapEventData lightColor:
case LightRotationBeatmapEventData lightRotation:
case LightTranslationBeatmapEventData lightTranslation:
case SpawnRotationBeatmapEventData spawn:
default:
info = new V3BeatmapEventInfomation();
Expand Down
6 changes: 6 additions & 0 deletions HttpSiraStatus/Models/GameStatus.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using HttpSiraStatus.Enums;
using HttpSiraStatus.Interfaces;
using System;
using UnityEngine;

namespace HttpSiraStatus.Models
Expand All @@ -17,6 +18,8 @@ internal class GameStatus : IGameStatus
public string songSubName { get; internal set; } = null;
public string songAuthorName { get; internal set; } = null;
public string levelAuthorName { get; internal set; } = null;
public string[] levelAuthorNamesArray { get; internal set; } = Array.Empty<string>();
public string[] lighterNamesArray { get; internal set; } = Array.Empty<string>();
public string songCover { get; internal set; } = null;
public string songHash { get; internal set; } = null;
public string levelId { get; internal set; } = null;
Expand Down Expand Up @@ -99,12 +102,15 @@ internal class GameStatus : IGameStatus
public float saberTrailIntensity { get; internal set; } = 0.5f;
public string environmentEffects { get; internal set; } = EnvironmentEffectsFilterPreset.AllEffects.ToString();
public bool hideNoteSpawningEffect { get; internal set; } = false;


public void ResetMapInfo()
{
this.songName = null;
this.songSubName = null;
this.songAuthorName = null;
this.levelAuthorName = null;
this.levelAuthorNamesArray = Array.Empty<string>();
this.songCover = null;
this.songHash = null;
this.levelId = null;
Expand Down
12 changes: 11 additions & 1 deletion HttpSiraStatus/Models/StatusManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,17 @@ private void UpdateBeatmapJSON()
beatmapJSON["songName"] = this.StringOrNull(this._gameStatus.songName);
beatmapJSON["songSubName"] = this.StringOrNull(this._gameStatus.songSubName);
beatmapJSON["songAuthorName"] = this.StringOrNull(this._gameStatus.songAuthorName);
beatmapJSON["levelAuthorName"] = this.StringOrNull(this._gameStatus.levelAuthorName);
beatmapJSON["levelAuthorName"] = this._gameStatus.levelAuthorName;
var mappers = new JSONArray();
foreach (var name in this._gameStatus.levelAuthorNamesArray) {
mappers.Add(name);
}
beatmapJSON["levelAuthorNamesArray"] = mappers;
var lighters = new JSONArray();
foreach (var name in this._gameStatus.lighterNamesArray) {
lighters.Add(name);
}
beatmapJSON["lighterNamesArray"] = lighters;
beatmapJSON["songCover"] = string.IsNullOrEmpty(this._gameStatus.songCover) ? JSONNull.CreateOrGet() : new JSONString(this._gameStatus.songCover);
beatmapJSON["songHash"] = this.StringOrNull(this._gameStatus.songHash);
beatmapJSON["levelId"] = this.StringOrNull(this._gameStatus.levelId);
Expand Down
Loading
0