コード例 #1
0
        public static CCFlipY actionWithFlipY(bool y)
        {
            CCFlipY cCFlipY = new CCFlipY();

            if (cCFlipY != null && cCFlipY.initWithFlipY(y))
            {
                return(cCFlipY);
            }
            return(null);
        }
コード例 #2
0
ファイル: CCFlipY.cs プロジェクト: xwfh2000/cocos2d-x-for-xna
        public static CCFlipY actionWithFlipY(bool y)
        {
            CCFlipY pRet = new CCFlipY();

            if (pRet != null && pRet.initWithFlipY(y))
            {
                return(pRet);
            }

            return(null);
        }
コード例 #3
0
        public static CCFlipY actionWithFlipY(bool y)
        {
            CCFlipY pRet = new CCFlipY();

            if (pRet != null && pRet.initWithFlipY(y))
            {
                return pRet;
            }

            return null;
        }
コード例 #4
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCFlipY cCFlipY = null;

            if (pZone == null || pZone.m_pCopyObject == null)
            {
                cCFlipY = new CCFlipY();
                pZone   = new CCZone(cCFlipY);
            }
            else
            {
                cCFlipY = (CCFlipY)pZone.m_pCopyObject;
            }
            base.copyWithZone(pZone);
            cCFlipY.initWithFlipY(this.m_bFlipY);
            return(cCFlipY);
        }
コード例 #5
0
ファイル: CCFlipY.cs プロジェクト: xwfh2000/cocos2d-x-for-xna
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone  pNewZone = null;
            CCFlipY pRet     = null;

            if (pZone != null && pZone.m_pCopyObject != null)
            {
                pRet = (CCFlipY)(pZone.m_pCopyObject);
            }
            else
            {
                pRet  = new CCFlipY();
                pZone = pNewZone = new CCZone(pRet);
            }

            base.copyWithZone(pZone);
            pRet.initWithFlipY(m_bFlipY);
            return(pRet);
        }
コード例 #6
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone pNewZone = null;
            CCFlipY pRet = null;

            if (pZone != null && pZone.m_pCopyObject != null)
            {
                pRet = (CCFlipY)(pZone.m_pCopyObject);
            }
            else
            {
                pRet = new CCFlipY();
                pZone = pNewZone = new CCZone(pRet);
            }

            base.copyWithZone(pZone);
            pRet.initWithFlipY(m_bFlipY);
            return pRet;
        }
コード例 #7
0
 public override CCFiniteTimeAction reverse()
 {
     return(CCFlipY.actionWithFlipY(!this.m_bFlipY));
 }
コード例 #8
0
        public SpriteBatchNodeOffsetAnchorFlip()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            for (int i = 0; i < 3; i++)
            {
                CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache;
                cache.AddSpriteFramesWithFile("animations/grossini.plist");
                cache.AddSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray");

                //
                // Animation using Sprite batch
                //
                CCSprite sprite = new CCSprite("grossini_dance_01.png");
                sprite.Position = (new CCPoint(s.Width / 4 * (i + 1), s.Height / 2));

                CCSprite point = new CCSprite("Images/r1");
                point.Scale = 0.25f;
                point.Position = sprite.Position;
                AddChild(point, 200);

                switch (i)
                {
                    case 0:
                        sprite.AnchorPoint = new CCPoint(0, 0);
                        break;
                    case 1:
                        sprite.AnchorPoint = new CCPoint(0.5f, 0.5f);
                        break;
                    case 2:
                        sprite.AnchorPoint = (new CCPoint(1, 1));
                        break;
                }

                point.Position = sprite.Position;

                CCSpriteBatchNode spritebatch = new CCSpriteBatchNode("animations/grossini");
                AddChild(spritebatch);

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

                CCAnimation animation = new CCAnimation(animFrames, 0.3f);
                sprite.RunAction(new CCRepeatForever (new CCAnimate (animation)));

                animFrames = null;

                CCFlipY flip = new CCFlipY(true);
                CCFlipY flip_back = new CCFlipY(false);
                CCDelayTime delay = new CCDelayTime (1);
                CCFiniteTimeAction seq = CCSequence.FromActions((CCFiniteTimeAction)delay, (CCFiniteTimeAction)flip, (CCFiniteTimeAction)delay.Copy(null), (CCFiniteTimeAction)flip_back);
                sprite.RunAction(new CCRepeatForever ((CCActionInterval)seq));

                spritebatch.AddChild(sprite, i);
            }
        }