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

C# Cocos2D.CCNode类代码示例

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

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



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

示例1: 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:Karunp,项目名称:cocos2d-xna,代码行数:29,代码来源:CCMenuItemImageLoader.cs


示例2: 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:pekayatt,项目名称:cocos2d-xna,代码行数:34,代码来源:CCGridAction.cs


示例3: StartWithTarget

 public override void StartWithTarget(CCNode target)
 {
     base.StartWithTarget(target);
     foreach (CCFiniteTimeAction action in m_pActions)
     {
         action.StartWithTarget(target);
     }
 }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:8,代码来源:CCParallel.cs


示例4: Init

        public bool Init(CCNode stencil)
        {
            m_pStencil = stencil;
            m_fAlphaThreshold = 1;
            m_bInverted = false;

            return true;
        }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:8,代码来源:CCClippingNode.cs


示例5: StartWithTarget

 public override void StartWithTarget(CCNode target)
 {
     base.StartWithTarget(target);
     for (int i = 0; i < m_pActions.Length; i++)
     {
         m_pActions[i].StartWithTarget(target);
     }
 }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:8,代码来源:CCParallel.cs


示例6: InitWithLabel

 protected bool InitWithLabel(CCNode label, SEL_MenuHandler selector)
 {
     base.InitWithTarget(selector);
     m_fOriginalScale = 1.0f;
     m_tColorBackup = CCTypes.CCWhite;
     DisabledColor = new CCColor3B(126, 126, 126);
     Label = label;
     return true;
 }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:9,代码来源:CCMenuItemLabel.cs


示例7: 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:CartBlanche,项目名称:cocos2d-xna,代码行数:57,代码来源:TextLayer.cs


示例8: StartWithTarget

        protected internal override void StartWithTarget(CCNode target)
        {
            base.StartWithTarget(target);

            m_fDeltaT = 1f / m_pPoints.Count;

            m_previousPosition = target.Position;
            m_accumulatedDiff = CCPoint.Zero;
        }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:9,代码来源:CCCardinalSplineTo.cs


示例9: SpriteHybrid

        public SpriteHybrid()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            // parents
            CCNode parent1 = new CCNode ();
            CCSpriteBatchNode parent2 = new CCSpriteBatchNode("animations/grossini", 50);

            AddChild(parent1, 0, (int)kTags.kTagNode);
            AddChild(parent2, 0, (int)kTags.kTagSpriteBatchNode);


            // IMPORTANT:
            // The sprite frames will be cached AND RETAINED, and they won't be released unless you call
            //     CCSpriteFrameCache::sharedSpriteFrameCache()->removeUnusedSpriteFrames);
            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("animations/grossini.plist");


            // create 250 sprites
            // only show 80% of them
            for (int i = 0; i < 250; i++)
            {
                int spriteIdx = (int)(CCRandom.NextDouble() * 14);
                string str = "";
                string temp = "";
                if (spriteIdx+1<10)
                {
                    temp = "0" + (spriteIdx+1);
                }
                else
                {
                    temp = (spriteIdx+1).ToString();
                }
                str = string.Format("grossini_dance_{0}.png", temp);
                CCSpriteFrame frame = CCSpriteFrameCache.SharedSpriteFrameCache.SpriteFrameByName(str);
                CCSprite sprite = new CCSprite(frame);
                parent1.AddChild(sprite, i, i);

                float x = -1000;
                float y = -1000;
                if (CCRandom.NextDouble() < 0.2f)
                {
                    x = (float)(CCRandom.NextDouble() * s.Width);
                    y = (float)(CCRandom.NextDouble() * s.Height);
                }
                sprite.Position = (new CCPoint(x, y));

                CCActionInterval action = new CCRotateBy (4, 360);
                sprite.RunAction(new CCRepeatForever (action));
            }

            m_usingSpriteBatchNode = false;

            Schedule(reparentSprite, 2);
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:55,代码来源:SpriteHybrid.cs


示例10: 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:Ratel13,项目名称:cocos2d-xna,代码行数:55,代码来源:SpriteChildrenVisibilityIssue665.cs


示例11: OnHandlePropTypeFloat

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


示例12: SetBaseValue

        public void SetBaseValue(object pValue, CCNode node, string pPropName)
        {
            Dictionary<string, object> props;
            if (!mBaseValues.TryGetValue(node, out props))
            {
                props = new Dictionary<string, object>();
                mBaseValues.Add(node, props);
            }

            props[pPropName] = pValue;
        }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:11,代码来源:CCBAnimationManager.cs


示例13: OnHandlePropTypeSize

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


示例14: OnHandlePropTypeCheck

 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);
     }
 }
开发者ID:liwq-net,项目名称:UIFactory,代码行数:11,代码来源:CCMenuItemLoader.cs


示例15: CCParallaxScrollOffset

 public CCParallaxScrollOffset(CCNode node, CCPoint r, CCPoint p, CCPoint s, CCPoint v)
 {
     Child = node;
     Ratio = r;
     Offset = s;
     RelativeVelocity = v;
     Child.Position = p;
     OriginalPosition = p;
     //currPosition = p;
     Child.AnchorPoint = CCPoint.AnchorLowerLeft;
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:11,代码来源:CCParallaxScrollOffset.cs


示例16: GetContainerSize

 public CCSize GetContainerSize(CCNode node)
 {
     if (node != null)
     {
         return node.ContentSize;
     }
     else
     {
         return mRootContainerSize;
     }
 }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:11,代码来源:CCBAnimationManager.cs


示例17: OnHandlePropTypeCCBFile

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


示例18: RemoveChild

 public override void RemoveChild(CCNode child, bool cleanup)
 {
     for (int i = 0; i < m_pParallaxArray.Count; i++)
     {
         if (m_pParallaxArray[i].Child == child)
         {
             m_pParallaxArray.RemoveAt(i);
             break;
         }
     }
     base.RemoveChild(child, cleanup);
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:12,代码来源:CCParallaxNode.cs


示例19: TextLayer

        public TextLayer()
        {
            InitWithColor(CCTypes.CreateColor(32, 32, 32, 255));

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

            var bg = new CCSprite(TestResource.s_back3);
            node.AddChild(bg, 0);
            bg.AnchorPoint = new CCPoint(0.5f, 0.5f);
            bg.Position = CCVisibleRect.Center;

            var grossini = new CCSprite(TestResource.s_pPathSister2);
            node.AddChild(grossini, 1);
            grossini.Position = new CCPoint(CCVisibleRect.Left.X + CCVisibleRect.VisibleRect.Size.Width / 3,
                                            CCVisibleRect.Center.Y);
            CCActionInterval sc = new CCScaleBy(2, 5);
            CCFiniteTimeAction sc_back = sc.Reverse();
            grossini.RunAction(new CCRepeatForever((new CCSequence(sc, sc_back))));

            var tamara = new CCSprite(TestResource.s_pPathSister1);
            node.AddChild(tamara, 1);
            tamara.Position = new CCPoint(CCVisibleRect.Left.X + 2 * CCVisibleRect.VisibleRect.Size.Width / 3,
                                          CCVisibleRect.Center.Y);
            CCActionInterval sc2 = new CCScaleBy(2, 5);
            CCFiniteTimeAction sc2_back = sc2.Reverse();
            tamara.RunAction(new CCRepeatForever((new CCSequence(sc2, sc2_back))));

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

            label.Position = new CCPoint(CCVisibleRect.Center.X, CCVisibleRect.Top.Y - 80);
            AddChild(label);
            label.Tag = EffectTestScene.kTagLabel;

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

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

            menu.Position = CCPoint.Zero;
            item1.Position = new CCPoint(CCVisibleRect.Center.X - item2.ContentSize.Width * 2,
                                         CCVisibleRect.Bottom.Y + item2.ContentSize.Height / 2);
            item2.Position = new CCPoint(CCVisibleRect.Center.X, CCVisibleRect.Bottom.Y + item2.ContentSize.Height / 2);
            item3.Position = new CCPoint(CCVisibleRect.Center.X + item2.ContentSize.Width * 2,
                                         CCVisibleRect.Bottom.Y + item2.ContentSize.Height / 2);

            AddChild(menu, 1);

            Schedule(checkAnim);
        }
开发者ID:womandroid,项目名称:cocos2d-xna,代码行数:53,代码来源:TextLayer.cs


示例20: OnHandlePropTypeIntegerLabeled

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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