478 lines
12 KiB
C#
478 lines
12 KiB
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.IO;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.Networking;
|
|||
|
|
using UnityEngine.UI;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public class ImagePlayerEx : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
public static ImagePlayerEx Instance;
|
|||
|
|
// public UnityWebRequest imgRequest;
|
|||
|
|
private void Awake()
|
|||
|
|
{
|
|||
|
|
Instance = this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public Data info;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// BackImage<67><65>RectTransform<72><6D><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public RectTransform rectBackImage;
|
|||
|
|
/// <summary>
|
|||
|
|
/// ͼ<><CDBC>
|
|||
|
|
/// </summary>
|
|||
|
|
public RawImage img;
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ͼƬ
|
|||
|
|
/// </summary>
|
|||
|
|
public Sprite SpritePlay;
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ƵֹͣͼƬ
|
|||
|
|
/// </summary>
|
|||
|
|
public Sprite SpriteStop;
|
|||
|
|
|
|||
|
|
public Texture2D ErrorImage;
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ƿ<EFBFBD><C7B7>ڲ<EFBFBD><DAB2><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
bool isPlaying;
|
|||
|
|
/// <summary>
|
|||
|
|
/// ȫ<><C8AB><EFBFBD><EFBFBD>ť
|
|||
|
|
/// </summary>
|
|||
|
|
public Button btnFullscreen;
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>رհ<D8B1>ť
|
|||
|
|
/// </summary>
|
|||
|
|
public Button btnClose;
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>رհ<D8B1>ť
|
|||
|
|
/// </summary>
|
|||
|
|
public Button btnSound;
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>һ<EFBFBD><D2BB>ͼƬ<CDBC><C6AC>ť
|
|||
|
|
/// </summary>
|
|||
|
|
public Button btnNext;
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>һ<EFBFBD><D2BB>ͼƬ<CDBC><C6AC>ť
|
|||
|
|
/// </summary>
|
|||
|
|
public Button btnPriv;
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ŵ<EFBFBD>ͼƬ<CDBC><C6AC>ť
|
|||
|
|
/// </summary>
|
|||
|
|
public Button btnLarge;
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>СͼƬ<CDBC><C6AC>ť
|
|||
|
|
/// </summary>
|
|||
|
|
public Button btnSmall;
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public Text txtTitle;
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public Text txtDescription;
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
string soundName;
|
|||
|
|
|
|||
|
|
int currentIndex = 0;
|
|||
|
|
float currentLarge = 1f;
|
|||
|
|
float maxLarge = 10f;
|
|||
|
|
float minLarge = 0.5f;
|
|||
|
|
|
|||
|
|
public bool IsShow;
|
|||
|
|
Vector2 v2;
|
|||
|
|
|
|||
|
|
Animator anim;
|
|||
|
|
|
|||
|
|
void Start()
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3BBAFA1>رա<D8B1><D5A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ť<EFBFBD>¼<EFBFBD>
|
|||
|
|
if (btnFullscreen != null)
|
|||
|
|
btnFullscreen.onClick.AddListener(OnBtnFullScreenClick);
|
|||
|
|
if (btnClose != null)
|
|||
|
|
btnClose.onClick.AddListener(OnBtnCloseClick);
|
|||
|
|
if (btnSound != null)
|
|||
|
|
btnSound.onClick.AddListener(OnBtnSoundClick);
|
|||
|
|
if (btnNext != null)
|
|||
|
|
btnNext.onClick.AddListener(OnBtnNextClick);
|
|||
|
|
if (btnPriv != null)
|
|||
|
|
btnPriv.onClick.AddListener(OnBtnPrivClick);
|
|||
|
|
if (btnLarge != null)
|
|||
|
|
btnLarge.onClick.AddListener(OnBtnLargeClick);
|
|||
|
|
if (btnSmall != null)
|
|||
|
|
btnSmall.onClick.AddListener(OnBtnSmallClick);
|
|||
|
|
|
|||
|
|
anim = GetComponent<Animator>();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void HideImage()
|
|||
|
|
{
|
|||
|
|
// <20><>ԭΪ<D4AD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if (isFullScreen)
|
|||
|
|
OnBtnFullScreenClick();
|
|||
|
|
|
|||
|
|
if (info.IsType(DataType.Image) || info.IsType(DataType.MultiImage))
|
|||
|
|
{
|
|||
|
|
// <20>ر<EFBFBD>
|
|||
|
|
if (anim != null)
|
|||
|
|
anim.SetTrigger("CloseBg");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
HideComplete();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
currentIndex = 0;
|
|||
|
|
currentLarge = 1f;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3>Ƶ<EFBFBD><C6B5><EFBFBD>š<EFBFBD><C5A1><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>Ű<EFBFBD>ťͼ<C5A5><CDBC>
|
|||
|
|
/// </summary>
|
|||
|
|
void HideComplete()
|
|||
|
|
{
|
|||
|
|
// AudioManager.Instance.StopAudio();
|
|||
|
|
btnSound.GetComponent<Image>().sprite = SpritePlay;
|
|||
|
|
IsShow = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ʾͼ<CABE><CDBC>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="data">ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|||
|
|
public void ShowImage(int index)
|
|||
|
|
{
|
|||
|
|
BaseController.CanControl = false;
|
|||
|
|
|
|||
|
|
currentIndex = index;
|
|||
|
|
|
|||
|
|
IsShow = true;
|
|||
|
|
currentLarge = 1f;
|
|||
|
|
|
|||
|
|
//txtTitle.text = info.Title;
|
|||
|
|
//if (txtDescription != null)
|
|||
|
|
//{
|
|||
|
|
// txtDescription.text = info.DataDetails[0];
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
if (anim != null)
|
|||
|
|
anim.SetTrigger("OpenBg");
|
|||
|
|
|
|||
|
|
if (string.IsNullOrEmpty(info.AudioName))
|
|||
|
|
{
|
|||
|
|
btnSound.gameObject.SetActive(false); // <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2>Ű<EFBFBD>ť
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
btnSound.gameObject.SetActive(true); // <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2>Ű<EFBFBD>ť
|
|||
|
|
soundName = info.AudioName;
|
|||
|
|
OnBtnSoundClick();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (info.IsType(DataType.Image) || info.IsType(DataType.ImageText))
|
|||
|
|
{
|
|||
|
|
StartCoroutine(ImageLoader<RawImage>.LoadImage(CommonData.SpotImageFullPath + info.ImageName, img, ImageLoadCompleted));
|
|||
|
|
|
|||
|
|
btnNext.gameObject.SetActive(false);
|
|||
|
|
btnPriv.gameObject.SetActive(false);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
StartCoroutine(ImageLoader<RawImage>.LoadImage(CommonData.SpotImageFullPath + info.DataDetails[currentIndex], img, ImageLoadCompleted));
|
|||
|
|
|
|||
|
|
ShowNextPrivButton();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void ImageLoadCompleted(Texture2D tex, RawImage img)
|
|||
|
|
{
|
|||
|
|
img.texture = tex;
|
|||
|
|
if (tex == null)
|
|||
|
|
{
|
|||
|
|
img.texture = ErrorImage;
|
|||
|
|
}
|
|||
|
|
Dofit();
|
|||
|
|
img.rectTransform.sizeDelta *= currentLarge;
|
|||
|
|
|
|||
|
|
|
|||
|
|
img.color = Color.white;
|
|||
|
|
if (info.IsType(DataType.Image) || info.IsType(DataType.ImageText))
|
|||
|
|
{
|
|||
|
|
txtTitle.text = info.Title;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
txtTitle.text = TipPointCollider.Instance.GetImageShow(info, currentIndex);
|
|||
|
|
}
|
|||
|
|
if (txtDescription != null)
|
|||
|
|
{
|
|||
|
|
txtDescription.text = info.DataDetails[0];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public float maxHeight = 520.0f;
|
|||
|
|
/// <summary>
|
|||
|
|
/// ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public float maxWidth = 1680.0f;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ʾ<EFBFBD>ϰ벿<CFB0>ֵ<EFBFBD>Ĭ<EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public float defaultWidth = 800.0f;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ʾ<EFBFBD>ϰ벿<CFB0>ֵı<D6B5><C4B1><EFBFBD>ֵ
|
|||
|
|
/// </summary>
|
|||
|
|
public float showTopScale = 2.0f;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ͼ<><CDBC>̫<EFBFBD><CCAB>ʱ<EFBFBD>Ƿ<EFBFBD>ֻ<EFBFBD><D6BB>ʾ<EFBFBD>ϰ벿<CFB0><EBB2BF>
|
|||
|
|
/// </summary>
|
|||
|
|
public bool showTop = true;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
|
|||
|
|
/// </summary>
|
|||
|
|
void Dofit()
|
|||
|
|
{
|
|||
|
|
float width, height;
|
|||
|
|
Texture tex = img.texture;
|
|||
|
|
float tw = tex.width;
|
|||
|
|
float th = tex.height;
|
|||
|
|
|
|||
|
|
if ( showTop && th / tw > showTopScale)
|
|||
|
|
{
|
|||
|
|
width = defaultWidth;
|
|||
|
|
|
|||
|
|
height = th * defaultWidth / tw;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
width = maxWidth;
|
|||
|
|
height = th * maxWidth / tw;
|
|||
|
|
if (height > maxHeight)
|
|||
|
|
{
|
|||
|
|
height = maxHeight;
|
|||
|
|
width = tw * maxHeight / th;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
RectTransform tranImg = img.GetComponent<RectTransform>();
|
|||
|
|
tranImg.sizeDelta = new Vector2(width, height);
|
|||
|
|
tranImg.anchoredPosition = new Vector2(0, (maxHeight - height) / 2);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD>ͣ<EFBFBD><CDA3>Ƶ<EFBFBD><C6B5>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void OnBtnSoundClick()
|
|||
|
|
{
|
|||
|
|
isPlaying = !isPlaying;
|
|||
|
|
if (isPlaying)
|
|||
|
|
{
|
|||
|
|
if (soundName.Contains("."))
|
|||
|
|
{
|
|||
|
|
soundName = soundName.Substring(0, soundName.IndexOf("."));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//AudioManager.Instance.PlayAudio(soundName);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//AudioManager.Instance.StopAudio();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
btnSound.GetComponent<Image>().sprite = isPlaying ? SpriteStop : SpritePlay;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>رհ<D8B1>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void OnBtnCloseClick()
|
|||
|
|
{
|
|||
|
|
// ViewController.Instance.HideView();
|
|||
|
|
if (anim != null)
|
|||
|
|
anim.SetTrigger("CloseBg");
|
|||
|
|
|
|||
|
|
img.texture = null;
|
|||
|
|
txtTitle.text = "";
|
|||
|
|
if (txtDescription != null)
|
|||
|
|
{
|
|||
|
|
txtDescription.text = "";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// BaseController.CanControl = true;
|
|||
|
|
// Invoke("SetControl", 0.2f);
|
|||
|
|
BtnController.Instance.SetCanControlDelay();
|
|||
|
|
|
|||
|
|
img.color = Color.clear;
|
|||
|
|
|
|||
|
|
ImageLoader<RawImage>.ClearImage();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ƿ<EFBFBD>ȫ<EFBFBD><C8AB>
|
|||
|
|
/// </summary>
|
|||
|
|
bool isFullScreen;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ȫ<><C8AB><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void OnBtnFullScreenClick()
|
|||
|
|
{
|
|||
|
|
if (isFullScreen)
|
|||
|
|
{
|
|||
|
|
isFullScreen = false;
|
|||
|
|
rectBackImage.localScale = Vector3.one * 0.6f;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
isFullScreen = true;
|
|||
|
|
rectBackImage.localScale = Vector3.one;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void OnBtnLargeClick()
|
|||
|
|
{
|
|||
|
|
currentLarge *= 1.1f;
|
|||
|
|
if (currentLarge > maxLarge)
|
|||
|
|
{
|
|||
|
|
currentLarge = maxLarge;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
img.rectTransform.sizeDelta *= 1.1f;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void OnBtnSmallClick()
|
|||
|
|
{
|
|||
|
|
currentLarge /= 1.1f;
|
|||
|
|
if (currentLarge < minLarge)
|
|||
|
|
{
|
|||
|
|
currentLarge = minLarge;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
img.rectTransform.sizeDelta /= 1.1f;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void ShowNextPrivButton()
|
|||
|
|
{
|
|||
|
|
currentLarge = 1f;
|
|||
|
|
if (currentIndex == 0)
|
|||
|
|
{
|
|||
|
|
btnPriv.gameObject.SetActive(false);
|
|||
|
|
|
|||
|
|
if (info.DataDetails.Length > 1)
|
|||
|
|
{
|
|||
|
|
btnNext.gameObject.SetActive(true);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (currentIndex == info.DataDetails.Length - 1)
|
|||
|
|
{
|
|||
|
|
btnNext.gameObject.SetActive(false);
|
|||
|
|
|
|||
|
|
if (info.DataDetails.Length > 1)
|
|||
|
|
{
|
|||
|
|
btnPriv.gameObject.SetActive(true);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
btnPriv.gameObject.SetActive(true);
|
|||
|
|
btnNext.gameObject.SetActive(true);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void OnBtnNextClick()
|
|||
|
|
{
|
|||
|
|
currentIndex++;
|
|||
|
|
if (currentIndex >= info.DataDetails.Length)
|
|||
|
|
{
|
|||
|
|
currentIndex = info.DataDetails.Length - 1;
|
|||
|
|
}
|
|||
|
|
ShowNextPrivButton();
|
|||
|
|
StartCoroutine(ImageLoader<RawImage>.LoadImage(CommonData.SpotImageFullPath + info.DataDetails[currentIndex], img, ImageLoadCompleted));
|
|||
|
|
// StartCoroutine("GetImage", info.DataDetails[currentIndex]);
|
|||
|
|
|
|||
|
|
txtTitle.text = TipPointCollider.Instance.GetImageShow(info, currentIndex);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void OnBtnPrivClick()
|
|||
|
|
{
|
|||
|
|
currentIndex--;
|
|||
|
|
if (currentIndex < 0)
|
|||
|
|
{
|
|||
|
|
currentIndex = 0;
|
|||
|
|
}
|
|||
|
|
ShowNextPrivButton();
|
|||
|
|
StartCoroutine(ImageLoader<RawImage>.LoadImage(CommonData.SpotImageFullPath + info.DataDetails[currentIndex], img, ImageLoadCompleted));
|
|||
|
|
// StartCoroutine("GetImage", info.DataDetails[currentIndex]);
|
|||
|
|
|
|||
|
|
txtTitle.text = TipPointCollider.Instance.GetImageShow(info, currentIndex);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private Vector2 finger1Position;
|
|||
|
|
private Vector2 finger2Position;
|
|||
|
|
float scroll;
|
|||
|
|
public float scrollSpeed = 50f;
|
|||
|
|
|
|||
|
|
void Update()
|
|||
|
|
{
|
|||
|
|
// if (imgRequest != null)
|
|||
|
|
{
|
|||
|
|
// Debug.Log($"{imgRequest.downloadProgress}");
|
|||
|
|
}
|
|||
|
|
if (!BaseController.CanControl)
|
|||
|
|
{
|
|||
|
|
if (Input.touchCount == 2)
|
|||
|
|
{
|
|||
|
|
Touch touch1 = Input.GetTouch(0);
|
|||
|
|
Touch touch2 = Input.GetTouch(1);
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָλ<D6B8><CEBB>
|
|||
|
|
finger1Position = touch1.position;
|
|||
|
|
finger2Position = touch2.position;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>㵱ǰ<E3B5B1><C7B0>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ֡<D2BB><D6A1>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
|
|||
|
|
float distance = Vector2.Distance(finger1Position, finger2Position);
|
|||
|
|
float previousDistance = Vector2.Distance(finger1Position - touch1.deltaPosition, finger2Position - touch2.deltaPosition);
|
|||
|
|
scroll = (previousDistance - distance) / scrollSpeed;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
scroll = Input.GetAxis("Mouse ScrollWheel");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Debug.Log(scroll);
|
|||
|
|
|
|||
|
|
if (scroll >= 0.1f)
|
|||
|
|
{
|
|||
|
|
OnBtnLargeClick();
|
|||
|
|
}
|
|||
|
|
else if (scroll <= -0.1f)
|
|||
|
|
{
|
|||
|
|
OnBtnSmallClick();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|