网演高层钦州
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.
 
 
 

58 lines
1.6 KiB

using AX.MessageSystem;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class QuadDispItemCtrl : MonoBehaviour {
public Text markNum;
public RawImage rawImg;
public RenderTexture texture;
public CloneGameObjInfo info;
private void Awake()
{
markNum = transform.Find("mark/Text").GetComponent<Text>();
rawImg = GetComponent<RawImage>();
texture = new RenderTexture(378, 250, 24);
rawImg.texture = texture;
}
private void OnEnable()
{
markNum.text = (transform.GetSiblingIndex() + 1).ToString();
}
public void Set(CloneGameObjInfo info)
{
this.info = info;
QuadCamsManager.Instance.InstantiateCamera(info, texture);
MessageDispatcher.AddListener("CancelQuadDisplay", DeleteDisplay);
}
void DeleteDisplay(IMessage obj)
{
var deleInfo = (CloneGameObjInfo)obj.Data;
if (deleInfo.gameObjID == info.gameObjID)
{
Destroy(gameObject);
}
else
{
if (gameObject.activeInHierarchy==true)
{
StartCoroutine(UpdateNum());
}
}
}
void OnDestroy()
{
MessageDispatcher.RemoveListener("CancelQuadDisplay", DeleteDisplay);
}
/// <summary>
/// 更新四分屏序号
/// </summary>
/// <returns></returns>
IEnumerator UpdateNum()
{
yield return new WaitForEndOfFrame();
markNum.text = (transform.GetSiblingIndex() + 1).ToString();
}
}