public void SameHeightSwitch() { if (proportionMode == 2) { return; } proportionMode = 2; if (imageList.Count == 0) { return; } getIndex(); RawImage ri = imageList[index].GetComponent <RawImage>(); float baseHeight = imageList[index].transform.localScale.x * ri.texture.height; for (int i = 0; i < imageList.Count; i++) { UniGifImage gifScript = imageList[i].GetComponent <UniGifImage>(); if (gifScript != null) { gifScript.Play(); } ri = imageList[i].GetComponent <RawImage>(); // Rescales images so they all have the same height as baseHeight float newScale = baseHeight / ri.texture.height; if (gifScript != null) { gifScript.Stop(); } imageList[i].transform.localScale = newScale * Vector3.one; } RecalculateArrangement(); }
public void OnButtonClicked() { if (m_mutex == false && m_uniGifImage != null && string.IsNullOrEmpty(m_inputField.text) == false) { m_mutex = true; m_uniGifImage.Stop(); StartCoroutine(ViewGifCoroutine()); } }
void OnEnable() { gifSaved = false; if (Record.m_Recorder != null) { Record.m_Recorder.Save(); Record.m_Recorder.OnFileSaved += OnGifSaved; } uniGifImage.Stop(); image.enabled = false; LoadingImage.gameObject.SetActive(true); }
/* * public void ReloadImage() * { * // Needs special check for whether image is a .gif * print("Index: " + index); // 0 remains out of range * //while (textureLists.Count <= index) * // print("Waiting for load..."); // this approach causes Unity to freeze * img.texture = textureLists[index]; * Vector2 sDelta = 0.02f * Mathf.Pow(scaleFactor, 2) * (new Vector2(img.texture.width, img.texture.height)); * img.rectTransform.sizeDelta = sDelta; * imgCollider.size = new Vector3(sDelta.x, sDelta.y, .01f); * } */ public void DisableImage(int imageIndex) { GameObject curImgObj = imageList[imageIndex]; UniGifImage gifScript = curImgObj.GetComponent <UniGifImage>(); if (gifScript != null) { print("StoppingGif"); gifScript.Stop(); } RawImage curImg = curImgObj.GetComponent <RawImage>(); BoxCollider curColl = curImgObj.GetComponent <BoxCollider>(); curColl.enabled = false; curImg.enabled = false; }
public void HideGIFer() { _panelLeftG.enabled = false; gifimage.Stop(); }