成就系统 巨大修改 新的ui 黑白效果 等一堆

This commit is contained in:
FloatGaming
2026-01-23 18:43:23 +08:00
parent f3ece026ca
commit 0e47864569
256 changed files with 134131 additions and 31192 deletions
+10 -7
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using UnityEngine;
@@ -51,7 +51,7 @@ public class SongData : ScriptableObject
public float songDuration;
public int game_enterTimes;
public int time_totalPlayingTime;
public float time_totalPlayingTime;
public DateTime uploadData;
[Header("各种图")]
@@ -106,13 +106,15 @@ public class SongData : ScriptableObject
if (chartFileMap == null) chartFileMap = new Dictionary<int, TextAsset>();
// If chartFiles exist in inspector, ensure maps reflect them
if (chartFiles != null && chartFiles.Count > 0)
{
SyncRecordsFromChartFiles();
SyncChartFileMap();
}
// Commented out automatic sync — disabled per request
// if (chartFiles != null && chartFiles.Count > 0)
// {
// SyncRecordsFromChartFiles();
// SyncChartFileMap();
// }
}
/*
// 构造函数:从 JSON 数据创建 SongData
public SongData(SongDataSerializable jsonData)
{
@@ -160,6 +162,7 @@ public class SongData : ScriptableObject
chartScoreMap[entry.difficulty] = entry.lastScoreForThisDifficulty;
}
}
*/
// 获取所有难度中最高的成绩(谱面分 + 偶像分 的最大和)
public int CalculateHighestPersonalRecord()
@@ -159,6 +159,85 @@ MonoBehaviour:
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u97F3\u4E50: artistName | \u66F2\u7ED8: painterName | \u5236\u8C31: charterName"
--- !u!1 &683142711094714909
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4553002270050802252}
- component: {fileID: 5067636407003327723}
- component: {fileID: 3544928675621084937}
m_Layer: 5
m_Name: diff
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4553002270050802252
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 683142711094714909}
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: 1613555900959276112}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -20, y: -28.1}
m_SizeDelta: {x: 160, y: 22}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5067636407003327723
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 683142711094714909}
m_CullTransparentMesh: 1
--- !u!114 &3544928675621084937
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 683142711094714909}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 775c674e81662c644b64550d2e8f74e0, type: 3}
m_FontSize: 22
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
m_MaxSize: 40
m_Alignment: 6
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "(\u6700\u9AD8\u5206\u6570\u96BE\u5EA6)"
--- !u!1 &1198053886828452625
GameObject:
m_ObjectHideFlags: 0
@@ -320,13 +399,34 @@ MonoBehaviour:
joinTime_and_dlcName_Text: {fileID: 5869685068699755495}
songOverallDescriptionText: {fileID: 2031114915171946668}
highestScoreText: {fileID: 1132493786035819634}
highestScoreDifficultyText: {fileID: 3544928675621084937}
difficultyIDText: {fileID: 6948039996079800055}
songIDText: {fileID: 6350822755597574453}
buttonImage: {fileID: 4974503315116154840}
scoreLevelImage: {fileID: 9222537835252028022}
profileImage: {fileID: 7018466335066945843}
song_songSerialID: 0
selected_boarder: {fileID: 4758992877847013954}
fade_image: {fileID: 8405752277710552670}
easePercent: 1
ssPercent: 0.95
sPercent: 0.9
aPercent: 0.8
bPercent: 0.7
cPercent: 0.6
dPercent: 0.5
ePercent: 0.4
fPercent: 0.3
easeSprite: {fileID: 21300000, guid: 1b7d3065f66d15b45b170444124b57ca, type: 3}
ssSprite: {fileID: 21300000, guid: c218e48d1b0d49541bee4a99fffc738c, type: 3}
sSprite: {fileID: 21300000, guid: 8f6b0c65c13b1ed478dd3f37e989f2c5, type: 3}
aSprite: {fileID: 21300000, guid: 61dd84e2a30a06a4b913933e34767f4b, type: 3}
bSprite: {fileID: 21300000, guid: ff77da93eaa5bdd44966dad03e35f56b, type: 3}
cSprite: {fileID: 21300000, guid: a919404cd6477be4c878442426de1d13, type: 3}
dSprite: {fileID: 21300000, guid: a3a60d742fbaa4b4081c9b4b73da8b96, type: 3}
eSprite: {fileID: 21300000, guid: 698d2276a92e5754d9064e9e0c3494bf, type: 3}
fSprite: {fileID: 21300000, guid: 37afeb5a99b12ff4995ab22436f2c8c5, type: 3}
ufSprite: {fileID: 21300000, guid: dc19bff00a17ee14ebbb6bbedf411046, type: 3}
minAlpha: 0
maxAlpha: 0.25
blinkDuration: 2
@@ -1015,6 +1115,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2006200464526798236}
- {fileID: 4553002270050802252}
m_Father: {fileID: 5796882771854016848}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
@@ -1337,4 +1438,4 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u5386\u53F2\u6700\u9AD8\u603B\u5206"
m_Text: "\u6700\u9AD8\u603B\u5206"
@@ -2,6 +2,7 @@ using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System.Collections;
using DG.Tweening;
public class SongButton : MonoBehaviour
{
@@ -13,9 +14,11 @@ public class SongButton : MonoBehaviour
public Text joinTime_and_dlcName_Text;
public Text songOverallDescriptionText;
public Text highestScoreText;
public Text highestScoreDifficultyText;
public Text difficultyIDText;
public Text songIDText;
public Image buttonImage;
public Image scoreLevelImage;
[Header("头图")]
public Image profileImage;
public int song_songSerialID;
@@ -23,6 +26,28 @@ public class SongButton : MonoBehaviour
public Image selected_boarder;
public Image fade_image;
[Header("计数百分比")]
public float easePercent = 1f;
public float ssPercent = 0.95f;
public float sPercent = 0.9f;
public float aPercent = 0.8f;
public float bPercent = 0.7f;
public float cPercent = 0.6f;
public float dPercent = 0.5f;
public float ePercent = 0.4f;
public float fPercent = 0.3f;
[Header("阶段图")]
public Sprite easeSprite;
public Sprite ssSprite;
public Sprite sSprite;
public Sprite aSprite;
public Sprite bSprite;
public Sprite cSprite;
public Sprite dSprite;
public Sprite eSprite;
public Sprite fSprite;
public Sprite ufSprite;
[Header("Fade Image Settings")]
public float minAlpha = 0f;
public float maxAlpha = 1f;
@@ -72,32 +97,122 @@ public class SongButton : MonoBehaviour
songOverallDescriptionText.text = string.IsNullOrEmpty(sd.thisLevel_overallDescription) ? "暂无歌曲简介。" : sd.thisLevel_overallDescription;
}
int bestTotal = 0;
// Robust logic: compute best total across chartFiles if present
int bestTotal = -1;
int bestDiff = -1;
if (sd.personalRecordMap != null)
if (sd.chartFiles != null && sd.chartFiles.Count > 0)
{
foreach (var kvp in sd.personalRecordMap)
foreach (var entry in sd.chartFiles)
{
int diff = kvp.Key;
int p = kvp.Value;
int i = sd.GetIdolRecord(diff);
int combined = p + i;
if (combined > bestTotal)
if (entry == null) continue;
int total = 0;
// prefer stored total if > 0
if (entry.totalPersonalRecordForThisDifficulty > 0)
{
bestTotal = combined;
bestDiff = diff;
total = entry.totalPersonalRecordForThisDifficulty;
}
else
{
// else compute from entry fields
int p = entry.chartPersonalRecordForThisDifficulty;
int i = entry.idolPersonalRecordForThisDifficulty;
total = p + i;
// as fallback also check SongData maps
if (total == 0 && sd.personalRecordMap != null)
{
int pm = sd.personalRecordMap.ContainsKey(entry.difficulty) ? sd.personalRecordMap[entry.difficulty] : 0;
int im = sd.idolRecordMap != null && sd.idolRecordMap.ContainsKey(entry.difficulty) ? sd.idolRecordMap[entry.difficulty] : 0;
total = pm + im;
}
}
if (bestDiff == -1 || total > bestTotal)
{
bestTotal = total;
bestDiff = entry.difficulty;
}
}
}
// If still not found, fallback to maps
if (bestDiff == -1)
{
if (sd.personalRecordMap != null)
{
foreach (var kvp in sd.personalRecordMap)
{
int diff = kvp.Key;
int p = kvp.Value;
int i = sd.GetIdolRecord(diff);
int combined = p + i;
if (bestDiff == -1 || combined > bestTotal)
{
bestTotal = combined;
bestDiff = diff;
}
}
}
}
// final fallback
if (bestDiff == -1)
{
bestTotal = sd.personalRecord;
bestDiff = sd.thisLevel_selectedDifficultyID;
}
if (bestTotal < 0) bestTotal = 0;
if (highestScoreText != null) highestScoreText.text = bestTotal.ToString();
// Map difficulty index to label and set highestScoreDifficultyText as (Label)
if (highestScoreDifficultyText != null)
{
string label = "";
switch (bestDiff)
{
case 0: label = "(Easy)"; break;
case 1: label = "(Hard)"; break;
case 2: label = "(Incredible)"; break;
case 3: label = "(Impossible)"; break;
default: label = ""; break;
}
highestScoreDifficultyText.text = label;
}
// Assign scoreLevelImage based on thresholds relative to 2,000,000
if (scoreLevelImage != null)
{
Sprite chosenSprite = null;
float baseScore = 2000000f;
// Evaluate from top to bottom thresholds
if (bestTotal >= baseScore * easePercent && easeSprite != null)
chosenSprite = easeSprite;
else if (bestTotal >= baseScore * ssPercent && ssSprite != null)
chosenSprite = ssSprite;
else if (bestTotal >= baseScore * sPercent && sSprite != null)
chosenSprite = sSprite;
else if (bestTotal >= baseScore * aPercent && aSprite != null)
chosenSprite = aSprite;
else if (bestTotal >= baseScore * bPercent && bSprite != null)
chosenSprite = bSprite;
else if (bestTotal >= baseScore * cPercent && cSprite != null)
chosenSprite = cSprite;
else if (bestTotal >= baseScore * dPercent && dSprite != null)
chosenSprite = dSprite;
else if (bestTotal >= baseScore * ePercent && eSprite != null)
chosenSprite = eSprite;
else if (bestTotal >= baseScore * fPercent && fSprite != null)
chosenSprite = fSprite;
else if (ufSprite != null)
chosenSprite = ufSprite;
if (chosenSprite != null)
scoreLevelImage.sprite = chosenSprite;
}
// Determine displayed difficulty: show the highest difficultyLEVEL present in chartFiles (if any)
string diffDisplay = "0";
if (sd.chartFiles != null && sd.chartFiles.Count > 0)
+4 -4
View File
@@ -18,7 +18,7 @@ public class SongDataSerializable
public float songDuration;
public int game_enterTimes;
public int time_totalPlayingTime;
public float time_totalPlayingTime;
public string uploadData;
public int difficultyID;
@@ -26,7 +26,7 @@ public class SongDataSerializable
public bool _if_level_is_EASE;
public int max_comboRecord;
public int personalRecord; // 存储总最高分 (个人分 + 偶像分)
public int personalRecord; // ߷ (˷ + ż)
public Dictionary<int, int> difficultyNumberMap = new Dictionary<int, int>();
public Dictionary<int, int> personalRecordMap = new Dictionary<int, int>();
public Dictionary<int, int> idolRecordMap = new Dictionary<int, int>();
@@ -60,7 +60,7 @@ public class SongDataSerializable
personalRecordMap = songData.personalRecordMap;
idolRecordMap = songData.idolRecordMap;
chartScoreMap = songData.chartScoreMap;
personalRecord = songData.personalRecord; // 存储综合最高分
personalRecord = songData.personalRecord; // ۺ߷
chartFileMap = new Dictionary<int, string>();
/*foreach (var kvp in songData.chartFileMap)
@@ -97,7 +97,7 @@ public class SongDataSerializable
songData.personalRecordMap = personalRecordMap;
songData.idolRecordMap = idolRecordMap;
songData.chartScoreMap = chartScoreMap;
songData.personalRecord = personalRecord; // 赋值综合最高分
songData.personalRecord = personalRecord; // ֵۺ߷
foreach (var kvp in chartFileMap)
{
+4
View File
@@ -28,4 +28,8 @@ public class dlcData : ScriptableObject
[Header("DLC所含曲目(ScriptableObjects")]
public List<SongData> songList = new List<SongData>();
[Header("本DLC结算音乐")]
[Tooltip("在结算界面播放的背景音乐AudioClip")]
public AudioClip settlementMusic;
}
+62 -3
View File
@@ -226,6 +226,50 @@ public class selected_songInfo : MonoBehaviour
c_DifficultyImage.color = chosen;
}
}
// Update sumScore_thisDifficulty based on currently selected difficulty
if (sumScore_thisDifficulty != null)
{
int sel = song.thisLevel_selectedDifficultyID;
int totalForDifficulty = 0;
// Try to find ChartFileEntry for this difficulty
if (song.chartFiles != null)
{
foreach (var entry in song.chartFiles)
{
if (entry != null && entry.difficulty == sel)
{
if (entry.totalPersonalRecordForThisDifficulty > 0)
{
totalForDifficulty = entry.totalPersonalRecordForThisDifficulty;
}
else
{
int p = song.GetPersonalRecord(sel);
int i = song.GetIdolRecord(sel);
totalForDifficulty = p + i;
}
break;
}
}
}
// fallback to maps if chartFiles did not contain entry
if (totalForDifficulty == 0)
{
int p = song.GetPersonalRecord(sel);
int i = song.GetIdolRecord(sel);
totalForDifficulty = p + i;
}
sumScore_thisDifficulty.text = totalForDifficulty.ToString();
}
// Update total_gameTime once from SongData.game_enterTimes (no dynamic change on difficulty switch)
if (total_gameTime != null)
{
int enterTimes = song.game_enterTimes;
total_gameTime.text = enterTimes.ToString();
}
}
else
{
@@ -247,6 +291,9 @@ public class selected_songInfo : MonoBehaviour
// restore original difficulty button backgrounds and text colors
SetDifficultyButtonBackground(-1);
if (sumScore_thisDifficulty != null) sumScore_thisDifficulty.text = "0";
if (total_gameTime != null) total_gameTime.text = "0";
}
}
@@ -326,7 +373,7 @@ public class selected_songInfo : MonoBehaviour
}
}
private void OnEnterDetailPageClicked()
public void OnEnterDetailPageClicked()
{
if (SongDataHolder.SelectedSongData != null)
{
@@ -705,10 +752,11 @@ public class selected_songInfo : MonoBehaviour
var pauseMgr = PauseManager.Instance ?? FindObjectOfType<PauseManager>();
pauseMgr?.Pause(false);
// small buffer to avoid hitching immediately after unpause: wait configured realtime delay from GameManager
// small buffer to avoid hitching immediately after unpause: wait configured delay from GameManager
// Use scaled WaitForSeconds so PauseManager (Escape) will pause the countdown
float unpauseBuffer = 3f;
if (gameManager != null) unpauseBuffer = Mathf.Max(0f, gameManager.playbackStartDelay);
yield return new WaitForSecondsRealtime(unpauseBuffer);
yield return new WaitForSeconds(unpauseBuffer);
// Start spawning notes
if (beatmapManager != null && beatmapManager.beatmap != null)
@@ -811,4 +859,15 @@ public class selected_songInfo : MonoBehaviour
}
return 0f;
}
private string FormatSeconds(int totalSeconds)
{
if (totalSeconds <= 0) return "0:00";
int hours = totalSeconds / 3600;
int minutes = (totalSeconds % 3600) / 60;
int seconds = totalSeconds % 60;
if (hours > 0)
return string.Format("{0}:{1:D2}:{2:D2}", hours, minutes, seconds);
return string.Format("{0}:{1:D2}", minutes, seconds);
}
}