public override void showCurrentTest()
        {
            CCNode ccnode = new CCNode();
            int nNodes = ((NodeChildrenMainScene)ccnode.parent).getQuantityOfNodes();
            NodeChildrenMainScene pScene = null;

            switch (PerformBasicLayer.m_nCurCase)
            {
                //     case 0:
                //         pScene = new IterateSpriteSheetFastEnum();
                //         break;
                case 0:
                    pScene = new IterateSpriteSheetCArray();
                    break;
                case 1:
                    pScene = new AddSpriteSheet();
                    break;
                case 2:
                    pScene = new RemoveSpriteSheet();
                    break;
                case 3:
                    pScene = new ReorderSpriteSheet();
                    break;
            }

            PerformanceNodeChildrenTest.s_nCurCase = PerformBasicLayer.m_nCurCase;

            if (pScene != null)
            {
                pScene.initWithQuantityOfNodes(nNodes);

                CCDirector.sharedDirector().replaceScene(pScene);
            }
        }
Esempio n. 2
0
        public override void startWithTarget(CCNode pTarget)
        {
            base.startWithTarget(pTarget);

            CCGridBase newgrid = this.getGrid();

            CCNode t = m_pTarget;
            CCGridBase targetGrid = t.Grid;

            if (targetGrid != null && targetGrid.ReuseGrid > 0)
            {
                if (targetGrid.Active && targetGrid.GridSize.x == m_sGridSize.x
                    && targetGrid.GridSize.y == m_sGridSize.y)
                {
                    targetGrid.reuse();
                }
            }
            else
            {
                if (targetGrid != null && targetGrid.Active)
                {
                    targetGrid.Active = false;
                }

                t.Grid = newgrid;
                t.Grid.Active = true;
            }
        }
 protected override void OnHandlePropTypeSpriteFrame(CCNode node, CCNode parent, string propertyName, CCSpriteFrame spriteFrame,
                                                     CCBReader reader)
 {
     if (propertyName == PROPERTY_NORMALDISPLAYFRAME)
     {
         if (spriteFrame != null)
         {
             ((CCMenuItemImage) node).SetNormalSpriteFrame(spriteFrame);
         }
     }
     else if (propertyName == PROPERTY_SELECTEDDISPLAYFRAME)
     {
         if (spriteFrame != null)
         {
             ((CCMenuItemImage) node).SetSelectedSpriteFrame(spriteFrame);
         }
     }
     else if (propertyName == PROPERTY_DISABLEDDISPLAYFRAME)
     {
         if (spriteFrame != null)
         {
             ((CCMenuItemImage) node).SetDisabledSpriteFrame(spriteFrame);
         }
     }
     else
     {
         base.OnHandlePropTypeSpriteFrame(node, parent, propertyName, spriteFrame, reader);
     }
 }
 public bool initWithCCPoint(CCPoint ratio, CCPoint offset)
 {
     m_tRatio = ratio;
     m_tOffset = offset;
     m_pChild = null;
     return true;
 }
Esempio n. 5
0
        public CCAction GetActionByTag(int tag, CCNode target)
        {
            Debug.Assert(tag != (int) ActionTag.kCCActionTagInvalid);

            HashElement element;
            if (m_pTargets.TryGetValue(target, out element))
            {
                if (element.Actions != null)
                {
                    int limit = element.Actions.Count;
                    for (int i = 0; i < limit; i++)
                    {
                        CCAction action = element.Actions[i];

                        if (action.Tag == tag)
                        {
                            return action;
                        }
                    }
                    CCLog.Log("cocos2d : getActionByTag: Tag " + tag + " not found");
                }
            }
            else
            {
                CCLog.Log("cocos2d : getActionByTag: Target not found");
            }
            return null;
        }
        public override void onEnter()
        {
            base.onEnter();

            CCSize s = CCDirector.sharedDirector().getWinSize();

            // the root object just rotates around
            m_root = CCSprite.spriteWithFile(s_pPathR1);
            addChild(m_root, 1);
            m_root.position = (new CCPoint(s.width / 2, s.height / 2));

            // the target object is offset from root, and the streak is moved to follow it
            m_target = CCSprite.spriteWithFile(s_pPathR1);
            m_root.addChild(m_target);
            m_target.position = (new CCPoint(100, 0));

            // create the streak object and add it to the scene
            //m_streak = CCMotionStreak.streakWithFade(2, 3, s_streak, 32, 32, new ccColor4B(0,255,0,255) );
            addChild(m_streak);
            // schedule an update on each frame so we can syncronize the streak with the target
            schedule(onUpdate);

            CCActionInterval a1 = CCRotateBy.actionWithDuration(2, 360);

            CCAction action1 = CCRepeatForever.actionWithAction(a1);
            CCActionInterval motion = CCMoveBy.actionWithDuration(2, new CCPoint(100, 0));
            m_root.runAction(CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(motion, motion.reverse()))));
            m_root.runAction(action1);
        }
Esempio n. 7
0
        public override void StartWithTarget(CCNode target)
        {
            base.StartWithTarget(target);

            CCNode t = m_pTarget;
            CCGridBase targetGrid = t.Grid;

            if (targetGrid != null && targetGrid.ReuseGrid > 0)
            {
                Grid = targetGrid;

                if (targetGrid.Active && targetGrid.GridSize.X == m_sGridSize.X
                    && targetGrid.GridSize.Y == m_sGridSize.Y /*&& dynamic_cast<CCGridBase*>(targetGrid) != NULL*/)
                {
                    targetGrid.Reuse();
                }
                else
                {
                    Debug.Assert(false);
                }
            }
            else
            {
                if (targetGrid != null && targetGrid.Active)
                {
                    targetGrid.Active = false;
                }

                CCGridBase newgrid = Grid;

                t.Grid = newgrid;
                t.Grid.Active = true;
            }
        }
        public override void showCurrentTest()
        {
            CCNode ccnode = new CCNode();
            ParticleMainScene pScene = (ParticleMainScene)ccnode.parent;
            int subTest = pScene.getSubTestNum();
            int parNum = pScene.getParticlesNum();

            ParticleMainScene pNewScene = null;

            switch (m_nCurCase)
            {
                case 0:
                    pNewScene = new ParticlePerformTest1();
                    break;
                case 1:
                    pNewScene = new ParticlePerformTest2();
                    break;
                case 2:
                    pNewScene = new ParticlePerformTest3();
                    break;
                case 3:
                    pNewScene = new ParticlePerformTest4();
                    break;
            }

            PerformanceParticleTest.s_nParCurIdx = m_nCurCase;
            if (pNewScene != null)
            {
                pNewScene.initWithSubTest(subTest, parNum);

                CCDirector.sharedDirector().replaceScene(pNewScene);
            }
        }
        // actions

        /// <summary>
        /// Adds an action with a target. 
        ///  If the target is already present, then the action will be added to the existing target.
        ///  If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target.
        ///  When the target is paused, the queued actions won't be 'ticked'.
        /// </summary>
        public void addAction(CCAction action, CCNode target, bool paused)
        {
            Debug.Assert(action != null);
            Debug.Assert(target != null);

            tHashElement element = null;
            if (!m_pTargets.ContainsKey(target))
            {
                element = new tHashElement();
                element.paused = paused;
                element.target = target;
                m_pTargets.Add(target, element);
            }
            else
            {
                element = m_pTargets[target];
            }

            actionAllocWithHashElement(element);

            Debug.Assert(!element.actions.Contains(action));
            element.actions.Add(action);

            action.startWithTarget(target);
        }
Esempio n. 10
0
 // super methods
 public virtual void addChild(CCNode child, UInt32 zOrder, int tag)
 {
     //    CC_UNUSED_PARAM(zOrder);
     //    CC_UNUSED_PARAM(child);
     //    CC_UNUSED_PARAM(tag);
     Debug.Assert(false, "ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead");
 }
Esempio n. 11
0
 public override void startWithTarget(CCNode pTarget)
 {
     base.startWithTarget(pTarget);
     m_fDeltaX = m_fSkewX;
     m_fDeltaY = m_fSkewY;
     m_fEndSkewX = m_fStartSkewX + m_fDeltaX;
     m_fEndSkewY = m_fStartSkewY + m_fDeltaY;
 }
 /// <summary>
 /// creates a menu item with a normal,selected  and disabled image with target/selector
 /// </summary>
 /// <param name="normalSprite"></param>
 /// <param name="selectedSprite"></param>
 /// <param name="disabledSprite"></param>
 /// <param name="target"></param>
 /// <param name="selector"></param>
 /// <returns></returns>
 public static CCMenuItemSprite itemFromNormalSprite(CCNode normalSprite, CCNode selectedSprite, CCNode disabledSprite,
                                                 SelectorProtocol target, SEL_MenuHandler selector)
 {
     CCMenuItemSprite pRet = new CCMenuItemSprite();
     pRet.initFromNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector);
     //pRet->autorelease();
     return pRet;
 }
        public virtual void startWithTarget(CCNode pTarget)
        {
            base.startWithTarget(pTarget);

            if (m_pTarget.Grid != null && m_pTarget.Grid.Active != null)
            {
                m_pTarget.Grid.ReuseGrid = m_pTarget.Grid.ReuseGrid + m_nTimes;
            }
        }
Esempio n. 14
0
 public int NumberOfRunningActionsInTarget(CCNode target)
 {
     HashElement element;
     if (m_pTargets.TryGetValue(target, out element))
     {
         return (element.Actions != null) ? element.Actions.Count : 0;
     }
     return 0;
 }
Esempio n. 15
0
 public static CCRect getRect(CCNode node)
 {
     CCRect rc = new CCRect();
     rc.Origin = node.Position;
     rc.Size = node.ContentSize;
     rc.Origin.X -= rc.Size.Width / 2;
     rc.Origin.Y -= rc.Size.Height / 2;
     return rc;
 }
        public override void startWithTarget(CCNode pTarget)
        {
            base.startWithTarget(pTarget);

            CCCamera camera = pTarget.Camera;
            camera.getCenterXYZ(out m_fCenterXOrig, out m_fCenterYOrig, out m_fCenterZOrig);
            camera.getEyeXYZ(out m_fEyeXOrig, out m_fEyeYOrig, out m_fEyeZOrig);
            camera.getUpXYZ(out m_fUpXOrig, out m_fUpYOrig, out m_fUpZOrig);
        }
 public static CCRect getRect(CCNode pNode)
 {
     CCRect rc = new CCRect();
     rc.origin = pNode.position;
     rc.size = pNode.contentSize;
     rc.origin.x -= rc.size.width / 2;
     rc.origin.y -= rc.size.height / 2;
     return rc;
 }
Esempio n. 18
0
        public TextLayer()
        {
            InitWithColor(CCTypes.CreateColor(32, 32, 32, 255));

            float x, y;

            CCSize size = CCDirector.SharedDirector.WinSize;
            x = size.Width;
            y = size.Height;

            CCNode node = new CCNode ();
            CCActionInterval effect = getAction();
            node.RunAction(effect);
            AddChild(node, 0, EffectTestScene.kTagBackground);

            CCSprite bg = new CCSprite(TestResource.s_back3);
            node.AddChild(bg, 0);
            bg.AnchorPoint = new CCPoint(0.5f, 0.5f);
            bg.Position = new CCPoint(size.Width / 2, size.Height / 2);

            CCSprite grossini = new CCSprite(TestResource.s_pPathSister2);
            node.AddChild(grossini, 1);
            grossini.Position = new CCPoint(x / 3, y / 2);
            CCActionInterval sc = new CCScaleBy(2, 5);
            CCFiniteTimeAction sc_back = sc.Reverse();
            grossini.RunAction(new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(sc, sc_back))));
            //grossini.runAction(effect);

            CCSprite tamara = new CCSprite(TestResource.s_pPathSister1);
            node.AddChild(tamara, 1);
            tamara.Position = new CCPoint(2 * x / 3, y / 2);
            CCActionInterval sc2 = new CCScaleBy(2, 5);
            CCFiniteTimeAction sc2_back = sc2.Reverse();
            tamara.RunAction(new CCRepeatForever ((CCActionInterval)(CCSequence.FromActions(sc2, sc2_back))));

            CCLabelTTF label = new CCLabelTTF(EffectTestScene.effectsList[EffectTestScene.actionIdx], "arial", 32);

            label.Position = new CCPoint(x / 2, y - 80);
            AddChild(label);
            label.Tag = EffectTestScene.kTagLabel;

            CCMenuItemImage item1 = new CCMenuItemImage(TestResource.s_pPathB1, TestResource.s_pPathB2, backCallback);
            CCMenuItemImage item2 = new CCMenuItemImage(TestResource.s_pPathR1, TestResource.s_pPathR2, restartCallback);
            CCMenuItemImage item3 = new CCMenuItemImage(TestResource.s_pPathF1, TestResource.s_pPathF2, nextCallback);

            CCMenu menu = new CCMenu(item1, item2, item3);

            menu.Position = new CCPoint(0, 0);
            item1.Position = new CCPoint(size.Width / 2 - 100, 30);
            item2.Position = new CCPoint(size.Width / 2, 30);
            item3.Position = new CCPoint(size.Width / 2 + 100, 30);

            AddChild(menu, 1);

            Schedule(checkAnim);
        }
Esempio n. 19
0
        public override void startWithTarget(CCNode pTarget)
        {
            base.startWithTarget(pTarget);

            CCGridBase pGrid = m_pTarget.Grid;
            if (pGrid != null && pGrid.Active)
            {
                pGrid.Active = false;
            }
        }
Esempio n. 20
0
        public override void startWithTarget(CCNode pTarget)
        {
            base.startWithTarget(pTarget);

            ICCRGBAProtocol pRGBAProtocol = pTarget as ICCRGBAProtocol;
            if (pRGBAProtocol != null)
            {
                m_fromOpacity = pRGBAProtocol.Opacity;
            }
        }
Esempio n. 21
0
        protected bool IsTouchNode(CCNode p_Node, List<CCTouch> touches)
        {
            CCRect rect = p_Node.boundingBox();
               CCSize size = CCDirector.sharedDirector().getWinSize();

              // rect.size = p_Node.contentSize;
               CCPoint touch =new CCPoint( touches[0].locationInView(touches[0].view()).x, touches[0].locationInView(touches[0].view()).y);
               touch.y = size.height - touch.y;
            return CCRect.CCRectContainsPoint(rect, touch);
        }
        public SpriteChildrenVisibilityIssue665()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

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

            CCNode aParent;
            CCSprite sprite1, sprite2, sprite3;
            //
            // SpriteBatchNode
            //
            // parents
            aParent = new CCSpriteBatchNode("animations/grossini", 50);
            aParent.Position = (new CCPoint(s.Width / 3, s.Height / 2));
            AddChild(aParent, 0);

            sprite1 = new CCSprite("grossini_dance_01.png");
            sprite1.Position = (new CCPoint(0, 0));

            sprite2 = new CCSprite("grossini_dance_02.png");
            sprite2.Position = (new CCPoint(20, 30));

            sprite3 = new CCSprite("grossini_dance_03.png");
            sprite3.Position = (new CCPoint(-20, 30));

            // test issue #665
            sprite1.Visible = false;

            aParent.AddChild(sprite1);
            sprite1.AddChild(sprite2, -2);
            sprite1.AddChild(sprite3, 2);

            //
            // Sprite
            //
            aParent = new CCNode ();
            aParent.Position = (new CCPoint(2 * s.Width / 3, s.Height / 2));
            AddChild(aParent, 0);

            sprite1 = new CCSprite("grossini_dance_01.png");
            sprite1.Position = (new CCPoint(0, 0));

            sprite2 = new CCSprite("grossini_dance_02.png");
            sprite2.Position = (new CCPoint(20, 30));

            sprite3 = new CCSprite("grossini_dance_03.png");
            sprite3.Position = (new CCPoint(-20, 30));

            // test issue #665
            sprite1.Visible = false;

            aParent.AddChild(sprite1);
            sprite1.AddChild(sprite2, -2);
            sprite1.AddChild(sprite3, 2);
        }
Esempio n. 23
0
 protected override void OnHandlePropTypeSize(CCNode node, CCNode parent, string propertyName, CCSize pSize, CCBReader reader)
 {
     if (propertyName == PROPERTY_CONTENTSIZE)
     {
         ((CCScrollView) node).ViewSize = pSize;
     }
     else
     {
         base.OnHandlePropTypeSize(node, parent, propertyName, pSize, reader);
     }
 }
Esempio n. 24
0
 protected override void OnHandlePropTypeFloat(CCNode node, CCNode parent, string propertyName, float pFloat, CCBReader reader)
 {
     if (propertyName == PROPERTY_SCALE)
     {
         node.Scale = pFloat;
     }
     else
     {
         base.OnHandlePropTypeFloat(node, parent, propertyName, pFloat, reader);
     }
 }
Esempio n. 25
0
 protected override void OnHandlePropTypeCheck(CCNode node, CCNode parent, string propertyName, bool pCheck, CCBReader reader)
 {
     if (propertyName == PROPERTY_ISENABLED)
     {
         ((CCMenuItem) node).Enabled = pCheck;
     }
     else
     {
         base.OnHandlePropTypeCheck(node, parent, propertyName, pCheck, reader);
     }
 }
Esempio n. 26
0
 public override void startWithTarget(CCNode pTarget)
 {
     base.startWithTarget(pTarget);
     m_fFrom = ((CCProgressTimer)(pTarget)).Percentage;
     // XXX: Is this correct ?
     // Adding it to support CCRepeat
     if (m_fFrom == 100)
     {
         m_fFrom = 0;
     }
 }
Esempio n. 27
0
 public CCSize GetContainerSize(CCNode node)
 {
     if (node != null)
     {
         return node.ContentSize;
     }
     else
     {
         return mRootContainerSize;
     }
 }
Esempio n. 28
0
 protected override void OnHandlePropTypeIntegerLabeled(CCNode node, CCNode parent, string propertyName, int pIntegerLabeled,
                                                        CCBReader reader)
 {
     if (propertyName == PROPERTY_DIRECTION)
     {
         ((CCScrollView) node).Direction = (CCScrollViewDirection) pIntegerLabeled;
     }
     else
     {
         base.OnHandlePropTypeFloatScale(node, parent, propertyName, pIntegerLabeled, reader);
     }
 }
Esempio n. 29
0
 protected override void OnHandlePropTypeCCBFile(CCNode node, CCNode parent, string propertyName, CCNode fileNode, CCBReader reader)
 {
     if (propertyName == PROPERTY_CONTAINER)
     {
         ((CCScrollView) node).Container = fileNode;
         ((CCScrollView) node).UpdateInset();
     }
     else
     {
         base.OnHandlePropTypeCCBFile(node, parent, propertyName, fileNode, reader);
     }
 }
        public void removeSprite(CCNode sender)
        {
            ////----UXLOG("removing tile: %x", sender);
            CCNode p = ((CCNode)sender).parent;

            if (p != null)
            {
                p.removeChild((CCNode)sender, true);
            }

            //////----UXLOG("atlas quantity: %d", p->textureAtlas()->totalQuads());
        }
Esempio n. 31
0
 public override void startWithTarget(CCNode target)
 {
     base.startWithTarget(target);
     this.m_delta = CCPointExtension.ccp(this.m_delta.x - this.m_startPosition.x, this.m_delta.y - this.m_startPosition.y);
 }
Esempio n. 32
0
 public override void startWithTarget(CCNode pTarget)
 {
     base.startWithTarget(pTarget);
     m_fDelta = m_fTo - m_fFrom;
 }
Esempio n. 33
0
 public override void startWithTarget(CCNode target)
 {
     base.startWithTarget(target);
     this.m_pOne.startWithTarget(target);
     this.m_pTwo.startWithTarget(target);
 }
 public override void startWithTarget(CCNode pTarget)
 {
     base.startWithTarget(pTarget);
     m_pOther.startWithTarget(pTarget);
 }
Esempio n. 35
0
 public virtual void addChild(CCNode child, uint zOrder, int tag)
 {
 }