示例#1
0
        private async Task GameOverAsync()
        {
            await Task.Delay(TimeSpan.FromSeconds(1.5));

            var scene = new GameStartScene(this.GameView);

            this.GameView.Director.ReplaceScene(scene);
            Game.Instance.IsPlaying = false;
        }
        void HandleViewCreated(object sender, EventArgs e)
        {
            var gameView = sender as CCGameView;

            if (gameView != null)
            {
                // This sets the game "world" resolution to 100x100:
                var device = DependencyService.Get <IUIDevice>();

                PageHeight = device.ScreenHeight * 200 / device.ScreenWidth;
                gameView.DesignResolution = new CCSizeI(200, PageHeight);
                gameView.ResolutionPolicy = CCViewResolutionPolicy.ShowAll;
                gameView.DepthTesting     = true;

                // GameScene is the root of the CocosSharp rendering hierarchy:
                gameScene = new GameStartScene(gameView);
                // Starts CocosSharp:
                gameView.RunWithScene(gameScene);
            }
        }