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.
46 lines
1.1 KiB
46 lines
1.1 KiB
4 years ago
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class RescueTeamManager : MonoBehaviour {
|
||
|
public GameObject itemPre;
|
||
|
public List<string> teams = new List<string>();
|
||
|
//获取所有正在营救的中队
|
||
|
public static event Func<List<string>, List<string>> getAllRescueTeams;
|
||
|
void OnEnable()
|
||
|
{
|
||
|
teams = new List<string>();
|
||
|
if(getAllRescueTeams != null)
|
||
|
{
|
||
|
teams = getAllRescueTeams(teams);
|
||
|
}
|
||
|
CreateTeams();
|
||
|
}
|
||
|
public void CreateTeams()
|
||
|
{
|
||
|
if (itemPre == null)
|
||
|
{
|
||
|
itemPre = Resources.Load("RescueInfo/RescueTeamItem") as GameObject;
|
||
|
}
|
||
|
for (int i = 0; i < transform.childCount; i++)
|
||
|
{
|
||
|
Destroy(transform.GetChild(i).gameObject);
|
||
|
}
|
||
|
foreach(string team in teams)
|
||
|
{
|
||
|
GameObject item = Instantiate(itemPre, transform);
|
||
|
item.GetComponent<RescueTeamItem>().Set(team);
|
||
|
}
|
||
|
}
|
||
|
// Use this for initialization
|
||
|
void Start () {
|
||
|
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update () {
|
||
|
|
||
|
}
|
||
|
}
|