110 lines
2.5 KiB
C#
110 lines
2.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class ChooseScenes : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// 122炮选择按钮
|
|
/// </summary>
|
|
public Button bt122;
|
|
/// <summary>
|
|
/// 181炮选择按钮
|
|
/// </summary>
|
|
public Button bt181;
|
|
|
|
/// <summary>
|
|
/// 左上角122选择
|
|
/// </summary>
|
|
public GameObject LeftToggle_122;
|
|
|
|
public Toggle PZ122;
|
|
|
|
public Toggle MZ122;
|
|
/// <summary>
|
|
/// 选择页面
|
|
/// </summary>
|
|
public GameObject ChoosePanel;
|
|
/// <summary>
|
|
/// 3个相机
|
|
/// </summary>
|
|
public List<Camera> Cameras = new List<Camera>();
|
|
/// <summary>
|
|
/// 3个模型
|
|
/// </summary>
|
|
public List<GameObject> Models = new List<GameObject>();
|
|
/// <summary>
|
|
/// 背景Canvas
|
|
/// </summary>
|
|
public Canvas BGcanvas;
|
|
|
|
/// <summary>
|
|
/// 返回按钮
|
|
/// </summary>
|
|
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()
|
|
{
|
|
|
|
}
|
|
}
|