本文整理汇总了C#中Cocos2D.CCScene.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# CCScene.AddChild方法的具体用法?C# CCScene.AddChild怎么用?C# CCScene.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cocos2D.CCScene
的用法示例。
在下文中一共展示了CCScene.AddChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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));
}
示例3: 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 }));
}
示例4: runTableViewTest
public static void runTableViewTest()
{
var pScene = new CCScene();
var pLayer = new TableViewTestLayer();
pLayer.Init();
pScene.AddChild(pLayer);
CCDirector.SharedDirector.ReplaceScene(pScene);
}
示例5: SceneWithScore
public static CCScene SceneWithScore(int score, int remoteScore)
{
var scene = new CCScene ();
var layer = new GameOverLayer (score, remoteScore);
scene.AddChild (layer);
return scene;
}
示例6: 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;
}
示例7: 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);
}
示例8: 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;
}
示例9: 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;
}
示例10: 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);
}
示例11: 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);
}
}
示例12: 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 || WINDOWSGL
CCDrawManager.SetDesignResolutionSize(1280, 768, CCResolutionPolicy.ExactFit);
#else
CCDrawManager.SetDesignResolutionSize(800, 480, CCResolutionPolicy.ShowAll);
//CCDrawManager.SetDesignResolutionSize(480, 320, CCResolutionPolicy.ShowAll);
#endif
// turn on display FPS
pDirector.DisplayStats = true;
// pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
// 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 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;
}
示例13: sceneWithTitle
public new static CCScene sceneWithTitle(string title)
{
var pScene = new CCScene();
var controlLayer = new CCControlButtonTest_Styling();
if (controlLayer != null && controlLayer.Init())
{
controlLayer.getSceneTitleLabel().Label = (title);
pScene.AddChild(controlLayer);
}
return pScene;
}
示例14: CreateSceneWithNodeGraphFromFile
public CCScene CreateSceneWithNodeGraphFromFile(string fileName, object owner, CCSize parentSize)
{
CCNode pNode = ReadNodeGraphFromFile(fileName, owner, parentSize);
CCScene pScene = new CCScene();
pScene.AddChild(pNode);
return pScene;
}
示例15: 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.FontScale = 0.6f;
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");
/*
CCContentManager.SharedContentManager.SearchPaths.Add("hd/extensions");
CCContentManager.SharedContentManager.SearchPaths.Add("extensions");
CCContentManager.SharedContentManager.SearchPaths.Add("hd/animations");
CCContentManager.SharedContentManager.SearchPaths.Add("animations");
CCContentManager.SharedContentManager.SearchPaths.Add("hd/TileMaps");
CCContentManager.SharedContentManager.SearchPaths.Add("TileMaps");
CCContentManager.SharedContentManager.SearchPaths.Add("hd/ccb");
CCContentManager.SharedContentManager.SearchPaths.Add("ccb");
CCContentManager.SharedContentManager.SearchPaths.Add("hd/Images");
CCContentManager.SharedContentManager.SearchPaths.Add("Particles");
CCContentManager.SharedContentManager.SearchPaths.Add("Sounds");
CCContentManager.SharedContentManager.SearchPaths.Add("TileMaps");
*/
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;
}