本文整理汇总了C#中CocosSharp.CCScene.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# CCScene.AddChild方法的具体用法?C# CCScene.AddChild怎么用?C# CCScene.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CocosSharp.CCScene
的用法示例。
在下文中一共展示了CCScene.AddChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: passToGame
public void passToGame(int i)
{
GameData.scores = new int[GameData.players];
CCSimpleAudioEngine.SharedEngine.StopEffect(mid);
var newScene = new CCScene(Window);
if(i == 1)
{
var silla = new SillaMusicalLayer();
newScene.AddChild(silla);
Window.DefaultDirector.ReplaceScene(newScene);
}
else if (i == 2)
{
var dictado = new DictadoLayercs();
newScene.AddChild(dictado);
Window.DefaultDirector.ReplaceScene(newScene);
}
else if (i == 3)
{
var maleta = new MaletaLayer();
newScene.AddChild(maleta);
Window.DefaultDirector.ReplaceScene(newScene);
}
else
{
var tablero = new Tablero();
newScene.AddChild(tablero);
Window.DefaultDirector.ReplaceScene(newScene);
}
}
示例2: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching (CCApplication application, CCWindow mainWindow)
{
application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
application.ContentSearchPaths.Add ("animations");
application.ContentSearchPaths.Add ("fonts");
application.ContentSearchPaths.Add ("sounds");
CCSize windowSize = mainWindow.WindowSizeInPixels;
float desiredHeight = 1024.0f;
float desiredWidth = 768.0f;
// This will set the world bounds to be (0,0, w, h)
// CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved
CCScene.SetDefaultDesignResolution (desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll);
CCScene scene = new CCScene (mainWindow);
GameLayer gameLayer = new GameLayer ();
scene.AddChild (gameLayer);
mainWindow.RunWithScene (scene);
}
示例3: 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()
{
ContentRootDirectory = "Content";
//CCSpriteFontCache.FontScale = 0.6f;
//CCSpriteFontCache.RegisterFont("MarkerFelt", 22);
CCDirector director = CCDirector.SharedDirector;
director.DisplayStats = true;
director.AnimationInterval = 1.0 / 60;
// turn on display FPS
director.DisplayStats = true;
// set FPS. the default value is 1.0/60 if you don't call this
director.AnimationInterval = 1.0 / 60;
CCScene scene = new CCScene();
var label = TestClass.PCLLabel(AppDelegate.PlatformMessage());
scene.AddChild(label);
director.RunWithScene(scene);
return true;
}
示例4: openTest
public void openTest(string pCCBFileName, string pCCNodeName, CCNodeLoader pCCNodeLoader)
{
/* Create an autorelease CCNodeLoaderLibrary. */
CCNodeLoaderLibrary ccNodeLoaderLibrary = new CCNodeLoaderLibrary();
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.Text = (pCCBFileName);
CCScene scene = new CCScene(Scene);
scene.AddChild(node);
/* Push the new scene with a fancy transition. */
CCColor3B transitionColor = new CCColor3B();
transitionColor.R = 0;
transitionColor.G = 0;
transitionColor.B = 0;
Scene.Director.PushScene(new CCTransitionFade(0.5f, scene, transitionColor));
}
示例5: ApplicationDidFinishLaunching
public override bool ApplicationDidFinishLaunching()
{
ContentRootDirectory = "Content";
CCSpriteFontCache.FontScale = 0.6f;
CCSpriteFontCache.RegisterFont("MarkerFelt", 22);
CCDirector director = CCDirector.SharedDirector;
director.DisplayStats = true;
director.AnimationInterval = 1.0 / 60;
CCSize designSize = new CCSize(480, 320);
if (CCDrawManager.FrameSize.Height > 320)
{
CCSize resourceSize = new CCSize(960, 640);
ContentSearchPaths.Add("hd");
director.ContentScaleFactor = resourceSize.Height / designSize.Height;
}
CCDrawManager.SetDesignResolutionSize(designSize.Width, designSize.Height, CCResolutionPolicy.ShowAll);
CCScene scene = new CCScene();
var label = TestClass.PCLLabel(AppDelegate.PlatformMessage());
scene.AddChild(label);
director.RunWithScene(scene);
return true;
}
示例6: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
application.ContentSearchPaths.Add ("animations");
application.ContentSearchPaths.Add ("fonts");
application.ContentSearchPaths.Add ("sounds");
CCSize windowSize = mainWindow.WindowSizeInPixels;
float desiredHeight = 512.0f;
float desiredWidth = 384.0f;
// This will set the world bounds to be (0,0, w, h).
// CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved.
CCScene.SetDefaultDesignResolution (desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll);
// Determine whether to use the high or low def versions of our images.
// Make sure the default texel to content size ratio is set correctly.
// Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd).
if (desiredWidth < windowSize.Width) {
application.ContentSearchPaths.Add ("images/hd");
CCSprite.DefaultTexelToContentSizeRatio = 2.0f;
} else {
application.ContentSearchPaths.Add ("images/ld");
CCSprite.DefaultTexelToContentSizeRatio = 1.0f;
}
CCScene scene = new CCScene (mainWindow);
GameLayer gameLayer = new GameLayer ();
scene.AddChild (gameLayer);
mainWindow.RunWithScene (scene);
}
示例7: runTableViewTest
public static void runTableViewTest()
{
var pScene = new CCScene(AppDelegate.SharedWindow, AppDelegate.SharedViewport);
var pLayer = new TableViewTestLayer();
pScene.AddChild(pLayer);
AppDelegate.SharedWindow.DefaultDirector.ReplaceScene(pScene);
}
示例8: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
application.ContentRootDirectory = "Content";
var windowSize = mainWindow.WindowSizeInPixels;
var desiredWidth = 1024.0f;
var desiredHeight = 768.0f;
// This will set the world bounds to be (0,0, w, h)
// CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved
mainWindow.SetDesignResolutionSize(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll);
// Determine whether to use the high or low def versions of our images
// Make sure the default texel to content size ratio is set correctly
// Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd)
if (desiredWidth < windowSize.Width)
{
application.ContentSearchPaths.Add("hd");
CCSprite.DefaultTexelToContentSizeRatio = 2.0f;
}
else
{
application.ContentSearchPaths.Add("ld");
CCSprite.DefaultTexelToContentSizeRatio = 1.0f;
}
var scene = new CCScene(mainWindow);
var introLayer = new IntroLayer();
scene.AddChild(introLayer);
mainWindow.RunWithScene(scene);
}
示例9: ApplicationDidFinishLaunching
/// <summary>
/// Called when app launched.
/// </summary>
/// <param name="application">application object</param>
/// <param name="mainWindow">main window</param>
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
var windowSize = mainWindow.WindowSizeInPixels;
var desiredHeight = 1024.0f;
var desiredWidth = 768.0f;
// This will set the world bounds to be (0,0, w, h)
// CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved
CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll);
CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds/hit_paddle");
CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds/hit_wall");
CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds/hit_off");
var scene = new CCScene(mainWindow);
var introLayer = new IntroLayer();
scene.AddChild(introLayer);
mainWindow.RunWithScene(scene);
}
示例10: switchLayer
public void switchLayer(float dt)
{
//unschedule(schedule_selector(Bug624Layer::switchLayer));
CCScene scene = new CCScene(Scene);
scene.AddChild(new Bug624Layer(), 0);
Scene.Director.ReplaceScene(new CCTransitionFade(2.0f, scene, new CCColor3B { R = 255, G = 0, B = 0 }));
}
示例11: GameScene
public static CCScene GameScene(CCWindow mainWindow)
{
var scene = new CCScene (mainWindow);
var layer = new MonsterRun();
scene.AddChild(layer);
return scene;
}
示例12: SceneWithScore
public static CCScene SceneWithScore (int score)
{
var scene = new CCScene ();
var layer = new GameOverLayer (score);
scene.AddChild (layer);
return scene;
}
示例13: passToGame
public void passToGame()
{
GameData.scores = new int[GameData.players];
CCSimpleAudioEngine.SharedEngine.StopEffect(mid);
var newScene = new CCScene(Window);
var silla = new Tablero();
newScene.AddChild(silla);
Window.DefaultDirector.ReplaceScene(newScene);
}
示例14: GameStartLayerScene
public static CCScene GameStartLayerScene (CCWindow mainWindow)
{
var scene = new CCScene (mainWindow);
var layer = new GameStartLayer ();
scene.AddChild (layer);
return scene;
}
示例15: SceneWithScore
public static CCScene SceneWithScore (CCWindow mainWindow, int score)
{
var scene = new CCScene (mainWindow);
var layer = new GameOverLayer (score);
scene.AddChild (layer);
return scene;
}