You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
151 lines
3.9 KiB
151 lines
3.9 KiB
3 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.TrackRecord;
|
||
|
using AX.MessageSystem;
|
||
|
public class AutoBrowsing : MonoBehaviour {
|
||
|
|
||
|
/// <summary>
|
||
|
/// 自动浏览脚本
|
||
|
/// </summary>
|
||
|
private float time = 0f;
|
||
|
public Toggle toggle;
|
||
|
[HideInInspector]
|
||
|
public GameObject Game;
|
||
|
public bool Flag = false;//用于判断是否为浏览模式
|
||
|
|
||
|
public static AutoBrowsing instance = null;
|
||
|
private void Awake()
|
||
|
{
|
||
|
if (instance == null)
|
||
|
{
|
||
|
instance = this;
|
||
|
}
|
||
|
}
|
||
|
void Start ()
|
||
|
{
|
||
|
toggle.onValueChanged.AddListener(ClickToggle);
|
||
|
}
|
||
|
public void ClickToggle(bool flag)
|
||
|
{
|
||
|
Flag = flag;
|
||
|
if (!flag)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("CloseNodeTreeHints", (object)"");
|
||
|
Game = null;
|
||
|
}
|
||
|
}
|
||
|
void Update ()
|
||
|
{
|
||
|
//控制物体规定时间关闭
|
||
|
if (Flag && Game != null)
|
||
|
{
|
||
|
time -= Time.deltaTime;
|
||
|
if (time < 0)
|
||
|
{
|
||
|
ContinueSomthing(Game);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 关闭面板对应继续播放
|
||
|
/// </summary>
|
||
|
|
||
|
public void ContinueSomthing(GameObject game)
|
||
|
{
|
||
|
Game = null;
|
||
|
switch (game.name)
|
||
|
{
|
||
|
case "NodeTreeHintsLoad":
|
||
|
game.SetActive(false);
|
||
|
StartPlayBack();
|
||
|
break;
|
||
|
case "TimeItem(Clone)":
|
||
|
TagCheck(game);
|
||
|
break;
|
||
|
case "RawImage":
|
||
|
game.SetActive(false);
|
||
|
ImageCheck(game);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
//刚开始的名称显示面板
|
||
|
public void StartPlayBack()
|
||
|
{
|
||
|
NodeSet.Instance.BecauseClickLoadNode();
|
||
|
}
|
||
|
//检测标签
|
||
|
public void TagCheck(GameObject obj)
|
||
|
{
|
||
|
if (obj.GetComponent<GetTheJieDian>().EventItem.objAttriList[0].modeadd != ModelADD.None)
|
||
|
{
|
||
|
if (obj.GetComponent<GetTheJieDian>().Picture.activeInHierarchy)
|
||
|
{
|
||
|
obj.GetComponent<GetTheJieDian>().ClickPicture(1);
|
||
|
}else
|
||
|
if (obj.GetComponent<GetTheJieDian>().Video.activeInHierarchy)
|
||
|
{
|
||
|
obj.GetComponent<GetTheJieDian>().ClickVideo(1);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
TheBackView.instance.BoFang();
|
||
|
}
|
||
|
}
|
||
|
//检测标签图片
|
||
|
public void ImageCheck(GameObject obj)
|
||
|
{
|
||
|
GameObject Tag = obj.GetComponent<SetRawImage>().TagGame;
|
||
|
if (Tag != null)
|
||
|
{
|
||
|
if (Tag.GetComponent<GetTheJieDian>().Video.activeInHierarchy)
|
||
|
{
|
||
|
Tag.GetComponent<GetTheJieDian>().ClickVideo(1);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
TheBackView.instance.BoFang();
|
||
|
}
|
||
|
}
|
||
|
GameObject.Find("Main Camera").GetComponent<MouseFollowRotation>().enabled = true;
|
||
|
GameObject.Find("Main Camera").GetComponent<MiddleButtonDrag>().enabled = true;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 接受正在开启的面板
|
||
|
/// </summary>
|
||
|
/// <param name="game">传来的物体</param>
|
||
|
/// <param name="T">传来的时间</param>
|
||
|
/// <param name="NextNode">是否为播放下个节点</param>
|
||
|
public void GetMessage(GameObject game,float T,bool NextNode)
|
||
|
{
|
||
|
Game = game;
|
||
|
time = T;
|
||
|
CheckNext(NextNode);
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 自动播放下一条节点
|
||
|
/// </summary>
|
||
|
/// <param name="Next"></param>
|
||
|
public void CheckNext(bool Next)
|
||
|
{
|
||
|
if (Next&& Flag)
|
||
|
{
|
||
|
if (TreeViewControl__.Instance.HasItemSelected() < 0)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("Operatinghints", (object)"未选中节点");
|
||
|
return;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
NodeSet.Instance.KeyDownLoadNode2(1);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|