当前位置: 首页>>代码示例>>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;未经允许,请勿转载。