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


C# Cocos2D.CCScene类代码示例

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


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

示例1: openTest

        public void openTest(string pCCBFileName, string pCCNodeName, CCNodeLoader pCCNodeLoader)
        {
            /* Create an autorelease CCNodeLoaderLibrary. */
            CCNodeLoaderLibrary ccNodeLoaderLibrary = CCNodeLoaderLibrary.NewDefaultCCNodeLoaderLibrary();

            ccNodeLoaderLibrary.RegisterCCNodeLoader("TestHeaderLayer", new Loader<TestHeaderLayer>());
            if (pCCNodeName != null && pCCNodeLoader != null)
            {
                ccNodeLoaderLibrary.RegisterCCNodeLoader(pCCNodeName, pCCNodeLoader);
            }

            /* Create an autorelease CCBReader. */
            var ccbReader = new CCBReader(ccNodeLoaderLibrary);

            /* Read a ccbi file. */
            // Load the scene from the ccbi-file, setting this class as
            // the owner will cause lblTestTitle to be set by the CCBReader.
            // lblTestTitle is in the TestHeader.ccbi, which is referenced
            // from each of the test scenes.
            CCNode node = ccbReader.ReadNodeGraphFromFile(pCCBFileName, this);

            mTestTitleLabelTTF.Label = (pCCBFileName);

            CCScene scene = new CCScene();
            scene.AddChild(node);

            /* Push the new scene with a fancy transition. */
            CCColor3B transitionColor;
            transitionColor.R = 0;
            transitionColor.G = 0;
            transitionColor.B = 0;

            CCDirector.SharedDirector.PushScene(new CCTransitionFade(0.5f, scene, transitionColor));
        }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:34,代码来源:HelloCocosBuilder.cs

示例2: ApplicationDidFinishLaunching

        /// <summary>
        ///  Implement CCDirector and CCScene init code here.
        /// </summary>
        /// <returns>
        ///  true  Initialize success, app continue.
        ///  false Initialize failed, app terminate.
        /// </returns>
        public override bool ApplicationDidFinishLaunching()
        {
            //initialize director
            CCDirector pDirector = CCDirector.SharedDirector;
            pDirector.SetOpenGlView();
#if WINDOWS
            CCDrawManager.SetDesignResolutionSize(320, 480, CCResolutionPolicy.ExactFit);
#else
            CCDrawManager.SetDesignResolutionSize(800, 480, ResolutionPolicy.ShowAll);
            //CCDrawManager.SetDesignResolutionSize(480, 320, ResolutionPolicy.ShowAll);
#endif
            // turn on display FPS
            pDirector.DisplayStats = true;

            // set FPS. the default value is 1.0/60 if you don't call this
            pDirector.AnimationInterval = 1.0 / 60;

            // create a scene. it's an autorelease object
            CCScene pScene = new CCScene();
            CCLayer pLayer = new GameLayer();

            pScene.AddChild(pLayer);
            pDirector.RunWithScene(pScene);

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

示例3: InitWithDuration

        protected virtual bool InitWithDuration(float t, CCScene scene)
        {
            Debug.Assert(scene != null, "Argument scene must be non-nil");

            if (base.Init())
            {
                m_fDuration = t;

                // retain
                m_pInScene = scene;
                m_pOutScene = CCDirector.SharedDirector.RunningScene;
                if (m_pOutScene == null)
                {
                    // Creating an empty scene.
                    m_pOutScene = new CCScene();
                    m_pOutScene.Init();
                }

                Debug.Assert(m_pInScene != m_pOutScene, "Incoming scene must be different from the outgoing scene");

                // disable events while transitions
                CCDirector pDirector = CCDirector.SharedDirector;
                pDirector.TouchDispatcher.IsDispatchEvents = false;
                SceneOrder();

                return true;
            }
            return false;
        }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:29,代码来源:CCTransitionScene.cs

示例4: runTableViewTest

		public static void runTableViewTest()
		{
			var pScene = new CCScene();
			var pLayer = new TableViewTestLayer();
			pLayer.Init();
			pScene.AddChild(pLayer);
			CCDirector.SharedDirector.ReplaceScene(pScene);
		}
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:8,代码来源:TableViewTestScene.cs

示例5: switchLayer

        public void switchLayer(float dt)
        {
            //unschedule(schedule_selector(Bug624Layer::switchLayer));

            CCScene scene = new CCScene();
            scene.AddChild(new Bug624Layer(), 0);
            CCDirector.SharedDirector.ReplaceScene(new CCTransitionFade(2.0f, scene, new CCColor3B { R = 255, G = 0, B = 0 }));
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:8,代码来源:Bug624Layer.cs

示例6: scene

        public static CCScene scene()
        {
            CCScene pScene = new CCScene();
            //Bug1159Layer layer = Bug1159Layer.node();
            //pScene.addChild(layer);

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

示例7: InitWithDuration

 /// <summary>
 /// initializes the transition with a duration and with an RGB color 
 /// </summary>
 protected virtual bool InitWithDuration(float duration, CCScene scene, CCColor3B color)
 {
     if (base.InitWithDuration(duration, scene))
     {
         m_tColor = new CCColor4B {R = color.R, G = color.G, B = color.B, A = 0};
     }
     return true;
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:11,代码来源:CCTransitionFade.cs

示例8: ApplicationDidFinishLaunching

        /// <summary>
        ///  Implement CCDirector and CCScene init code here.
        /// </summary>
        /// <returns>
        ///  true  Initialize success, app continue.
        ///  false Initialize failed, app terminate.
        /// </returns>
        public override bool ApplicationDidFinishLaunching()
        {
            //initialize director
            CCDirector pDirector = CCDirector.SharedDirector;
            pDirector.SetOpenGlView();

            CCSpriteFontCache.RegisterFont("arial", 12, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 38, 50, 64);
            CCSpriteFontCache.RegisterFont("MarkerFelt", 16, 18, 22);
            CCSpriteFontCache.RegisterFont("MarkerFelt-Thin", 12, 18);
            CCSpriteFontCache.RegisterFont("Paint Boy", 26);
            CCSpriteFontCache.RegisterFont("Schwarzwald Regular", 26);
            CCSpriteFontCache.RegisterFont("Scissor Cuts", 26);
            CCSpriteFontCache.RegisterFont("A Damn Mess", 26);
            CCSpriteFontCache.RegisterFont("Abberancy", 26);
            CCSpriteFontCache.RegisterFont("Abduction", 26);

            // turn on display FPS
            pDirector.DisplayStats = true;
            // set FPS. the default value is 1.0/60 if you don't call this
            pDirector.AnimationInterval = 1.0 / 60;

            CCSize designSize = new CCSize(480, 320);

            if (CCDrawManager.FrameSize.Height > 320)
            {
                CCSize resourceSize = new CCSize(960, 640);
                CCContentManager.SharedContentManager.SearchPaths.Add("hd");
                pDirector.ContentScaleFactor = resourceSize.Height / designSize.Height;
            }

            CCDrawManager.SetDesignResolutionSize(designSize.Width, designSize.Height, CCResolutionPolicy.ShowAll);

/*
#if WINDOWS || WINDOWSGL
            CCDrawManager.SetDesignResolutionSize(1280, 768, CCResolutionPolicy.ExactFit);
#else
            CCDrawManager.SetDesignResolutionSize(800, 480, CCResolutionPolicy.ShowAll);
            //CCDrawManager.SetDesignResolutionSize(480, 320, CCResolutionPolicy.ShowAll);
#endif
*/

            // create a scene. it's an autorelease object
            CCScene pScene = new CCScene();
            CCLayer pLayer = new TestController();
            
            /*           
            CCScene pScene = CCScene.node();
            var pLayer = Box2DView.viewWithEntryID(0);
            pLayer.scale = 10;
            pLayer.anchorPoint = new CCPoint(0, 0);
            pLayer.position = new CCPoint(CCDirector.sharedDirector().getWinSize().width / 2, CCDirector.sharedDirector().getWinSize().height / 4);
            */

            pScene.AddChild(pLayer);
            pDirector.RunWithScene(pScene);

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

示例9: sceneWithTitle

		public new static CCScene sceneWithTitle(string title)
		{
			var pScene = new CCScene();
			var controlLayer = new CCControlButtonTest_HelloVariableSize();
		    controlLayer.Init();
    		controlLayer.getSceneTitleLabel().Text = (title);
			pScene.AddChild(controlLayer);
			return pScene;
		}
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:9,代码来源:CCControlButtonTest.cs

示例10: SceneWithScore

        public static CCScene SceneWithScore(int score, int remoteScore)
        {
            var scene = new CCScene ();
            var layer = new GameOverLayer (score, remoteScore);

            scene.AddChild (layer);

            return scene;
        }
开发者ID:nightsnaker,项目名称:XamarinMultiplayerBananas,代码行数:9,代码来源:GameOverLayer.cs

示例11: runTouchesTest

        public static void runTouchesTest()
        {
            s_nTouchCurCase = 0;
            CCScene pScene = new CCScene();
            CCLayer pLayer = new TouchesPerformTest1(true, TEST_COUNT, s_nTouchCurCase);

            pScene.AddChild(pLayer);

            CCDirector.SharedDirector.ReplaceScene(pScene);
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:10,代码来源:PerformanceTouchesTest.cs

示例12: sceneWithTitle

 public new static CCScene sceneWithTitle(string title)
 {
     var pScene = new CCScene();
     var controlLayer = new CCControlStepperTest();
     if (controlLayer != null)
     {
         controlLayer.getSceneTitleLabel().Text = (title);
         pScene.AddChild(controlLayer);
     }
     return pScene;
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:11,代码来源:CCControlStepperTest.cs

示例13: sceneWithTitle

 public new static CCScene sceneWithTitle(string title)
 {
     CCScene pScene = new CCScene();
     var controlLayer = new CCControlSwitchTest();
     if (controlLayer != null && controlLayer.Init())
     {
         controlLayer.getSceneTitleLabel().Text = (title);
         pScene.AddChild(controlLayer);
     }
     return pScene;
 }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:11,代码来源:CCControlSwitchTest.cs

示例14: menuCallback

        public void menuCallback(object pSender)
        {
            CCMenuItemFont pItem = (CCMenuItemFont)pSender;
            int nIndex = pItem.ZOrder - BugsTestScene.kItemTagBasic;

            CCScene pScene = new CCScene();
            CCLayer pLayer = null;

            switch (nIndex)
            {
                case 0:
                    pLayer = new Bug350Layer();
                    pLayer.Init();
                    break;
                case 1:
                    pLayer = new Bug422Layer();
                    pLayer.Init();
                    break;
                case 2:
                    pLayer = new Bug458Layer();
                    pLayer.Init();
                    break;
                case 3:
                    pLayer = new Bug624Layer();
                    pLayer.Init();
                    break;
                case 4:
                    pLayer = new Bug886Layer();
                    pLayer.Init();
                    break;
                case 5:
                    pLayer = new Bug899Layer();
                    pLayer.Init();
                    break;
                case 6:
                    pLayer = new Bug914Layer();
                    pLayer.Init();
                    break;
                case 7:
                    pLayer = new Bug1159Layer();
                    pLayer.Init();
                    break;
                case 8:
                    pLayer = new Bug1174Layer();
                    pLayer.Init();
                    break;
                default:
                    break;
            }
            pScene.AddChild(pLayer);
            CCDirector.SharedDirector.ReplaceScene(pScene);
        }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:52,代码来源:BugsTestMainLayer.cs

示例15: showCurrentTest

        public override void showCurrentTest()
        {
            CCLayer pLayer = null;
            switch (m_nCurCase)
            {
                case 0:
                    pLayer = new TouchesPerformTest1(true, PerformanceTouchesTest.TEST_COUNT, m_nCurCase);
                    break;
                case 1:
                    pLayer = new TouchesPerformTest2(true, PerformanceTouchesTest.TEST_COUNT, m_nCurCase);
                    break;
            }
            PerformanceTouchesTest.s_nTouchCurCase = m_nCurCase;

            if (pLayer != null)
            {
                CCScene pScene = new CCScene();
                pScene.AddChild(pLayer);

                CCDirector.SharedDirector.ReplaceScene(pScene);
            }
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:22,代码来源:TouchesMainScene.cs


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