コード例 #1
0
            public override void Activate()
            {
                if (!active)
                {
                    active = true;

                    CommandStack.Push(commandMap);
                    HelpOverlay.Push("RunSimulation");

                    // Wake everything up.
                    parent.ActivateAllGameThings();

                    // This is commented out since it was removing Creatables from the level
                    // when it shouldn't.  In particular if you restart Kodu, find a level in
                    // the LoadLevelMenu, and choose Edit, it would remove all the creatables.
                    // Running and then editing would restore them so it's not peristing the
                    // removal.
                    // Normally I'd just delete the line but if this change starts causing issues
                    // it might help to know this was here.  If it's now 2019 or later you can
                    // probably feel free to remove this.  :-)
                    //parent.RemoveCreatablesFromScene();

                    timerInstrument = Instrumentation.StartTimer(Instrumentation.TimerId.InGameRunSim);

#if !NETFX_CORE
                    // Refresh the list of attached microbits.
                    {
                        System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(MicrobitManager.RefreshWorker));
                        t.Start();
                    }
#endif

                    // Be sure all Auth UI is hidden.
                    AuthUI.HideAllDialogs();

                    base.Activate();
                }

                if (Program2.CmdLine.Exists("analytics"))
                {
#if !NETFX_CORE
                    Console.WriteLine("Begin Analytics");
#endif
                    ObjectAnalysis oa = new ObjectAnalysis();
                    oa.beginAnalysis(MainMenu.StartupWorldFilename.ToString());


                    //  GamePadInput.stopActiveInputTimer();

                    //deactivate the menu on exit to stop the timer
                    Deactivate();

                    // Wave bye, bye.
#if NETFX_CORE
                    Windows.UI.Xaml.Application.Current.Exit();
#else
                    BokuGame.bokuGame.Exit();
#endif
                }
            }   // end of RunSimUpdateObj Activate()