本文整理汇总了C#中CocosSharp.CCScene.AddLayer方法的典型用法代码示例。如果您正苦于以下问题:C# CCScene.AddLayer方法的具体用法?C# CCScene.AddLayer怎么用?C# CCScene.AddLayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CocosSharp.CCScene
的用法示例。
在下文中一共展示了CCScene.AddLayer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: LoadGame
void LoadGame(object sender, EventArgs e)
{
var nativeGameView = sender as CCGameView;
if (nativeGameView == null)
return;
var contentSearchPaths = new List<string> () { "Fonts", "Sounds", "Images" };
// TODO look at Ian Parson's Gone Bananas sample and make images path vary depending on resolution
CCSprite.DefaultTexelToContentSizeRatio = 2.0f; // TODO make this vary according to resolution
nativeGameView.ContentManager.SearchPaths = contentSearchPaths;
CCScene gameScene = new CCScene(nativeGameView);
gameScene.AddLayer(GameModel.MakeLayer());
nativeGameView.RunWithScene(gameScene);
}
示例3: LoadGame
void LoadGame(object sender, EventArgs e)
{
CCGameView gameView = sender as CCGameView;
if (gameView != null)
{
gameView.ContentManager.SearchPaths = new List<string>()
{"Images", "Fonts","Sounds", "Tiles"};
//gameView.ContentManager.RootDirectory = "Content";
//CCScene.SetDefaultDesignResolution(380, 240, CCSceneResolutionPolicy.ShowAll);
//gameView.ResolutionPolicy = CCViewResolutionPolicy.ExactFit;
CCScene gameScene = new CCScene(gameView);
gameScene.AddLayer(new GameStartLayer());
gameView.RunWithScene(gameScene);
}
}
示例4: LoadGame
void LoadGame (object sender, EventArgs e)
{
CCGameView gameView = sender as CCGameView;
if (gameView != null)
{
var contentSearchPaths = new List<string>() { "Fonts", "Sounds", "Images" };
int width = 512;
int height = 384;
// Set world dimensions
gameView.DesignResolution = new CCSizeI(width, height);
gameView.ContentManager.SearchPaths = contentSearchPaths;
CCScene gameScene = new CCScene(gameView);
gameScene.AddLayer(new GameLayer());
gameView.RunWithScene(gameScene);
}
}
示例5: getNewMap
//Carry user over to next level
private static void getNewMap(CCGameView gameView, character user, int level)
{
CCScene gamePlayScene = new CCScene(gameView);
gamePlayScene.AddLayer(new GameLayer(user, level));
gameView.Director.ReplaceScene(gamePlayScene);
}
示例6: LoadGame
private void LoadGame(object sender, EventArgs e)
{
var gameView = sender as CCGameView;
if (gameView != null)
{
gameView.DesignResolution = new CCSizeI(600, 600);
gameView.ContentManager.SearchPaths =
new List<string>() { "", "hd", "animations", "fonts", "sounds", "images" };
CCScene gameScene = new CCScene(gameView);
this.game = new GameLayer(new CCSize(600, 600));
gameScene.AddLayer(game);
gameView.RunWithScene(gameScene);
Device.BeginInvokeOnMainThread(() =>
{
this.moveLabel.Text = $"Press \"Next\" to start";
});
}
}