Exemplo n.º 1
0
 private void TargetBoneChangeCheck()
 {
     if (!(this.targetBone == CommonUIData.bone))
     {
         this.targetBone = CommonUIData.bone;
         if (this.targetBone)
         {
             this.bgr.SetTarget(this.targetBone);
             this.bgr.Visible = this.bEdit;
             using (List <BoneRendererAssist> .Enumerator enumerator = this.braList.GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     BoneRendererAssist boneRendererAssist = enumerator.Current;
                     if (this.toFromBoneDic[boneRendererAssist.transform] == this.targetBone)
                     {
                         boneRendererAssist.SetColor(Setting.selectBoneColor.GetValue());
                     }
                     else
                     {
                         boneRendererAssist.SetColor(Setting.normalBoneColor.GetValue());
                     }
                 }
                 return;
             }
         }
         this.bgr.SetTarget(null);
         this.bgr.Visible = false;
     }
 }
Exemplo n.º 2
0
        private void SetRoot(Transform root)
        {
            this.rootTrs      = new GameObject().transform;
            this.rootTrs.name = root.name;
            this.copyBoneList.Add(this.rootTrs);
            this.fromToBoneDic.Add(root, this.rootTrs);
            this.toFromBoneDic.Add(this.rootTrs, root);
            this.rootTrs.parent = this.boneRendererRoot;
            CopyTransform copyTransform = this.rootTrs.gameObject.AddComponent <CopyTransform>();

            copyTransform.bScl = false;
            copyTransform.SetTarget(this.toFromBoneDic[this.rootTrs]);
            BoneRendererAssist boneRendererAssist = this.rootTrs.gameObject.AddComponent <BoneRendererAssist>();

            boneRendererAssist.SetSelectable(this.selectable);
            boneRendererAssist.SetVisible(this.boneDisplay == BoneDisplay.Visible);
            boneRendererAssist.SetColor(Setting.normalBoneColor.GetValue());
            this.braList.Add(boneRendererAssist);
        }
Exemplo n.º 3
0
    public void AutoSetUp()
    {
        bool flag = base.transform.parent;

        if (flag)
        {
            this.parent = base.transform.parent.GetComponent <BoneRendererAssist>();
        }
        else
        {
            this.parent = null;
        }
        this.children = new List <BoneRendererAssist>();
        foreach (object obj in base.transform)
        {
            Transform          transform = (Transform)obj;
            BoneRendererAssist component = transform.GetComponent <BoneRendererAssist>();
            bool flag2 = component != null;
            if (flag2)
            {
                this.children.Add(component);
            }
        }
    }
Exemplo n.º 4
0
        private Transform GetOrSetCopyBone(Transform root, Transform fromBone)
        {
            Transform result;

            if (this.fromToBoneDic.ContainsKey(fromBone))
            {
                result = this.fromToBoneDic[fromBone];
            }
            else if (fromBone.parent == null)
            {
                result = null;
            }
            else
            {
                BoneRendererAssist component;
                if (this.fromToBoneDic.ContainsKey(fromBone.parent))
                {
                    component = this.fromToBoneDic[fromBone.parent].GetComponent <BoneRendererAssist>();
                    if (this.parentChildDic.ContainsKey(fromBone.name))
                    {
                        string    name       = this.parentChildDic[fromBone.name];
                        Transform transform2 = CMT.SearchObjName(root.transform, name, false);
                        if (transform2)
                        {
                            component = this.GetOrSetCopyBone(root, transform2).GetComponent <BoneRendererAssist>();
                        }
                    }
                }
                else
                {
                    Transform transform3 = this.GetOrSetCopyBone(root, fromBone.parent);
                    if (transform3 == null)
                    {
                        return(null);
                    }
                    component = transform3.GetComponent <BoneRendererAssist>();
                }
                Transform transform4 = new GameObject().transform;
                transform4.name = fromBone.name;
                this.copyBoneList.Add(transform4);
                this.fromToBoneDic.Add(fromBone, transform4);
                this.toFromBoneDic.Add(transform4, fromBone);
                transform4.parent = this.boneRendererRoot;
                CopyTransform copyTransform = transform4.gameObject.AddComponent <CopyTransform>();
                copyTransform.bScl = false;
                copyTransform.SetTarget(this.toFromBoneDic[transform4]);
                BoneRendererAssist boneRendererAssist = transform4.gameObject.AddComponent <BoneRendererAssist>();
                boneRendererAssist.SetSelectable(this.selectable);
                if (component)
                {
                    boneRendererAssist.SetParent(component);
                    if (this.firstChildDic.ContainsKey(transform4.name) && this.firstChildDic[transform4.name] == component.transform.name)
                    {
                        component.SetFirstChild(boneRendererAssist);
                    }
                    else
                    {
                        component.SetChild(boneRendererAssist);
                    }
                }
                if (this.boneDisplay == BoneDisplay.Visible)
                {
                    boneRendererAssist.SetVisible(this.JudgeVisibleBone(boneRendererAssist));
                }
                else
                {
                    boneRendererAssist.SetVisible(false);
                }
                boneRendererAssist.SetColor(Setting.normalBoneColor.GetValue());
                this.braList.Add(boneRendererAssist);
                result = transform4;
            }
            return(result);
        }
Exemplo n.º 5
0
 private bool JudgeVisibleBone(BoneRendererAssist bra)
 {
     return(!bra.transform.name.EndsWith("_nub") && (Setting.targetSelectMode != 0 || !this.exclusiveBoneList.Contains(bra.transform.name)) && (Setting.targetSelectMode != 0 || Setting.bodyBoneDisplay.GetValue() != BodyBoneDisplay.Invisible || !BoneUtil.IsBodyBone(bra.transform.name)) && (!bra.transform.name.EndsWith("_SCL_") || !(bra.parent.transform.name == bra.transform.name.Substring(0, bra.transform.name.Length - 5))));
 }
Exemplo n.º 6
0
 public void SetChild(BoneRendererAssist bra)
 {
     this.children.Add(bra);
 }
Exemplo n.º 7
0
 public void SetParent(BoneRendererAssist bra)
 {
     this.parent = bra;
 }
Exemplo n.º 8
0
 public void SetFirstChild(BoneRendererAssist bra)
 {
     this.children.Insert(0, bra);
 }