using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ChooseScenes : MonoBehaviour
{
///
/// 122炮选择按钮
///
public Button bt122;
///
/// 181炮选择按钮
///
public Button bt181;
///
/// 左上角122选择
///
public GameObject LeftToggle_122;
public Toggle PZ122;
public Toggle MZ122;
///
/// 选择页面
///
public GameObject ChoosePanel;
///
/// 3个相机
///
public List Cameras = new List();
///
/// 3个模型
///
public List Models = new List();
///
/// 背景Canvas
///
public Canvas BGcanvas;
///
/// 返回按钮
///
public Button Backbt;
void Start()
{
Init();
}
void Init()
{
bt122.onClick.AddListener(() =>
{
LeftToggle_122.SetActive(true);
ChoosePanel.SetActive(false);
Backbt.gameObject.SetActive(true);
Models[1].SetActive(true);
BGcanvas.worldCamera = Cameras[1];
});
bt181.onClick.AddListener(() =>
{
LeftToggle_122.SetActive(false);
ChoosePanel.SetActive(false);
Backbt.gameObject.SetActive(true);
Models[0].SetActive(true);
BGcanvas.worldCamera = Cameras[0];
});
PZ122.onValueChanged.AddListener((ison) =>
{
if (ison)
{
BGcanvas.worldCamera = Cameras[2];
Models[2].SetActive(true);
}
else
{
Models[2].SetActive(false);
}
});
MZ122.onValueChanged.AddListener((ison) =>
{
if (ison)
{
BGcanvas.worldCamera = Cameras[1];
Models[1].SetActive(true);
}
else
{
Models[1].SetActive(false);
}
});
Backbt.onClick.AddListener(() =>
{
ChoosePanel.SetActive(true);
Backbt.gameObject.SetActive(false);
BGcanvas.worldCamera = Cameras[3];
for (int i = 0; Models.Count > i; i++)
{
Models[i].gameObject.SetActive(false);
}
});
}
void Update()
{
}
}