public void BuildMenu() { menu.DeleteAll(); menu.AddText(Strings.Localize("miniHub.reset")); menu.AddText(Strings.Localize("miniHub.edit")); menu.AddText(Strings.Localize("miniHub.save")); menu.AddText(Strings.Localize("miniHub.publish")); menu.AddText(Strings.Localize("miniHub.load")); menu.AddText(Strings.Localize("miniHub.emptyLevel")); #if NETFX_CORE // Disable printing since WinRT doesn't support just sending a text file to the printer. #else menu.AddText(Strings.Localize("miniHub.print")); #endif menu.AddText(Strings.Localize("miniHub.quit")); } // end of BuildMenu()
// c'tor public Shared(MainMenu parent) { // Set up the options menu. optionsMenu = new OptionsMenu(); liveFeed = new LiveFeedDisplay(); if (BokuGame.bMarsMode) { boku = ActorManager.GetActor("RoverGreeter").CreateNewInstance() as BokuGreeter; } else { boku = ActorManager.GetActor("BokuGreeter").CreateNewInstance() as BokuGreeter; } boku.SetColor(Classification.Colors.White); bokuCamera.NearClip = 0.1f; bokuCamera.FarClip = 20.0f; // These are the values for the model when its translation off the ground has been thrown away (and added back via constant) bokuCamera.From = 1.3f * new Vector3(1.5f, 0.3f, 0.5f); bokuCamera.At = new Vector3(0.0f, -0.5f, 0.0f); // These are the values for a "correct" model - that is raised off the ground in Max and whose translation is intact // bokuCamera.From = new Vector3(1.5f, 0.3f, 1.4f); // bokuCamera.At = new Vector3(0.0f, -0.5f, 0.7f); // Move camera to look at menu from an angle. //camera.From = 0.9f * camera.From; camera.At = new Vector3(-0.6f, 0, 0); Matrix foo = Matrix.CreateRotationY(-0.3f) * Matrix.CreateTranslation(new Vector3(1.0f, 0.0f, -2.0f)); camera.At = Vector3.Transform(camera.At, foo); camera.From = Vector3.Transform(camera.From, foo); // We'll be using a 1280x720 rendertarget for all rendering. camera.Resolution = new Point(1280, 720); bokuCamera.Resolution = new Point(1280, 720); timer = new Boku.Base.GameTimer(Boku.Base.GameTimer.ClockType.WallClock, 3.1415927); timer.TimerElapsed += ChangeExpression; // Create text elements. // Start with a blob of common parameters. UIGridElement.ParamBlob blob = new UIGridElement.ParamBlob(); blob.width = 3.4f; blob.height = 0.5f; blob.edgeSize = 0.06f; blob.Font = UI2D.Shared.GetGameFont24Bold; blob.textColor = Color.White; blob.dropShadowColor = Color.Black; blob.useDropShadow = true; blob.invertDropShadow = true; 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.Left; menu = new ModularMenu(blob, null /*Strings.Localize("mainMenu.mainMenu")*/); menu.OnSelect = parent.OnSelect; menu.OnCancel = parent.OnCancel; menu.UseRtCoords = true; menu.AddText(Strings.Localize("mainMenu.new")); menu.AddText(Strings.Localize("mainMenu.play")); #if NETFX_CORE menu.AddText(Strings.Localize("mainMenu.import")); #else if (WinStoreHelpers.RunningAsUWP) { menu.AddText(Strings.Localize("mainMenu.import")); } #endif menu.AddText(Strings.Localize("mainMenu.community")); menu.AddText(Strings.Localize("mainMenu.options")); menu.AddText(Strings.Localize("mainMenu.help")); #if !NETFX_CORE // Once you run an app in Win8, you are never allowed to kill it. // Only the system can kill it. menu.AddText(Strings.Localize("mainMenu.exit")); #endif // And then remove what we don't want. if (!Program2.SiteOptions.CommunityEnabled) { menu.DeleteText(Strings.Localize("mainMenu.community")); } menu.WorldMatrix = Matrix.CreateScale(0.9f, 1.0f, 1.0f); string signOutStr = Strings.Localize("textDialog.signOut"); signOutButton = new Button(signOutStr, Color.White, null, UI2D.Shared.GetGameFont20); //Because this button has no texture and we can't set the width of the texture passed in explicitly. Just use the fixed size based on text size. UI2D.Shared.GetFont Font = UI2D.Shared.GetGameFont20; Vector2 size = (null != Font) ? Font().MeasureString(signOutStr) : new Vector2(60.0f, 20.0f); signOutButton.FixedSize = size; signOutButton.UseFixedSize = true; textBlob = new TextBlob(UI2D.Shared.GetGameFont24, "", 340); } // end of Shared c'tor