Skip to content
Open
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
4 changes: 2 additions & 2 deletions Assets/Art/Menu/Common/DifficultyIcons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions Assets/Art/Menu/Common/DifficultyIcons.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 77 additions & 0 deletions Assets/Prefabs/Menu/MusicLibrary/Instrument Difficulty.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6388824535481474079}
- {fileID: 8765432101234567002}
- {fileID: 2527093660762882793}
m_Father: {fileID: 724794527332165637}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -173,6 +174,81 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &8765432101234567001
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8765432101234567002}
- component: {fileID: 8765432101234567003}
- component: {fileID: 8765432101234567004}
m_Layer: 0
m_Name: Difficulty Ring
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8765432101234567002
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8765432101234567001}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1322352689153992488}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 4, y: 0}
m_SizeDelta: {x: 32, y: 32}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &8765432101234567003
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8765432101234567001}
m_CullTransparentMesh: 1
--- !u!114 &8765432101234567004
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8765432101234567001}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 1723301127, guid: f3ceabe704bcf1745866d8e7135c98ab, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &4178860913408610405
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -537,4 +613,5 @@ MonoBehaviour:
m_EditorClassIdentifier:
_instrumentIcon: {fileID: 8738765378136697063}
_difficultyIcon: {fileID: 4230519954311980479}
_difficultyRing: {fileID: 8765432101234567004}
_percentText: {fileID: 4824570177518276672}
7 changes: 6 additions & 1 deletion Assets/Script/Gameplay/GameManager.Loading.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,12 @@ private void CreatePlayers()
player.RefreshPresets();
}

var lastHighScore = ScoreContainer.GetHighScore(Song.Hash, player.Profile.Id, player.Profile.CurrentInstrument, false)?.Score;
var lastHighScore = ScoreContainer.GetHighScore(
Song.Hash,
player.Profile.Id,
player.Profile.CurrentInstrument,
allowCacheUpdate: false,
preferredEnginePresetId: player.Profile.EnginePreset)?.Score;
YargLogger.LogFormatInfo("Current high score for player {0} on {1}: {2}",
player.Profile.Name, player.Profile.CurrentInstrument, lastHighScore ?? 0);

Expand Down
23 changes: 22 additions & 1 deletion Assets/Script/Menu/MusicLibrary/InstrumentDifficultyView.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.UI;
using YARG.Core.Game;
using YARG.Helpers.Extensions;
using YARG.Settings;

Expand All @@ -18,24 +20,34 @@ public class InstrumentDifficultyView : MonoBehaviour
[SerializeField]
private Image _difficultyIcon;

[SerializeField]
private Image _difficultyRing;

[SerializeField]
private TextMeshProUGUI _percentText;

private static readonly Color FcGold = new(1, 208 / 255f, 41 / 255f);
private static readonly Color DefaultEngineColor = Color.white;
private static readonly Color CasualEngineColor = new(0.9f, 0.3f, 0.9f);
private static readonly Color PrecisionEngineColor = new(1f, 0.9f, 0f);
private static readonly Color SoloTapsEngineColor = new(0.5411765f, 0.1686275f, 0.8862746f);
private static readonly Color CustomEngineColor = new(1f, 0.25f, 0.25f);


public void SetInfo(ViewType.ScoreInfo scoreInfo)
{
// Set width
var rect = GetComponent<RectTransform>();
var length = SettingsManager.Settings.ShowPercentDecimals.Value ? 150 : 130;
GetComponent<RectTransform>().sizeDelta = new Vector2(length, rect.sizeDelta.y);
rect.sizeDelta = new Vector2(length, rect.sizeDelta.y);

// Set instrument icon
_instrumentIcon.sprite = GetSprite($"InstrumentIcons[{scoreInfo.Instrument.ToResourceName()}]");

// Set difficulty icon
_difficultyIcon.sprite = GetSprite($"DifficultyIcons[{scoreInfo.Difficulty.ToString()}]");
_difficultyIcon.color = Color.white;
_difficultyRing.color = GetEngineColor(scoreInfo.EnginePresetId);

// Set percent value
if (SettingsManager.Settings.ShowPercentDecimals.Value)
Expand All @@ -60,5 +72,14 @@ private static Sprite GetSprite(string assetKey)

return sprite;
}

private static Color GetEngineColor(Guid enginePresetId) => enginePresetId switch
{
var id when id == Guid.Empty || id == EnginePreset.Default.Id => DefaultEngineColor,
var id when id == EnginePreset.Casual.Id => CasualEngineColor,
var id when id == EnginePreset.Precision.Id => PrecisionEngineColor,
var id when id == EnginePreset.SoloTaps.Id => SoloTapsEngineColor,
_ => CustomEngineColor
};
}
}
4 changes: 3 additions & 1 deletion Assets/Script/Menu/MusicLibrary/ViewTypes/SongViewType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public override string GetSideText(bool selected)
Difficulty = _playerScoreRecord.Difficulty,
Percent = _playerScoreRecord.GetPercent(),
Instrument = _playerScoreRecord.Instrument,
EnginePresetId = _playerScoreRecord.EnginePresetId,
IsFc = _playerScoreRecord.IsFc
};
}
Expand Down Expand Up @@ -228,7 +229,8 @@ private static void FetchHighScores(SongEntry songEntry, out PlayerScoreRecord p
{
var player = PlayerContainer.Players.First(e => !e.Profile.IsBot);
playerScoreRecord = ScoreContainer.GetPreferredHighScore(
songEntry.Hash, player.Profile.Id, player.Profile.CurrentInstrument);
songEntry.Hash, player.Profile.Id, player.Profile.CurrentInstrument,
preferredEnginePresetId: player.Profile.EnginePreset);
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions Assets/Script/Menu/MusicLibrary/ViewTypes/ViewType.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Cysharp.Text;
using System;
using YARG.Core;
using YARG.Core.Game;
using YARG.Helpers;
Expand All @@ -25,6 +26,7 @@ public struct ScoreInfo
public int Score;
public Difficulty Difficulty;
public Instrument Instrument;
public Guid EnginePresetId;
public bool IsFc;
}

Expand Down
9 changes: 8 additions & 1 deletion Assets/Script/Menu/ProfileList/ProfileSidebar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,14 @@ public void ChangeUseCymbalModels()

public void ChangeEngine()
{
_profile.EnginePreset = _enginePresetsByIndex[_engineDropdown.value];
var enginePreset = _enginePresetsByIndex[_engineDropdown.value];
if (_profile.EnginePreset == enginePreset)
{
return;
}

_profile.EnginePreset = enginePreset;
ScoreContainer.InvalidateScoreCache();
}

public void ChangeOpenLaneDisplayType()
Expand Down
Loading