本文整理汇总了C#中Vector4.PUParse方法的典型用法代码示例。如果您正苦于以下问题:C# Vector4.PUParse方法的具体用法?C# Vector4.PUParse怎么用?C# Vector4.PUParse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector4
的用法示例。
在下文中一共展示了Vector4.PUParse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: gaxb_private_complete
public override void gaxb_private_complete()
{
// Delay setting of stretch anchors until after loading has happened
if (gameObject == null) {
return;
}
RectTransform parentTransform = gameObject.transform.parent as RectTransform;
float parentW = Screen.width;
float parentH = Screen.height;
if (parentTransform != null) {
Canvas rootCanvas = parentTransform.GetComponent<Canvas> ();
if (rootCanvas == null || rootCanvas.isRootCanvas == false) {
// Work around for unity issue where the rect transform of a sub canvas does not update soon enough
if (rootCanvas != null && ((int)parentTransform.rect.width == 100 && (int)parentTransform.rect.height == 100) ) {
} else {
parentW = parentTransform.rect.width;
parentH = parentTransform.rect.height;
}
}
}
if (anchor != null) {
int numCommas = anchor.NumberOfOccurancesOfChar (',');
Vector4 values = new Vector4 ();
if (numCommas == 1) {
// english representation
values = stringToAnchorLookup [anchor];
}
if (numCommas == 3) {
// math representation
values.PUParse (anchor);
}
rectTransform.anchorMin = new Vector2 (values.x, values.y);
rectTransform.anchorMax = new Vector2 (values.z, values.w);
// the sizeDelta is the amount left over after the anchors are calculated; therefore,
// if we have set the anchors we need to adjust the sizeDelta
float anchorDeltaX = rectTransform.anchorMax.x - rectTransform.anchorMin.x;
float anchorDeltaY = rectTransform.anchorMax.y - rectTransform.anchorMin.y;
float mySizeDeltaX = rectTransform.sizeDelta.x;
float mySizeDeltaY = rectTransform.sizeDelta.y;
mySizeDeltaX -= (parentW * anchorDeltaX);
mySizeDeltaY -= (parentH * anchorDeltaY);
rectTransform.sizeDelta = new Vector2 (mySizeDeltaX, mySizeDeltaY);
}
}