예제 #1
0
 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);
             }
         }
     }
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
 public static Transform FindChildByName(string name, Component parent)
 {
     if (parent.name == name)
     {
         return(parent.transform);
     }
     if (FindChildHelper._FindChildByNameRecurse(name, parent.transform))
     {
         return(FindChildHelper._GetFound());
     }
     return(FindChildHelper.NoChildNamed(name, parent));
 }
예제 #4
0
    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);
    }
예제 #5
0
 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);
     }
 }
예제 #6
0
    public static Transform RandomChild(Transform transform)
    {
        int num  = transform.childCount;
        int num1 = num;

        if (num1 == 0)
        {
            return(null);
        }
        if (num1 == 1)
        {
            return(transform.GetChild(0));
        }
        return(FindChildHelper.GetChildAtIndex(transform, UnityEngine.Random.Range(0, num)));
    }
예제 #7
0
    private static bool __FindChildByNameRecurse(string name, Transform parent)
    {
        if (parent.childCount == 0)
        {
            return(false);
        }
        FindChildHelper.found = parent.Find(name);
        if (FindChildHelper.found)
        {
            return(true);
        }
        int num = parent.childCount;

        for (int i = 0; i < num; i++)
        {
            Transform child = parent.GetChild(i);
            if (child.childCount > 0 && FindChildHelper.__FindChildByNameRecurse(name, child))
            {
                return(true);
            }
        }
        return(false);
    }
예제 #8
0
 private static bool _FindChildByNameRecurse(string name, Transform parent)
 {
     return(FindChildHelper.__FindChildByNameRecurse(name, parent));
 }