一些修复和优化

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
@@ -189,9 +189,24 @@ public class levelBar_controller : MonoBehaviour
}
}
// Documentation text normalized.
// 等级评级改从持久化账本(AllyHeroDeployLedger)取真值,而非 SO 上被打包烘焙的镜像字段。
// 修复客户端更新后 SO 镜像为出厂 0 值、卡片显示过期等级、需重新给经验才同步的问题。
private string GetRatingFromSO(AllyHero_SO so)
{
return so != null ? so.GetDisplayLevelRatingKey() : "C";
if (so == null)
{
return "C";
}
if (so.ally_heroID <= 0)
{
return so.GetDisplayLevelRatingKey();
}
AllyHeroDeployLedger ledger = AllyHeroDeployLedger.EnsureInstance();
int currentExp = ledger.GetCurrentExp(so.ally_heroID);
int unlockedTier = ledger.GetUnlockedTierIndex(so.ally_heroID);
bool levelLocked = ledger.IsLevelLockEnabled(so.ally_heroID);
return so.GetDisplayLevelRatingKeyFromGrowth(currentExp, unlockedTier, levelLocked);
}
}
@@ -198,9 +198,25 @@ public class roleCard_prefabController : MonoBehaviour, IDropHandler, IBeginDrag
}
}
// 等级评级改从持久化账本(AllyHeroDeployLedger)取真值,而非 SO 上被打包烘焙的镜像字段。
// 修复客户端更新后 SO 镜像为出厂 0 值、卡片显示过期等级、需重新给经验才同步的问题。
private string GetRatingFromSO(AllyHero_SO so)
{
return so != null ? so.GetDisplayLevelRatingKey() : "C";
if (so == null)
{
return "C";
}
if (so.ally_heroID <= 0)
{
return so.GetDisplayLevelRatingKey();
}
AllyHeroDeployLedger ledger = AllyHeroDeployLedger.EnsureInstance();
int currentExp = ledger.GetCurrentExp(so.ally_heroID);
int unlockedTier = ledger.GetUnlockedTierIndex(so.ally_heroID);
bool levelLocked = ledger.IsLevelLockEnabled(so.ally_heroID);
return so.GetDisplayLevelRatingKeyFromGrowth(currentExp, unlockedTier, levelLocked);
}
// ---------------- Drag implementation so roleCard entries can be dragged as source ----------------
@@ -948,10 +948,26 @@ public class slots_heroSlots : MonoBehaviour, IDropHandler, IBeginDragHandler, I
}
}
// Documentation text normalized.
// 等级评级改从持久化账本(AllyHeroDeployLedger)取真值,而非 SO 上被打包烘焙的镜像字段。
// 修复:客户端更新后 SO 镜像为出厂 0 值,若账本尚未回写 SO 就渲染卡片,会显示过期等级,
// 且需玩家重新给一次经验才同步。这里直接读账本(getter 内部保证 InitializeIfNeeded),从根源消除不一致。
private string GetRatingFromSO(AllyHero_SO so)
{
return so != null ? so.GetDisplayLevelRatingKey() : "C";
if (so == null)
{
return "C";
}
if (so.ally_heroID <= 0)
{
return so.GetDisplayLevelRatingKey();
}
AllyHeroDeployLedger ledger = AllyHeroDeployLedger.EnsureInstance();
int currentExp = ledger.GetCurrentExp(so.ally_heroID);
int unlockedTier = ledger.GetUnlockedTierIndex(so.ally_heroID);
bool levelLocked = ledger.IsLevelLockEnabled(so.ally_heroID);
return so.GetDisplayLevelRatingKeyFromGrowth(currentExp, unlockedTier, levelLocked);
}
// Handle detail button click