一些修复和优化

This commit is contained in:
2026-07-20 02:22:51 +08:00
parent 818fc9a02f
commit 0a0872c4f4
49 changed files with 2008 additions and 262 deletions
+75
View File
@@ -25,6 +25,7 @@ public sealed class PackagingBuildGuard : IPreprocessBuildWithReport
var problems = new List<string>();
CheckPlayers(problems);
CheckPlayerSkills(problems);
CheckHeroes(problems);
CheckSongs(problems);
CheckMails(problems);
@@ -85,6 +86,24 @@ public sealed class PackagingBuildGuard : IPreprocessBuildWithReport
problems.Add(path + " :: uRankingScore = " + rank.floatValue);
}
}
PlayerExperienceRuntimeProbe expProbe;
if (SecureSaveVault.TryLoadJson("player_experience", "runtime", out expProbe) && expProbe != null && expProbe.playerExp != 0)
{
problems.Add("player_experience/runtime :: playerExp = " + expProbe.playerExp);
}
int backupExp;
if (PlayerProgressBackupService.TryRestorePlayerExperience(out backupExp) && backupExp != 0)
{
problems.Add("player progress backup :: playerExperience = " + backupExp);
}
}
[System.Serializable]
private sealed class PlayerExperienceRuntimeProbe
{
public int playerExp;
}
private static void CheckHeroes(List<string> problems)
@@ -118,6 +137,62 @@ public sealed class PackagingBuildGuard : IPreprocessBuildWithReport
}
}
private static void CheckPlayerSkills(List<string> problems)
{
foreach (var guid in AssetDatabase.FindAssets("t:userLevel_skills_SO"))
{
string path = AssetDatabase.GUIDToAssetPath(guid);
var so = AssetDatabase.LoadAssetAtPath<userLevel_skills_SO>(path);
if (so == null || so.skills == null || so.skills.Count == 0)
{
continue;
}
int enabledCount = 0;
int enabledIndex = -1;
for (int i = 0; i < so.skills.Count; i++)
{
var entry = so.skills[i];
if (entry != null && entry.isEnabled)
{
enabledCount++;
enabledIndex = i;
}
}
if (enabledCount != 1 || enabledIndex != 0)
{
problems.Add(path + " :: player skill selection must ship with only index 0 enabled, current enabledIndex=" + enabledIndex + ", enabledCount=" + enabledCount);
}
}
PlayerSkillSaveData runtimeSkillData;
if (SecureSaveVault.TryLoadJson("player_skills", "runtime", out runtimeSkillData) && runtimeSkillData != null)
{
if (runtimeSkillData.selectedSkillIndex != 0 ||
runtimeSkillData.postMatchRewardCounter != 0 ||
runtimeSkillData.skillSwitchCooldownRemainingMatches != 0)
{
problems.Add("player_skills/runtime :: selectedSkillIndex=" + runtimeSkillData.selectedSkillIndex
+ ", postMatchRewardCounter=" + runtimeSkillData.postMatchRewardCounter
+ ", skillSwitchCooldownRemainingMatches=" + runtimeSkillData.skillSwitchCooldownRemainingMatches);
}
}
PlayerSkillSaveData backupSkillData;
if (PlayerProgressBackupService.TryRestorePlayerSkill(out backupSkillData) && backupSkillData != null)
{
if (backupSkillData.selectedSkillIndex != 0 ||
backupSkillData.postMatchRewardCounter != 0 ||
backupSkillData.skillSwitchCooldownRemainingMatches != 0)
{
problems.Add("player progress backup :: playerSkill selectedSkillIndex=" + backupSkillData.selectedSkillIndex
+ ", postMatchRewardCounter=" + backupSkillData.postMatchRewardCounter
+ ", skillSwitchCooldownRemainingMatches=" + backupSkillData.skillSwitchCooldownRemainingMatches);
}
}
}
private static void CheckSongs(List<string> problems)
{
string[] recordFields =