rename/refactor
This commit is contained in:
parent
a7e33f217c
commit
444a04ee6f
|
|
@ -64,16 +64,20 @@ public class CornField : MonoBehaviour
|
|||
|
||||
// セーブデータから畑を復元
|
||||
availableLines.Clear();
|
||||
foreach (var line in gameData.PlantLines)
|
||||
foreach (var lineData in gameData.PlantLineDataList)
|
||||
{
|
||||
var plantLine = plantLines.First(x => x.LineName == line.Type);
|
||||
var plantLine = plantLines.First(x => x.LineName == lineData.Type);
|
||||
plantLine.gameObject.SetActive(true);
|
||||
plantLine.SetFieldLevel(line.Level);
|
||||
plantLine.SetFieldLevel(lineData.Level);
|
||||
availableLines.Add(plantLine);
|
||||
// コーン株の進行度初回データ作成
|
||||
if (!gameData.SeedlingDataList.Exists(x => x.type == line.Type))
|
||||
if (!gameData.SeedlingDataList.Exists(x => x.type == lineData.Type))
|
||||
{
|
||||
gameData.SeedlingDataList.Add(GenerateSeedlingData(line.Type, line.Level));
|
||||
gameData.SeedlingDataList.Add(new SeedlingProgressData
|
||||
{
|
||||
type = lineData.Type,
|
||||
Seedlings = Enumerable.Repeat(GenerateSeedlingGene(lineData.Level), plantLine.Seedlings.Count).ToList()
|
||||
});
|
||||
}
|
||||
}
|
||||
GameDataManager.SaveGameData();
|
||||
|
|
@ -211,10 +215,9 @@ public class CornField : MonoBehaviour
|
|||
private void SetData()
|
||||
{
|
||||
var gameData = GameDataManager.GameData;
|
||||
// 解放済みの畑
|
||||
// if (gameData.PlantLines == null || gameData.PlantLines.Count == 0)
|
||||
if (gameData.PlantLineDataList == null || gameData.PlantLineDataList.Count == 0)
|
||||
{
|
||||
gameData.PlantLines = new List<PlantLineData>
|
||||
gameData.PlantLineDataList = new List<PlantLineData>
|
||||
{
|
||||
new PlantLineData(PlantLineType.Top, CornFieldRank.Rank3),
|
||||
new PlantLineData(PlantLineType.Center, CornFieldRank.Rank1),
|
||||
|
|
@ -225,53 +228,11 @@ public class CornField : MonoBehaviour
|
|||
{
|
||||
gameData.SeedlingDataList = new List<SeedlingProgressData>();
|
||||
}
|
||||
// 収穫機レベル
|
||||
Debug.Log($"machineLevel {gameData.MachineLevel}");
|
||||
GameDataManager.SaveGameData();
|
||||
}
|
||||
|
||||
private SeedlingProgressData GenerateSeedlingData(PlantLineType type, CornFieldRank level)
|
||||
{
|
||||
switch (type)
|
||||
if (gameData.MachineLevel == 0)
|
||||
{
|
||||
case PlantLineType.Top:
|
||||
return new SeedlingProgressData
|
||||
{
|
||||
type = PlantLineType.Top,
|
||||
Seedlings = new List<SeedlingData>()
|
||||
{
|
||||
GenerateSeedlingGene(level),
|
||||
GenerateSeedlingGene(level),
|
||||
GenerateSeedlingGene(level),
|
||||
GenerateSeedlingGene(level),
|
||||
}
|
||||
};
|
||||
case PlantLineType.Center:
|
||||
return new SeedlingProgressData
|
||||
{
|
||||
type = PlantLineType.Center,
|
||||
Seedlings = new List<SeedlingData>()
|
||||
{
|
||||
GenerateSeedlingGene(level),
|
||||
GenerateSeedlingGene(level),
|
||||
GenerateSeedlingGene(level),
|
||||
}
|
||||
};
|
||||
case PlantLineType.Bottom:
|
||||
return new SeedlingProgressData
|
||||
{
|
||||
type = PlantLineType.Bottom,
|
||||
Seedlings = new List<SeedlingData>()
|
||||
{
|
||||
GenerateSeedlingGene(level),
|
||||
GenerateSeedlingGene(level),
|
||||
GenerateSeedlingGene(level),
|
||||
GenerateSeedlingGene(level),
|
||||
}
|
||||
};
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
||||
gameData.MachineLevel = 1;
|
||||
}
|
||||
GameDataManager.SaveGameData();
|
||||
}
|
||||
|
||||
private SeedlingData GenerateSeedlingGene(CornFieldRank level)
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ public class FacilityExpantion : MonoBehaviour
|
|||
// 適用できるかどうか判定
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (!GameDataManager.GameData.PlantLines.Exists(x => x.Type == item.Type))
|
||||
if (!GameDataManager.GameData.PlantLineDataList.Exists(x => x.Type == item.Type))
|
||||
{
|
||||
item.SetItem(false, CornFieldRank.Rank1);
|
||||
return;
|
||||
}
|
||||
item.SetItem(true, GameDataManager.GameData.PlantLines.First(x => x.Type == item.Type).Level);
|
||||
item.SetItem(true, GameDataManager.GameData.PlantLineDataList.First(x => x.Type == item.Type).Level);
|
||||
item.ClickObservable.Subscribe(_ =>
|
||||
{
|
||||
// 購入時コイン比較後、コイン減算(ここコイン増加と処理がかぶるとややこしい(Batchとかで処理するといいかも
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public sealed class GameData {
|
|||
// public bool isRandomAvatar;
|
||||
// CornField
|
||||
[DataMember(Name = "Data12")]
|
||||
public List<PlantLineData> PlantLines = new List<PlantLineData>();
|
||||
public List<PlantLineData> PlantLineDataList = new List<PlantLineData>();
|
||||
// [DataMember(Name = "Data13")]
|
||||
[DataMember(Name = "Data14")]
|
||||
public int MachineLevel = 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue