コード例 #1
0
ファイル: Skeleton.cs プロジェクト: ladioussuapp/QMAX
        /// <summary>Caches information about bones and IK constraints. Must be called if bones or IK constraints are added or
        /// removed.</summary>
        public void UpdateCache()
        {
            ExposedList <ExposedList <Bone> > boneCache     = this.boneCache;
            ExposedList <IkConstraint>        ikConstraints = this.ikConstraints;
            int ikConstraintsCount = ikConstraints.Count;

            int arrayCount = ikConstraintsCount + 1;

            if (boneCache.Count > arrayCount)
            {
                boneCache.RemoveRange(arrayCount, boneCache.Count - arrayCount);
            }
            for (int i = 0, n = boneCache.Count; i < n; i++)
            {
                boneCache.Items[i].Clear();
            }
            while (boneCache.Count < arrayCount)
            {
                boneCache.Add(new ExposedList <Bone>());
            }

            ExposedList <Bone> nonIkBones = boneCache.Items[0];

            for (int i = 0, n = bones.Count; i < n; i++)
            {
                Bone bone    = bones.Items[i];
                Bone current = bone;
                do
                {
                    for (int ii = 0; ii < ikConstraintsCount; ii++)
                    {
                        IkConstraint ikConstraint = ikConstraints.Items[ii];
                        Bone         parent       = ikConstraint.bones.Items[0];
                        Bone         child        = ikConstraint.bones.Items[ikConstraint.bones.Count - 1];
                        while (true)
                        {
                            if (current == child)
                            {
                                boneCache.Items[ii].Add(bone);
                                boneCache.Items[ii + 1].Add(bone);
                                goto outer;
                            }
                            if (child == parent)
                            {
                                break;
                            }
                            child = child.parent;
                        }
                    }
                    current = current.parent;
                } while (current != null);
                nonIkBones.Add(bone);
                outer : { }
            }
        }
コード例 #2
0
 static int RemoveRange(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         Spine.ExposedList <Spine.Animation> obj = (Spine.ExposedList <Spine.Animation>)ToLua.CheckObject <Spine.ExposedList <Spine.Animation> >(L, 1);
         int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
         obj.RemoveRange(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #3
0
        public void UpdateCache()
        {
            ExposedList <ExposedList <Bone> > exposedList  = this.boneCache;
            ExposedList <IkConstraint>        exposedList2 = this.ikConstraints;
            int count = exposedList2.Count;
            int num   = count + 1;

            if (exposedList.Count > num)
            {
                exposedList.RemoveRange(num, exposedList.Count - num);
            }
            int i      = 0;
            int count2 = exposedList.Count;

            while (i < count2)
            {
                exposedList.Items[i].Clear(true);
                i++;
            }
            while (exposedList.Count < num)
            {
                exposedList.Add(new ExposedList <Bone>());
            }
            ExposedList <Bone> exposedList3 = exposedList.Items[0];
            int j      = 0;
            int count3 = this.bones.Count;

            while (j < count3)
            {
                Bone bone  = this.bones.Items[j];
                Bone bone2 = bone;
                int  k;
                while (true)
                {
                    k = 0;
IL_143:
                    while (k < count)
                    {
                        IkConstraint ikConstraint = exposedList2.Items[k];
                        Bone         bone3        = ikConstraint.bones.Items[0];
                        Bone         bone4        = ikConstraint.bones.Items[ikConstraint.bones.Count - 1];
                        while (bone2 != bone4)
                        {
                            if (bone4 == bone3)
                            {
                                k++;
                                goto IL_143;
                            }
                            bone4 = bone4.parent;
                        }
                        goto Block_4;
                    }
                    bone2 = bone2.parent;
                    if (bone2 == null)
                    {
                        goto Block_7;
                    }
                }
IL_164:
                j++;
                continue;
Block_4:
                exposedList.Items[k].Add(bone);
                exposedList.Items[k + 1].Add(bone);
                goto IL_164;
Block_7:
                exposedList3.Add(bone);
                goto IL_164;
            }
        }