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.
41 lines
1.3 KiB
41 lines
1.3 KiB
4 years ago
|
using AX.MessageSystem;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class QuadrupleDisplay : MonoBehaviour {
|
||
|
public GameObject itemPre;
|
||
|
// Use this for initialization
|
||
|
void Start () {
|
||
|
itemPre = Resources.Load("4GTransfer/QuadDispItem") as GameObject;
|
||
|
MessageDispatcher.AddListener("QuadDisplay", InstantiateDisplay);
|
||
|
//MessageDispatcher.AddListener("QuadrupleMode", DeleteAllDisplay);
|
||
|
}
|
||
|
private void OnDestroy()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("QuadDisplay", InstantiateDisplay);
|
||
|
}
|
||
|
void InstantiateDisplay(IMessage obj)
|
||
|
{
|
||
|
var info = (CloneGameObjInfo)obj.Data;
|
||
|
GameObject item = Instantiate(itemPre, transform);
|
||
|
item.name = "QuadDispItem-" + item.transform.GetSiblingIndex().ToString();
|
||
|
item.GetComponent<QuadDispItemCtrl>().Set(info);
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 【暂时不用】关闭四分屏模式,删除所有分屏UI
|
||
|
/// </summary>
|
||
|
/// <param name="obj"></param>
|
||
|
void DeleteAllDisplay(IMessage obj)
|
||
|
{
|
||
|
var isQuad = (bool)obj.Data;
|
||
|
if (isQuad == false)
|
||
|
{
|
||
|
for(int i = 0; i < transform.childCount; i++)
|
||
|
{
|
||
|
Destroy(transform.GetChild(i).gameObject);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|