本文整理汇总了C#中CocosSharp.CCScene类的典型用法代码示例。如果您正苦于以下问题:C# CCScene类的具体用法?C# CCScene怎么用?C# CCScene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCScene类属于CocosSharp命名空间,在下文中一共展示了CCScene类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:25,代码来源:GameAppDelegate.cs
示例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);
}
开发者ID:netonjm,项目名称:CocosSharp,代码行数:7,代码来源:TableViewTestScene.cs
示例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;
}
开发者ID:h7ing,项目名称:CocosSharp,代码行数:34,代码来源:AppDelegate.cs
示例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));
}
开发者ID:h7ing,项目名称:CocosSharp,代码行数:34,代码来源:HelloCocosBuilder.cs
示例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);
}
开发者ID:jonathanzuniga,项目名称:BouncingGame,代码行数:35,代码来源:GameAppDelegate.cs
示例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;
}
开发者ID:KerwinMa,项目名称:CocosSharp,代码行数:32,代码来源:AppDelegate.cs
示例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);
}
}
开发者ID:sanslash332,项目名称:codename-the-great-and-powerful-phone-party,代码行数:33,代码来源:SeleccionJuego.cs
示例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);
}
开发者ID:AnimaRobotics,项目名称:CocosSharp,代码行数:33,代码来源:AppDelegate.cs
示例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);
}
开发者ID:vividos,项目名称:CocosSharp,代码行数:30,代码来源:AppDelegate.cs
示例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);
}
开发者ID:netonjm,项目名称:CocosSharp,代码行数:60,代码来源:AppDelegate.cs
示例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);
}
}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:31,代码来源:GamePage.cs
示例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 }));
}
开发者ID:h7ing,项目名称:CocosSharp,代码行数:8,代码来源:Bug624Layer.cs
示例13: scene
public static CCScene scene()
{
CCScene pScene = new CCScene(AppDelegate.SharedWindow);
//Bug1159Layer layer = Bug1159Layer.node();
//pScene.addChild(layer);
return pScene;
}
开发者ID:haithemaraissia,项目名称:CocosSharp,代码行数:8,代码来源:Bug1159Layer.cs
示例14: GameStartLayerScene
public static CCScene GameStartLayerScene (CCWindow mainWindow)
{
var scene = new CCScene (mainWindow);
var layer = new GameStartLayer ();
scene.AddChild (layer);
return scene;
}
开发者ID:460189852,项目名称:cocos-sharp-samples,代码行数:9,代码来源:GameStartLayer.cs
示例15: GameScene
public static CCScene GameScene(CCWindow mainWindow)
{
var scene = new CCScene (mainWindow);
var layer = new MonsterRun();
scene.AddChild(layer);
return scene;
}
开发者ID:jonathanzuniga,项目名称:MonsterSmashing,代码行数:9,代码来源:MonsterRun.cs
示例16: 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);
}
开发者ID:sanslash332,项目名称:codename-the-great-and-powerful-phone-party,代码行数:9,代码来源:IntroLayer.cs
示例17: SceneWithScore
public static CCScene SceneWithScore (int score)
{
var scene = new CCScene ();
var layer = new GameOverLayer (score);
scene.AddChild (layer);
return scene;
}
开发者ID:h7ing,项目名称:CocosSharp,代码行数:9,代码来源:GameOverLayer.cs
示例18: SceneWithScore
public static CCScene SceneWithScore (CCWindow mainWindow, int score)
{
var scene = new CCScene (mainWindow);
var layer = new GameOverLayer (score);
scene.AddChild (layer);
return scene;
}
开发者ID:Adameg,项目名称:mobile-samples,代码行数:9,代码来源:GameOverLayer.cs
示例19: runTouchesTest
public static void runTouchesTest()
{
s_nTouchCurCase = 0;
CCScene pScene = new CCScene(AppDelegate.SharedWindow, AppDelegate.SharedViewport);
CCLayer pLayer = new TouchesPerformTest1(true, TEST_COUNT, s_nTouchCurCase);
pScene.AddChild(pLayer);
AppDelegate.SharedWindow.DefaultDirector.ReplaceScene(pScene);
}
开发者ID:netonjm,项目名称:CocosSharp,代码行数:10,代码来源:PerformanceTouchesTest.cs
示例20: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
SharedWindow = mainWindow;
DefaultResolution = new CCSize(
application.MainWindow.WindowSizeInPixels.Width,
application.MainWindow.WindowSizeInPixels.Height);
application.ContentRootDirectory = "Content";
CCScene scene = new CCScene(mainWindow);
CCLayer layer = new IntroLayer(DefaultResolution);
var b = new CozyColorSampleButton(100, 100, 158, 158)
{
NormalColor = new CCColor4B(255, 0, 0),
ClickedColor = new CCColor4B(0, 255, 0),
Text = "Hello Bttton",
HasBorder = true,
};
b.OnClick += () =>
{
};
var list = new CozySampleListView()
{
ContentSize = new CCSize(350, 350),
Orientation = ControlOrientation.Vertical,
Position = new CCPoint(100, 100),
HasBorder = true,
};
layer.AddChild(list);
list.AddItem(new CozySampleListViewItemSprite(new CCSprite("gold"))
{
MarginBottom = 10,
MarginTop = 10,
HasBorder = true,
});
list.AddItem(b);
list.AddItem(new CozySampleListViewItemSprite(new CCSprite("gold"))
{
MarginBottom = 10,
MarginTop = 10,
HasBorder = true,
});
layer.AddEventListener(b.EventListener, layer);
scene.AddChild(layer);
mainWindow.RunWithScene(scene);
}
开发者ID:xxy1991,项目名称:cozy,代码行数:55,代码来源:AppDelegate.cs
注:本文中的CocosSharp.CCScene类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论