Example #1
0
            // c'tor
            public Shared(MiniHub parent)
            {
                // Create text elements.
                // Start with a blob of common parameters.
                UIGridElement.ParamBlob blob = new UIGridElement.ParamBlob();
                blob.width            = 5.0f;
                blob.height           = 0.75f;
                blob.edgeSize         = 0.06f;
                blob.Font             = UI2D.Shared.GetGameFont30Bold;
                blob.textColor        = Color.White;
                blob.dropShadowColor  = Color.Black;
                blob.useDropShadow    = true;
                blob.invertDropShadow = false;
                blob.unselectedColor  = new Color(new Vector3(4, 100, 90) / 255.0f);
                blob.selectedColor    = new Color(new Vector3(5, 180, 160) / 255.0f);
                blob.normalMapName    = @"Slant0Smoothed5NormalMap";
                blob.justify          = UIGrid2DTextElement.Justification.Center;

                menu             = new ModularMenu(blob, Strings.Localize("miniHub.minihub"));
                menu.OnChange    = parent.OnChange;
                menu.OnCancel    = parent.OnCancel;
                menu.OnSelect    = parent.OnSelect;
                menu.WorldMatrix = Matrix.CreateScale(1.4f);
                //menu.AcceptStartForCancel = true;
                menu.UseRtCoords = false;
                menu.HelpOverlay = "MiniHub";

                BuildMenu();
            }
Example #2
0
 public RenderObj(MiniHub parent, Shared shared)
 {
     this.shared = shared;
     this.parent = parent;
 }
Example #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
Example #4
0
 public UpdateObj(MiniHub parent, Shared shared)
 {
     this.parent = parent;
     this.shared = shared;
 }