當前位置: 首頁>>代碼示例>>C#>>正文


C# RectTransform.SetAsFirstSibling方法代碼示例

本文整理匯總了C#中UnityEngine.RectTransform.SetAsFirstSibling方法的典型用法代碼示例。如果您正苦於以下問題:C# RectTransform.SetAsFirstSibling方法的具體用法?C# RectTransform.SetAsFirstSibling怎麽用?C# RectTransform.SetAsFirstSibling使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEngine.RectTransform的用法示例。


在下文中一共展示了RectTransform.SetAsFirstSibling方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MakeRipple

		public void MakeRipple (int size, float animSpeed, float startAlpha, float endAlpha, Color color, Vector3 endPosition)
		{
	//		Get references to components
			thisImage = gameObject.GetComponent<Image> ();
			thisRect = gameObject.GetComponent<RectTransform> ();

	//		Sets the ink blot to draw behind all other siblings (text, icon etc)
			thisRect.SetAsFirstSibling ();

			thisRect.sizeDelta = new Vector2 (size * 1.5f, size * 1.5f);
			thisRect.localScale = new Vector3(0f, 0f, 1f);

			if (gameObject.GetComponentInParent<MaterialUIScaler> ())
				scaledSize = Mathf.RoundToInt(gameObject.GetComponentInParent<MaterialUIScaler>().scaleFactor * size);
			else
				scaledSize = size;

			if (scaledSize <= 64 && im64px)
				thisImage.sprite = im64px;
			else if (scaledSize <= 128 && im128px)
				thisImage.sprite = im128px;
			else if (scaledSize <= 256 && im256px)
				thisImage.sprite = im256px;
			else if (scaledSize <= 384 && im384px)
				thisImage.sprite = im384px;
			else if (scaledSize <= 512 && im512px)
				thisImage.sprite = im512px;
			else if (scaledSize <= 640 && im640px)
				thisImage.sprite = im640px;
			else if (scaledSize <= 768 && im768px)
				thisImage.sprite = im768px;
			else if (scaledSize <= 896 && im896px)
				thisImage.sprite = im896px;
			else if (im1024px)
				thisImage.sprite = im1024px;

			tempColor = color;
			tempColor.a = startAlpha;
			thisImage.color = tempColor;

			if (endPosition != new Vector3 (0, 0, 0))
			{
				moveTowardCenter = true;
				endPos = endPosition;
			}

//			thisRect.localPosition = new Vector3 (thisRect.localPosition.x, thisRect.localPosition.y, 0f);

			startPos = thisRect.position;

			startColorAlpha = startAlpha;
			endColorAlpha = endAlpha;
			animationSpeed = animSpeed;

			state = 1;
			animStartTime = Time.realtimeSinceStartup;
			animFirstStartTime = animStartTime;
		}
開發者ID:modulexcite,項目名稱:MaterialUI,代碼行數:58,代碼來源:RippleAnim.cs


注:本文中的UnityEngine.RectTransform.SetAsFirstSibling方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。