畑の強化通知を追加
This commit is contained in:
parent
1a15c70654
commit
3108138fc5
|
|
@ -2386,6 +2386,7 @@ MonoBehaviour:
|
|||
sideButtons: {fileID: 1735316554}
|
||||
promoteGrowthButton: {fileID: 730756546}
|
||||
upgradeButton: {fileID: 974444277}
|
||||
upgradeButtonBadge: {fileID: 737572416}
|
||||
harvestEffectPrefab: {fileID: 3900911687800301846, guid: e9a7e2b2f003d44fab5926ca6ec6d728,
|
||||
type: 3}
|
||||
harvestPrefab: {fileID: 8524901521850801684, guid: e642499b3643dab4ba05b02e8c6bde1c,
|
||||
|
|
@ -2593,6 +2594,12 @@ RectTransform:
|
|||
type: 3}
|
||||
m_PrefabInstance: {fileID: 737572414}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &737572416 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 9056949049436837036, guid: f8587bb162250fa48947d648e934781e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 737572414}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &769574933
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public class CornField : MonoBehaviour
|
|||
[SerializeField] private GameObject sideButtons;
|
||||
[SerializeField] private Button promoteGrowthButton;
|
||||
[SerializeField] private Button upgradeButton;
|
||||
[SerializeField] private GameObject upgradeButtonBadge;
|
||||
[SerializeField] private GameObject harvestEffectPrefab;
|
||||
[SerializeField] private GameObject harvestPrefab;
|
||||
[SerializeField] private Transform harvestSpawnTarget;
|
||||
|
|
@ -103,8 +104,7 @@ public class CornField : MonoBehaviour
|
|||
|
||||
upgradeButton.OnClickAsObservable().ThrottleFirst(TimeSpan.FromSeconds(.3f)).Subscribe(_ =>
|
||||
{
|
||||
LocalCacheManager.Save(CornFieldReinforcement.CornFieldResetCallbackTag, new Action(() => SetCornField()));
|
||||
TransitionManager.Instance.LoadSceneAdditive(GameScenes.Reinforcement);
|
||||
CornFieldReinforcement.ShowDialog(() => SetCornField());
|
||||
}).AddTo(this);
|
||||
|
||||
fertilizerButtonView.RewardButton.ThrottleFirst(TimeSpan.FromSeconds(.3f)).Subscribe(_ =>
|
||||
|
|
@ -309,7 +309,6 @@ public class CornField : MonoBehaviour
|
|||
}
|
||||
GameDataManager.SaveGameData();
|
||||
|
||||
|
||||
// セーブデータから畑を復元
|
||||
foreach (var plantLine in plantLines)
|
||||
{
|
||||
|
|
@ -420,6 +419,31 @@ public class CornField : MonoBehaviour
|
|||
// 設定のセーブ
|
||||
GameDataManager.SaveGameData();
|
||||
}).AddTo(compositeDisposable);
|
||||
|
||||
// 強化ボタン通知
|
||||
var upgradePrice = int.MaxValue;
|
||||
if (fieldData.FirstOrDefault(x => x.Type == CornFieldUpgradeType.Machine && x.level == gameData.MachineLevel + 1)?.price is int nextMachinePrice)
|
||||
{
|
||||
upgradePrice = Mathf.Min(upgradePrice, nextMachinePrice);
|
||||
}
|
||||
foreach (var plantLine in plantLines)
|
||||
{
|
||||
var upgradeType = FieldUpgradeData.PlantTypeToUpgradeType(plantLine.LineName);
|
||||
var nextRank = CornFieldRank.Rank1;
|
||||
if (gameData.PlantLineDataList.FirstOrDefault(data => data.Type == plantLine.LineName) is PlantLineData plantLineData)
|
||||
{
|
||||
if (plantLineData.Level == CornFieldRank.Rank3)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
nextRank = CornFieldReinforcement.GetNextRank(plantLineData.Level);
|
||||
}
|
||||
if (fieldData.FirstOrDefault(x => x.Type == upgradeType && x.level == (int) nextRank)?.price is int nextPrice)
|
||||
{
|
||||
upgradePrice = Mathf.Min(upgradePrice, nextPrice);
|
||||
}
|
||||
}
|
||||
upgradeButtonBadge.SetActive(upgradePrice <= CoinManager.Instance.OwnCoin);
|
||||
}
|
||||
|
||||
private IDisposable SetFertilizerTimer(int time)
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ public class CornFieldReinforcement : MonoBehaviour
|
|||
{
|
||||
public static readonly string CornFieldReinforcementDataTypeTag = "CornFieldReinforcementDataType";
|
||||
public static readonly string CornFieldReinforcementDataTag = "CornFieldReinforcementData";
|
||||
public static readonly string CornFieldResetCallbackTag = "CornFieldResetCallback";
|
||||
private static readonly string CornFieldResetCallbackTag = "CornFieldResetCallback";
|
||||
[SerializeField] private List<CornFieldReinforcementView> reinforcementViews;
|
||||
[SerializeField] private MachineUpgradeView machineUpgradeView;
|
||||
[SerializeField] private Button closeButton;
|
||||
|
||||
private CompositeDisposable compositeDisposable = new CompositeDisposable();
|
||||
private readonly CompositeDisposable compositeDisposable = new CompositeDisposable();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
|
@ -147,4 +147,10 @@ public class CornFieldReinforcement : MonoBehaviour
|
|||
throw new ArgumentOutOfRangeException(nameof(rank), rank, null);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ShowDialog(Action onClose = null)
|
||||
{
|
||||
LocalCacheManager.Save(CornFieldResetCallbackTag, onClose);
|
||||
TransitionManager.Instance.LoadSceneAdditive(GameScenes.Reinforcement);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue