using System;
using System.Collections.Generic;
using System.Linq;
using UniRx;
using UnityEngine;
using UnityEngine.Analytics;
using UnityEngine.UI;

public class HeaderManager : MonoBehaviour
{
    [SerializeField] private Button settingButton;
    [SerializeField] private Button missionButton;
    [SerializeField] private Button informationButton;
    [SerializeField] private GameObject missionIndicator;

    private void Start()
    {
        settingButton.OnClickAsObservable().ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ =>
        {
            TransitionManager.Instance.LoadSceneAdditive(GameScenes.SettingsDialog);
        });
        missionButton.OnClickAsObservable().ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ =>
        {
            MissionManager.ShowDialog();
        });
        informationButton.OnClickAsObservable().ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ =>
        {
            TransitionManager.Instance.LoadSceneAdditive(GameScenes.Information);
        });
        // mission報酬通知
        GameDataObserver.Instance.UpdateMissionAchieved.Subscribe(x =>
        {
            missionIndicator.SetActive(x);
        }).AddTo(this);
    }
}
