• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# cocos2d.CCNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中cocos2d.CCNode的典型用法代码示例。如果您正苦于以下问题:C# CCNode类的具体用法?C# CCNode怎么用?C# CCNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CCNode类属于cocos2d命名空间,在下文中一共展示了CCNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: showCurrentTest

        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);
            }
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:33,代码来源:ParticleMenuLayer.cs


示例2: OnHandlePropTypeSpriteFrame

 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);
     }
 }
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:29,代码来源:CCMenuItemImageLoader.cs


示例3: startWithTarget

        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;
            }
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:28,代码来源:CCGridAction.cs


示例4: showCurrentTest

        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);
            }
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:34,代码来源:NodeChildrenMenuLayer.cs


示例5: addAction

        // 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);
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:33,代码来源:CCActionManager.cs


示例6: GetActionByTag

        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;
        }
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:28,代码来源:CCActionManager.cs


示例7: StartWithTarget

        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;
            }
        }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:34,代码来源:CCGridAction.cs


示例8: addChild

 // 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");
 }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:8,代码来源:CCParallaxNode.cs


示例9: startWithTarget

 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;
 }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:8,代码来源:CCSkewBy.cs


示例10: itemFromNormalSprite

 /// <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;
 }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:17,代码来源:CCMenuItemSprite.cs


示例11: getRect

 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;
 }
开发者ID:eickegao,项目名称:cocos2d-xna,代码行数:9,代码来源:TextInputTestScene.cs


示例12: startWithTarget

        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);
        }
开发者ID:ChowZenki,项目名称:cocos2d-x-for-xna,代码行数:9,代码来源:CCActionCamera.cs


示例13: getRect

 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;
 }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:9,代码来源:TextInputTestScene.cs


示例14: startWithTarget

        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;
            }
        }
开发者ID:liwq-net,项目名称:cocos2d-for-xna-windows,代码行数:9,代码来源:CCReuseGrid.cs


示例15: NumberOfRunningActionsInTarget

 public int NumberOfRunningActionsInTarget(CCNode target)
 {
     HashElement element;
     if (m_pTargets.TryGetValue(target, out element))
     {
         return (element.Actions != null) ? element.Actions.Count : 0;
     }
     return 0;
 }
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:9,代码来源:CCActionManager.cs


示例16: TextLayer

        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);
        }
开发者ID:KogleDK,项目名称:cocos2d-xna-1,代码行数:56,代码来源:TextLayer.cs


示例17: startWithTarget

        public override void startWithTarget(CCNode pTarget)
        {
            base.startWithTarget(pTarget);

            CCGridBase pGrid = m_pTarget.Grid;
            if (pGrid != null && pGrid.Active)
            {
                pGrid.Active = false;
            }
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:10,代码来源:CCStopGrid.cs


示例18: startWithTarget

        public override void startWithTarget(CCNode pTarget)
        {
            base.startWithTarget(pTarget);

            ICCRGBAProtocol pRGBAProtocol = pTarget as ICCRGBAProtocol;
            if (pRGBAProtocol != null)
            {
                m_fromOpacity = pRGBAProtocol.Opacity;
            }
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:10,代码来源:CCFadeTo.cs


示例19: IsTouchNode

        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);
        }
开发者ID:tianjing,项目名称:SayWordByPicture,代码行数:10,代码来源:BaseLayer.cs


示例20: SpriteChildrenVisibilityIssue665

        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);
        }
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:55,代码来源:SpriteChildrenVisibilityIssue665.cs



注:本文中的cocos2d.CCNode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# cocos2d.CCObject类代码示例发布时间:2022-05-26
下一篇:
C# cocos2d.CCLabelTTF类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap