예제 #1
0
        public static CCCallFuncN actionWithTarget(SelectorProtocol pSelectorTarget, SEL_CallFuncN selector)
        {
            CCCallFuncN pRet = new CCCallFuncN();

            if (pRet != null && pRet.initWithTarget(pSelectorTarget, selector))
            {
                return pRet;
            }

            return null;
        }
예제 #2
0
        // super methods
        public override CCObject copyWithZone(CCZone zone)
        {
            CCZone pNewZone = null;
            CCCallFuncN pRet = null;

            if (zone != null && zone.m_pCopyObject != null)
            {
                //in case of being called at sub class
                pRet = (CCCallFuncN) (zone.m_pCopyObject);
            } else {
                pRet = new CCCallFuncN();
                zone = pNewZone = new CCZone(pRet);
            }

            base.copyWithZone(zone);
            pRet.initWithTarget(m_pSelectorTarget, m_pCallFuncN);
            return pRet;
        }
예제 #3
0
        public TMXReadWriteTest()
        {
            m_gid = 0;

            CCTMXTiledMap map = CCTMXTiledMap.Create("TileMaps/orthogonal-test2");
            AddChild(map, 0, kTagTileMap);

            CCTMXLayer layer = map.LayerNamed("Layer 0");
            layer.Texture.SetAntiAliasTexParameters();

            map.Scale = (1);

            CCSprite tile0 = layer.TileAt(new CCPoint(1, 63));
            CCSprite tile1 = layer.TileAt(new CCPoint(2, 63));
            CCSprite tile2 = layer.TileAt(new CCPoint(3, 62)); //new CCPoint(1,62));
            CCSprite tile3 = layer.TileAt(new CCPoint(2, 62));
            tile0.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile1.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile2.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile3.AnchorPoint = (new CCPoint(0.5f, 0.5f));

            CCMoveBy move = new CCMoveBy (0.5f, new CCPoint(0, 160));
            CCRotateBy rotate = new CCRotateBy (2, 360);
            CCScaleBy scale = new CCScaleBy(2, 5);
            CCFadeOut opacity = new CCFadeOut  (2);
            CCFadeIn fadein = new CCFadeIn  (2);
            CCScaleTo scaleback = new CCScaleTo(1, 1);
            CCCallFuncN finish = new CCCallFuncN(removeSprite);
            CCSequence seq0 = CCSequence.FromActions(move, rotate, scale, opacity, fadein, scaleback, finish);
            var seq1 = (CCActionInterval) (seq0.Copy());
            var seq2 = (CCActionInterval) (seq0.Copy());
            var seq3 = (CCActionInterval) (seq0.Copy());

            tile0.RunAction(seq0);
            tile1.RunAction(seq1);
            tile2.RunAction(seq2);
            tile3.RunAction(seq3);

            m_gid = layer.TileGIDAt(new CCPoint(0, 63));
            ////----UXLOG("Tile GID at:(0,63) is: %d", m_gid);

            Schedule(updateCol, 2.0f);
            Schedule(repaintWithGID, 2.0f);
            Schedule(removeTiles, 1.0f);

            ////----UXLOG("++++atlas quantity: %d", layer.textureAtlas().getTotalQuads());
            ////----UXLOG("++++children: %d", layer.getChildren().count() );

            m_gid2 = 0;
        }
예제 #4
0
 /**
  * Sets a new content offset. It ignores max/min offset. It just sets what's given. (just like UIKit's UIScrollView)
  * You can override the animation duration with this method.
  *
  * @param offset new offset
  * @param animation duration
  */
 public void SetContentOffsetInDuration(CCPoint offset, float dt)
 {
     CCMoveTo scroll = new CCMoveTo (dt, offset);
     CCCallFuncN expire = new CCCallFuncN(StoppedAnimatedScroll);
     m_pContainer.RunAction(CCSequence.FromActions(scroll, expire));
     Schedule(PerformedAnimatedScroll);
 }
예제 #5
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(0);

            var spr = new CCSprite("Images/grossini");
            spr.Position = new CCPoint(100, 100);
            AddChild(spr);

            var act1 = new CCCallFuncN(logSprRotation);
            var act2 = new CCRotateBy (0.25f, 45);
            var act3 = new CCCallFuncN(logSprRotation);
            var act4 = new CCRotateBy (0.25f, 45);
            var act5 = new CCCallFuncN(logSprRotation);
            var act6 = new CCRotateBy (0.25f, 45);
            var act7 = new CCCallFuncN(logSprRotation);
            var act8 = new CCRotateBy (0.25f, 45);
            var act9 = new CCCallFuncN(logSprRotation);

            var actF = CCSequence.FromActions(act1, act2, act3, act4, act5, act6, act7, act8, act9);
            spr.RunAction(actF);
        }