157 lines
3.4 KiB
C#
157 lines
3.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine.UI;
|
|
using DG.Tweening;
|
|
|
|
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;
|
|
|
|
public Transform selectParent;
|
|
public Toggle hideSelect;
|
|
public Image show;
|
|
|
|
|
|
void Start()
|
|
{
|
|
|
|
Init();
|
|
}
|
|
|
|
void Init()
|
|
{
|
|
|
|
hideSelect.onValueChanged.AddListener(OnHideToggleChange);
|
|
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);
|
|
//}
|
|
SceneManager.LoadScene("火控场景");
|
|
});
|
|
}
|
|
|
|
|
|
void OnHideToggleChange(bool value)
|
|
{
|
|
if (value)
|
|
{
|
|
show.enabled = false;
|
|
selectParent.transform.DOLocalMoveX(-1100f, .5f);
|
|
}
|
|
else
|
|
{
|
|
selectParent.transform.DOLocalMoveX(-960f, .5f);
|
|
show.enabled = true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void OnQuitClick()
|
|
{
|
|
Application.Quit();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 181接口入口
|
|
/// </summary>
|
|
public void APIEnter181()
|
|
{
|
|
bt181.onClick?.Invoke();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 122接口入口
|
|
/// </summary>
|
|
public void APIEnter122()
|
|
{
|
|
bt122.onClick?.Invoke();
|
|
}
|
|
}
|