Exemplo n.º 1
0
        /// <summary>
        /// Sets the given values of the object with the given name. </summary>
        /// <param name="name"> the name of the object </param>
        /// <param name="x"> the new position in x direction of the object </param>
        /// <param name="y"> the new position in y direction of the object </param>
        /// <param name="angle"> the new angle of the object </param>
        /// <param name="scaleX"> the new scale in x direction of the object </param>
        /// <param name="scaleY"> the new scale in y direction of the object </param>
        /// <param name="pivotX"> the new pivot in x direction of the object </param>
        /// <param name="pivotY"> the new pivot in y direction of the object </param>
        /// <param name="alpha"> the new alpha value of the object </param>
        /// <param name="folder"> the new folder index of the object </param>
        /// <param name="file"> the new file index of the object </param>
        /// <exception cref="SpriterException"> if no object exists of the given name </exception>
        public virtual void SetObject(string name, float x, float y, float angle, float scaleX, float scaleY, float pivotX, float pivotY, float alpha, int folder, int file)
        {
            int index = GetObjectIndex(name);

            if (index == -1)
            {
                throw new SpriterException("No object found for name \"" + name + "\"");
            }
            Mainline.Key.ObjectRef @ref = CurrentKey.GetObjectRef(index);
            Object @object = GetObject(index);

            @object.Set(x, y, angle, scaleX, scaleY, pivotX, pivotY, alpha, folder, file);
            UnmapObjects(@ref);
        }
Exemplo n.º 2
0
        private void LoadRefs(ContentReader input, int objectRefCount, int boneRefCount, Mainline.Key _key)
        {
            for (int id = 0; id < boneRefCount; id++)
            {
                int parent   = input.ReadInt32();
                int timeline = input.ReadInt32();
                int key      = input.ReadInt32();

                Mainline.Key.BoneRef boneRef = new Mainline.Key.BoneRef(id, timeline, key, _key.GetBoneRef(parent));
                _key.AddBoneRef(boneRef);
            }

            for (int id = 0; id < objectRefCount; id++)
            {
                int parent   = input.ReadInt32();
                int timeline = input.ReadInt32();
                int key      = input.ReadInt32();
                int z        = input.ReadInt32();
                Mainline.Key.ObjectRef objref = new Mainline.Key.ObjectRef(id, timeline, key, _key.GetBoneRef(parent), z);
                _key.AddObjectRef(objref);
            }

            // TODO sort?
        }
Exemplo n.º 3
0
 /// <summary>
 /// Returns an iterator to iterate over all time line objects in the current animation starting at a given root. </summary>
 /// <param name="start"> the object reference to start at </param>
 /// <returns> the object iterator </returns>
 public virtual IEnumerator <Object> ObjectIterator(Mainline.Key.ObjectRef start)
 {
     this.objectIterator.Index = start.Id;
     return(this.objectIterator);
 }