private void Update() { if (string.IsNullOrEmpty(this.find)) { this.foundFind = null; this.foundIter = null; } else { if (this.findSW == null) { this.findSW = new Stopwatch(); } this.findSW.Reset(); this.findSW.Start(); this.foundFind = base.transform.Find(this.find); this.findSW.Stop(); this.findTime = (float)this.findSW.Elapsed.TotalMilliseconds; if (this.iterSW == null) { this.iterSW = new Stopwatch(); } this.iterSW.Reset(); this.iterSW.Start(); this.foundIter = FindChildHelper.FindChildByName(this.find, this); this.iterSW.Stop(); this.iterTime = (float)this.iterSW.Elapsed.TotalMilliseconds; } }
private static void _RecursiveLinkTransformsByName(Transform ragdoll, Transform body, Transform bodyMatchTransform, ref Transform ragdollMatchTransform, ref bool foundMatch) { ragdollMatchTransform = null; for (int i = 0; i < ragdoll.childCount; i++) { Transform childAtIndex = FindChildHelper.GetChildAtIndex(ragdoll, i); Transform transform2 = FindChildHelper.FindChildByName(childAtIndex.name, body); if (transform2 != null) { childAtIndex.position = transform2.position; childAtIndex.rotation = transform2.rotation; if (!foundMatch && (transform2 == bodyMatchTransform)) { foundMatch = true; ragdollMatchTransform = childAtIndex; } if (foundMatch) { _RecursiveLinkTransformsByName(childAtIndex, transform2); } else { _RecursiveLinkTransformsByName(childAtIndex, transform2, bodyMatchTransform, ref ragdollMatchTransform, ref foundMatch); } } } }
public GameObject AddProgressStat(string text, float currentAmount, float maxAmount, float aboveSpace) { float contentHeight = this.GetContentHeight(); GameObject obj2 = NGUITools.AddChild(this.addParent, this.progressStatPrefab); UISlider componentInChildren = obj2.GetComponentInChildren <UISlider>(); UILabel component = FindChildHelper.FindChildByName("ProgressStatTitle", obj2.gameObject).GetComponent <UILabel>(); UILabel label2 = FindChildHelper.FindChildByName("ProgressAmountLabel", obj2.gameObject).GetComponent <UILabel>(); component.text = text; label2.text = (currentAmount >= 1f) ? currentAmount.ToString("N0") : currentAmount.ToString("N2"); componentInChildren.sliderValue = currentAmount / maxAmount; obj2.transform.SetLocalPositionY(-(contentHeight + aboveSpace)); return(obj2); }
private static void _RecursiveLinkTransformsByName(Transform ragdoll, Transform body) { for (int i = 0; i < ragdoll.childCount; i++) { Transform childAtIndex = FindChildHelper.GetChildAtIndex(ragdoll, i); Transform transform2 = FindChildHelper.FindChildByName(childAtIndex.name, body); if (transform2 != null) { childAtIndex.position = transform2.position; childAtIndex.rotation = transform2.rotation; } _RecursiveLinkTransformsByName(childAtIndex, body); } }