Merge branch 'develop' of bitbucket.org:usaya/popcorn into develop

This commit is contained in:
koya_15 2021-09-30 11:24:14 +09:00
commit 4e7161fa74
9 changed files with 3541 additions and 18724 deletions

View File

@ -785,7 +785,7 @@ RectTransform:
- {fileID: 308891213}
- {fileID: 698470367}
m_Father: {fileID: 2144327477}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -991,6 +991,80 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1720684618}
m_CullTransparentMesh: 0
--- !u!1 &1728771686
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1728771687}
- component: {fileID: 1728771689}
- component: {fileID: 1728771688}
m_Layer: 5
m_Name: BG
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1728771687
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1728771686}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2144327477}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1728771688
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1728771686}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1728771689
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1728771686}
m_CullTransparentMesh: 0
--- !u!1 &1848874147
GameObject:
m_ObjectHideFlags: 0
@ -1130,6 +1204,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1728771687}
- {fileID: 884928058}
m_Father: {fileID: 0}
m_RootOrder: 0

View File

@ -29,7 +29,6 @@ public class CornField : MonoBehaviour
[SerializeField] private Transform animationTarget;
[Space]
[SerializeField] private List<PlantLine> plantLines = new List<PlantLine>();
private readonly List<PlantLine> availableLines = new List<PlantLine>();
private static readonly int maxPeriod = 60;
private static readonly int minPeriod = 45;
private static readonly int harvestedFrameInterval = 3;
@ -59,34 +58,20 @@ public class CornField : MonoBehaviour
counterView.Initialize(gameData.cornSeed);
SetData();
var fieldData = SpreadsheetDataManager.Instance.GetBaseDataList<FieldUpgradeData>(Const.FieldUpgradeDataSheet);
// 畑リセット
foreach (var line in plantLines)
{
line.gameObject.SetActive(false);
}
// セーブデータから畑を復元
availableLines.Clear();
foreach (var lineData in gameData.PlantLineDataList)
{
var plantLine = plantLines.First(x => x.LineName == lineData.Type);
plantLine.gameObject.SetActive(true);
plantLine.SetFieldLevel(lineData.Level);
availableLines.Add(plantLine);
// コーン株の進行度初回データ作成
if (!gameData.SeedlingDataList.Exists(x => x.type == lineData.Type))
{
gameData.SeedlingDataList.Add(new SeedlingProgressData
{
type = lineData.Type,
Seedlings = Enumerable.Repeat(GenerateSeedlingGene(lineData.Level), plantLine.Seedlings.Count).ToList()
});
}
}
GameDataManager.SaveGameData();
SetCornField();
upgradeButton.OnClickAsObservable().Subscribe(_ =>
{
LocalCacheManager.Save(CornFieldReinforcement.CornFieldResetCallbackTag, new Action(SetCornField));
TransitionManager.Instance.LoadSceneAdditive(GameScenes.Reinforcement);
}).AddTo(this);
// 収穫カウンター+吸収演出
cornHarvester.FinishHarvested
.Scan((list, newList) => (newList.count, list.colliders.Concat(newList.colliders).ToList()))
@ -130,71 +115,101 @@ public class CornField : MonoBehaviour
counterView.SetHarvestedCount(x.count);
});
}).AddTo(this);
// 株設定
foreach (var line in availableLines)
}
public void SetCornField()
{
compositeDisposable.Clear();
var gameData = GameDataManager.GameData;
var fieldData = SpreadsheetDataManager.Instance.GetBaseDataList<FieldUpgradeData>(Const.FieldUpgradeDataSheet);
// コーン株の進行度初回データ作成
foreach (var lineData in gameData.PlantLineDataList)
{
var seedlingDataIndex = gameData.SeedlingDataList.FindIndex(x => x.type == line.LineName);
var lineData = gameData.SeedlingDataList[seedlingDataIndex];
var i = 0;
foreach (var seedling in line.Seedlings)
// コーン株の進行度初回データ作成
if (!gameData.SeedlingDataList.Exists(data => data.type == lineData.Type))
{
var index = i;
i++;
seedling.SetSeedlingGene(lineData.Seedlings[index].FirstTime, lineData.Seedlings[index].Period, lineData.Seedlings[index].Level);
#if DEVELOPMENT_BUILD || UNITY_EDITOR
if (UsayaStorageManager.LoadOrDefault(UsayaStorageFilename.Settings_Data, "DebugFastGrowing", false))
var plantLine = plantLines.First(line => line.LineName == lineData.Type);
gameData.SeedlingDataList.Add(new SeedlingProgressData
{
seedling.SetSeedlingGene(lineData.Seedlings[index].FirstTime, lineData.Seedlings[index].Period / 3, lineData.Seedlings[index].Level);
}
#endif
// 収穫通知
seedling.Harvested.Subscribe(_ =>
type = lineData.Type,
Seedlings = Enumerable.Range(0, plantLine.Seedlings.Count).Select(_ => GenerateSeedlingGene(lineData.Level)).ToList()
});
}
}
GameDataManager.SaveGameData();
// セーブデータから畑を復元
foreach (var plantLine in plantLines)
{
if (gameData.PlantLineDataList.FirstOrDefault(data => data.Type == plantLine.LineName) is PlantLineData plantLineData)
{
plantLine.gameObject.SetActive(true);
plantLine.SetFieldLevel(plantLineData.Level);
for (int i = 0; i < plantLine.Seedlings.Count; i++)
{
VibrationManager.Instance.PlayVibrationOnce();
var harvestCount = fieldData.FirstOrDefault(x => x.Type == CornFieldUpgradeType.FieldCenter && x.level == (int)lineData.Seedlings[index].Level)?.harvested ?? 1;
var harvestedCorn = fieldData.FirstOrDefault(x => x.Type == CornFieldUpgradeType.Machine && x.level == gameData.MachineLevel)?.harvested ?? 20;
gameData.cornSeed += harvestedCorn * harvestCount;
var seedlingTransform = seedling.transform;
var harvestEffect = Instantiate(harvestEffectPrefab, seedlingTransform);
Destroy(harvestEffect, 1f);
for (int j = 0; j < harvestCount; j++)
{
// 株の位置調整
var pos = seedlingTransform.position;
if (harvestCount > 1)
{
pos += Vector3.right * (j - 1) * harvestedDistance + Vector3.forward * (j - 1);
}
this.CallWaitForFrame(harvestedFrameInterval * j, () =>
{
var harvestAnimation = Instantiate(harvestPrefab, pos, Quaternion.identity, seedlingTransform);
this.CallWaitForSeconds(.5f, () =>
{
this.CallLerp(.4f, f =>
{
harvestAnimation.transform.position = Vector3.Lerp(pos, harvestInsertPosition.position, f.EaseInQuadratic());
}, () =>
{
// コーン排出
cornHarvester.AddCount(harvestedCorn);
Destroy(harvestAnimation);
});
});
});
}
// 新しい苗
var newGene = GenerateSeedlingGene(line.FieldLevel);
seedling.SetSeedlingGene(newGene.FirstTime, newGene.Period, newGene.Level);
var progressData = gameData.SeedlingDataList.First(data => data.type == plantLineData.Type).Seedlings[i];
var seedling = plantLine.Seedlings[i];
seedling.SetSeedlingGene(progressData.FirstTime, progressData.Period, progressData.Level);
#if DEVELOPMENT_BUILD || UNITY_EDITOR
if (UsayaStorageManager.LoadOrDefault(UsayaStorageFilename.Settings_Data, "DebugFastGrowing", false))
{
seedling.SetSeedlingGene(newGene.FirstTime, newGene.Period / 3, newGene.Level);
seedling.SetSeedlingGene(progressData.FirstTime, progressData.Period / 3, progressData.Level);
}
#endif
gameData.SeedlingDataList[seedlingDataIndex].Seedlings[index] = newGene;
GameDataManager.SaveGameData();
}).AddTo(compositeDisposable);
// 収穫通知
seedling.Harvested.Subscribe(_ =>
{
VibrationManager.Instance.PlayVibrationOnce();
var harvestCount = fieldData.FirstOrDefault(x => x.Type == CornFieldUpgradeType.FieldCenter && x.level == (int)progressData.Level)?.harvested ?? 1;
var harvestedCorn = fieldData.FirstOrDefault(x => x.Type == CornFieldUpgradeType.Machine && x.level == gameData.MachineLevel)?.harvested ?? 20;
gameData.cornSeed += harvestedCorn * harvestCount;
var seedlingTransform = seedling.transform;
var harvestEffect = Instantiate(harvestEffectPrefab, seedlingTransform);
Destroy(harvestEffect, 1f);
for (int j = 0; j < harvestCount; j++)
{
// 株の位置調整
var pos = seedlingTransform.position;
if (harvestCount > 1)
{
pos += Vector3.right * (j - 1) * harvestedDistance + Vector3.forward * (j - 1);
}
this.CallWaitForFrame(harvestedFrameInterval * j, () =>
{
var harvestAnimation = Instantiate(harvestPrefab, pos, Quaternion.identity, seedlingTransform);
this.CallWaitForSeconds(.5f, () =>
{
this.CallLerp(.4f, f =>
{
harvestAnimation.transform.position = Vector3.Lerp(pos, harvestInsertPosition.position, f.EaseInQuadratic());
}, () =>
{
// コーン排出
cornHarvester.AddCount(harvestedCorn);
Destroy(harvestAnimation);
});
});
});
}
// 新しい苗
var newGene = GenerateSeedlingGene(plantLineData.Level);
seedling.SetSeedlingGene(newGene.FirstTime, newGene.Period, newGene.Level);
#if DEVELOPMENT_BUILD || UNITY_EDITOR
if (UsayaStorageManager.LoadOrDefault(UsayaStorageFilename.Settings_Data, "DebugFastGrowing", false))
{
seedling.SetSeedlingGene(newGene.FirstTime, newGene.Period / 3, newGene.Level);
}
#endif
progressData.Level = newGene.Level;
progressData.Period = newGene.Period;
progressData.FirstTime = newGene.FirstTime;
GameDataManager.SaveGameData();
}).AddTo(compositeDisposable);
}
}
}
@ -202,28 +217,27 @@ public class CornField : MonoBehaviour
promoteGrowthButton.OnClickAsObservable().Subscribe(_ =>
{
VibrationManager.Instance.PlayVibrationOnce();
foreach (var line in availableLines)
foreach (var plantLine in plantLines)
{
var seedlingDataIndex = gameData.SeedlingDataList.FindIndex(x => x.type == line.LineName);
for (int i = 0; i < line.Seedlings.Count; i++)
if (gameData.PlantLineDataList.FirstOrDefault(data => data.Type == plantLine.LineName) is PlantLineData plantLineData)
{
if (Random.Range(0, 2) == 0)
for (int i = 0; i < plantLine.Seedlings.Count; i++)
{
var tmpData = gameData.SeedlingDataList[seedlingDataIndex].Seedlings[i];
tmpData.FirstTime = tmpData.FirstTime.AddSeconds(-1);
line.Seedlings[i].PromoteGrowth(tmpData.FirstTime);
gameData.SeedlingDataList[seedlingDataIndex].Seedlings[i] = tmpData;
if (Random.Range(0, 2) == 0)
{
continue;
}
var progressData = gameData.SeedlingDataList.First(data => data.type == plantLineData.Type).Seedlings[i];
var seedling = plantLine.Seedlings[i];
progressData.FirstTime = progressData.FirstTime.AddSeconds(-1);
seedling.PromoteGrowth(progressData.FirstTime);
}
}
}
// 設定のセーブ
GameDataManager.SaveGameData();
}).AddTo(compositeDisposable);
upgradeButton.OnClickAsObservable().Subscribe(_ =>
{
TransitionManager.Instance.LoadSceneAdditive(GameScenes.Reinforcement);
}).AddTo(this);
}
private void SetData()

View File

@ -9,6 +9,7 @@ public class CornFieldReinforcement : MonoBehaviour
{
public static readonly string CornFieldReinforcementDataTypeTag = "CornFieldReinforcementDataType";
public static readonly string CornFieldReinforcementDataTag = "CornFieldReinforcementData";
public static readonly string CornFieldResetCallbackTag = "CornFieldResetCallback";
[SerializeField] private List<CornFieldReinforcementView> reinforcementViews;
[SerializeField] private MachineUpgradeView machineUpgradeView;
[SerializeField] private Button closeButton;
@ -20,9 +21,10 @@ public class CornFieldReinforcement : MonoBehaviour
compositeDisposable.AddTo(this);
closeButton.OnClickAsObservable().Subscribe(_ =>
{
TransitionManager.Instance.UnloadScene(GameScenes.Reinforcement);
LocalCacheManager.Remove(CornFieldReinforcementDataTypeTag);
LocalCacheManager.Remove(CornFieldReinforcementDataTag);
LocalCacheManager.Remove(CornFieldResetCallbackTag);
TransitionManager.Instance.UnloadScene(GameScenes.Reinforcement);
}).AddTo(this);
SetView();
}
@ -57,6 +59,7 @@ public class CornFieldReinforcement : MonoBehaviour
LocalCacheManager.Save(CornFieldReinforcementDataTag, (lineData, price, new Action(() => {
PurchaseField(price, view.LineType, nextRank);
SetView();
LocalCacheManager.Load<Action>(CornFieldResetCallbackTag, null)?.Invoke();
})));
TransitionManager.Instance.LoadSceneAdditive(GameScenes.ReinforcementDetail);
}).AddTo(compositeDisposable);
@ -74,6 +77,7 @@ public class CornFieldReinforcement : MonoBehaviour
LocalCacheManager.Save(CornFieldReinforcementDataTag, (lineData = null, price, new Action(() => {
PurchaseField(price, view.LineType, CornFieldRank.Rank1);
SetView();
LocalCacheManager.Load<Action>(CornFieldResetCallbackTag, null)?.Invoke();
})));
TransitionManager.Instance.LoadSceneAdditive(GameScenes.ReinforcementDetail);
}).AddTo(compositeDisposable);
@ -99,6 +103,7 @@ public class CornFieldReinforcement : MonoBehaviour
LocalCacheManager.Save(CornFieldReinforcementDataTag, (gameData.MachineLevel, price, new Action(() => {
PurchaseMachine(price);
SetView();
LocalCacheManager.Load<Action>(CornFieldResetCallbackTag, null)?.Invoke();
})));
TransitionManager.Instance.LoadSceneAdditive(GameScenes.ReinforcementDetail);
}).AddTo(compositeDisposable);

View File

@ -31,7 +31,6 @@ public class CornFieldReinforcementDetailView : MonoBehaviour
{
Action callback;
var upgradeType = LocalCacheManager.Load<CornFieldUpgradeType>(CornFieldReinforcement.CornFieldReinforcementDataTypeTag);
Debug.Log(upgradeType);
switch (upgradeType)
{
case CornFieldUpgradeType.FieldTop:
@ -79,6 +78,8 @@ public class CornFieldReinforcementDetailView : MonoBehaviour
{
ReinforceObject.SetActive(false);
ReleaseObject.SetActive(true);
purchaseButton.gameObject.SetActive(false);
releaseButton.gameObject.SetActive(true);
releasePriceText.text = price.ToString();
messageText.text = ReleaseFormat;
}
@ -86,6 +87,8 @@ public class CornFieldReinforcementDetailView : MonoBehaviour
{
ReinforceObject.SetActive(true);
ReleaseObject.SetActive(false);
purchaseButton.gameObject.SetActive(true);
releaseButton.gameObject.SetActive(false);
reinforcePriceText.text = price.ToString();
var nextRank = CornFieldReinforcement.GetNextRank(data.Level);
var upgradeType = FieldUpgradeData.PlantTypeToUpgradeType(data.Type);
@ -103,5 +106,7 @@ public class CornFieldReinforcementDetailView : MonoBehaviour
{
ReinforceObject.SetActive(false);
ReleaseObject.SetActive(false);
purchaseButton.gameObject.SetActive(true);
releaseButton.gameObject.SetActive(false);
}
}

View File

@ -51,7 +51,7 @@ public class CornSeedling : MonoBehaviour, IPointerEnterHandler
{
completed = false;
compositeDisposable.Clear();
seedlingStage.SetValueAndForceNotify(SeedlingStage.Stage0);
UpdateStage();
beginTime = dateTime;
period = periodTime;
@ -69,6 +69,7 @@ public class CornSeedling : MonoBehaviour, IPointerEnterHandler
// 更新
seedlingStage
.SkipLatestValueOnSubscribe()
.TakeWhile(_ => !completed)
.Subscribe(x =>
{

View File

@ -16,12 +16,10 @@ public class PlantLine : MonoBehaviour
[SerializeField] private List<CornSeedling> seedlings = new List<CornSeedling>();
public PlantLineType LineName => lineName;
public List<CornSeedling> Seedlings => seedlings;
public CornFieldRank FieldLevel { get; private set; }
private readonly string boardFormat = "x{0}";
public void SetFieldLevel(CornFieldRank rank)
{
FieldLevel = rank;
switch (rank)
{
case CornFieldRank.Rank1:

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 182afe41c8e664bf3a0e8f43acbdb199
guid: 7f040d1b248234841802683edae3c4fa
DefaultImporter:
externalObjects: {}
userData:

View File

@ -27,13 +27,12 @@ public class KitchenManager : MonoBehaviour
kitchenView.Initialize();
adButton.gameObject.SetActive(false);
kitchenView.SetNormalAnimation();
// 動画視聴可能かどうかはシーンロード時に確認
// kitchenView.SetNormalAnimation();
#if UNITY_EDITOR || DEVELOPMENT_BUILD
Observable.Timer(TimeSpan.FromSeconds(3f)).Subscribe(_ =>
{
adButton.gameObject.SetActive(true);
kitchenView.SetTiredAnimation();
}).AddTo(this);
adButton.gameObject.SetActive(true);
kitchenView.SetTiredAnimation();
adButton.OnClickAsObservable().Subscribe(_ =>
{
// 動画視聴POP