本文整理汇总了C#中CocosSharp.CCScene类的典型用法代码示例。如果您正苦于以下问题:C# CCScene类的具体用法?C# CCScene怎么用?C# CCScene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCScene类属于CocosSharp命名空间,在下文中一共展示了CCScene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例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 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);
}
示例6: 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;
}
示例7: 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);
}
}
示例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: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
//application.SupportedOrientations = CCDisplayOrientation.LandscapeRight | CCDisplayOrientation.LandscapeLeft;
//application.AllowUserResizing = true;
//application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
CCRect boundsRect = new CCRect(0.0f, 0.0f, 960, 640);
sharedViewport = new CCViewport(new CCRect (0.0f, 0.0f, 1.0f, 1.0f));
sharedWindow = mainWindow;
sharedCamera = new CCCamera(boundsRect.Size, new CCPoint3(boundsRect.Center, 100.0f), new CCPoint3(boundsRect.Center, 0.0f));
mainWindow.SetDesignResolutionSize(960, 640, CCSceneResolutionPolicy.ShowAll);
#if WINDOWS || WINDOWSGL || WINDOWSDX
//application.PreferredBackBufferWidth = 1024;
//application.PreferredBackBufferHeight = 768;
#elif MACOS
//application.PreferredBackBufferWidth = 960;
//application.PreferredBackBufferHeight = 640;
#endif
#if WINDOWS_PHONE8
application.HandleMediaStateAutomatically = false; // Bug in MonoGame - https://github.com/Cocos2DXNA/cocos2d-xna/issues/325
#endif
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, 32);
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);
//sharedDirector = new CCDirector();
//director.DisplayStats = true;
//director.AnimationInterval = 1.0 / 60;
// if (sharedWindow.WindowSizeInPixels.Height > 320)
// {
// application.ContentSearchPaths.Insert(0,"HD");
// }
//sharedWindow.AddSceneDirector(sharedDirector);
CCScene scene = new CCScene(sharedWindow);
scene.Camera = sharedCamera;
CCLayer layer = new TestController();
scene.AddChild(layer);
sharedWindow.RunWithScene(scene);
}
示例11: LoadGame
void LoadGame (object sender, EventArgs e)
{
var nativeGameView = sender as CCGameView;
if (nativeGameView != null)
{
var contentSearchPaths = new List<string> () { "Fonts", "Sounds" };
CCSizeI viewSize = nativeGameView.ViewSize;
CCSizeI designResolution = nativeGameView.DesignResolution;
// 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 (designResolution.Width < viewSize.Width)
{
contentSearchPaths.Add ("Images/Hd");
CCSprite.DefaultTexelToContentSizeRatio = 2.0f;
}
else
{
contentSearchPaths.Add ("Images/Ld");
CCSprite.DefaultTexelToContentSizeRatio = 1.0f;
}
nativeGameView.ContentManager.SearchPaths = contentSearchPaths;
CCScene gameScene = new CCScene (nativeGameView);
gameScene.AddLayer (new GameLayer ());
nativeGameView.RunWithScene (gameScene);
}
}
示例12: 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 }));
}
示例13: scene
public static CCScene scene()
{
CCScene pScene = new CCScene(AppDelegate.SharedWindow);
//Bug1159Layer layer = Bug1159Layer.node();
//pScene.addChild(layer);
return pScene;
}
示例14: GameStartLayerScene
public static CCScene GameStartLayerScene (CCWindow mainWindow)
{
var scene = new CCScene (mainWindow);
var layer = new GameStartLayer ();
scene.AddChild (layer);
return scene;
}
示例15: GameScene
public static CCScene GameScene(CCWindow mainWindow)
{
var scene = new CCScene (mainWindow);
var layer = new MonsterRun();
scene.AddChild(layer);
return scene;
}