功能批量实现 优化 服务端 新浮动小游戏框架 新界面UI
This commit is contained in:
@@ -137,6 +137,10 @@ public class settlementController : MonoBehaviour
|
||||
[SerializeField] private Ease introMvpEnterEase = Ease.OutCubic;
|
||||
[SerializeField] private bool introTweenUseUnscaledTime = true;
|
||||
|
||||
[Header("Settle Rewards")]
|
||||
public GameObject rewardPrefab;
|
||||
public Transform rewardParent;
|
||||
|
||||
private int targetPmScore;
|
||||
private int targetIdolScore;
|
||||
private int targetTotalScore;
|
||||
@@ -159,6 +163,7 @@ public class settlementController : MonoBehaviour
|
||||
private bool settlementHistoryRecorded;
|
||||
private bool settlementHeroStatsRecorded;
|
||||
private bool roomScoreSubmitTriggered;
|
||||
private bool settlementRewardsGranted;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -202,6 +207,7 @@ public class settlementController : MonoBehaviour
|
||||
RegisterCurrentLineupDeployCount();
|
||||
settlementHistoryRecorded = false;
|
||||
settlementHeroStatsRecorded = false;
|
||||
settlementRewardsGranted = false;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -321,7 +327,7 @@ public class settlementController : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
allHeroes = Resources.LoadAll<AllyHero_SO>(string.Empty);
|
||||
allHeroes = RuntimeResourcesCache.LoadAllAllyHeroes();
|
||||
if (allHeroes == null || allHeroes.Length == 0)
|
||||
{
|
||||
return;
|
||||
@@ -487,7 +493,7 @@ public class settlementController : MonoBehaviour
|
||||
{
|
||||
if (_cachedAllyHeroSOs == null || _cachedAllyHeroSOs.Length == 0)
|
||||
{
|
||||
_cachedAllyHeroSOs = Resources.LoadAll<AllyHero_SO>(string.Empty);
|
||||
_cachedAllyHeroSOs = RuntimeResourcesCache.LoadAllAllyHeroes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,6 +533,7 @@ public class settlementController : MonoBehaviour
|
||||
settlementHistoryRecorded = false;
|
||||
settlementHeroStatsRecorded = false;
|
||||
roomScoreSubmitTriggered = false;
|
||||
settlementRewardsGranted = false;
|
||||
OnSettlementCompleted?.Invoke();
|
||||
equipSmelt.NotifySettlementCompleted();
|
||||
|
||||
@@ -561,6 +568,7 @@ public class settlementController : MonoBehaviour
|
||||
targetTotalPercent = (float)targetTotalScore / Mathf.Max(1, _1000000) * 100f;
|
||||
|
||||
PlayerSkillService.NotifySettlementCompleted(targetIdolScore);
|
||||
GrantSettlementRewardsAndDisplay();
|
||||
|
||||
finalScore_Text.text = targetTotalScore.ToString();
|
||||
pmScoreSum_Text.text = targetPmScore.ToString();
|
||||
@@ -748,6 +756,90 @@ public class settlementController : MonoBehaviour
|
||||
StartSettlementIntro();
|
||||
}
|
||||
|
||||
private void GrantSettlementRewardsAndDisplay()
|
||||
{
|
||||
if (settlementRewardsGranted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
settlementRewardsGranted = true;
|
||||
|
||||
int coinReward = Mathf.CeilToInt((targetTotalScore / 10000f) * 0.75f);
|
||||
int materialReward = Mathf.CeilToInt((targetTotalScore / 10000f) * 0.20f);
|
||||
int playerExpReward = Mathf.FloorToInt(targetTotalScore / 100000f);
|
||||
|
||||
moneyToGive_thisLevel = coinReward;
|
||||
|
||||
Player_SO playerData = LoadDefaultPlayerSo();
|
||||
if (playerData != null)
|
||||
{
|
||||
PlayerEconomyLedger.EnsureInstance().AttachPlayerData(playerData);
|
||||
PlayerExperienceLedger.EnsureInstance().AttachPlayerData(playerData);
|
||||
ExpBottleLedger.EnsureInstance().AttachPlayerData(playerData);
|
||||
DushMaterialLedger.EnsureInstance().AttachPlayerData(playerData);
|
||||
}
|
||||
|
||||
PlayerEconomyLedger.EnsureInstance().AddCoins(coinReward);
|
||||
PlayerEconomyLedger.EnsureInstance().AddMaterial(materialReward);
|
||||
PlayerExperienceLedger.EnsureInstance().AddExperience(playerExpReward);
|
||||
|
||||
PlayerEconomyLedger.EnsureInstance().SaveNow();
|
||||
PlayerExperienceLedger.EnsureInstance().SaveNow();
|
||||
|
||||
if (reward_money_Text != null)
|
||||
{
|
||||
reward_money_Text.text = $"+{coinReward}";
|
||||
}
|
||||
|
||||
if (reward_idolEXP_bottle_Text != null)
|
||||
{
|
||||
reward_idolEXP_bottle_Text.text = $"+{materialReward}";
|
||||
}
|
||||
|
||||
if (reward_playerEXP_Text != null)
|
||||
{
|
||||
reward_playerEXP_Text.text = $"+{playerExpReward}";
|
||||
}
|
||||
|
||||
RebuildSettlementRewardVisuals(coinReward, materialReward, playerExpReward);
|
||||
}
|
||||
|
||||
private void RebuildSettlementRewardVisuals(int coinReward, int materialReward, int playerExpReward)
|
||||
{
|
||||
if (rewardParent != null)
|
||||
{
|
||||
for (int i = rewardParent.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
Destroy(rewardParent.GetChild(i).gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
SpawnSettlementReward(global::rewardPrefab.RewardVisualType.Coins, coinReward);
|
||||
SpawnSettlementReward(global::rewardPrefab.RewardVisualType.Material, materialReward);
|
||||
SpawnSettlementReward(global::rewardPrefab.RewardVisualType.PlayerExp, playerExpReward);
|
||||
}
|
||||
|
||||
private void SpawnSettlementReward(global::rewardPrefab.RewardVisualType rewardType, int amount)
|
||||
{
|
||||
if (rewardPrefab == null || rewardParent == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject go = Instantiate(rewardPrefab, rewardParent);
|
||||
global::rewardPrefab prefab = go != null ? go.GetComponent<global::rewardPrefab>() : null;
|
||||
if (prefab != null)
|
||||
{
|
||||
prefab.Bind(rewardType, amount);
|
||||
}
|
||||
}
|
||||
|
||||
private static Player_SO LoadDefaultPlayerSo()
|
||||
{
|
||||
return RuntimeResourcesCache.LoadDefaultPlayerSo();
|
||||
}
|
||||
|
||||
private void TryRecordRecentPlayHistory(int noteCountRaw)
|
||||
{
|
||||
if (GameConfig.autoPlayEnabled)
|
||||
@@ -1287,7 +1379,7 @@ public class settlementController : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
dlcData[] allDlcs = Resources.LoadAll<dlcData>("");
|
||||
dlcData[] allDlcs = RuntimeResourcesCache.LoadAllDlcs();
|
||||
dlcData foundDlc = null;
|
||||
|
||||
for (int i = 0; i < allDlcs.Length; i++)
|
||||
@@ -2038,7 +2130,7 @@ public class settlementController : MonoBehaviour
|
||||
{
|
||||
if (_cachedAllyHeroSOs == null || _cachedAllyHeroSOs.Length == 0)
|
||||
{
|
||||
_cachedAllyHeroSOs = Resources.LoadAll<AllyHero_SO>("");
|
||||
_cachedAllyHeroSOs = RuntimeResourcesCache.LoadAllAllyHeroes();
|
||||
}
|
||||
foreach (var a in _cachedAllyHeroSOs)
|
||||
{
|
||||
@@ -2054,7 +2146,7 @@ public class settlementController : MonoBehaviour
|
||||
{
|
||||
if (_cachedAllyHeroSOs == null || _cachedAllyHeroSOs.Length == 0)
|
||||
{
|
||||
_cachedAllyHeroSOs = Resources.LoadAll<AllyHero_SO>("");
|
||||
_cachedAllyHeroSOs = RuntimeResourcesCache.LoadAllAllyHeroes();
|
||||
}
|
||||
if (_cachedAllyHeroSOs != null && _cachedAllyHeroSOs.Length > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user