収穫リワード終了時の表示調整/ リワード中のUI非表示対応
This commit is contained in:
parent
0ff46301df
commit
d36a18bbde
|
|
@ -20,7 +20,9 @@ public enum CornFieldRank
|
|||
public class CornField : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float animationDuration = .3f;
|
||||
[SerializeField] private float fertilizerFinishWaitTime = 1f;
|
||||
[Space]
|
||||
[SerializeField] private UIVisibleController uiVisibleController;
|
||||
[SerializeField] private Button promoteGrowthButton;
|
||||
[SerializeField] private Button upgradeButton;
|
||||
[SerializeField] private GameObject harvestEffectPrefab;
|
||||
|
|
@ -43,6 +45,7 @@ public class CornField : MonoBehaviour
|
|||
private static readonly int animationDivisor = 3;
|
||||
private static readonly int animationLimit = 100;
|
||||
|
||||
private static readonly int fertilizerDuration = 15;
|
||||
private static readonly double fertilizerWaitTime = 300f;
|
||||
|
||||
private readonly CompositeDisposable compositeDisposable = new CompositeDisposable();
|
||||
|
|
@ -93,9 +96,20 @@ public class CornField : MonoBehaviour
|
|||
{
|
||||
GetRewardDialog.ShowCornFieldDialog(() =>
|
||||
{
|
||||
gameData.fertilizerTime = DateTime.UtcNow.AddSeconds(fertilizerWaitTime + fertilizerDuration).ToBinary();
|
||||
#if UNITY_EDITOR
|
||||
gameData.fertilizerTime = DateTime.UtcNow.AddSeconds(10 + fertilizerDuration).ToBinary();
|
||||
#endif
|
||||
GameDataManager.SaveGameData();
|
||||
|
||||
SoundManager.Instance.PlayBGM("bgm_fertilizer");
|
||||
brotherFertilizerAnimation.StartAnimation();
|
||||
// button非表示
|
||||
fertilizerButtonView.gameObject.SetActive(false);
|
||||
promoteGrowthButton.gameObject.SetActive(false);
|
||||
upgradeButton.gameObject.SetActive(false);
|
||||
uiVisibleController.SetActive(false);
|
||||
|
||||
SetCornField(true);
|
||||
|
||||
var push = new Subject<Unit>().AddTo(this);
|
||||
|
|
@ -123,7 +137,7 @@ public class CornField : MonoBehaviour
|
|||
}
|
||||
}
|
||||
Observable.Timer(TimeSpan.FromSeconds(1f), TimeSpan.FromSeconds(1f))
|
||||
.Select(x => (int)(15 - x))
|
||||
.Select(x => (int)(fertilizerDuration - x))
|
||||
.TakeWhile(x => x > 0)
|
||||
.Subscribe(x =>
|
||||
{
|
||||
|
|
@ -132,11 +146,17 @@ public class CornField : MonoBehaviour
|
|||
{
|
||||
SoundManager.Instance.PlayBGM("bgm_Main");
|
||||
brotherFertilizerAnimation.EndAnimation();
|
||||
promoteGrowthButton.gameObject.SetActive(true);
|
||||
SetCornField();
|
||||
gameData.fertilizerTime = DateTime.UtcNow.AddSeconds(fertilizerWaitTime).ToBinary();
|
||||
GameDataManager.SaveGameData();
|
||||
resetFertilizerTimer.OnNext((int)DateTime.FromBinary(gameData.fertilizerTime).Subtract(DateTime.UtcNow).TotalSeconds);
|
||||
|
||||
this.CallWaitForSeconds(fertilizerFinishWaitTime, () =>
|
||||
{
|
||||
// ボタン表示復活
|
||||
fertilizerButtonView.gameObject.SetActive(true);
|
||||
promoteGrowthButton.gameObject.SetActive(true);
|
||||
upgradeButton.gameObject.SetActive(true);
|
||||
uiVisibleController.SetActive(true);
|
||||
});
|
||||
}).AddTo(this);
|
||||
});
|
||||
}).AddTo(this);
|
||||
|
|
@ -145,9 +165,6 @@ public class CornField : MonoBehaviour
|
|||
resetFertilizerTimer
|
||||
.Subscribe(x =>
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
x = 5;
|
||||
#endif
|
||||
fertilizerButtonView.SetButtonActive(x <= 0);
|
||||
fertilizerButtonView.SetTime(x);
|
||||
SetFertilizerTimer(x).AddTo(this);
|
||||
|
|
|
|||
|
|
@ -1190,6 +1190,56 @@ MonoBehaviour:
|
|||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &1043394538986757308
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2279658240340545036}
|
||||
- component: {fileID: 6168082219279810231}
|
||||
m_Layer: 5
|
||||
m_Name: UIManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2279658240340545036
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1043394538986757308}
|
||||
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: 3664916832564167477}
|
||||
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}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &6168082219279810231
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1043394538986757308}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0924eb4fad074319b84c6282591cc527, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
headerObject: {fileID: 3664916834242367712}
|
||||
footerObject: {fileID: 3664916833752817996}
|
||||
--- !u!1 &1527155573937108630
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -1459,6 +1509,7 @@ RectTransform:
|
|||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_Children:
|
||||
- {fileID: 3664916832844628215}
|
||||
- {fileID: 2279658240340545036}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
|
@ -2559,6 +2610,11 @@ PrefabInstance:
|
|||
propertyPath: m_Name
|
||||
value: Footer
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3310671341541575850, guid: 42b6e2c5e0aa46a4e973df1237dc5691,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3310671341541575851, guid: 42b6e2c5e0aa46a4e973df1237dc5691,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
|
|
@ -2666,6 +2722,12 @@ PrefabInstance:
|
|||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 42b6e2c5e0aa46a4e973df1237dc5691, type: 3}
|
||||
--- !u!1 &3664916833752817996 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 3310671341541575850, guid: 42b6e2c5e0aa46a4e973df1237dc5691,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2246654624185019878}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!224 &3664916833752817997 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 3310671341541575851, guid: 42b6e2c5e0aa46a4e973df1237dc5691,
|
||||
|
|
@ -2739,6 +2801,11 @@ PrefabInstance:
|
|||
propertyPath: m_Name
|
||||
value: Header
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 137127163878687690, guid: ac3be7383b736d941b251a588e626963,
|
||||
type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 137127163878687691, guid: ac3be7383b736d941b251a588e626963,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
|
|
@ -2862,6 +2929,12 @@ PrefabInstance:
|
|||
objectReference: {fileID: 3664916832844628215}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: ac3be7383b736d941b251a588e626963, type: 3}
|
||||
--- !u!1 &3664916834242367712 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 137127163878687690, guid: ac3be7383b736d941b251a588e626963,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 3691625806369805098}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!224 &3664916834242367713 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 137127163878687691, guid: ac3be7383b736d941b251a588e626963,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class UIVisibleController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject headerObject;
|
||||
[SerializeField] private GameObject footerObject;
|
||||
|
||||
public void SetActive(bool active)
|
||||
{
|
||||
headerObject.SetActive(active);
|
||||
footerObject.SetActive(active);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0924eb4fad074319b84c6282591cc527
|
||||
timeCreated: 1634805216
|
||||
Loading…
Reference in New Issue