Esempio n. 1
0
        override public void Activate()
        {
            if (state != States.Active)
            {
                // Do stack handling here.  If we do it in the update object we have no
                // clue which order things get pushed and popped and madness ensues.
                CommandStack.Push(commandMap);

                pendingState             = States.Active;
                BokuGame.objectListDirty = true;

                saveChangesActivated = false;

                HelpOverlay.ToolIcon = null;

                InGame.inGame.RenderWorldAsThumbnail = true;

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

                Foley.PlayMenuLoop();

                Time.Paused = true;

                AuthUI.ShowStatusDialog();
            }
        }
Esempio n. 2
0
            public override void Update()
            {
                if (AuthUI.IsModalActive)
                {
                    return;
                }

                if (parent.newWorldDialog.Active)
                {
                    parent.newWorldDialog.Update();
                    return;
                }

                // We need to do this ever frame instead of just at activation
                // time since deactivation of the previous scene and activation
                // of this scene don't always happen in that order.
                AuthUI.ShowStatusDialog();

                parent.saveLevelDialog.Update();
                shared.communityShareMenu.Update();

                parent.saveChangesMessage.Update();
                parent.saveChangesWithDiscardMessage.Update();
                parent.shareSuccessMessage.Update();
                parent.noCommunityMessage.Update();

                // If any of the dialogs are active, we don't want to look for input.
                if (parent.saveLevelDialog.Active ||
                    parent.saveChangesMessage.Active ||
                    parent.saveChangesWithDiscardMessage.Active ||
                    parent.shareSuccessMessage.Active ||
                    parent.noCommunityMessage.Active
                    )
                {
                    return;
                }

                // Ensure camera matches screen.
                shared.camera.Resolution = new Point((int)BokuGame.ScreenSize.X, (int)BokuGame.ScreenSize.Y);
                shared.camera.Update();

                // Update menu.
                shared.menu.Update(shared.camera, ref shared.worldMatrix);

                // Ensure the help overlay is up to date.
                HelpOverlay.RefreshTexture();
            }   // end of MiniHub UpdateObj Update()
Esempio n. 3
0
            public override void Activate()
            {
                // If we have a level to resume, check for the crashed cookie.  If we find the cookie
                // delete it and activate the dialog letting the user know they can recover the level.
                if (InGame.UnDoStack.HaveResume())
                {
                    if (Storage4.FileExists(MainMenu.CrashCookieFilename, StorageSource.UserSpace))
                    {
                        Storage4.Delete(MainMenu.CrashCookieFilename);

                        parent.prevSessionCrashedMessage.Activate();
                    }
                }

                // Force feed to refresh rendering.
                shared.liveFeed.Dirty = true;

                // Start showing the current, signed-in creator.
                AuthUI.ShowStatusDialog();
            }
Esempio n. 4
0
            public override void Update()
            {
                shared.timer.Update();

                // Keep Kodu animating even if a dialog is active.
                shared.boku.UpdateFace();
                shared.boku.UpdateAnimations();

                if (AuthUI.IsModalActive)
                {
                    return;
                }

                if (parent.newWorldDialog.Active)
                {
                    parent.newWorldDialog.Update();
                    return;
                }

                // If not modal, always show status.
                AuthUI.ShowStatusDialog();

                // Update the dialogs.
                parent.prevSessionCrashedMessage.Update();
                parent.noCommunityMessage.Update();
                parent.noSharingMessage.Update();

                // Don't do anything else until the user reads and dismisses the dialogs.
                if (parent.prevSessionCrashedMessage.Active ||
                    parent.exitingKodu)
                {
                    return;
                }

                // Update the options menu.  Do this first so that if it is active it can steal input.
                shared.optionsMenu.Update();

                // Main menu should always be active.
                shared.menu.Active = true;

                // If OptionsMenu is active, don't look at input.  This is a problem for touch input
                // which doesn't support any kind of "ClearAllWasPressedState" functionality.
                if (!shared.optionsMenu.Active)
                {
                    // Check for click on signOut tile or url.
                    if (MouseInput.Left.WasPressed || Actions.Select.WasPressed || TouchInput.WasTouched)
                    {
                        TouchContact touch = TouchInput.GetOldestTouch();
                        if (touch != null)
                        {
                            touch.position = ScreenWarp.ScreenToRT(touch.position);
                        }
                        Vector2 mouseHit = MouseInput.GetMouseInRtCoords();

                        // url is in rt coords.
                        if (shared.urlBox.Contains(mouseHit) ||
                            (null != touch && shared.urlBox.Contains(touch.position)))
                        {
#if NETFX_CORE
                            Launcher.LaunchUriAsync(new Uri(KoduGameLabUrl));
#else
                            Process.Start(KoduGameLabUrl);
#endif
                            MouseInput.Left.ClearAllWasPressedState();
                        }
                    }

                    // Enable resume option if we have something to resume to.
                    if (InGame.UnDoStack.HaveResume() && (shared.menu.Item(0) != Strings.Localize("mainMenu.resume")))
                    {
                        shared.menu.InsertText(Strings.Localize("mainMenu.resume"), 0);
                    }

                    shared.liveFeed.UpdateFeed();
                    shared.liveFeed.Update(shared.camera);

                    if (!UpdateNonMenuItems())
                    {
                        // JW - Only update the menu and process input if the interactive non-menu
                        // items didn't already handle the input.
                        int curIndex = shared.menu.CurIndex;
                        shared.menu.Update(shared.camera, ref shared.worldMatrix);
                        int newIndex = shared.menu.CurIndex;

                        // If the user made a menu change, have boku glance over.
                        if (curIndex != newIndex)
                        {
                            shared.boku.DirectGaze(new Vector3(0.2f, -0.4f, 0.08f - 0.05f * newIndex), 0.5f);
                        }
                    }
                }

                if (Actions.MiniHub.WasPressed && InGame.XmlWorldData != null)
                {
                    parent.Deactivate();
                    InGame.inGame.SwitchToMiniHub();
                    return;
                }

#if IMPORT_DEBUG
                if (!string.IsNullOrEmpty(StartupWorldFilename))
                {
                    LevelPackage.DebugPrint("MainMenu");
                    LevelPackage.DebugPrint("    StartupWorldFilename : " + StartupWorldFilename);
                }
#endif
                // Jump into the startup world, if it was specified.
                if (!String.IsNullOrEmpty(StartupWorldFilename))
                {
                    if (Storage4.FileExists(StartupWorldFilename, StorageSource.All))
                    {
#if IMPORT_DEBUG
                        LevelPackage.DebugPrint("    level exists, trying to load and run");
#endif
                        if (BokuGame.bokuGame.inGame.LoadLevelAndRun(StartupWorldFilename, keepPersistentScores: false, newWorld: false, andRun: true))
                        {
#if IMPORT_DEBUG
                            LevelPackage.DebugPrint("    success on load and run");
#endif
                            parent.Deactivate();
                        }
#if IMPORT_DEBUG
                        else
                        {
                            LevelPackage.DebugPrint("    fail to load and run");
                        }
#endif
                        shared.waitingForStorage = false;
                    }
#if IMPORT_DEBUG
                    else
                    {
                        LevelPackage.DebugPrint("    level not found");
                    }
#endif

                    StartupWorldFilename = null;
                }

                // Set news feed state to opposite of options menu.  This allows the
                // News Feed to "hide" when the Options Menu is active.
                if (shared.optionsMenu.Active)
                {
                    shared.liveFeed.Deactivate();
                }
                else
                {
                    shared.liveFeed.Activate();
                    shared.liveFeed.UpdateFeed();
                }
            }   // end of Update()