using System;
using UniRx;
using UnityEngine;
using UnityEngine.UI;

public class FooterManager : MonoBehaviour
{
    [SerializeField] private Button kitchenButton;
    [SerializeField] private Button fieldButton;
    [SerializeField] private Button stockButton;
    [SerializeField] private Button saleButton;
    private BoolReactiveProperty shareGate = new BoolReactiveProperty(true);

    private void Start()
    {
        kitchenButton.BindToOnClick(shareGate, _ =>
        {
            TransitionManager.Instance.LoadScene(GameScenes.Main);
            return Observable.Timer(TimeSpan.FromSeconds(.5f)).AsUnitObservable();
        }).AddTo(this);
        fieldButton.BindToOnClick(shareGate, _ =>
        {
            TransitionManager.Instance.LoadScene(GameScenes.CornField);
            return Observable.Timer(TimeSpan.FromSeconds(.5f)).AsUnitObservable();
        }).AddTo(this);
        stockButton.BindToOnClick(shareGate, _ =>
        {
            TransitionManager.Instance.LoadScene(GameScenes.shopping);
            return Observable.Timer(TimeSpan.FromSeconds(.5f)).AsUnitObservable();
        }).AddTo(this);
        saleButton.BindToOnClick(shareGate, _ =>
        {
            TransitionManager.Instance.LoadScene(GameScenes.marketing);
            return Observable.Timer(TimeSpan.FromSeconds(.5f)).AsUnitObservable();
        }).AddTo(this);
    }
}