public GameLayer()
            : base(CCColor4B.Blue, CCColor4B.AliceBlue)
        {
            // Set the layer gradient direction
            this.Vector = new CCPoint (0.5f, 0.5f);

            // Create and add sprites
            // We will later be applying a wave action to these sprites
            // These type of actions can only be applied to CCNodeGrid instances
            // Therefore, wrap our sprites in a CCNodeGrid parent
            monkeySprite1 = new CCNodeGrid ();
            monkeySprite1.AddChild (new CCSprite ("monkey"));
            AddChild (monkeySprite1);

            monkeySprite2 = new CCNodeGrid ();
            monkeySprite2.AddChild (new CCSprite ("monkey"));
            AddChild (monkeySprite2);

            // Define actions
            var moveUp = new CCMoveBy (1.0f, new CCPoint (0.0f, 50.0f));
            var moveDown = moveUp.Reverse ();

            // A CCSequence action runs the list of actions in ... sequence!
            CCSequence moveSeq = new CCSequence (new CCEaseBackInOut (moveUp), new CCEaseBackInOut (moveDown));

            repeatedAction = new CCRepeatForever (moveSeq);

            // A CCSpawn action runs the list of actions concurrently
            dreamAction = new CCSpawn (new CCFadeIn (5.0f), new CCWaves (5.0f, new CCGridSize (10, 20), 4, 4));

            // Schedule for method to be called every 0.1s
            Schedule (UpdateLayerGradient, 0.1f);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="animation"></param>
        public virtual bool StartAnimation(Animation animation, bool repeat = true)
        {
            if (SpriteSheet == null)
                return false;

            if (CurrentAnimation == animation)
                return false;

            CurrentAnimation = animation;
            
            var animationFrames = GetAnimationSprites(animation.RawSprite);
            SpriteFrame = animationFrames.First();
                        
            if (AnimationAction != null)
                StopAction(AnimationAction.Tag);
            AnimationAction = new CCAnimate(new CCAnimation(animationFrames, animation.SpriteDelay));
            if (repeat)
                AnimationAction = new CCRepeatForever(AnimationAction);
            AnimationAction.Tag = TAG_CURRENT_ANIMATION;
            RunAction(AnimationAction);

            OnFrameChanged();

            return true;
        }
Example #3
0
 public CCFiniteTimeActionState (CCFiniteTimeAction action, CCNode target)
     : base (action, target)
 { 
     Duration = action.Duration;
     Elapsed = 0.0f;
     firstTick = true;
 }
Example #4
0
        void InitCCSequence (CCFiniteTimeAction actionOne, CCFiniteTimeAction actionTwo)
        {
            Debug.Assert (actionOne != null);
            Debug.Assert (actionTwo != null);

            Actions [0] = actionOne;
            Actions [1] = actionTwo;
        }
Example #5
0
		public static CCFiniteTimeAction ActionWithDuration(float t)
        {
            var fadeout = new CCFadeOutDownTiles(t, new CCGridSize(16, 12));
            var back = fadeout.Reverse();
            var delay = new CCDelayTime (0.5f);
            var actions = new CCFiniteTimeAction[] {fadeout, delay, back};

			return new CCSequence(fadeout, delay, back);
        }
        public SpriteBatchNodeOffsetAnchorSkew()
        {
            CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache;
            cache.AddSpriteFrames("animations/grossini.plist");
            cache.AddSpriteFrames("animations/grossini_gray.plist", "animations/grossini_gray");

            // Create animations and actions

            var animFrames = new List<CCSpriteFrame>();
            string tmp = "";
            for (int j = 0; j < 14; j++)
            {
                string temp = "";
                if (j+1<10)
                {
                    temp = "0" + (j + 1);
                }
                else
                {
                    temp = (j + 1).ToString();
                }
                tmp = string.Format("grossini_dance_{0}.png", temp);
                CCSpriteFrame frame = cache[tmp];
                animFrames.Add(frame);
            }

            animation = new CCAnimation(animFrames, 0.3f);

            // skew
            CCSkewBy skewX = new CCSkewBy (2, 45, 0);
            CCFiniteTimeAction skewX_back = (CCFiniteTimeAction)skewX.Reverse();
            CCSkewBy skewY = new CCSkewBy (2, 0, 45);
            CCFiniteTimeAction skewY_back = (CCFiniteTimeAction)skewY.Reverse();

            // scale 
            CCScaleBy scale = new CCScaleBy(2, 2);
            CCFiniteTimeAction scale_back = (CCFiniteTimeAction)scale.Reverse();

            seq_scale = new CCSequence(scale, scale_back);
            seq_skew = new CCSequence(skewX, skewX_back, skewY, skewY_back);

            sprites = new CCSprite[numOfSprites];
            pointSprites = new CCSprite[numOfSprites];

            for (int i = 0; i < numOfSprites; i++)
            {
                // Animation using Sprite batch
                sprites[i] = new CCSprite("grossini_dance_01.png");
                pointSprites[i] = new CCSprite("Images/r1");

                CCSpriteBatchNode spritebatch = new CCSpriteBatchNode("animations/grossini");
                AddChild(spritebatch);
                AddChild(pointSprites[i], 200);
                spritebatch.AddChild(sprites[i], i);
            }
        }
Example #7
0
        public override CCFiniteTimeAction Reverse()
        {
            CCFiniteTimeAction[] rev = new CCFiniteTimeAction[Actions.Length];
            for (int i = 0; i < Actions.Length; i++)
            {
                rev [i] = Actions [i].Reverse();
            }

            return(new CCParallel(rev));
        }
Example #8
0
        public override CCFiniteTimeAction Reverse ()
        {
            CCFiniteTimeAction[] rev = new CCFiniteTimeAction[Actions.Length];
            for (int i = 0; i < Actions.Length; i++)
            {
                rev [i] = Actions [i].Reverse ();
            }

            return new CCParallel (rev);
        }
        public SpriteBatchNodeOffsetAnchorFlip()
        {
            CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache;
            cache.AddSpriteFrames("animations/grossini.plist");
            cache.AddSpriteFrames("animations/grossini_gray.plist", "animations/grossini_gray");

            // Create animations and actions

            var animFrames = new List<CCSpriteFrame>();
            string tmp = "";
            for (int j = 0; j < 14; j++)
            {
                string temp = "";
                if (j+1<10)
                {
                    temp = "0" + (j + 1);
                }
                else
                {
                    temp = (j + 1).ToString();
                }

                tmp = string.Format("grossini_dance_{0}.png", temp);
                CCSpriteFrame frame = cache[tmp];
                animFrames.Add(frame);
            }

            animation = new CCAnimation(animFrames, 0.3f);


            CCFlipY flip = new CCFlipY(true);
            CCFlipY flip_back = new CCFlipY(false);
            CCDelayTime delay = new CCDelayTime (1);

            seq = new CCSequence(delay, flip, delay, flip_back);

            sprites = new CCSprite[numOfSprites];
            pointSprites = new CCSprite[numOfSprites];

            for (int i = 0; i < numOfSprites; i++)
            {
                // Animation using Sprite batch
                sprites[i] = new CCSprite("grossini_dance_01.png");
                pointSprites[i] = new CCSprite("Images/r1");

                CCSpriteBatchNode spritebatch = new CCSpriteBatchNode("animations/grossini");
                AddChild(spritebatch);
                AddChild(pointSprites[i], 200);
                spritebatch.AddChild(sprites[i], i);
            }
        }
Example #10
0
        public CCLayerMultiplex(CCFiniteTimeAction inAction, CCFiniteTimeAction outAction, params CCLayer[] layers) 
            : base()
        {
            InAction = inAction;
            OutAction = outAction;
            ShowFirstLayerOnEnter = true;
            EnabledLayerIndex = NoLayer;
            Layers = new List<CCLayer>(layers);

            foreach(CCLayer layer in Layers)
            {
                AddChild(layer);
                layer.Visible = false;
            }
        }
        public CCLayerMultiplex(CCFiniteTimeAction inAction, CCFiniteTimeAction outAction, params CCLayer[] layers)
            : base()
        {
            InAction              = inAction;
            OutAction             = outAction;
            ShowFirstLayerOnEnter = true;
            EnabledLayerIndex     = NoLayer;
            Layers = new List <CCLayer>(layers);

            foreach (CCLayer layer in Layers)
            {
                AddChild(layer);
                layer.Visible = false;
            }
        }
        public SpriteOffsetAnchorSkewScale()
        {
            sprites = new CCSprite[numOfSprites];
            pointSprites = new CCSprite[numOfSprites];

            // Create actions

            CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache;
            cache.AddSpriteFrames("animations/grossini.plist");
            cache.AddSpriteFrames("animations/grossini_gray.plist", "animations/grossini_gray");
            var animFrames = new List<CCSpriteFrame>();
            string tmp = "";
            for (int j = 0; j < 14; j++)
            {
                tmp = string.Format("grossini_dance_{0:00}.png", j + 1);
                CCSpriteFrame frame = cache[tmp];
                animFrames.Add(frame);
            }

            animation = new CCAnimation(animFrames, 0.3f);

            // Skew
            CCSkewBy skewX = new CCSkewBy (2, 45, 0);
            CCFiniteTimeAction skewX_back = (CCFiniteTimeAction)skewX.Reverse();
            CCSkewBy skewY = new CCSkewBy (2, 0, 45);
            CCFiniteTimeAction skewY_back = (CCFiniteTimeAction)skewY.Reverse();

            seq_skew = new CCSequence(skewX, skewX_back, skewY, skewY_back);

            // Scale
            CCScaleBy scale = new CCScaleBy(2, 2);
            CCFiniteTimeAction scale_back = (CCFiniteTimeAction)scale.Reverse();

            seq_scale = new CCSequence(scale, scale_back);


            for (int i = 0; i < numOfSprites; i++)
            {
                // Animation using Sprite batch
                sprites[i] = new CCSprite("grossini_dance_01.png");
                AddChild(sprites[i], 0);

                pointSprites[i] = new CCSprite("Images/r1");
                AddChild(pointSprites[i], 1);
            }
        }
        private void RunAction(CCNode node, CCBSequenceProperty pSeqProp, float fTweenDuration)
        {
            List <CCBKeyframe> keyframes = pSeqProp.Keyframes;
            int numKeyframes             = keyframes.Count;

            if (numKeyframes > 1)
            {
                // Make an animation!
                var actions = new List <CCFiniteTimeAction>();

                CCBKeyframe keyframeFirst = keyframes[0];
                float       timeFirst     = keyframeFirst.Time + fTweenDuration;

                if (timeFirst > 0)
                {
                    actions.Add(new CCDelayTime(timeFirst));
                }

                for (int i = 0; i < numKeyframes - 1; ++i)
                {
                    CCBKeyframe kf0 = keyframes[i];
                    CCBKeyframe kf1 = keyframes[i + 1];

                    CCFiniteTimeAction action = GetAction(kf0, kf1, pSeqProp.Name, node);
                    if (action != null)
                    {
                        // Apply easing
                        action = GetEaseAction(action, kf0.EasingType, kf0.EasingOpt);

                        actions.Add(action);
                    }
                }

                if (actions.Count > 1)
                {
                    CCFiniteTimeAction seq = new CCSequence(actions.ToArray());
                    node.RunAction(seq);
                }
                else
                {
                    node.RunAction(actions[0]);
                }
            }
        }
        public SpriteOffsetAnchorScale()
        {
            CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache;
            cache.AddSpriteFrames("animations/grossini.plist");
            cache.AddSpriteFrames("animations/grossini_gray.plist", "animations/grossini_gray");

            sprites = new CCSprite[numOfSprites];
            pointSprites = new CCSprite[numOfSprites];

            var animFrames = new List<CCSpriteFrame>(14);
            string str = "";
            for (int j = 0; j < 14; j++)
            {
                string temp = "";
                if (j + 1 < 10)
                {
                    temp = "0" + (j + 1);
                }
                else
                {
                    temp = (j + 1).ToString();
                }
                str = string.Format("grossini_dance_{0}.png", temp);
                CCSpriteFrame frame = cache[str];
                animFrames.Add(frame);
            }

            animation = new CCAnimation(animFrames, 0.3f);

            for (int i = 0; i < numOfSprites; i++)
            {
                // Animation using Sprite BatchNode
                sprites[i] = new CCSprite("grossini_dance_01.png");
                AddChild(sprites[i], 0);

                pointSprites[i] = new CCSprite("Images/r1");
                AddChild(pointSprites[i], 1);


                CCFiniteTimeAction scale = new CCScaleBy(2, 2);
                CCFiniteTimeAction scale_back = (CCFiniteTimeAction)scale.Reverse();
                seq_scale = (CCFiniteTimeAction)(new CCSequence(scale, scale_back));
            }
        }
        public SpriteBatchNodeChildren()
        {
            CCSpriteBatchNode batch = new CCSpriteBatchNode("animations/grossini", 50);
            AddChild(batch, 0, (int)kTags.kTagSpriteBatchNode);

            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFrames("animations/grossini.plist");

            sprite1 = new CCSprite("grossini_dance_01.png");
            sprite2 = new CCSprite("grossini_dance_02.png");
            sprite3 = new CCSprite("grossini_dance_03.png");

            batch.AddChild(sprite1);
            sprite1.AddChild(sprite2);
            sprite1.AddChild(sprite3);

            var animFrames = new List<CCSpriteFrame>();
            string str = "";
            for (int i = 1; i < 15; i++)
            {
                string temp = "";
                if (i<10)
                {
                    temp = "0" + i;
                }
                else
                {
                    temp = i.ToString();
                }
                str = string.Format("grossini_dance_{0}.png", temp);
                CCSpriteFrame frame = CCSpriteFrameCache.SharedSpriteFrameCache[str];
                animFrames.Add(frame);
            }

            animation = new CCAnimation(animFrames, 0.2f);

            action = new CCMoveBy (2, new CCPoint(200, 0));
            action_back = (CCFiniteTimeAction)action.Reverse();
            action_rot = new CCRotateBy (2, 360);
            action_s = new CCScaleBy(2, 2);
            action_s_back = (CCFiniteTimeAction)action_s.Reverse();

            seq2 = (CCFiniteTimeAction)action_rot.Reverse();
        }
Example #16
0
        private void InitCCSpawn(CCFiniteTimeAction action1, CCFiniteTimeAction action2)
        {
            Debug.Assert(action1 != null);
            Debug.Assert(action2 != null);

            float d1 = action1.Duration;
            float d2 = action2.Duration;

            ActionOne = action1;
            ActionTwo = action2;

            if (d1 > d2)
            {
                ActionTwo = new CCSequence(action2, new CCDelayTime(d1 - d2));
            }
            else if (d1 < d2)
            {
                ActionOne = new CCSequence(action1, new CCDelayTime(d2 - d1));
            }
        }
Example #17
0
        private void InitCCSpawn (CCFiniteTimeAction action1, CCFiniteTimeAction action2)
        {
            Debug.Assert (action1 != null);
            Debug.Assert (action2 != null);

            float d1 = action1.Duration;
            float d2 = action2.Duration;

            ActionOne = action1;
            ActionTwo = action2;

            if (d1 > d2)
            {
                ActionTwo = new CCSequence (action2, new CCDelayTime (d1 - d2));
            }
            else if (d1 < d2)
            {
                ActionOne = new CCSequence (action1, new CCDelayTime (d2 - d1));
            }
        }
Example #18
0
        public Sprite6()
        {
            // small capacity. Testing resizing
            // Don't use capacity=1 in your real game. It is expensive to resize the capacity
            batch = new CCSpriteBatchNode("Images/grossini_dance_atlas", 1);


            // SpriteBatchNode actions
            rotate = new CCRotateBy(5, 360);
            action = new CCRepeatForever(rotate);

            // SpriteBatchNode actions
            rotate_back = rotate.Reverse();

            scale = new CCScaleBy(5, 1.5f);
            scale_back = scale.Reverse();

            for (int i = 0; i < 3; i++)
            {
                CCSprite sprite = new CCSprite(batch.Texture, new CCRect(85 * i, 121 * 1, 85, 121));
                batch.AddChild(sprite, i);
            }
        }
Example #19
0
        public SpriteAnimationSplit()
        {
            var texture = CCTextureCache.SharedTextureCache.AddImage("animations/dragon_animation");
            CCSize contentSizeInPixels = texture.ContentSizeInPixels;
            float height = contentSizeInPixels.Height / 4.0f;
            float heightOffset = height / 2.0f;
            float width = contentSizeInPixels.Width / 5.0f;

            // Manually add frames to the frame cache
            // The rects in pixels of each frame are determined from the textureatlas 
            var frame0 = new CCSpriteFrame(texture, new CCRect(width * 0, heightOffset + height * 0, width, height));
            var frame1 = new CCSpriteFrame(texture, new CCRect(width * 1, heightOffset + height * 0, width, height));
            var frame2 = new CCSpriteFrame(texture, new CCRect(width * 2, heightOffset + height * 0, width, height));
            var frame3 = new CCSpriteFrame(texture, new CCRect(width * 3, heightOffset + height * 0, width, height));

            // Note: The height positioning below is a bit of voodoo because the sprite atlas isn't currently packed tightly
            // See the dragon_animation.png file
            var frame4 = new CCSpriteFrame(texture, new CCRect(width * 0, heightOffset * 1.6f + height * 1, width, height));
            var frame5 = new CCSpriteFrame(texture, new CCRect(width * 1, heightOffset * 1.6f + height * 1, width, height));

            // Animation using Sprite BatchNode
            sprite = new CCSprite(frame0);
            AddChild(sprite);

            var animFrames = new List<CCSpriteFrame>(6);
            animFrames.Add(frame0);
            animFrames.Add(frame1);
            animFrames.Add(frame2);
            animFrames.Add(frame3);
            animFrames.Add(frame4);
            animFrames.Add(frame5);

            CCAnimation animation = new CCAnimation(animFrames, 0.2f);
            CCAnimate animate = new CCAnimate (animation);
            seq = new CCSequence(animate, new CCFlipX(true), animate, new CCFlipX(false));
        }
        private void AddTitle() {
            var title = new CCLabelTtf(Settings.GameName, "kongtext", 28) {
                Color = CCColor3B.White,
                AnchorPoint = CCPoint.AnchorMiddleTop,
                PositionX = Settings.ScreenWidth/2,
                PositionY = 550,
            };

            var titleShadow = new CCLabelTtf(Settings.GameName, "kongtext", 28) {
                Color = new CCColor3B(100, 0, 220),
                AnchorPoint = CCPoint.AnchorMiddleTop,
                PositionX = Settings.ScreenWidth/2,
                PositionY = 550,
            };

            // Движение тени у текста с названием игры
            const int moveStreak = 30;
            var moves = new CCFiniteTimeAction[moveStreak];
            for (int i = 0; i < moveStreak; i++) {
                moves[i] = MoveAround();
            }
            titleShadow.RepeatForever(new CCSequence(moves));


            var helper = new CCLabelTtf("Enter/Space to start, Esc to exit", "kongtext", 10) {
                Color = CCColor3B.Gray,
                AnchorPoint = CCPoint.AnchorMiddleBottom,
                PositionX = Settings.ScreenWidth/2,
                PositionY = 0
            };

            AddChild(titleShadow);

            AddChild(title);
            AddChild(helper);
        }
Example #21
0
 public CCEaseInOut (CCFiniteTimeAction action, float rate) : base (action, rate)
 {
 }
 public CCEaseExponentialOut(CCFiniteTimeAction action) : base(action)
 {
 }
Example #23
0
        public ActionFade()
        {
            action1 = new CCFadeIn(1.0f);
            action1Back = action1.Reverse();

            action2 = new CCFadeOut(1.0f);
            action2Back = action2.Reverse();
        }
 public CCFiniteTimeAction EaseAction(CCFiniteTimeAction action)
 {
     return(new CCEaseOut(action, 2.0f));
 }
Example #25
0
 public CCEaseExponentialIn (CCFiniteTimeAction action) : base (action)
 {
 }
 public CCBEaseInstant(CCFiniteTimeAction action)
     : base(action)
 {
 }
Example #27
0
 public CCEaseElasticInOut (CCFiniteTimeAction action) : this (action, 0.3f)
 {
 }
Example #28
0
 public CCSequence (CCFiniteTimeAction action1, CCFiniteTimeAction action2) : base (action1.Duration + action2.Duration)
 {
     Actions = new CCFiniteTimeAction[2];
     InitCCSequence (action1, action2);
 }
Example #29
0
 public CCReverseTime(CCFiniteTimeAction action) : base(action.Duration)
 {
     Other = action;
 }
Example #30
0
 public CCSpeed(CCFiniteTimeAction action, float speed)
 {
     InnerAction = action;
     Speed       = speed;
 }
Example #31
0
 public ActionRepeat()
 {
     a1 = new CCMoveBy (1, new CCPoint(150, 0));
     a1Reverse = a1.Reverse();
 }
Example #32
0
        public ActionReverseSequence2()
        {
            var move1 = new CCMoveBy (1, new CCPoint(250, 0));
            var move2 = new CCMoveBy (1, new CCPoint(0, 50));
            var toggle = new CCToggleVisibility();
            var seq = new CCSequence(move1, toggle, move2, toggle, move1.Reverse());
            action = new CCRepeat ((new CCSequence(seq, seq.Reverse())), 3);

            var move_tamara = new CCMoveBy (1, new CCPoint(100, 0));
            var move_tamara2 = new CCMoveBy (1, new CCPoint(50, 0));
            var hide = new CCHide();

            seq_tamara = new CCSequence(move_tamara, hide, move_tamara2);
            seq_back = seq_tamara.Reverse();
        }
Example #33
0
 public ActionTint()
 {
     action1 = new CCTintTo (2, 255, 0, 255);
     action2 = new CCTintBy (2, -127, -255, -127);
     action2Back = action2.Reverse();
 }
        private void SetAnimatedProperty(string pPropName, CCNode node, object pValue, float fTweenDuraion)
        {
            if (fTweenDuraion > 0)
            {
                // Create a fake keyframe to generate the action from
                var kf1 = new CCBKeyframe();
                kf1.Value      = pValue;
                kf1.Time       = fTweenDuraion;
                kf1.EasingType = CCBEasingType.Linear;

                // Animate
                CCFiniteTimeAction tweenAction = GetAction(null, kf1, pPropName, node);
                node.RunAction(tweenAction);
            }
            else
            {
                // Just set the value

                if (pPropName == "position")
                {
                    // Get position type
                    var array = (List <CCBValue>)GetBaseValue(node, pPropName);
                    var type  = (CCBPositionType)array[2].GetIntValue();

                    // Get relative position
                    var   value = (List <CCBValue>)pValue;
                    float x     = value[0].GetFloatValue();
                    float y     = value[1].GetFloatValue();

                    node.Position = CCBHelper.GetAbsolutePosition(new CCPoint(x, y), type, GetContainerSize(node.Parent), pPropName);
                }
                else if (pPropName == "scale")
                {
                    // Get scale type
                    var array = (List <CCBValue>)GetBaseValue(node, pPropName);
                    var type  = (CCBScaleType)array[2].GetIntValue();

                    // Get relative scale
                    var   value = (List <CCBValue>)pValue;
                    float x     = value[0].GetFloatValue();
                    float y     = value[1].GetFloatValue();

                    CCBHelper.SetRelativeScale(node, x, y, type, pPropName);
                }
                else if (pPropName == "skew")
                {
                    // Get relative scale
                    var   value = (List <CCBValue>)pValue;
                    float x     = value[0].GetFloatValue();
                    float y     = value[1].GetFloatValue();

                    node.SkewX = x;
                    node.SkewY = y;
                }
                else
                {
                    // [node setValue:value forKey:name];

                    // TODO only handle rotation, opacity, displayFrame, color
                    if (pPropName == "rotation")
                    {
                        float rotate = ((CCBValue)pValue).GetFloatValue();
                        node.Rotation = rotate;
                    }
                    else if (pPropName == "rotationX")
                    {
                        float rotate = ((CCBValue)pValue).GetFloatValue();
                        node.RotationX = rotate;
                    }
                    else if (pPropName == "rotationY")
                    {
                        float rotate = ((CCBValue)pValue).GetFloatValue();
                        node.RotationY = rotate;
                    }
                    else if (pPropName == "opacity")
                    {
                        byte opacity = ((CCBValue)pValue).GetByteValue();
                        node.Opacity = opacity;
                    }
                    else if (pPropName == "displayFrame")
                    {
                        ((CCSprite)node).SpriteFrame = (CCSpriteFrame)pValue;
                    }
                    else if (pPropName == "color")
                    {
                        var color = (CCColor3BWapper)pValue;
                        node.Color = color.Color;
                    }
                    else if (pPropName == "visible")
                    {
                        bool visible = ((CCBValue)pValue).GetBoolValue();
                        node.Visible = visible;
                    }
                    else
                    {
                        CCLog.Log("unsupported property name is {0}", pPropName);
                        Debug.Assert(false, "unsupported property now");
                    }
                }
            }
        }
Example #35
0
 public CCSequence(CCFiniteTimeAction action1, CCFiniteTimeAction action2) : base(action1.Duration + action2.Duration)
 {
     Actions = new CCFiniteTimeAction[2];
     InitCCSequence(action1, action2);
 }
Example #36
0
 public CCEaseElasticInOut (CCFiniteTimeAction action, float period) : base (action, period)
 {
 }
Example #37
0
 public CCEaseOut(CCFiniteTimeAction action, float rate) : base(action, rate)
 {
 }
Example #38
0
 public CCEaseSineOut (CCFiniteTimeAction action) : base (action)
 {
 }
Example #39
0
 public CCRepeatForever(CCFiniteTimeAction action)
 {
     Debug.Assert(action != null);
     InnerAction = action;
 }
 public CCEaseElasticOut(CCFiniteTimeAction action) : base(action, 0.3f)
 {
 }
 public CCEaseElasticIn(CCFiniteTimeAction action, float period) : base(action, period)
 {
 }
Example #42
0
 public CCRepeatForever(params CCFiniteTimeAction[] actions)
 {
     Debug.Assert(actions != null);
     InnerAction = new CCSequence(actions);
 }
 public CCEaseElasticIn(CCFiniteTimeAction action) : this(action, 0.3f)
 {
 }
Example #44
0
        public AnimationCache()
        {
            var frameCache = CCSpriteFrameCache.SharedSpriteFrameCache;
            frameCache.AddSpriteFrames("animations/grossini.plist");
            frameCache.AddSpriteFrames("animations/grossini_gray.plist");
            frameCache.AddSpriteFrames("animations/grossini_blue.plist");

            //
            // create animation "dance"
            //
            var animFrames = new List<CCSpriteFrame>(15);
            string str = "";
            for (int i = 1; i < 15; i++)
            {
                str = string.Format("grossini_dance_{0:00}.png", i);
                CCSpriteFrame frame = CCSpriteFrameCache.SharedSpriteFrameCache[str];
                animFrames.Add(frame);
            }

            CCAnimation animation = new CCAnimation(animFrames, 0.2f);

            // Add an animation to the Cache
            CCAnimationCache.SharedAnimationCache.AddAnimation(animation, "dance");

            //
            // create animation "dance gray"
            //
            animFrames.Clear();

            for (int i = 1; i < 15; i++)
            {
                str = String.Format("grossini_dance_gray_{0:00}.png", i);
                CCSpriteFrame frame = CCSpriteFrameCache.SharedSpriteFrameCache[str];
                animFrames.Add(frame);
            }

            animation = new CCAnimation(animFrames, 0.2f);

            // Add an animation to the Cache
            CCAnimationCache.SharedAnimationCache.AddAnimation(animation, "dance_gray");

            //
            // create animation "dance blue"
            //
            animFrames.Clear();

            for (int i = 1; i < 4; i++)
            {
                str = String.Format("grossini_blue_{0:00}.png", i);
                CCSpriteFrame frame = CCSpriteFrameCache.SharedSpriteFrameCache[str];
                animFrames.Add(frame);
            }

            animation = new CCAnimation(animFrames, 0.2f);

            // Add an animation to the Cache
            CCAnimationCache.SharedAnimationCache.AddAnimation(animation, "dance_blue");


            CCAnimationCache animCache = CCAnimationCache.SharedAnimationCache;

            CCAnimation normal = animCache["dance"];
            normal.RestoreOriginalFrame = true;
            CCAnimation dance_grey = animCache["dance_gray"];
            dance_grey.RestoreOriginalFrame = true;
            CCAnimation dance_blue = animCache["dance_blue"];
            dance_blue.RestoreOriginalFrame = true;

            CCAnimate animN = new CCAnimate (normal);
            CCAnimate animG = new CCAnimate (dance_grey);
            CCAnimate animB = new CCAnimate (dance_blue);

            seqAnimation = new CCSequence(animN, animG, animB);

            grossini = new CCSprite();
            AddChild(grossini);
        }
Example #45
0
 public CCReverseTime (CCFiniteTimeAction action) : base (action.Duration)
 {
     Other = action;
 }
Example #46
0
        public CCRepeatForever (params CCFiniteTimeAction[] actions)
        {
            Debug.Assert (actions != null);
            InnerAction = new CCSequence (actions);

        }
Example #47
0
 public CCRepeatForever (CCFiniteTimeAction action)
 {
     Debug.Assert (action != null);
     InnerAction = action;
 }
Example #48
0
 protected CCSpawn(CCFiniteTimeAction action1, CCFiniteTimeAction action2)
     : base(Math.Max(action1.Duration, action2.Duration))
 {
     InitCCSpawn(action1, action2);
 }
Example #49
0
 public CCEaseSineOut(CCFiniteTimeAction action) : base(action)
 {
 }
Example #50
0
 public CCEaseCustom(CCFiniteTimeAction action, Func <float, float> easeFunc) : base(action)
 {
     EaseFunc = easeFunc;
 }
 public CCLayerMultiplex(CCFiniteTimeAction inAction, CCFiniteTimeAction outAction)
     : this(inAction, outAction, null)
 {
 }