試食ボタンのDisable対応

This commit is contained in:
kimura 2021-10-11 16:32:50 +09:00
parent 50c85c7c82
commit 36af17455b
2 changed files with 10 additions and 0 deletions

View File

@ -718,6 +718,11 @@ PrefabInstance:
propertyPath: m_IsActive propertyPath: m_IsActive
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8103176713869808018, guid: caaa748dbeed576499e8cae74d33f689,
type: 3}
propertyPath: m_RootOrder
value: 9
objectReference: {fileID: 0}
- target: {fileID: 8136363072906095234, guid: caaa748dbeed576499e8cae74d33f689, - target: {fileID: 8136363072906095234, guid: caaa748dbeed576499e8cae74d33f689,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
@ -1105,6 +1110,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
tastingButton: {fileID: 1280872481} tastingButton: {fileID: 1280872481}
tastingDisabledObject: {fileID: 1001931507}
view: {fileID: 639967259} view: {fileID: 639967259}
--- !u!1 &613202084 --- !u!1 &613202084
GameObject: GameObject:

View File

@ -15,6 +15,7 @@ public enum ManagementState
public class ProductManagement : MonoBehaviour public class ProductManagement : MonoBehaviour
{ {
[SerializeField] private Button tastingButton; [SerializeField] private Button tastingButton;
[SerializeField] private GameObject tastingDisabledObject;
[SerializeField] private ProductManagementView view; [SerializeField] private ProductManagementView view;
private readonly ReactiveProperty<ManagementState> state = new ReactiveProperty<ManagementState>(); private readonly ReactiveProperty<ManagementState> state = new ReactiveProperty<ManagementState>();
private void Start() private void Start()
@ -213,6 +214,9 @@ public class ProductManagement : MonoBehaviour
state.Value = ManagementState.None; state.Value = ManagementState.None;
}).AddTo(this); }).AddTo(this);
var allTankStock = gameData.StorageTanks.Sum(x => x.Stock);
tastingDisabledObject.SetActive(allTankStock == 0);
tastingButton.interactable = allTankStock != 0;
tastingButton.OnClickAsObservable().Subscribe(_ => tastingButton.OnClickAsObservable().Subscribe(_ =>
{ {
state.Value = ManagementState.Tasting; state.Value = ManagementState.Tasting;