本文整理汇总了C#中CocosSharp.CCWindow.RunWithScene方法的典型用法代码示例。如果您正苦于以下问题:C# CCWindow.RunWithScene方法的具体用法?C# CCWindow.RunWithScene怎么用?C# CCWindow.RunWithScene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CocosSharp.CCWindow
的用法示例。
在下文中一共展示了CCWindow.RunWithScene方法的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 = 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);
}
示例2: 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);
}
示例3: 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);
}
示例4: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
application.ContentSearchPaths.Add ("fonts");
application.ContentSearchPaths.Add ("landscape");
application.ContentSearchPaths.Add ("menu");
application.ContentSearchPaths.Add ("interface");
application.ContentSearchPaths.Add ("particle");
gameContainer = new mapKnightLibrary.Container ();
gameContainer.mainCharacter= new RoboBob();
gameContainer.physicsHandler = new PhysicsHandler ();
runningWindow = mainWindow;
// This tells the application to not use antialiasing which can
// improve the performance of your game.
// Get the resolution of the main window...
var bounds = mainWindow.WindowSizeInPixels;
////definieren der Windowgröße auf 1280x576 p (16:9)
CCScene.SetDefaultDesignResolution (bounds.Width, bounds.Height, CCSceneResolutionPolicy.ShowAll);
//startScene = new StartScene (mainWindow);
gameScene = new GameScene (mainWindow, gameContainer, RunningControlType);
optionScene = new OptionScene (mainWindow);
// startet das erste Fenster
mainWindow.RunWithScene (gameScene);
//startScene.Version = app_version;
//startScene.startGame += startGame;
//if (ApplicationFinishedLaunching != null)
// ApplicationFinishedLaunching (this, EventArgs.Empty);
}
示例5: 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);
}
示例6: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
CCLog.Logger = DebugLogging;
preferredWidth = 1024;
preferredHeight = 768;
application.PreferMultiSampling = true;
application.ContentRootDirectory = "Content";
//CCSpriteFontCache.FontScale = 0.5f;
//CCSpriteFontCache.RegisterFont("MarkerFelt", 22);
//CCSpriteFontCache.RegisterFont("arial", 12, 24);
CCSize designSize = new CCSize(480, 320);
// if (CCDrawManager.FrameSize.Height > 320)
// {
// //CCSize resourceSize = new CCSize(960, 640);
// CCSize resourceSize = new CCSize(480, 320);
// application.ContentSearchPaths.Add("hd");
// director.ContentScaleFactor = resourceSize.Height / designSize.Height;
// }
CCScene.SetDefaultDesignResolution(designSize.Width, designSize.Height, CCSceneResolutionPolicy.ShowAll);
// turn on display FPS
mainWindow.DisplayStats = true;
mainWindow.StatsScale = 2;
CCScene pScene = GoblinLayer.Scene(mainWindow);
mainWindow.RunWithScene(pScene);
}
示例7: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
try
{
CCSimpleAudioEngine.SharedEngine.PreloadEffect("Sounds/SplatEffect");
CCSimpleAudioEngine.SharedEngine.PreloadEffect("Sounds/pew-pew-lei");
CCSimpleAudioEngine.SharedEngine.PlayBackgroundMusic("Sounds/backgroundSound", true);
CCSimpleAudioEngine.SharedEngine.BackgroundMusicVolume = 0.9f;
CCSimpleAudioEngine.SharedEngine.EffectsVolume = 0.7f;
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
}
var winSize = mainWindow.WindowSizeInPixels;
mainWindow.SetDesignResolutionSize(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ExactFit);
// CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ExactFit);
// TODO: Set this up when we have a Game Layer
CCScene scene = GameStartLayer.GameStartLayerScene(mainWindow);
mainWindow.RunWithScene (scene);
}
示例8: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
application.ContentRootDirectory = "Content";
sharedWindow = mainWindow;
var introScene = IntroLayer.CreateScene(mainWindow);
sharedWindow.RunWithScene(introScene);
}
示例9: 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);
}
示例10: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching (CCApplication application, CCWindow mainWindow)
{
application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
var bounds = mainWindow.WindowSizeInPixels;
CCScene.SetDefaultDesignResolution(bounds.Width, bounds.Height, CCSceneResolutionPolicy.ShowAll);
GameScene gameScene = new GameScene (mainWindow);
mainWindow.RunWithScene (gameScene);
}
示例11: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) {
base.ApplicationDidFinishLaunching(application, mainWindow);
/** Set up resource folders */
Resources.LoadContent(application);
ServerScene = new ServerScene(mainWindow);
mainWindow.RunWithScene(ServerScene);
LoadAccounts();
ServerScene.Schedule(SaveAccounts, 5);
}
示例12: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
//application.AllowUserResizing = true;
application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
application.ContentSearchResolutionOrder = new List<string>() { "", "images", "fonts" };
sharedWindow = mainWindow;
CCSize winSize = mainWindow.WindowSizeInPixels;
CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ShowAll);
//CCScene.SetDefaultDesignResolution(winSize.Width/2, winSize.Height/2, 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);
mainWindow.DisplayStats = true;
mainWindow.StatsScale = 1;
// if (mainWindow.WindowSizeInPixels.Height > 320)
// {
// application.ContentSearchPaths.Insert(0,"HD");
// }
//CCApplication.DefaultTexelToContentSizeRatio = 2f;
CCScene scene = new CCScene(sharedWindow);
CCLayer layer = new TestController();
scene.AddChild(layer);
sharedWindow.RunWithScene(scene);
}
示例13: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
mainWindow.SupportedDisplayOrientations = CCDisplayOrientation.Portrait | CCDisplayOrientation.LandscapeLeft | CCDisplayOrientation.LandscapeRight;
application.ContentSearchPaths.Add ("hd");
CCSimpleAudioEngine.SharedEngine.PreloadEffect ("Sounds/tap");
CCScene scene = GameStartLayer.GameStartLayerScene (mainWindow);
mainWindow.RunWithScene (scene);
}
示例14: ApplicationDidFinishLaunching
/// <summary>
/// Метод вызывается после загрузки приложения
/// </summary>
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) {
base.ApplicationDidFinishLaunching(application, mainWindow);
sharedWindow = mainWindow;
mainWindow.SetDesignResolutionSize(Settings.ScreenWidth, Settings.ScreenHeight,
CCSceneResolutionPolicy.ShowAll);
Resources.LoadContent(application);
mainWindow.DisplayStats = true;
mainWindow.AllowUserResizing = false;
_startScene = new MenuScene(mainWindow);
mainWindow.RunWithScene(_startScene);
}
示例15: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching (CCApplication application, CCWindow mainWindow)
{
application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
application.ContentSearchPaths.Add("hd");
CCSimpleAudioEngine.SharedEngine.PreloadEffect ("Sounds/tap");
CCSimpleAudioEngine.SharedEngine.PreloadBackgroundMusic ("Sounds/backgroundMusic");
CCSize winSize = mainWindow.WindowSizeInPixels;
CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ExactFit);
CCScene scene = GameStartLayer.GameStartLayerScene(mainWindow);
mainWindow.RunWithScene (scene);
}