public GoblinLayer()
        {

            labelBones = new CCLabelTtf("B = Toggle Debug Bones", "arial", 12);
            labelBones.AnchorPoint = CCPoint.AnchorMiddleLeft;
            AddChild(labelBones);

            labelSlots = new CCLabelTtf("M = Toggle Debug Slots", "arial", 12);
            labelSlots.AnchorPoint = CCPoint.AnchorMiddleLeft;
            AddChild(labelSlots);

            labelSkin = new CCLabelTtf("S = Toggle Skin", "arial", 12);
            labelSkin.AnchorPoint = CCPoint.AnchorMiddleLeft;
            AddChild(labelSkin);

            labelTimeScale = new CCLabelTtf("Up/Down = TimeScale +/-", "arial", 12);
            labelTimeScale.AnchorPoint = CCPoint.AnchorMiddleLeft;
            AddChild(labelTimeScale);

            labelAction = new CCLabelTtf("A = Toggle Move Action", "arial", 12);
            labelAction.AnchorPoint = CCPoint.AnchorMiddleLeft;
            AddChild(labelAction);

            labelScene = new CCLabelTtf("P = SpineBoy", "arial", 12);
            labelScene.AnchorPoint = CCPoint.AnchorMiddleLeft;
            AddChild(labelScene);

            String name = @"goblins-ffd";
            //String name = @"goblins";
            skeletonNode = new CCSkeletonAnimation(name + ".json", name + ".atlas", 0.5f);
            skeletonNode.PremultipliedAlpha = true;

            skeletonNode.SetSkin("goblin");

            var wt = skeletonNode.NodeToWorldTransform;
            skeletonNode.SetSlotsToSetupPose();
            skeletonNode.UpdateWorldTransform();

            skeletonNode.AddAnimation(0, "walk", true, 4);
            skeletonNode.SetAnimation(0, "walk", true);

            skeletonNode.Start += Start;
            skeletonNode.End += End;
            skeletonNode.Complete += Complete;
            skeletonNode.Event += Event;

            //skeletonNode.RepeatForever(new CCFadeOut(1), new CCFadeIn(1));

            AddChild(skeletonNode);

            var listener = new CCEventListenerTouchOneByOne();
            listener.OnTouchBegan = (touch, touchEvent) =>
                {
                    if (!skeletonNode.DebugBones)
                    {
                        skeletonNode.DebugBones = true; 
                    }
                    else if (skeletonNode.TimeScale == 1)
                        skeletonNode.TimeScale = 0.3f;
                    else if (skeletonNode.Skeleton.Skin.Name == "goblin")
                        skeletonNode.SetSkin("goblingirl");
                    return true;
                };

			AddEventListener(listener, this);

            var keyListener = new CCEventListenerKeyboard();
            keyListener.OnKeyPressed = (keyEvent) =>
                {
                    switch (keyEvent.Keys)
                    {
                        case CCKeys.B:
                            skeletonNode.DebugBones = !skeletonNode.DebugBones;
                            break;
                        case CCKeys.M:
                            skeletonNode.DebugSlots = !skeletonNode.DebugSlots;
                            break;
                        case CCKeys.S:
                            if (skeletonNode.Skeleton.Skin.Name == "goblin")
                                skeletonNode.SetSkin("goblingirl");
                            else
                                skeletonNode.SetSkin("goblin");
                            break;
                        case CCKeys.Up:
                            skeletonNode.TimeScale += 0.1f;
                            break;
                        case CCKeys.Down:
                            skeletonNode.TimeScale -= 0.1f;
                            break;
                        case CCKeys.A:
                            if (isMoving)
                            {
								StopAction(skeletonActionState);
                                isMoving = false;
                            }
                            else
                            {
                                skeletonActionState = skeletonNode.RepeatForever(skeletonMoveAction);
                                isMoving = true;
                            }
                            break;
                        case CCKeys.P:
							Director.ReplaceScene(SpineBoyLayer.Scene);
                            break;
                    }

                };
			AddEventListener(keyListener, this);
        }
        public SpineBoyLayer()
        {
            CCMenuItemFont.FontName = "arial";
            CCMenuItemFont.FontSize = 12;

            labelBones = new CCMenuItemFont("B = Toggle Debug Bones", (obj) =>
                {
                    skeletonNode.DebugBones = !skeletonNode.DebugBones;
                }

            ) { AnchorPoint = CCPoint.AnchorMiddleLeft };

            labelSlots = new CCMenuItemFont("M = Toggle Debug Slots", (obj) =>
                {
                    skeletonNode.DebugSlots = !skeletonNode.DebugSlots;
                }

            ) { AnchorPoint = CCPoint.AnchorMiddleLeft };

            labelTimeScaleUp = new CCMenuItemFont("Up - TimeScale +", (obj) =>
                {
                    skeletonNode.TimeScale += 0.1f;
                }

            ) { AnchorPoint = CCPoint.AnchorMiddleLeft };

            labelTimeScaleDown = new CCMenuItemFont("Down - TimeScale -", (obj) =>
                {
                    skeletonNode.TimeScale -= 0.1f;
                }

            ) { AnchorPoint = CCPoint.AnchorMiddleLeft };

            labelScene = new CCMenuItemFont("G = Goblins", (obj) =>
                {
                    Director.ReplaceScene(GoblinLayer.Scene(Window));
                }

            ) { AnchorPoint = CCPoint.AnchorMiddleLeft };

            labelJump = new CCMenuItemFont("J = Jump", (obj) =>
                {
                    // I truthfully do not know if this is how it is done or not
                    skeletonNode.SetAnimation(0, "jump", false);
                    skeletonNode.AddAnimation(0, "run", true);
                }

            ) { AnchorPoint = CCPoint.AnchorMiddleLeft };

            menu = new CCMenu(labelBones, labelSlots, labelTimeScaleUp, labelTimeScaleDown, labelJump, labelScene);
            menu.AlignItemsVertically();
            AddChild(menu);

			String name = @"spineboy";
            skeletonNode = new CCSkeletonAnimation(name + ".json", name + ".atlas", 0.25f);

            skeletonNode.SetMix("walk", "jump", 0.2f);
            skeletonNode.SetMix("jump", "run", 0.2f);
            skeletonNode.SetAnimation(0, "walk", true);
			TrackEntry jumpEntry = skeletonNode.AddAnimation(0, "jump", false, 3);
            skeletonNode.AddAnimation(0, "run", true);

            skeletonNode.Start += Start;
            skeletonNode.End += End;
            skeletonNode.Complete += Complete;
            skeletonNode.Event += Event;

            AddChild(skeletonNode);

            var listener = new CCEventListenerTouchOneByOne();
            listener.OnTouchBegan = (touch, touchEvent) =>
                {
                    if (!skeletonNode.DebugBones)
                    {
                        skeletonNode.DebugBones = true; 
                    }
                    else if (skeletonNode.TimeScale == 1)
                        skeletonNode.TimeScale = 0.3f;
                    return true;
                };
			AddEventListener(listener, this);

            var keyListener = new CCEventListenerKeyboard();
            keyListener.OnKeyPressed = (keyEvent) =>
                {
                    switch (keyEvent.Keys)
                    {
                        case CCKeys.B:
                            skeletonNode.DebugBones = !skeletonNode.DebugBones;
                            break;
                        case CCKeys.M:
                            skeletonNode.DebugSlots = !skeletonNode.DebugSlots;
                            break;
                        case CCKeys.Up:
                            skeletonNode.TimeScale += 0.1f;
                            break;
                        case CCKeys.Down:
                            skeletonNode.TimeScale -= 0.1f;
                            break;
                        case CCKeys.G:
                            Director.ReplaceScene(GoblinLayer.Scene(Window));
                            break;
						case CCKeys.J:
							// I truthfully do not know if this is how it is done or not
							skeletonNode.SetAnimation(0, "jump", false);
							skeletonNode.AddAnimation(0, "run", true);
							break;
                    }

                };
			AddEventListener(keyListener, this);
        }
        public SpineBoyLayer()
        {

            labelBones = new CCLabelTtf("B = Toggle Debug Bones", "arial", 12);
            labelBones.AnchorPoint = CCPoint.AnchorMiddleLeft;
            AddChild(labelBones);

            labelSlots = new CCLabelTtf("M = Toggle Debug Slots", "arial", 12);
            labelSlots.AnchorPoint = CCPoint.AnchorMiddleLeft;
            AddChild(labelSlots);

            labelTimeScale = new CCLabelTtf("Up/Down = TimeScale +/-", "arial", 12);
            labelTimeScale.AnchorPoint = CCPoint.AnchorMiddleLeft;
            AddChild(labelTimeScale);

            labelScene = new CCLabelTtf("G = Goblins", "arial", 12);
            labelScene.AnchorPoint = CCPoint.AnchorMiddleLeft;
            AddChild(labelScene);

			labelJump = new CCLabelTtf("J = Jump", "arial", 12);
			labelJump.AnchorPoint = CCPoint.AnchorMiddleLeft;
			AddChild(labelJump);

			String name = @"spineboy";
            skeletonNode = new CCSkeletonAnimation(name + ".json", name + ".atlas", 0.25f);

            skeletonNode.SetMix("walk", "jump", 0.2f);
            skeletonNode.SetMix("jump", "run", 0.2f);
            skeletonNode.SetAnimation(0, "walk", true);
			TrackEntry jumpEntry = skeletonNode.AddAnimation(0, "jump", false, 3);
            skeletonNode.AddAnimation(0, "run", true);

            skeletonNode.Start += Start;
            skeletonNode.End += End;
            skeletonNode.Complete += Complete;
            skeletonNode.Event += Event;

            AddChild(skeletonNode);

            var listener = new CCEventListenerTouchOneByOne();
            listener.OnTouchBegan = (touch, touchEvent) =>
                {
                    if (!skeletonNode.DebugBones)
                    {
                        skeletonNode.DebugBones = true; 
                    }
                    else if (skeletonNode.TimeScale == 1)
                        skeletonNode.TimeScale = 0.3f;
                    return true;
                };
			AddEventListener(listener, this);

            var keyListener = new CCEventListenerKeyboard();
            keyListener.OnKeyPressed = (keyEvent) =>
                {
                    switch (keyEvent.Keys)
                    {
                        case CCKeys.B:
                            skeletonNode.DebugBones = !skeletonNode.DebugBones;
                            break;
                        case CCKeys.M:
                            skeletonNode.DebugSlots = !skeletonNode.DebugSlots;
                            break;
                        case CCKeys.Up:
                            skeletonNode.TimeScale += 0.1f;
                            break;
                        case CCKeys.Down:
                            skeletonNode.TimeScale -= 0.1f;
                            break;
                        case CCKeys.G:
                            Director.ReplaceScene(GoblinLayer.Scene);
                            break;
						case CCKeys.J:
							// I truthfully do not know if this is how it is done or not
							skeletonNode.SetAnimation(0, "jump", false);
							skeletonNode.AddAnimation(0, "run", true);
							break;
                    }

                };
			AddEventListener(keyListener, this);
        }