using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityStandardAssets.Characters.FirstPerson;
using DG.Tweening;
using static InterfaceManager;
public class ChangeScence : MonoBehaviour
{
public static ChangeScence Instanc;
public bool IsHideGui = false;
///
/// 仓库按钮
///
public Button warehousebt;
///
/// 称重按钮
///
public Button weighbt;
///
/// 大厅按钮
///
public Button hallbt;
public Button diannaofang;
public List Point = new List();
private void Awake()
{
Instanc = this;
}
void Start()
{
diannaofang.onClick.AddListener(() =>
{
StartCoroutine(WaitFade(Point[3],diannaofang.name));
});
hallbt.onClick.AddListener(() =>
{
StartCoroutine(WaitFade(Point[0],hallbt.name));
});
weighbt.onClick.AddListener(() =>
{
StartCoroutine(WaitFade(Point[1],weighbt.name));
});
warehousebt.onClick.AddListener(() =>
{
StartCoroutine(WaitFade(Point[2],warehousebt.name));
if (GameManager.Instance.combinedClass.Subjectname.Contains("不可用办理实物退库"))
{
IsHideGui = true;
}
});
}
void Update()
{
}
///
/// 延迟显示黑屏
///
///
public IEnumerator WaitFade(Transform transform,string btnName)
{
Transform player = GameObject.FindWithTag("Player").transform;
Image bg = player.GetComponentInChildren();
player.GetComponent().enabled = false;
bg.DOFade(1, 1.9f);
yield return new WaitForSeconds(2f);
bg.DOFade(0, 1.9f);
player.SetLocalPositionAndRotation(transform.position, Quaternion.Euler(0, -90, 0));
yield return new WaitForSeconds(0.1f);
player.GetComponent().enabled = true;
player.GetComponent().InitController();
if (IsHideGui)
{
LoadTriggerNextGuide("关闭");;
}
else
{
LoadTriggerNextGuide(btnName);
}
}
}