当前位置: 首页>>代码示例>>C#>>正文


C# CCScene.AddChild方法代码示例

本文整理汇总了C#中CCScene.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# CCScene.AddChild方法的具体用法?C# CCScene.AddChild怎么用?C# CCScene.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCScene的用法示例。


在下文中一共展示了CCScene.AddChild方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Layer3

        public Layer3()
            : base(new ccColor4B (0,0,255,255))
        {
            CGSize s = CCDirector.SharedDirector ().WinSize ();
            CCMenuItemFont item0 = new CCMenuItemFont("Touch to pushScene (self)", delegate {
                CCScene newScene = new CCScene();
                newScene.AddChild (new Layer3 ());
                CCDirector.SharedDirector ().PushScene (new CCTransitionFade (0.5f, newScene, new ccColor3B (0, 255, 255)));
            });

            CCMenuItemFont item1 = new CCMenuItemFont("Touch to popScene", delegate {
                CCDirector.SharedDirector ().PopScene ();
            });

            CCMenuItemFont item2 = new CCMenuItemFont("Touch to popToRootScene", delegate {
                CCDirector.SharedDirector ().PopToRootScene ();
            });

            CCMenu menu = new CCMenu(item0, item1, item2);
            this.AddChild (menu);
            menu.AlignItemsVertically ();

            CCSprite sprite = new CCSprite("grossini.png", true);
            this.AddChild (sprite);
            sprite.Position = new CCPoint(s.Width / 2, 40);
            var rotate = new CCRotateBy (2, 360);
            var repeat = new CCRepeatForever (rotate);
            sprite.RunAction (repeat);
        }
开发者ID:trustme,项目名称:cocos2d-mono,代码行数:29,代码来源:Layer3.cs

示例2: FinishedLaunching

        public override void FinishedLaunching(NSObject notification)
        {
            CCDirector director = CCDirector.SharedDirector ();

            director.View = glView;
            director.DisplayStats = true;

            CCScene scene =  new CCScene();
            Layer1 l = new Layer1();
            scene.AddChild (l);
            director.RunWithScene (scene);
        }
开发者ID:trustme,项目名称:cocos2d-mono,代码行数:12,代码来源:AppDelegate.cs

示例3: OnPushSceneTran

 void OnPushSceneTran(NSObject CCSenderCallback)
 {
     CCScene scene = new CCScene();
     scene.AddChild (new Layer2 (), 0);
     CCDirector.SharedDirector ().PushScene (new CCTransitionSlideInT (1, scene));
 }
开发者ID:trustme,项目名称:cocos2d-mono,代码行数:6,代码来源:Layer1.cs

示例4: OnPushScene

 void OnPushScene(NSObject CCSenderCallback)
 {
     CCScene scene = new CCScene();
     scene.AddChild (new Layer2 (), 0);
     CCDirector.SharedDirector ().PushScene (scene);
 }
开发者ID:trustme,项目名称:cocos2d-mono,代码行数:6,代码来源:Layer1.cs

示例5: backCallback

 void backCallback(NSObject sender)
 {
     CCScene scene = new CCScene();
     scene.AddChild (MenuTest.Scene ());
     CCDirector.SharedDirector ().ReplaceScene (scene);
 }
开发者ID:trustme,项目名称:cocos2d-mono,代码行数:6,代码来源:Layer4.cs

示例6: NewScene

 void NewScene()
 {
     CCScene s = new CCScene ();
     var child = new TextLayer ();
     s.AddChild (child);
     CCDirector.SharedDirector ().ReplaceScene (s);
 }
开发者ID:trustme,项目名称:cocos2d-mono,代码行数:7,代码来源:EffectsTest.cs

示例7: OnReplaceSceneTran

 void OnReplaceSceneTran(NSObject CCSenderCallback)
 {
     CCScene scene = new CCScene();
     scene.AddChild (new Layer3 (), 0);
     CCDirector.SharedDirector ().ReplaceScene (new CCTransitionFlipX (2, scene));
 }
开发者ID:trustme,项目名称:cocos2d-mono,代码行数:6,代码来源:Layer2.cs

示例8: OnReplaceScene

 void OnReplaceScene(NSObject CCSenderCallback)
 {
     CCScene scene = new CCScene();
     scene.AddChild (new Layer3 (), 0);
     CCDirector.SharedDirector ().ReplaceScene (scene);
 }
开发者ID:trustme,项目名称:cocos2d-mono,代码行数:6,代码来源:Layer2.cs

示例9: MenuTest

        public MenuTest()
        {
            CCDirector director = CCDirector.SharedDirector ();
            SizeF size = director.WinSize ();
            CCMenu menu = null;

            CCSprite spriteNormal = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 2, 115, 23));
            CCSprite spriteSelected = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 1, 115, 23));
            CCSprite spriteDisabled = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 0, 115, 23));
            CCMenuItemSprite item1 = new CCMenuItemSprite (spriteNormal, spriteSelected, spriteDisabled,
                delegate (NSObject sender) {
                CCScene scene1 = new CCScene ();
                scene1.AddChild (Layer2.Node());
                CCDirector.SharedDirector ().ReplaceScene (scene1);
            });

            CCMenuItemImage item2 = new CCMenuItemImage ("SendScoreButton.png", "SendScoreButtonPressed.png", null, cb);

            CCLabelAtlas labelAtlas = new CCLabelAtlas ("0123456789", "fps_images.png", 12, 32, '.');
            CCMenuItemLabel item3 = new CCMenuItemLabel(labelAtlas,
                delegate (NSObject sender) {
                CCDirector.SharedDirector ().EventDispatcher.AddMouseDelegate (this, -128-1);
                this.Schedule (new MonoMac.ObjCRuntime.Selector ("allowTouches"), 5.0f);
            });

            item3.DisabledColor = new ccColor3B (32, 32, 64);
            item3.Color = new ccColor3B (200, 200, 255);
            disabledItem = item3;

            CCMenuItemFont item4 = new CCMenuItemFont ("I toggle enabled items",
                delegate {
                disabledItem.Enabled = !disabledItem.Enabled;
            }
            );
            item4.FontSize = 20;
            item4.FontName = "Marker Felt";

            CCLabelBMFont label = new CCLabelBMFont ("configuration", "bitmapFontTest3.fnt");
            CCMenuItemLabel item5 = new CCMenuItemLabel (label,
                delegate {
                CCScene scene = new CCScene ();
                scene.AddChild (new Layer4 ());
                CCDirector.SharedDirector ().ReplaceScene (scene);
            });
            item5.Scale = 0.8f;

            CCMenuItemFont.DefaultFontName = "Marker Felt";
            CCMenuItemFont item6 = new CCMenuItemFont ("Priority Test",
                delegate (NSObject sender) {
                CCScene scene = new CCScene();
                scene.AddChild (new LayerPriorityTest());
                CCDirector.SharedDirector ().PushScene (scene);
            });

            CCMenuItemFont.DefaultFontName = "Courier New";
            CCMenuItemFont.DefaultFontSize = 30;
            CCMenuItemFont item7 = new CCMenuItemFont ("Quit",
                delegate {
                director.View.Window.Close ();
            });

            CCTintBy color_action = new CCTintBy(0.5f, 0, -255, -255);
            var color_back = color_action.Reverse ();
            var seq = new CCSequence (color_action, color_back);
            item7.RunAction (new CCRepeatForever (seq));

            menu = new CCMenu (item1, item2, item3, item4, item5, item6, item7);
            menu.AlignItemsVertically ();

            for (uint i = 0; i < menu.Children.Count(); i++) {
                CCNode child = (CCNode)menu.Children.ObjectAtIndex(i);
                PointF dstPoint = child.Position;
                int offset = (int)(size.Width/2) + 50;
                if (i % 2 == 0)
                    offset = -offset;
                child.Position = new PointF(dstPoint.X + offset, dstPoint.Y);
                child.RunAction(new CCEaseElasticOut(
                    new CCMoveBy(2, new PointF(dstPoint.X - offset, 0)), 0.35f));
            }

            menu.Position = new PointF(size.Width/2, size.Height/2);
            this.AddChild(menu);
        }
开发者ID:trustme,项目名称:cocos2d-mono,代码行数:83,代码来源:MenuTest.cs

示例10: cb

 void cb(NSObject sender)
 {
     CCScene scene =  new CCScene();
     scene.AddChild(new Layer3());
     CCDirector.SharedDirector().ReplaceScene(scene);
 }
开发者ID:trustme,项目名称:cocos2d-mono,代码行数:6,代码来源:MenuTest.cs

示例11: Scene

        public static CCScene Scene()
        {
            CCScene scene = new CCScene ();
            MenuTest mt = new MenuTest();
            scene.AddChild (mt);

            return scene;
        }
开发者ID:trustme,项目名称:cocos2d-mono,代码行数:8,代码来源:MenuTest.cs


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