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.

53 lines
1.1 KiB

3 years ago
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MenuWnd : MonoBehaviour
{
//视图索引
private int viewIndex = 0;
public Button viewChangeBtn;
public GameObject threeDcamera;
public GameObject twoDcamera;
// Start is called before the first frame update
void Start()
{
Init();
}
public void Init()
{
viewChangeBtn.onClick.AddListener(ChangeView);
}
/// <summary>
/// 0为3D试图1为2D视图
/// </summary>
public void ChangeView()
{
switch (viewIndex)
{
case 0:
viewIndex = 1;
break;
case 1:
viewIndex = 0;
break;
}
switch (viewIndex)
{
case 0:
twoDcamera.SetActive(false);
threeDcamera.SetActive(true);
break;
case 1:
twoDcamera.SetActive(true);
threeDcamera.SetActive(false);
break;
}
}
}