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.
61 lines
1.8 KiB
61 lines
1.8 KiB
11 months ago
|
using UnityEngine;
|
||
|
namespace AX.ImageViewer
|
||
|
{
|
||
|
public class PanoramicViewer : MonoBehaviour
|
||
|
{
|
||
|
#region Static Variables
|
||
|
private static PanoramicViewer m_instance = null;
|
||
|
private static PanoramicViewer Instance
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
if (m_instance == null)
|
||
|
{
|
||
|
m_instance = Instantiate(Resources.Load<GameObject>("PanoramicViewer").GetComponent<PanoramicViewer>());
|
||
|
DontDestroyOnLoad(m_instance.gameObject);
|
||
|
m_instance.gameObject.SetActive(false);
|
||
|
}
|
||
|
return m_instance;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
#region Variables
|
||
|
[SerializeField]
|
||
|
private GameObject PanoramaObject;
|
||
|
//private GameObject MainCanvas;
|
||
|
#endregion
|
||
|
|
||
|
public void OnBackButtonClicked()
|
||
|
{
|
||
|
UIManager.GetCanvas().GetComponent<Canvas>().enabled = true;
|
||
|
Hide();
|
||
|
//if (Camera.main.GetComponent<CameraOrbit>())
|
||
|
// Camera.main.GetComponent<CameraOrbit>().enabled = true;
|
||
|
}
|
||
|
|
||
|
public void Show()
|
||
|
{
|
||
|
gameObject.SetActive(true);
|
||
|
}
|
||
|
public void Hide()
|
||
|
{
|
||
|
gameObject.SetActive(false);
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 查看全景图片
|
||
|
/// </summary>
|
||
|
/// <param name="ImagePath">图片地址</param>
|
||
|
public static void Load(Texture2D texture)
|
||
|
{
|
||
|
//if (Camera.main.GetComponent<CameraOrbit>())
|
||
|
// Camera.main.GetComponent<CameraOrbit>().enabled = false;
|
||
|
UIManager.GetCanvas().GetComponent<Canvas>().enabled = false;
|
||
|
Instance.Show();
|
||
|
Instance.PanoramaObject.GetComponent<Renderer>().material.SetTexture("_MainTex", texture);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|