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.
132 lines
4.9 KiB
132 lines
4.9 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.IO;
|
||
|
using System.Collections.Generic;
|
||
|
using System;
|
||
|
using System.Xml.Serialization;
|
||
|
using AX.TrackRecord;
|
||
|
using System.Collections;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.MessageSystem;
|
||
|
using Video;
|
||
|
public class GetTheJieDian : MonoBehaviour {
|
||
|
|
||
|
GameObject CameraGame;
|
||
|
[HideInInspector]
|
||
|
public GameObject Picture;
|
||
|
[HideInInspector]
|
||
|
public GameObject Video;
|
||
|
void Start()
|
||
|
{
|
||
|
CameraGame = GameObject.Find("Main Camera").gameObject;
|
||
|
Picture = transform.Find("Show").Find("Picture").gameObject;
|
||
|
Video = transform.Find("Show").Find("Video").gameObject;
|
||
|
}
|
||
|
private EventRecordItem_two eventItem;
|
||
|
public EventRecordItem_two EventItem
|
||
|
{
|
||
|
get { return eventItem; }
|
||
|
set { eventItem=value; }
|
||
|
}
|
||
|
public bool canExeFlag = true;
|
||
|
public void SetFlag_False()
|
||
|
{
|
||
|
canExeFlag = false;
|
||
|
StartCoroutine(SetFlag_True());
|
||
|
}
|
||
|
|
||
|
private IEnumerator SetFlag_True()
|
||
|
{
|
||
|
yield return new WaitForSeconds(0.5f);
|
||
|
canExeFlag = true;
|
||
|
}
|
||
|
|
||
|
public void ButtonClick() //点击节点重新生成事件,重新对进度条赋值
|
||
|
{
|
||
|
|
||
|
if (LoadManager.Instance.record_Load != null && eventItem.timer <= LoadManager.Instance.record_Load.SumTime)
|
||
|
{
|
||
|
MouseFollowRotation.Instance.CameraAttri = eventItem.camAttributeList[0];
|
||
|
GameObject ShowText = GameObject.Find("Canvas").transform.Find("ShowText").gameObject;
|
||
|
|
||
|
TheBackView.instance.ClickJieDianApect(eventItem);
|
||
|
|
||
|
MessageDispatcher.SendMessage("ProcessSkipEvent", new SkipEventAttri
|
||
|
{
|
||
|
from = LoadManager.Instance.LoadTimer - Time.deltaTime * 2,
|
||
|
to = eventItem.timer + Time.deltaTime * 2
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
public void ClickVideo(int flag)
|
||
|
{
|
||
|
VCR._videoFiles = ExamInfoHelpClass.VideoFilePath+ eventItem.objAttriList[0].VideoFile;
|
||
|
VCR.Instance().StartPlayer();
|
||
|
GameObject.Find("Canvas").transform.Find("Panel_Video 1").GetComponent<RectTransform>().localScale = new Vector3(0.5f, 0.5f, 1);
|
||
|
MouseFollowRotation.Instance.CameraAttri = eventItem.camAttributeList[0];
|
||
|
GameObject ShowText = GameObject.Find("Canvas").transform.Find("ShowText").gameObject;
|
||
|
if (flag != 1)
|
||
|
{
|
||
|
TheBackView.instance.ClickJieDianApect(eventItem);
|
||
|
}
|
||
|
MessageDispatcher.SendMessage("ProcessSkipEvent", new SkipEventAttri
|
||
|
{
|
||
|
from = LoadManager.Instance.LoadTimer - Time.deltaTime * 2,
|
||
|
to = eventItem.timer + Time.deltaTime * 2
|
||
|
});
|
||
|
}
|
||
|
public void ClickPicture(int flag)
|
||
|
{
|
||
|
RawImage image = GameObject.Find("Canvas").transform.Find("RawImage").GetComponent<RawImage>();
|
||
|
image.gameObject.GetComponent<SetRawImage>().TagGame = this.gameObject;
|
||
|
GameObject.Find("Canvas").transform.Find("RawImage").gameObject.SetActive(true);
|
||
|
image.GetComponent<RectTransform>().localScale = new Vector3(1, 1, 1);
|
||
|
GameObject ShowText = GameObject.Find("Canvas").transform.Find("ShowText").gameObject;
|
||
|
if (flag != 1)
|
||
|
{
|
||
|
TheBackView.instance.ClickJieDianApect(eventItem);
|
||
|
}
|
||
|
MessageDispatcher.SendMessage("ProcessSkipEvent", new SkipEventAttri
|
||
|
{
|
||
|
from = LoadManager.Instance.LoadTimer - Time.deltaTime * 2,
|
||
|
to = eventItem.timer + Time.deltaTime * 2
|
||
|
});
|
||
|
|
||
|
FileStream fileStream = new FileStream(ExamInfoHelpClass.PictureFilePath+eventItem.objAttriList[0].PictureFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||
|
fileStream.Seek(0, SeekOrigin.Begin);
|
||
|
//创建文件缓冲区
|
||
|
byte[] bytes = new byte[fileStream.Length];
|
||
|
//读取文件
|
||
|
fileStream.Read(bytes, 0, (int)fileStream.Length);
|
||
|
//释放文件读取流
|
||
|
|
||
|
fileStream.Close();
|
||
|
fileStream.Dispose();
|
||
|
fileStream = null;
|
||
|
|
||
|
FileStream fs = File.OpenRead(ExamInfoHelpClass.PictureFilePath + eventItem.objAttriList[0].PictureFile); //OpenRead
|
||
|
int filelength = 0;
|
||
|
filelength = (int)fs.Length; //获得文件长度
|
||
|
byte[] images = new byte[filelength]; //建立一个字节数组
|
||
|
fs.Read(images, 0, filelength); //按字节流读取
|
||
|
System.Drawing.Image result = System.Drawing.Image.FromStream(fs);
|
||
|
fs.Close();
|
||
|
|
||
|
int width = result.Width;//1024
|
||
|
int height = result.Height;//1024
|
||
|
Texture2D texture = new Texture2D(width, height);
|
||
|
texture.LoadImage(bytes);
|
||
|
|
||
|
if (width > 800 || height>800)
|
||
|
{
|
||
|
image.GetComponent<RectTransform>().sizeDelta = new Vector2(width/3, height/3);
|
||
|
}
|
||
|
|
||
|
image.texture = texture;
|
||
|
|
||
|
GameObject.Find("Main Camera").GetComponent<MouseFollowRotation>().enabled = false;
|
||
|
GameObject.Find("Main Camera").GetComponent<MiddleButtonDrag>().enabled = false;
|
||
|
|
||
|
AutoBrowsing.instance.GetMessage(image.gameObject, 5f, false);
|
||
|
}
|
||
|
}
|