コード例 #1
0
        public override void DidFinishLaunching(NSNotification notification)
        {
            // Start the progress indicator animation.
            loadingProgressIndicator.StartAnimation(this);

            gameLogo.Image      = new NSImage(NSBundle.MainBundle.PathForResource("logo", "png"));
            archerButton.Image  = new NSImage(NSBundle.MainBundle.PathForResource("button_archer", "png"));
            warriorButton.Image = new NSImage(NSBundle.MainBundle.PathForResource("button_warrior", "png"));

            // The size for the primary scene - 1024x768 is good for OS X and iOS.
            var size = new CGSize(1024, 768);

            // Load the shared assets of the scene before we initialize and load it.
            scene = new AdventureScene(size);

            scene.LoadSceneAssetsWithCompletionHandler(() => {
                scene.Initialize();
                scene.ScaleMode = SKSceneScaleMode.AspectFill;

                SKView.PresentScene(scene);

                loadingProgressIndicator.StopAnimation(this);
                loadingProgressIndicator.Hidden = true;

                NSAnimationContext.CurrentContext.Duration    = 2.0f;
                ((NSButton)archerButton.Animator).AlphaValue  = 1.0f;
                ((NSButton)warriorButton.Animator).AlphaValue = 1.0f;

                scene.ConfigureGameControllers();
            });

            SKView.ShowsFPS       = true;
            SKView.ShowsDrawCount = true;
            SKView.ShowsNodeCount = true;
        }
コード例 #2
0
        void BuildScence()
        {
            loadingProgressIndicator.StartAnimating();

            CGSize size = View.Bounds.Size;

            // On iPhone/iPod touch we want to see a similar amount of the scene as on iPad.
            // So, we set the size of the scene to be double the size of the view, which is
            // the whole screen, 3.5- or 4- inch. This effectively scales the scene to 50%.
            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
            {
                size.Height *= 2;
                size.Width  *= 2;
            }

            scene = new AdventureScene(size);

            scene.LoadSceneAssetsWithCompletionHandler(() => {
                scene.Initialize();
                scene.ScaleMode = SKSceneScaleMode.AspectFill;
                scene.ConfigureGameControllers();

                loadingProgressIndicator.StopAnimating();
                loadingProgressIndicator.Hidden = true;

                SKView.PresentScene(scene);

                UIView.Animate(2, 0, UIViewAnimationOptions.CurveEaseInOut, () => {
                    archerButton.Alpha  = 1;
                    warriorButton.Alpha = 1;
                }, null);
            });

            SKView.ShowsFPS       = true;
            SKView.ShowsDrawCount = true;
            SKView.ShowsNodeCount = true;
        }