public AddEntries ( |
||
option | ||
return | void |
/// <summary> /// Erzeugt eine neue Instanz eines ProfileSettingsScreen-Objekts und initialisiert dieses mit einem Knot3Game-Objekt. /// </summary> public GeneralSettingsScreen(GameCore game) : base(game) { MenuName = "General"; InputItem playerNameInput = new InputItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Player Name:", inputText: Config.Default ["profile", "name", "Player"] ); playerNameInput.OnValueSubmitted += () => { Config.Default ["profile", "name", String.Empty] = playerNameInput.InputText; }; settingsMenu.Add (playerNameInput); // Languages LanguageOption languageOption = new LanguageOption ( section: "language", name: "current", configFile: Config.Default ); ComboBox languageItem = new ComboBox ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Language" ); languageItem.AddEntries (languageOption); settingsMenu.Add (languageItem); }
/// <summary> /// Erzeugt eine neue Instanz eines CreativeModeScreen-Objekts und initialisiert diese mit einem Knot3Game-Objekt game, sowie einem Knoten knot. /// </summary> public JunctionEditorScreen(GameCore game) : base(game) { // die Spielwelt world = new World (screen: this, drawOrder: DisplayLayer.GameWorld, bounds: Bounds.FromLeft (0.60f)); // der Input-Handler knotInput = new KnotInputHandler (screen: this, world: world); // der Mauszeiger pointer = new MousePointer (screen: this); // der Maus-Handler für die 3D-Modelle modelMouseHandler = new ModelMouseHandler (screen: this, world: world); // der Knoten-Renderer knotRenderer = new JunctionEditorRenderer (screen: this, position: Vector3.Zero); world.Add (knotRenderer); // visualisiert die BoundingSpheres debugBoundings = new DebugBoundings (screen: this, position: Vector3.Zero); world.Add (debugBoundings); // Hintergrund SkyCube skyCube = new SkyCube (screen: this, position: Vector3.Zero, distance: 10000); world.Add (skyCube); // Backbutton backButton = new MenuEntry ( screen: this, drawOrder: DisplayLayer.Overlay + DisplayLayer.MenuItem, name: "Back", onClick: (time) => NextScreen = new StartScreen (Game) ); backButton.AddKey (Keys.Escape); backButton.IsVisible = true; // Menü settingsMenu = new Menu (this, DisplayLayer.Overlay + DisplayLayer.Menu); settingsMenu.Bounds = Bounds.FromRight (0.40f).FromBottom (0.9f).FromLeft (0.8f); settingsMenu.Bounds.Padding = new ScreenPoint (this, 0.010f, 0.010f); settingsMenu.RelativeItemHeight = 0.030f; float[] validJunctionCounts = new float[] { 1, 2, 3 }; optionJunctionCount = new FloatOption ( section: "debug", name: "debug_junction_count", defaultValue: validJunctionCounts.At (-1), validValues: validJunctionCounts, configFile: Config.Default ); itemJunctionCount = new ComboBox ( screen: this, drawOrder: DisplayLayer.Overlay + DisplayLayer.MenuItem, text: "Junctions #" ); itemJunctionCount.AddEntries (optionJunctionCount); itemJunctionCount.ValueChanged += OnJunctionCountChanged; Direction[] validDirections = Direction.Values; optionJuctionDirection = new DistinctOption [3]; itemJunctionDirection = new ComboBox [3]; for (int i = 0; i < 3; ++i) { DistinctOption option = new DistinctOption ( section: "debug", name: "debug_junction_direction" + i.ToString (), defaultValue: validDirections [i * 2], validValues: validDirections.Select (d => d.Name), configFile: Config.Default ); ComboBox item = new ComboBox ( screen: this, drawOrder: DisplayLayer.Overlay + DisplayLayer.MenuItem, text: Localizer.Localize ("Direction ") + i.ToString () ); item.AddEntries (option); optionJuctionDirection [i] = option; item.ValueChanged += OnDirectionsChanged; itemJunctionDirection [i] = item; } itemBumpRotation = new ComboBox [3]; for (int i = 0; i < 3; ++i) { ComboBox item = new ComboBox ( screen: this, drawOrder: DisplayLayer.Overlay + DisplayLayer.MenuItem, text: Localizer.Localize ("Bump Angle ") + i.ToString () ); item.ValueChanged += OnAnglesChanged; itemBumpRotation [i] = item; } itemModels = new ComboBox [3]; for (int i = 0; i < 3; ++i) { ComboBox item = new ComboBox ( screen: this, drawOrder: DisplayLayer.Overlay + DisplayLayer.MenuItem, text: Localizer.Localize ("Model ") + i.ToString () ); item.ValueChanged += OnModelsChanged; itemModels [i] = item; } OnDirectionsChanged (null); OnJunctionCountChanged (null); world.Camera.PositionToTargetDistance = 180; }
/// <summary> /// Erzeugt eine neue Instanz eines CreativeModeScreen-Objekts und initialisiert diese mit einem Knot3Game-Objekt game, sowie einem Knoten knot. /// </summary> public VisualTestsScreen(GameCore game) : base(game) { // die Spielwelt world = new World (screen: this, drawOrder: DisplayLayer.GameWorld, bounds: Bounds.FromLeft (0.60f)); // der Knoten-Renderer knotRenderer = new KnotRenderer (screen: this, position: Vector3.Zero); world.Add (knotRenderer); // Hintergrund //SkyCube skyCube = new SkyCube (screen: this, position: Vector3.Zero, distance: world.Camera.MaxPositionDistance + 500); //world.Add (skyCube); // Menü settingsMenu = new Menu (this, DisplayLayer.Overlay + DisplayLayer.Menu); settingsMenu.Bounds = Bounds.FromRight (0.40f).FromBottom (0.9f).FromLeft (0.8f); settingsMenu.Bounds.Padding = new ScreenPoint (this, 0.010f, 0.010f); settingsMenu.RelativeItemHeight = 0.030f; float[] validEdgeCounts = new float[] { 500, 1000, 2000, 3000, 4000, 5000, 7500, 10000, 15000 }; optionEdgeCount = new FloatOption ( section: "visualtests", name: "edgecount", defaultValue: validEdgeCounts.At (0), validValues: validEdgeCounts, configFile: Config.Default ) { Verbose = false }; optionEdgeCount.Value = validEdgeCounts.At (0); itemEdgeCount = new ComboBox ( screen: this, drawOrder: DisplayLayer.Overlay + DisplayLayer.MenuItem, text: "Edges:" ); itemEdgeCount.AddEntries (optionEdgeCount); itemEdgeCount.ValueChanged += OnEdgeCountChanged; itemDisplayTime = new InputItem ( screen: this, drawOrder: DisplayLayer.Overlay + DisplayLayer.MenuItem, text: "Time:", inputText: "" ); itemFPS = new InputItem ( screen: this, drawOrder: DisplayLayer.Overlay + DisplayLayer.MenuItem, text: "FPS:", inputText: "" ); OnEdgeCountChanged (null); }
/// <summary> /// Erzeugt ein neues GraphicsSettingsScreen-Objekt und initialisiert dieses mit einem Knot3Game-Objekt. /// </summary> public GraphicsSettingsScreen(GameCore game) : base(game) { MenuName = "Graphics"; CheckBoxItem itemShowArrows = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Show Arrows", option: new BooleanOption ("video", "arrows", false, Config.Default) ); settingsMenu.Add (itemShowArrows); // blinking stars BooleanOption optionBlinkingStars = new BooleanOption ("video", "stars-blinking", true, Config.Default); CheckBoxItem itemBlinkingStars = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Blinking Stars", option: optionBlinkingStars ); itemBlinkingStars.OnValueChanged += () => { (game as Knot3Game).NotAvailableOnXNA (); }; settingsMenu.Add (itemBlinkingStars); // star count float[] validStarCounts = { 100, 250, 500, 750, 1000, 1250, 1500, 2000, 2500, 3000, 5000 }; FloatOption optionStarCount = new FloatOption ( section: "video", name: "stars-count", defaultValue: validStarCounts [4], validValues: validStarCounts, configFile: Config.Default ); ComboBox itemStarCount = new ComboBox ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Number of stars" ) { NameWidth = 0.75f, ValueWidth = 0.25f }; itemStarCount.AddEntries (optionStarCount); settingsMenu.Add (itemStarCount); // show sun BooleanOption optionShowSun = new BooleanOption ("video", "show-sun", false, Config.Default); CheckBoxItem itemShowSun = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Show Sun", option: optionShowSun ); settingsMenu.Add (itemShowSun); // day cycle float[] validDayCycles = { 10, 20, 30, 60, 120, 300, 600, 900, 1200, 3600, 7200 }; FloatOption optionDayCycle = new FloatOption ( section: "video", name: "day-cycle-seconds", defaultValue: validDayCycles [3], validValues: validDayCycles, configFile: Config.Default ); ComboBox itemDayCycle = new ComboBox ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Day cycle in seconds" ) { NameWidth = 0.75f, ValueWidth = 0.25f }; itemDayCycle.AddEntries (optionDayCycle); settingsMenu.Add (itemDayCycle); // selective rendering CheckBoxItem itemSelectiveRender = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Selective Rendering", option: new BooleanOption ("video", "selectiveRendering", false, Config.Default) ); settingsMenu.Add (itemSelectiveRender); // auto camera when moving CheckBoxItem itemAutoCameraMove = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Auto Camera (edge move)", option: new BooleanOption ("video", "auto-camera-move", true, Config.Default) ); settingsMenu.Add (itemAutoCameraMove); // auto camera CheckBoxItem itemAutoCamera = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Auto Camera", option: new BooleanOption ("video", "auto-camera-nomove", false, Config.Default) ); settingsMenu.Add (itemAutoCamera); // Resolutions string currentResolution = GraphicsManager.GraphicsDevice.DisplayMode.Width.ToString () + "x" + GraphicsManager.GraphicsDevice.DisplayMode.Height.ToString (); DisplayModeCollection modes = GraphicsAdapter.DefaultAdapter.SupportedDisplayModes; HashSet<string> reso = new HashSet<string> (); foreach (DisplayMode mode in modes) { reso.Add (mode.Width + "x" + mode.Height); } reso.Add ("1024x600"); string[] validResolutions = reso.ToArray (); validResolutions = validResolutions.OrderBy (x => Decimal.Parse (x.Split ('x') [0], System.Globalization.NumberStyles.Any)).ToArray (); DistinctOption optionResolution = new DistinctOption ( section: "video", name: "resolution", defaultValue: currentResolution, validValues: validResolutions, configFile: Config.Default ); ComboBox itemResolution = new ComboBox ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Resolution" ) { NameWidth = 0.75f, ValueWidth = 0.25f }; itemResolution.AddEntries (optionResolution); settingsMenu.Add (itemResolution); // Supersampling float[] validSupersamples = { 1f, 1.25f, 1.5f, 1.75f, 2f }; FloatOption optionSupersamples = new FloatOption ( section: "video", name: "Supersamples", defaultValue: 2f, validValues: validSupersamples, configFile: Config.Default ); ComboBox itemSupersamples = new ComboBox ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Supersamples" ) { NameWidth = 0.75f, ValueWidth = 0.25f }; itemSupersamples.AddEntries (optionSupersamples); settingsMenu.Add (itemSupersamples); // fullscreen BooleanOption optionFullscreen = new BooleanOption ("video", "fullscreen", false, Config.Default); CheckBoxItem itemFullscreen = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Fullscreen", option: optionFullscreen ); itemFullscreen.OnValueChanged += () => Game.IsFullScreen = optionFullscreen.Value; settingsMenu.Add (itemFullscreen); // Model quality SliderItem sliderModelQuality = new SliderItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Model Quality", max: 1000, min: 0, value: 0 ); sliderModelQuality.Value = (int)(Primitive.ModelQualityOption.Value * 1000f); sliderModelQuality.OnValueChanged = (time) => { float quality = (float)sliderModelQuality.Value / 1000f; Primitive.ModelQualityOption.Value = quality; Primitive.OnModelQualityChanged (time); }; settingsMenu.Add (sliderModelQuality); // Rendereffects RenderEffectOption optionRenderEffect = new RenderEffectOption ( section: "video", name: "current-world-effect", configFile: Config.Default ); ComboBox itemRenderEffect = new ComboBox ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Render Effect" ); itemRenderEffect.ValueChanged += (time) => { RenderEffectLibrary.RenderEffectChanged (Config.Default ["video", "current-world-effect", "default"], time); }; itemRenderEffect.AddEntries (optionRenderEffect); settingsMenu.Add (itemRenderEffect); // Projector Mode BooleanOption optionProjectorMode = new BooleanOption ("debug", "projector-mode", false, Config.Default); CheckBoxItem itemProjectorMode = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Video projector mode", option: optionProjectorMode ); itemProjectorMode.OnValueChanged += () => { if (optionProjectorMode.Value) { new ProjectorDesign ().Apply (); Config.Default ["video", "camera-overlay", false] = false; Config.Default ["video", "profiler-overlay", false] = false; Config.Default ["video", "current-world-effect", "default"] = "default"; Config.Default ["video", "Supersamples", 2f] = 2f; Config.Default ["video", "arrows", false] = false; Config.Default ["language", "current", "en"] = "de"; Config.Default ["video", "day-cycle-seconds", 60] = 10; } else { new HfGDesign ().Apply (); } NextScreen = new StartScreen (game); }; settingsMenu.Add (itemProjectorMode); }
/// <summary> /// Erzeugt ein neues DebugSettingsScreen-Objekt und initialisiert dieses mit einem Knot3Game-Objekt. /// </summary> public DebugSettingsScreen(GameCore game) : base(game) { MenuName = "Debug"; CheckBoxItem showOverlay = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Show Overlay", option: new BooleanOption ("video", "camera-overlay", false, Config.Default) ); settingsMenu.Add (showOverlay); CheckBoxItem showFps = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Show FPS", option: new BooleanOption ("video", "fps-overlay", false, Config.Default) ); settingsMenu.Add (showFps); CheckBoxItem showProfiler = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Show Profiler", option: new BooleanOption ("video", "profiler-overlay", false, Config.Default) ); settingsMenu.Add (showProfiler); CheckBoxItem showBoundings = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Show Bounding Boxes", option: new BooleanOption ("debug", "show-boundings", false, Config.Default) ); settingsMenu.Add (showBoundings); CheckBoxItem showStartEdgeArrow = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Show Start Edge Direction", option: new BooleanOption ("debug", "show-startedge-direction", false, Config.Default) ); settingsMenu.Add (showStartEdgeArrow); string[] unprojectMethods = { "SelectedObject", "NearFarAverage" }; DistinctOption unprojectOption = new DistinctOption ("debug", "unproject", unprojectMethods [0], unprojectMethods, Config.Default); ComboBox unprojectItem = new ComboBox ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Unproject" ); unprojectItem.AddEntries (unprojectOption); settingsMenu.Add (unprojectItem); /* CheckBoxItem shaderPascal = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Use Pascal's Shader", option: new BooleanOptionInfo ("video", "pascal-shader", false, Options.Default) );te settingsMenu.Add (shaderPascal); CheckBoxItem shaderCel = new CheckBoxItem ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Use Cel Shader", option: new BooleanOptionInfo ("video", "cel-shading", false, Options.Default) ); settingsMenu.Add (shaderCel); */ }