装备系统完结,修复并加入很多
This commit is contained in:
@@ -14,6 +14,8 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
upgradeMaterial: {fileID: 11400000, guid: 4b7d886fc44e4cbe9db602da8c2f9c11, type: 2}
|
||||
breakthroughMaterial: {fileID: 11400000, guid: 6b403344b9414dbba95b7311c3ff57fa, type: 2}
|
||||
propertyTransferMaterial: {fileID: 11400000, guid: 11164239e74f4101ac94d6f7b80ac547, type: 2}
|
||||
finalDreamMaterial: {fileID: 11400000, guid: 7b38bd4f8a8d45d8bd5bd6de3893b995, type: 2}
|
||||
upgradeMaterialBase: 3
|
||||
upgradeMaterialGrowth: 3
|
||||
upgradeCoinsBase: 3
|
||||
@@ -29,3 +31,27 @@ MonoBehaviour:
|
||||
coinRequired: 4000
|
||||
- materialRequired: 200
|
||||
coinRequired: 10000
|
||||
memoryEntrustCost:
|
||||
transferMaterialRequired: 1
|
||||
memoryFragmentRequired: 100
|
||||
coinRequired: 1000
|
||||
tourEntrustStageCosts:
|
||||
- transferMaterialRequired: 1
|
||||
memoryFragmentRequired: 100
|
||||
coinRequired: 1000
|
||||
- transferMaterialRequired: 2
|
||||
memoryFragmentRequired: 250
|
||||
coinRequired: 2497
|
||||
- transferMaterialRequired: 3
|
||||
memoryFragmentRequired: 500
|
||||
coinRequired: 5000
|
||||
- transferMaterialRequired: 4
|
||||
memoryFragmentRequired: 800
|
||||
coinRequired: 8000
|
||||
- transferMaterialRequired: 5
|
||||
memoryFragmentRequired: 1200
|
||||
coinRequired: 12000
|
||||
finalDreamCost:
|
||||
transferMaterialRequired: 1
|
||||
memoryFragmentRequired: 500
|
||||
coinRequired: 5000
|
||||
|
||||
@@ -12,11 +12,26 @@ public class eUpdate_mtrSO : ScriptableObject
|
||||
public int coinRequired;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class PropertyTransferCost
|
||||
{
|
||||
[Tooltip("78121 required count")]
|
||||
public int transferMaterialRequired;
|
||||
[Tooltip("player_material required count")]
|
||||
public int memoryFragmentRequired;
|
||||
[Tooltip("coin required count")]
|
||||
public int coinRequired;
|
||||
}
|
||||
|
||||
[Header("Material Definitions")]
|
||||
[Tooltip("Fixed equipment upgrade consumable definition: 78101")]
|
||||
public equipmentConsumableSO upgradeMaterial;
|
||||
[Tooltip("Fixed equipment breakthrough consumable definition: 78111")]
|
||||
public equipmentConsumableSO breakthroughMaterial;
|
||||
[Tooltip("Fixed equipment transfer consumable definition: 78121")]
|
||||
public equipmentConsumableSO propertyTransferMaterial;
|
||||
[Tooltip("Fixed equipment final dream consumable definition: 78131")]
|
||||
public equipmentConsumableSO finalDreamMaterial;
|
||||
|
||||
[Header("Upgrade Cost")]
|
||||
[Tooltip("Upgrade material required count = base + level * growth")]
|
||||
@@ -33,6 +48,15 @@ public class eUpdate_mtrSO : ScriptableObject
|
||||
[Tooltip("Index 0-3 -> level 4/9/14/19")]
|
||||
public BreakthroughStageCost[] breakthroughStageCosts = new BreakthroughStageCost[4];
|
||||
|
||||
[Header("Property Transfer Cost")]
|
||||
[Tooltip("Fixed cost for 记忆嘱托")]
|
||||
public PropertyTransferCost memoryEntrustCost = new PropertyTransferCost();
|
||||
[Tooltip("Index 0-4 -> level 0-4 / 5-9 / 10-14 / 15-19 / 20")]
|
||||
public PropertyTransferCost[] tourEntrustStageCosts = new PropertyTransferCost[5];
|
||||
|
||||
[Header("Final Dream Cost")]
|
||||
public PropertyTransferCost finalDreamCost = new PropertyTransferCost();
|
||||
|
||||
public int GetUpgradeMaterialRequired(int level)
|
||||
{
|
||||
return Mathf.Max(0, upgradeMaterialBase + Mathf.Max(0, level) * upgradeMaterialGrowth);
|
||||
@@ -70,6 +94,54 @@ public class eUpdate_mtrSO : ScriptableObject
|
||||
return Mathf.Max(0, breakthroughStageCosts[stageIndex].coinRequired);
|
||||
}
|
||||
|
||||
public int GetMemoryEntrustTransferMaterialRequired()
|
||||
{
|
||||
return memoryEntrustCost != null ? Mathf.Max(0, memoryEntrustCost.transferMaterialRequired) : 0;
|
||||
}
|
||||
|
||||
public int GetMemoryEntrustMemoryFragmentRequired()
|
||||
{
|
||||
return memoryEntrustCost != null ? Mathf.Max(0, memoryEntrustCost.memoryFragmentRequired) : 0;
|
||||
}
|
||||
|
||||
public int GetMemoryEntrustCoinsRequired()
|
||||
{
|
||||
return memoryEntrustCost != null ? Mathf.Max(0, memoryEntrustCost.coinRequired) : 0;
|
||||
}
|
||||
|
||||
public int GetTourEntrustTransferMaterialRequired(int level)
|
||||
{
|
||||
PropertyTransferCost cost = GetTourEntrustCost(level);
|
||||
return cost != null ? Mathf.Max(0, cost.transferMaterialRequired) : 0;
|
||||
}
|
||||
|
||||
public int GetTourEntrustMemoryFragmentRequired(int level)
|
||||
{
|
||||
PropertyTransferCost cost = GetTourEntrustCost(level);
|
||||
return cost != null ? Mathf.Max(0, cost.memoryFragmentRequired) : 0;
|
||||
}
|
||||
|
||||
public int GetTourEntrustCoinsRequired(int level)
|
||||
{
|
||||
PropertyTransferCost cost = GetTourEntrustCost(level);
|
||||
return cost != null ? Mathf.Max(0, cost.coinRequired) : 0;
|
||||
}
|
||||
|
||||
public int GetFinalDreamMaterialRequired()
|
||||
{
|
||||
return finalDreamCost != null ? Mathf.Max(0, finalDreamCost.transferMaterialRequired) : 0;
|
||||
}
|
||||
|
||||
public int GetFinalDreamMemoryFragmentRequired()
|
||||
{
|
||||
return finalDreamCost != null ? Mathf.Max(0, finalDreamCost.memoryFragmentRequired) : 0;
|
||||
}
|
||||
|
||||
public int GetFinalDreamCoinsRequired()
|
||||
{
|
||||
return finalDreamCost != null ? Mathf.Max(0, finalDreamCost.coinRequired) : 0;
|
||||
}
|
||||
|
||||
public int GetBreakthroughStageIndex(int level)
|
||||
{
|
||||
switch (level)
|
||||
@@ -87,6 +159,47 @@ public class eUpdate_mtrSO : ScriptableObject
|
||||
}
|
||||
}
|
||||
|
||||
public int GetTransferStageIndex(int level)
|
||||
{
|
||||
if (level < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (level >= 20)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (level >= 15)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (level >= 10)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (level >= 5)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private PropertyTransferCost GetTourEntrustCost(int level)
|
||||
{
|
||||
int stageIndex = GetTransferStageIndex(level);
|
||||
if (stageIndex < 0 || tourEntrustStageCosts == null || stageIndex >= tourEntrustStageCosts.Length)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return tourEntrustStageCosts[stageIndex];
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
if (breakthroughStageCosts == null || breakthroughStageCosts.Length != 4)
|
||||
@@ -109,5 +222,37 @@ public class eUpdate_mtrSO : ScriptableObject
|
||||
breakthroughStageCosts[i].materialRequired = Mathf.Max(0, breakthroughStageCosts[i].materialRequired);
|
||||
breakthroughStageCosts[i].coinRequired = Mathf.Max(0, breakthroughStageCosts[i].coinRequired);
|
||||
}
|
||||
|
||||
memoryEntrustCost ??= new PropertyTransferCost();
|
||||
memoryEntrustCost.transferMaterialRequired = Mathf.Max(0, memoryEntrustCost.transferMaterialRequired);
|
||||
memoryEntrustCost.memoryFragmentRequired = Mathf.Max(0, memoryEntrustCost.memoryFragmentRequired);
|
||||
memoryEntrustCost.coinRequired = Mathf.Max(0, memoryEntrustCost.coinRequired);
|
||||
|
||||
if (tourEntrustStageCosts == null || tourEntrustStageCosts.Length != 5)
|
||||
{
|
||||
var resized = new PropertyTransferCost[5];
|
||||
if (tourEntrustStageCosts != null)
|
||||
{
|
||||
for (int i = 0; i < Mathf.Min(tourEntrustStageCosts.Length, resized.Length); i++)
|
||||
{
|
||||
resized[i] = tourEntrustStageCosts[i];
|
||||
}
|
||||
}
|
||||
|
||||
tourEntrustStageCosts = resized;
|
||||
}
|
||||
|
||||
for (int i = 0; i < tourEntrustStageCosts.Length; i++)
|
||||
{
|
||||
tourEntrustStageCosts[i] ??= new PropertyTransferCost();
|
||||
tourEntrustStageCosts[i].transferMaterialRequired = Mathf.Max(0, tourEntrustStageCosts[i].transferMaterialRequired);
|
||||
tourEntrustStageCosts[i].memoryFragmentRequired = Mathf.Max(0, tourEntrustStageCosts[i].memoryFragmentRequired);
|
||||
tourEntrustStageCosts[i].coinRequired = Mathf.Max(0, tourEntrustStageCosts[i].coinRequired);
|
||||
}
|
||||
|
||||
finalDreamCost ??= new PropertyTransferCost();
|
||||
finalDreamCost.transferMaterialRequired = Mathf.Max(0, finalDreamCost.transferMaterialRequired);
|
||||
finalDreamCost.memoryFragmentRequired = Mathf.Max(0, finalDreamCost.memoryFragmentRequired);
|
||||
finalDreamCost.coinRequired = Mathf.Max(0, finalDreamCost.coinRequired);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ public class equipUpdate : MonoBehaviour
|
||||
}
|
||||
|
||||
prevLevelText.text = $"{Mathf.Max(0, eqp_p_SO.level)}追忆等级";
|
||||
prevLevelText.color = ResolveEquipmentColor(GetQualityColorIndex(eqp_p_SO.level));
|
||||
prevLevelText.color = ResolveEquipmentColor(eqp_p_SO.GetVisualQualityColorIndex());
|
||||
}
|
||||
|
||||
private void RefreshNextLevelText()
|
||||
@@ -259,7 +259,7 @@ public class equipUpdate : MonoBehaviour
|
||||
}
|
||||
|
||||
nextLevelText.text = $"{Mathf.Max(0, nextLevelPreviewSO.level)}追忆等级";
|
||||
nextLevelText.color = ResolveEquipmentColor(GetQualityColorIndex(nextLevelPreviewSO.level));
|
||||
nextLevelText.color = ResolveEquipmentColor(nextLevelPreviewSO.GetVisualQualityColorIndex());
|
||||
}
|
||||
|
||||
private void RefreshMaterialRequirements()
|
||||
@@ -281,7 +281,7 @@ public class equipUpdate : MonoBehaviour
|
||||
{
|
||||
if (mtrInfo != null)
|
||||
{
|
||||
mtrInfo.text = "装备不合法";
|
||||
mtrInfo.text = "记忆不合法";
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -290,7 +290,7 @@ public class equipUpdate : MonoBehaviour
|
||||
{
|
||||
if (mtrInfo != null)
|
||||
{
|
||||
mtrInfo.text = "<color=#FF69B4>梦醒装备已满级</color>";
|
||||
mtrInfo.text = "已完成全部追忆";
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -328,7 +328,8 @@ public class equipUpdate : MonoBehaviour
|
||||
SpawnMaterialItem(
|
||||
need_mtrSO.upgradeMaterial.consumableSprite,
|
||||
need_mtrSO.upgradeMaterial.consumableName,
|
||||
upgradeMaterialRequired.ToString());
|
||||
EquipmentConsumableLedger.EnsureInstance().GetCount(need_mtrSO.upgradeMaterial.consumableKind),
|
||||
upgradeMaterialRequired);
|
||||
}
|
||||
|
||||
if (upgradeCoinsRequired > 0)
|
||||
@@ -336,7 +337,8 @@ public class equipUpdate : MonoBehaviour
|
||||
SpawnMaterialItem(
|
||||
coinSprite,
|
||||
"Coins",
|
||||
upgradeCoinsRequired.ToString());
|
||||
PlayerEconomyLedger.EnsureInstance().GetCoins(),
|
||||
upgradeCoinsRequired);
|
||||
}
|
||||
|
||||
if (upgradeMemoryRequired > 0)
|
||||
@@ -344,11 +346,12 @@ public class equipUpdate : MonoBehaviour
|
||||
SpawnMaterialItem(
|
||||
MemoryFragmentSprite,
|
||||
"记忆碎片",
|
||||
upgradeMemoryRequired.ToString());
|
||||
PlayerEconomyLedger.EnsureInstance().GetMaterial(),
|
||||
upgradeMemoryRequired);
|
||||
}
|
||||
}
|
||||
|
||||
private void SpawnMaterialItem(Sprite sprite, string displayName, string amountText)
|
||||
private void SpawnMaterialItem(Sprite sprite, string displayName, int ownedAmount, int requiredAmount)
|
||||
{
|
||||
GameObject instance = Instantiate(mtrPrefab, mtrParent);
|
||||
instance.SetActive(true);
|
||||
@@ -357,7 +360,7 @@ public class equipUpdate : MonoBehaviour
|
||||
materialPrefab item = instance.GetComponent<materialPrefab>();
|
||||
if (item != null)
|
||||
{
|
||||
item.Bind(sprite, displayName, amountText, true, false, null);
|
||||
item.BindOwnedRequired(sprite, displayName, ownedAmount, requiredAmount, true, false, null);
|
||||
item.SetSelected(true);
|
||||
if (item.materialButton != null)
|
||||
{
|
||||
@@ -408,7 +411,7 @@ public class equipUpdate : MonoBehaviour
|
||||
|
||||
if (level >= 20)
|
||||
{
|
||||
return "梦醒装备已满级";
|
||||
return "此记忆已完成全部追忆";
|
||||
}
|
||||
|
||||
if (RequiresTour(level))
|
||||
@@ -544,31 +547,6 @@ public class equipUpdate : MonoBehaviour
|
||||
return itemPrefab.itemBtmColors[safeIndex];
|
||||
}
|
||||
|
||||
private static int GetQualityColorIndex(int level)
|
||||
{
|
||||
if (level >= 20)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
if (level >= 15)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (level >= 10)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (level >= 5)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static bool IsLegalLevel(int level)
|
||||
{
|
||||
return level >= 0 && level <= 20;
|
||||
|
||||
Reference in New Issue
Block a user