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
983 B
41 lines
983 B
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
using UnityEngine.SceneManagement; |
|
|
|
public class CreateDisasterBtn : MonoBehaviour { |
|
|
|
public MapType mapType = null; |
|
private Text hints; |
|
// Use this for initialization |
|
void Start () { |
|
GetComponent<Button>().onClick.AddListener(CreateDisaster); |
|
hints = transform.parent.Find("Hints").GetComponent<Text>(); |
|
} |
|
|
|
private void OnDestroy() |
|
{ |
|
GetComponent<Button>().onClick.RemoveListener(CreateDisaster); |
|
} |
|
|
|
private void CreateDisaster() |
|
{ |
|
if (mapType == null) |
|
{ |
|
hints.text = "请选择单位!"; |
|
return; |
|
} |
|
|
|
GameSettings.disasterSetting.mapType = mapType; |
|
GameSettings.disasterSetting.isCteateDisaster = true; |
|
|
|
SceneManager.LoadScene(mapType.unit.ToString()); |
|
} |
|
|
|
// Update is called once per frame |
|
void Update () { |
|
|
|
} |
|
}
|
|
|