using DG.Tweening;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

[AddComponentMenu("PatternChoose/模式选择")]
public class PatternChoose : MonoBehaviour
{

    public Button TS_button;
    public Button RL_button;
    /// <summary>
    /// 热力效果图
    /// </summary>
    public GameObject heatMap;
    // Start is called before the first frame update

    Vector3 init_pos;
    Vector3 init_rot;
    private void Awake()
    {
        init_pos=Camera.main.transform.localPosition;
        init_rot = Camera.main.transform.localEulerAngles;
    }
    void Start()
    {
        TS_button.onClick.AddListener(() => F1(false));
        RL_button.onClick.AddListener(() => F2(true));
    }

    // Update is called once per frame
    void Update()
    {

    }

    void F1(bool isheatMap)
    {
        heatMap.SetActive(isheatMap);
        ExtendedFlycam.Inst.init_mainCamera_rot();
        Camera.main.transform.DOMove(/*TransparentGlowManage.Inst.MainCamera_pos*/init_pos, 1f);
        Camera.main.transform.DORotateQuaternion(Quaternion.Euler(/*TransparentGlowManage.Inst.MainCamera_rot*/init_rot), 1f).OnComplete(() =>
        {
            //更新相机初始旋转角度
            ExtendedFlycam.Inst.initialRotationEulerAngles = Camera.main.transform.localEulerAngles;
        });
        TransparentGlowManage.Inst.renewALL();
    }

    void F2(bool isheatMap)
    {
        heatMap.SetActive(isheatMap);
        ExtendedFlycam.Inst.init_mainCamera_rot();
        Camera.main.transform.DOMove(/*TransparentGlowManage.Inst.MainCamera_pos*/init_pos, 1f);
        Camera.main.transform.DORotateQuaternion(Quaternion.Euler(/*TransparentGlowManage.Inst.MainCamera_rot*/init_rot), 1f).OnComplete(() =>
        {
            //更新相机初始旋转角度
            ExtendedFlycam.Inst.initialRotationEulerAngles = Camera.main.transform.localEulerAngles;
        });
        TransparentGlowManage.Inst.renewALL();
    }
}
