Exemplo n.º 1
0
        // c'tor
        public OptionsMenu()
        {
            InitGrid();

            helpSquare          = new UIGridModularHelpSquare();
            helpSquare.Size     = 0.95f;
            helpSquare.Position = new Vector2(3.5f, 0.0f);

            // Since we're rendering to a 1280*720 rendertarget.
            camera.Resolution = new Point(1280, 720);

            // changeLanguageMessage -- tell the user they need to restart Kodu if they change the language.
            {
                ModularMessageDialog.ButtonHandler handlerA = delegate(ModularMessageDialog dialog)
                {
                    // User chose "No, continue"
                    // User has decided not to restart at this time so clear this.
                    prevLanguage = XmlOptionsData.Language;

                    // Deactivate dialog.
                    dialog.Deactivate();
                };
                ModularMessageDialog.ButtonHandler handlerB = delegate(ModularMessageDialog dialog)
                {
                    // User chose "Yes, quit Kodu"

                    // Deactivate dialog.
                    dialog.Deactivate();

#if NETFX_CORE
                    Windows.UI.Xaml.Application.Current.Exit();
#else
                    BokuGame.bokuGame.Exit();
#endif
                };
                changeLanguageMessage = new ModularMessageDialog(
                    Strings.Localize("optionsParams.changeLanguageMessage"),
                    handlerA, Strings.Localize("optionsParams.noContinue"),
                    handlerB, Strings.Localize("optionsParams.yesQuitKodu"),
                    null, null,
                    null, null
                    );
            }
        }   // end of c'tor
Exemplo n.º 2
0
        public ShareHub()
        {
            ShareHub.Instance = this;

            shared = new Shared(this);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(this, shared);

            openingSharingRoomMessage = new ModularMessageDialog(
                Strings.Localize("shareHub.messageOpeningSharingRoom"),
                null, null,
                null, null,
                null, null,
                null, null);

            openingInviteGuideMessage = new ModularMessageDialog(
                Strings.Localize("shareHub.messageOpeningInviteGuide"),
                null, null,
                null, null,
                null, null,
                null, null);
        }   // end of MainMenu c'tor
Exemplo n.º 3
0
        // c'tor
        public MiniHub()
        {
            MiniHub.Instance = this;

            shared = new Shared(this);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(this, shared);

            saveLevelDialog.OnButtonPressed += OnSaveLevelDialogButton;

            //
            // Set up SaveChangesDialogs
            //
            {
                ModularMessageDialog.ButtonHandler handlerA = delegate(ModularMessageDialog dialog)
                {
                    // User chose "save"

                    // Deactivate dialog.
                    dialog.Deactivate();

                    // Activate saveLevelDialog.
                    saveLevelDialog.Activate();
                };
                ModularMessageDialog.ButtonHandler handlerB = delegate(ModularMessageDialog dialog)
                {
                    // User chose "back"

                    // Deactivate dialog.
                    dialog.Deactivate();

                    // Clear the flag since the user backed out.  This way if they
                    // try again the save changes message will be displayed again.
                    saveChangesActivated = false;

                    // Reactivate the mini-hub grid.
                    shared.menu.Active = true;
                };
                ModularMessageDialog.ButtonHandler handlerX = delegate(ModularMessageDialog dialog)
                {
                    // User chose "discard"

                    // Deactivate self and go wherever we were going...
                    dialog.Deactivate();

                    // Deactivate mini-hub.
                    //Deactivate();

                    // We gave the user the opportunity to save changes and he chose
                    // not to so call OnSelect() once more to get them on their way.
                    if (saveChangesActivated)
                    {
                        OnSelect(shared.menu);
                        saveChangesActivated = false;
                    }
                };
                saveChangesMessage = new ModularMessageDialog(
                    Strings.Localize("textDialog.saveChangesPrompt"),
                    handlerA, Strings.Localize("textDialog.save"),
                    handlerB, Strings.Localize("textDialog.back"),
                    null, null,
                    null, null
                    );
                saveChangesWithDiscardMessage = new ModularMessageDialog(
                    Strings.Localize("textDialog.saveChangesPrompt"),
                    handlerA, Strings.Localize("textDialog.save"),
                    handlerB, Strings.Localize("textDialog.back"),
                    handlerX, Strings.Localize("textDialog.discard"),
                    null, null
                    );
            }

            //
            // Set up ShareSuccessDialog
            //
            {
                ModularMessageDialog.ButtonHandler handlerB = delegate(ModularMessageDialog dialog)
                {
                    // User chose "back"

                    // Deactivate dialog.
                    dialog.Deactivate();

                    // Make sure grid is still active.
                    shared.menu.Active = true;
                };
                shareSuccessMessage = new ModularMessageDialog(
                    Strings.Localize("miniHub.shareSuccessMessage"),
                    null, null,
                    handlerB, Strings.Localize("textDialog.back"),
                    null, null,
                    null, null
                    );
            }

            //
            // Set up NoCommunityDialog
            //
            {
                ModularMessageDialog.ButtonHandler handlerB = delegate(ModularMessageDialog dialog)
                {
                    // User chose "back"

                    // Deactivate dialog.
                    dialog.Deactivate();

                    // Make sure grid is still active.
                    shared.menu.Active = true;
                };
                noCommunityMessage = new ModularMessageDialog(
                    Strings.Localize("miniHub.noCommunityMessage"),
                    null, null,
                    handlerB, Strings.Localize("textDialog.back"),
                    null, null,
                    null, null
                    );
            }

            //
            //  Set up NewWorld dialog.
            //
            NewWorldDialog.OnAction OnSelectWorld = delegate(string level)
            {
                // Deactivate main menu and go into editor with empty level.
                string levelFilename = Path.Combine(BokuGame.Settings.MediaPath, BokuGame.BuiltInWorldsPath, level + ".Xml");
                if (BokuGame.bokuGame.inGame.LoadLevelAndRun(levelFilename, keepPersistentScores: false, newWorld: true, andRun: false))
                {
                    Deactivate();
                    InGame.inGame.Activate();
                    InGame.inGame.CurrentUpdateMode = InGame.UpdateMode.ToolMenu;
                }
                else
                {
                    shared.menu.Active = true;
                }
            };
            NewWorldDialog.OnAction OnCancel = delegate(string level)
            {
                shared.menu.Active = true;
            };
            newWorldDialog = new NewWorldDialog(OnSelectWorld, OnCancel);
        }   // end of MiniHub c'tor
Exemplo n.º 4
0
        }   // end of Update()

        public void DeactivateMenu(ModularMessageDialog dialog)
        {
            //close the dialog
            dialog.Deactivate();
            Deactivate();
        }
Exemplo n.º 5
0
        // c'tor
        public MainMenu()
        {
            MainMenu.Instance = this;

            shared = new Shared(this);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(this, shared);

            NewWorldDialog.OnAction OnSelectWorld = delegate(string level)
            {
                // Deactivate main menu and go into editor with empty level.
                string levelFilename = Path.Combine(BokuGame.Settings.MediaPath, BokuGame.BuiltInWorldsPath, level + ".Xml");
                if (BokuGame.bokuGame.inGame.LoadLevelAndRun(levelFilename, keepPersistentScores: false, newWorld: true, andRun: false))
                {
                    Deactivate();
                    InGame.inGame.Activate();
                    InGame.inGame.CurrentUpdateMode = InGame.UpdateMode.ToolMenu;
                }
                else
                {
                    shared.menu.Active = true;
                }
            };
            NewWorldDialog.OnAction OnCancel = delegate(string level)
            {
                shared.menu.Active = true;
            };
            newWorldDialog = new NewWorldDialog(OnSelectWorld, OnCancel);

            // Set up the NoCommunity, NoSharing and PrevCrash dialogs.
            ModularMessageDialog.ButtonHandler handlerA = delegate(ModularMessageDialog dialog)
            {
                // User chose "resume"

                // Deactivate dialog.
                dialog.Deactivate();

                if (InGame.CurrentWorldId == Guid.Empty)
                {
                    if (InGame.UnDoStack.Resume())
                    {
                        // Deactivate MainMenu.
                        Deactivate();
                    }
                    else
                    {
                        //Debug.Assert(false, "Resume should not be enabled unless there is something to resume from");

                        // We had some error in trying to resume.  So, remove the resume
                        // option from the menu and soldier on.
                        shared.menu.DeleteText(Strings.Localize("mainMenu.resume"));
                        shared.menu.Active          = true;
                        XmlOptionsData.LastAutoSave = -1;
                    }
                }
                else
                {
                    // Deactivate MainMenu.
                    Deactivate();

                    // Just reactivate the existing game.
                    BokuGame.bokuGame.inGame.Activate();
                }
            };

            ModularMessageDialog.ButtonHandler handlerB = delegate(ModularMessageDialog dialog)
            {
                // User chose "back"

                // Deactivate dialog.
                dialog.Deactivate();

                // Only needed for corruptStorageMessage but shouldn't hurt for all.
            };

            ModularMessageDialog.ButtonHandler handlerX = delegate(ModularMessageDialog dialog)
            {
                // User chose to quit Kodu

                // Deactivate dialog.
                dialog.Deactivate();

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

                exitingKodu = true;
            };

            noCommunityMessage = new ModularMessageDialog(Strings.Localize("miniHub.noCommunityMessage"),
                                                          null, null,
                                                          handlerB, Strings.Localize("textDialog.back"),
                                                          null, null,
                                                          null, null
                                                          );
            noSharingMessage = new ModularMessageDialog(Strings.Localize("miniHub.noSharingMessage"),
                                                        null, null,
                                                        handlerB, Strings.Localize("textDialog.back"),
                                                        null, null,
                                                        null, null
                                                        );
            prevSessionCrashedMessage = new ModularMessageDialog(Strings.Localize("mainMenu.prevSessionCrashedMessage"),
                                                                 handlerA, Strings.Localize("textDialog.resume"),
                                                                 handlerB, Strings.Localize("textDialog.back"),
                                                                 null, null,
                                                                 null, null
                                                                 );
        }   // end of MainMenu c'tor