using System;
using DefaultNamespace;
using DefaultNamespace.ProcessMode;
using MotionFramework;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

namespace ToolsPack
{
    public class ToolsPackSceneJump : MonoBehaviour
    {
        public string Scenename;
        static private string saveSN;//LY
        public void Start()
        {
            //学习模式下不能返回工具间
            if (MotionEngine.GetModule<DataConfigManager>().GetProcessMode() == ProcessMode.Teaching && Scenename.Equals("工具间"))
            {
                this.gameObject.SetActive(false);
            }
            else
            {
                this.GetComponent<Button>().onClick.AddListener(delegate
                {
                    if (saveSN == Scenename)//LY
                    {
                        return;
                    }
                    saveSN = Scenename;
                    // MotionEngine.GetModule<AnimationProcessManager>().HandleClick("前往现场");
                    SceneManager.LoadScene(Scenename);
                });
            }
        }
    }
}