using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class timeControl : MonoBehaviour
{
public Button game;
///
/// 检测时间间隔
///
[Header(“检测时间间隔”)]
public float maxTimeOffset;
///
/// 编辑器是否开启检测
///
[Header(“编辑器是否开启检测”)]
public bool IsEditorOpen = false;
///
/// 上次的时间
///
private float lasterTime;
// Start is called before the first frame update
void Start()
{
game.onClick.AddListener(SC_Onclick);
}
// Update is called once per frame
void Update()
{
float nowTime = Time.time;
if (Input.GetMouseButtonDown(0))
{
IsEditorOpen = true;
lasterTime = nowTime;//更新触摸时间
}
float offsetTime = Mathf.Abs(nowTime - lasterTime);
//Debug.Log("长时间无操作 offsetTime:" + offsetTime);
if (offsetTime > maxTimeOffset)
{
UIManger.instance.Standby_Video();
game.gameObject.SetActive(true);
IsEditorOpen = false;
offsetTime = 0;
}
else
{
Debug.Log("长时间无操作 offsetTime:" + offsetTime);
}
}
public void SC_Onclick()
{
if (LoadXml.instance.data_dict.ContainsKey(30))
{
Layer1.instance.SendMessage(UIManger.instance.layerIndex, LoadXml.instance.data_dict[30][0].code);
}
Debug.Log("取消待机视频播放");
}
}