当前位置: 首页>>代码示例>>C#>>正文


C# CCScene.AddLayer方法代码示例

本文整理汇总了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);
			}
		}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:31,代码来源:GamePage.cs

示例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);
 }
开发者ID:AndyDentFree,项目名称:xfcs-play,代码行数:13,代码来源:Drawing.xaml.cs

示例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);
            }
        }
开发者ID:jacobmcrandall,项目名称:POOPCrawler,代码行数:18,代码来源:MainActivity.cs

示例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);
            }
		}
开发者ID:CodeSensei,项目名称:mobile-samples,代码行数:21,代码来源:MainActivity.cs

示例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);
 }
开发者ID:jacobmcrandall,项目名称:POOPCrawler,代码行数:7,代码来源:GameLayer.cs

示例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";
                });
            }
        }
开发者ID:AGRocks,项目名称:chezzles,代码行数:20,代码来源:GamePage.cs


注:本文中的CocosSharp.CCScene.AddLayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。