当前位置: 首页>>代码示例>>C#>>正文


C# Spine.AnimationStateData类代码示例

本文整理汇总了C#中Spine.AnimationStateData的典型用法代码示例。如果您正苦于以下问题:C# AnimationStateData类的具体用法?C# AnimationStateData怎么用?C# AnimationStateData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AnimationStateData类属于Spine命名空间,在下文中一共展示了AnimationStateData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Animation

        public Animation(string AnimationFile)
        {
            skeletonRenderer = new SkeletonRenderer();

            String name = AnimationFile;

            Atlas atlas = new Atlas("Data/" + name + ".atlas", new GLImpTextureLoader());
            SkeletonJson json = new SkeletonJson(atlas);
            skeleton = new Skeleton(json.ReadSkeletonData("Data/" + name + ".json"));
            skeleton.SetSlotsToSetupPose();

            // Define mixing between animations.
            stateData = new AnimationStateData(skeleton.Data);
            state = new AnimationState(stateData);
            //state.SetAnimation("idle", true);

            skeleton.X = 0;
            skeleton.Y = 0.1f;
            skeleton.UpdateWorldTransform();

            drawtime = new Stopwatch();
            drawtime.Start();

            Program.MiddleDrawQueue += Draw;
        }
开发者ID:CloneDeath,项目名称:PokemonSmash,代码行数:25,代码来源:Animation.cs

示例2: MakeSkeletonAndAnimationData

    /*
     */
    private void MakeSkeletonAndAnimationData()
    {
        if(sprites == null) {
            Debug.LogWarning("Sprite collection not set for skeleton data asset: " + name,this);
            return;
        }

        if(skeletonJSON == null) {
            Debug.LogWarning("Skeleton JSON file not set for skeleton data asset: " + name,this);
            return;
        }

        SkeletonJson json = new SkeletonJson(new tk2dSpineAttachmentLoader(sprites.spriteCollection));
        json.Scale = scale;

        try {
            skeletonData = json.ReadSkeletonData(new StringReader(skeletonJSON.text));
        } catch (Exception ex) {
            Debug.Log("Error reading skeleton JSON file for skeleton data asset: " + name + "\n" + ex.Message + "\n" + ex.StackTrace,this);
            return;
        }

        stateData = new AnimationStateData(skeletonData);
        for(int i = 0, n = fromAnimation.Length; i < n; i++) {
            if(fromAnimation[i].Length == 0 || toAnimation[i].Length == 0) continue;
            stateData.SetMix(fromAnimation[i],toAnimation[i],duration[i]);
        }
    }
开发者ID:anhuishuqi,项目名称:spine-runtimes,代码行数:30,代码来源:tk2dSpineSkeletonDataAsset.cs

示例3: SpineSkeleton

		public SpineSkeleton(string atlasName, string skeletonName, Rectangle originAndScale)
		{
			skeleton = CreateSkeleton(atlasName, skeletonName);
			skeleton.SetBonesToSetupPose();
			stateData = new AnimationStateData(skeleton.Data);
			state = new AnimationState(stateData);
			LastOriginAndScale = OriginAndScale = originAndScale;
			OnDraw<SpineRenderer>();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:9,代码来源:SpineSkeleton.cs

示例4: SetFadingSettings

        /// <summary>
        /// Wendet alle zum Skeleton passenden AnimationMixes auf animationStateData an.
        /// </summary>
        public static void SetFadingSettings(AnimationStateData pAnimationStateData)
        {
            List<AnimationMix> AnimationFadingList;
            AnimationFadingList = AnimationFading[pAnimationStateData.SkeletonData.Name];

            foreach (AnimationMix animMix in AnimationFadingList)
            {
                pAnimationStateData.SetMix(animMix.From, animMix.To, animMix.Fading);
            }
        }
开发者ID:jrichter42,项目名称:DragonEngine,代码行数:13,代码来源:SpineSettings.cs

示例5: SetAnimationStateData

        public void SetAnimationStateData (AnimationStateData stateData ) {
	        
	        if (stateData!=null)

	        OwnsAnimationStateData = false;
	        State = new AnimationState(stateData);
            State.Event += OnEvent;
            State.Start += OnStart;
            State.Complete += OnComplete;
            State.End += OnEnd;

        }
开发者ID:460189852,项目名称:cocos-sharp-samples,代码行数:12,代码来源:CCSkeletonAnimation.cs

示例6: SpinePlayer

        public SpinePlayer(string atlasPath, string jsonPath)
        {
            Name = jsonPath;

            _skeletonRenderer = new SkeletonRenderer(Render.Device);

            var atlas = new Atlas(atlasPath, new XnaTextureLoader(Render.Device));
            var json = new SkeletonJson(atlas);

            Skeleton = new Skeleton(json.ReadSkeletonData(jsonPath));
            Skeleton.SetSlotsToSetupPose(); // Without this the skin attachments won't be attached. See SetSkin.

            var stateData = new AnimationStateData(Skeleton.Data);
            State = new AnimationState(stateData);
            IsVisible = true;
        }
开发者ID:hgrandry,项目名称:Mgx,代码行数:16,代码来源:SpinePlayer.cs

示例7: LoadContent

        protected override void LoadContent()
        {
            Effect spriteBatchEffect = Content.Load<Effect>("SpriteBatchEffect");
            spriteBatch = new SpriteBatchEx(GraphicsDevice, spriteBatchEffect);

            Bone.yDown = true;
            skeletonData = Content.Load<SkeletonData>("spineboy/spineboy");
            skeleton = new Skeleton(skeletonData);
            skeleton.SetSlotsToSetupPose();

            AnimationStateData stateData = new AnimationStateData(skeleton.Data);
            animationState = new AnimationState(stateData);
            animationState.SetAnimation(0, "walk", true);

            skeleton.UpdateWorldTransform();
        }
开发者ID:ThirdPartyNinjas,项目名称:NinjaSharp,代码行数:16,代码来源:TestGame.cs

示例8: Avatar

        public Avatar(string AnimationFile)
        {
            SkeletonRenderer = new SkeletonRenderer(Vector3.UnitY, Vector3.UnitZ);

            String name = AnimationFile;

            Atlas atlas = new Atlas(name + ".atlas", new OpenTKTextureLoader());
            SkeletonJson json = new SkeletonJson(atlas);
            Skeleton = new Skeleton(json.ReadSkeletonData(name + ".json"));
            Skeleton.SetSlotsToSetupPose();

            // Define mixing between animations.
            StateData = new AnimationStateData(Skeleton.Data);
            State = new AnimationState(StateData);

            Skeleton.X = 0;
            Skeleton.Y = 0;
            Skeleton.UpdateWorldTransform();
        }
开发者ID:CloneDeath,项目名称:spine-runtimes,代码行数:19,代码来源:Avatar.cs

示例9: GetSkeletonData

	public SkeletonData GetSkeletonData (bool quiet) {
		if (atlasAsset == null) {
			if (!quiet)
				Debug.LogWarning("Atlas not set for skeleton data asset: " + name, this);
			Clear();
			return null;
		}

		if (skeletonJSON == null) {
			if (!quiet)
				Debug.LogWarning("Skeleton JSON file not set for skeleton data asset: " + name, this);
			Clear();
			return null;
		}

		Atlas atlas = atlasAsset.GetAtlas();
		if (atlas == null) {
			Clear();
			return null;
		}

		if (skeletonData != null)
			return skeletonData;

		SkeletonJson json = new SkeletonJson(atlas);
		json.Scale = scale;
		try {
			skeletonData = json.ReadSkeletonData(new StringReader(skeletonJSON.text));
		} catch (Exception ex) {
			if (!quiet)
				Debug.Log("Error reading skeleton JSON file for skeleton data asset: " + name + "\n" + ex.Message + "\n" + ex.StackTrace, this);
			return null;
		}

		stateData = new AnimationStateData(skeletonData);
		for (int i = 0, n = fromAnimation.Length; i < n; i++) {
			if (fromAnimation[i].Length == 0 || toAnimation[i].Length == 0) continue;
			stateData.SetMix(fromAnimation[i], toAnimation[i], duration[i]);
		}

		return skeletonData;
	}
开发者ID:D021,项目名称:ink,代码行数:42,代码来源:SkeletonDataAsset.cs

示例10: GetSkeletonData

	public SkeletonData GetSkeletonData (bool quiet) {
		if (spriteCollection == null) {
			if (!quiet)
				Debug.LogWarning("Sprite collection not set for skeleton data asset: " + name, this);
			Clear();
			return null;
		}

		if (skeletonJSON == null) {
			if (!quiet)
				Debug.LogWarning("Skeleton JSON file not set for skeleton data asset: " + name, this);
			Clear();
			return null;
		}

		if (skeletonData != null)
			return skeletonData;

		SkeletonJson json = new SkeletonJson(new SpriteCollectionAttachmentLoader(spriteCollection));
		json.Scale = 1.0f / (spriteCollection.invOrthoSize * spriteCollection.halfTargetHeight) * scale;

		try {
			skeletonData = json.ReadSkeletonData(new StringReader(skeletonJSON.text));
		} catch (Exception ex) {
			Debug.Log("Error reading skeleton JSON file for skeleton data asset: " + name + "\n" +
				ex.Message + "\n" + ex.StackTrace, this);
			return null;
		}

		stateData = new AnimationStateData(skeletonData);
		for (int i = 0, n = fromAnimation.Length; i < n; i++) {
			if (fromAnimation[i].Length == 0 || toAnimation[i].Length == 0)
				continue;
			stateData.SetMix(fromAnimation[i], toAnimation[i], duration[i]);
		}

		return skeletonData;
	}
开发者ID:rtumelty,项目名称:ridiculousrescue,代码行数:38,代码来源:SkeletonDataAsset.cs

示例11: LoadContent

        protected override void LoadContent()
        {
            skeletonRenderer = new SkeletonRenderer(GraphicsDevice);

            String name = "spineboy"; // "goblins";

            Atlas atlas = new Atlas("data/" + name + ".atlas", new XnaTextureLoader(GraphicsDevice));
            SkeletonJson json = new SkeletonJson(atlas);
            skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json"));
            if (name == "goblins") skeleton.SetSkin("goblingirl");
            skeleton.SetSlotsToBindPose(); // Without this the skin attachments won't be attached. See SetSkin.

            // Define mixing between animations.
            AnimationStateData stateData = new AnimationStateData(skeleton.Data);
            if (name == "spineboy") {
                stateData.SetMix("walk", "jump", 0.2f);
                stateData.SetMix("jump", "walk", 0.4f);
            }

            state = new AnimationState(stateData);
            state.SetAnimation("walk", false);
            state.AddAnimation("jump", false);
            state.AddAnimation("walk", true);

            skeleton.RootBone.X = 320;
            skeleton.RootBone.Y = 440;
            skeleton.UpdateWorldTransform();
        }
开发者ID:CalPeterWu,项目名称:spine-runtimes,代码行数:28,代码来源:ExampleGame.cs

示例12: LoadContent

		protected override void LoadContent () {
			skeletonRenderer = new SkeletonMeshRenderer(GraphicsDevice);
			skeletonRenderer.PremultipliedAlpha = true;

			// String name = "spineboy";
			// String name = "goblins-mesh";
			String name = "raptor";
			bool binaryData = true;

			Atlas atlas = new Atlas(assetsFolder + name + ".atlas", new XnaTextureLoader(GraphicsDevice));

			float scale = 1;
			if (name == "spineboy") scale = 0.6f;
			if (name == "raptor") scale = 0.5f;

			SkeletonData skeletonData;
			if (binaryData) {
				SkeletonBinary binary = new SkeletonBinary(atlas);
				binary.Scale = scale;
				skeletonData = binary.ReadSkeletonData(assetsFolder + name + ".skel");
			} else {
				SkeletonJson json = new SkeletonJson(atlas);
				json.Scale = scale;
				skeletonData = json.ReadSkeletonData(assetsFolder + name + ".json");
			}
			skeleton = new Skeleton(skeletonData);
			if (name == "goblins-mesh") skeleton.SetSkin("goblin");

			// Define mixing between animations.
			AnimationStateData stateData = new AnimationStateData(skeleton.Data);
			state = new AnimationState(stateData);

			if (name == "spineboy") {
				stateData.SetMix("run", "jump", 0.2f);
				stateData.SetMix("jump", "run", 0.4f);

				// Event handling for all animations.
				state.Start += Start;
				state.End += End;
				state.Complete += Complete;
				state.Event += Event;

				state.SetAnimation(0, "test", false);
				TrackEntry entry = state.AddAnimation(0, "jump", false, 0);
				entry.End += End; // Event handling for queued animations.
				state.AddAnimation(0, "run", true, 0);
			} else if (name == "raptor") {
				state.SetAnimation(0, "walk", true);
				state.SetAnimation(1, "empty", false);
				state.AddAnimation(1, "gungrab", false, 2);
			} else {
				state.SetAnimation(0, "walk", true);
			}

			skeleton.X = 400;
			skeleton.Y = 590;
			skeleton.UpdateWorldTransform();

			headSlot = skeleton.FindSlot("head");
		}
开发者ID:Lucius0,项目名称:spine-runtimes,代码行数:60,代码来源:ExampleGame.cs

示例13: BuildSkeleton

    // build the sprite and slots with the skeleton data
    private void BuildSkeleton(SkeletonData skeletonData)
    {
        skeleton = new Skeleton(skeletonData);
        skeleton.UpdateWorldTransform();

        // check if there are multiple skins loaded
        if(skeleton.Data.Skins.Count > 0){
            // load the first skin as default
            SetSkin(skeleton.Data.Skins[0].Name);
        }

        // build all the child sprites in the container, add them based on the slot draw order and create using the default slot/attachment
        for(int i = 0; i < skeleton.DrawOrder.Count; i++){
            GSpineSlot slot = new GSpineSlot(skeleton.DrawOrder[i]);
            slots.Add(slot);
            AddChild(slot);
        }

        AnimationStateData animationStateData = new AnimationStateData(skeleton.Data);
        animation = new Spine.AnimationState(animationStateData);
    }
开发者ID:Grizzlage,项目名称:Futile-SpineSprite,代码行数:22,代码来源:GSpineSprite.cs

示例14: LoadContent

        protected override void LoadContent()
        {
            skeletonRenderer = new SkeletonRenderer(GraphicsDevice);

            String name = "spineboy"; // "goblins";

            Atlas atlas = new Atlas("data/" + name + ".atlas", new XnaTextureLoader(GraphicsDevice));
            SkeletonJson json = new SkeletonJson(atlas);
            skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json"));
            if (name == "goblins") skeleton.SetSkin("goblingirl");
            skeleton.SetSlotsToSetupPose(); // Without this the skin attachments won't be attached. See SetSkin.

            // Define mixing between animations.
            AnimationStateData stateData = new AnimationStateData(skeleton.Data);
            if (name == "spineboy") {
                stateData.SetMix("walk", "jump", 0.2f);
                stateData.SetMix("jump", "walk", 0.4f);
            }

            state = new AnimationState(stateData);

            if (true) {
                // Event handling for all animations.
                state.Start += new EventHandler(Start);
                state.End += new EventHandler(End);
                state.Complete += new EventHandler<CompleteArgs>(Complete);
                state.Event += new EventHandler<EventTriggeredArgs>(Event);

                state.SetAnimation("drawOrder", true);
            } else {
                state.SetAnimation("walk", false);
                QueueEntry entry = state.AddAnimation("jump", false);
                entry.End += new EventHandler(End); // Event handling for queued animations.
                state.AddAnimation("walk", true);
            }

            skeleton.X = 320;
            skeleton.Y = 440;
            skeleton.UpdateWorldTransform();

            headSlot = skeleton.FindSlot("head");
        }
开发者ID:jaimeBokoko,项目名称:spine-runtimes,代码行数:42,代码来源:ExampleGame.cs

示例15: InitializeWithData

		internal void InitializeWithData (SkeletonData sd) {
			this.skeletonData = sd;
			this.stateData = new AnimationStateData(skeletonData);
			FillStateData();
		}
开发者ID:EsotericSoftware,项目名称:spine-runtimes,代码行数:5,代码来源:SkeletonDataAsset.cs


注:本文中的Spine.AnimationStateData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。