/// <summary> /// Erzeugt ein neues ConfirmDialog-Objekt und initialisiert dieses mit dem zugehörigen IGameScreen-Objekt. /// Zudem ist die Angabe der Zeichenreihenfolge Pflicht. /// </summary> public ComboBox(IScreen screen, DisplayLayer drawOrder, string text) : base(screen, drawOrder, String.Empty) { dropdown = new Menu(screen: screen, drawOrder: Index + DisplayLayer.Menu); dropdown.Bounds.Position = ValueBounds.Position; dropdown.Bounds.Size = new ScreenPoint(Screen, () => ValueBounds.Size.OnlyX + ValueBounds.Size.OnlyY * 10); dropdown.ItemForegroundColor = Design.ComboBoxItemForegroundColorFunc; // (s) => Container.ItemForegroundColor (s); dropdown.ItemBackgroundColor = Design.ComboBoxItemBackgroundColorFunc; // (s) => Design.WidgetBackground; dropdown.BackgroundColorFunc = (s) => Design.WidgetBackground; dropdown.ItemAlignX = HorizontalAlignment.Left; dropdown.ItemAlignY = VerticalAlignment.Center; dropdown.IsVisible = false; dropdownBorder = new Border( screen: screen, drawOrder: Index + DisplayLayer.Menu, widget: dropdown, lineWidth: 2, padding: 2 ); currentValue = new InputItem(screen: screen, drawOrder: Index, text: text, inputText: String.Empty); currentValue.Bounds = Bounds; currentValue.ForegroundColorFunc = (s) => ForegroundColor; currentValue.BackgroundColorFunc = (s) => Color.Transparent; currentValue.IsVisible = IsVisible; currentValue.IsMouseClickEventEnabled = false; ValidKeys.Add(Keys.Escape); }
/// <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> /// Erstelle einen neuen TextInputDialog. /// </summary> public TextInputDialog(IScreen screen, DisplayLayer drawOrder, string title, string text, string inputText) : base(screen, drawOrder, title) { textItem = new TextItem (screen, drawOrder, String.Empty); Cancel = (time) => { Close (time); }; Submit = (time) => { Close (time); }; Bounds.Size = new ScreenPoint (screen, 0.5f, 0.3f); // Der Titel-Text ist mittig ausgerichtet AlignX = HorizontalAlignment.Center; menu = new Menu (Screen, Index + DisplayLayer.Menu); menu.Bounds = ContentBounds; menu.Bounds.Padding = new ScreenPoint (screen, 0.010f, 0.019f); menu.ItemAlignX = HorizontalAlignment.Left; menu.ItemAlignY = VerticalAlignment.Center; //die Texteingabe textInput = new InputItem (Screen, Index + DisplayLayer.MenuItem, text, inputText); menu.Add (textInput); menu.Add (textItem); textInput.IsEnabled = true; textInput.IsInputEnabled = true; textInput.NameWidth = 0.35f; textInput.ValueWidth = 0.65f; ValidKeys.AddRange (new Keys[] { Keys.Enter, Keys.Escape }); }
/// <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 eine neue Instanz eines ChallengeCreateScreen-Objekts und initialisiert diese mit einem Knot3Game-Objekt game. /// </summary> public ChallengeCreateScreen(GameCore game) : base(game) { startKnotMenu = new Menu (this, DisplayLayer.ScreenUI + DisplayLayer.Menu); startKnotMenu.Bounds = ScreenContentBounds.FromLeft (0.47f).FromTop (0.98f); startKnotMenu.ItemBackgroundColor = Design.ComboBoxItemBackgroundColorFunc; startKnotMenu.ItemForegroundColor = Design.ComboBoxItemForegroundColorFunc; startKnotMenu.RelativeItemHeight = Design.DataItemHeight; targetKnotMenu = new Menu (this, DisplayLayer.ScreenUI + DisplayLayer.Menu); targetKnotMenu.Bounds = ScreenContentBounds.FromRight (0.47f).FromTop (0.98f); targetKnotMenu.ItemBackgroundColor = Design.ComboBoxItemBackgroundColorFunc; targetKnotMenu.ItemForegroundColor = Design.ComboBoxItemForegroundColorFunc; targetKnotMenu.RelativeItemHeight = Design.DataItemHeight; challengeName = new InputItem (this, DisplayLayer.ScreenUI + DisplayLayer.MenuItem, "Name:", String.Empty); challengeName.Bounds.Position = ScreenContentBounds.Position + ScreenContentBounds.Size.OnlyY + new ScreenPoint (this, 0f, 0.050f); challengeName.Bounds.Size = new ScreenPoint (this, 0.375f, 0.040f); challengeName.OnValueChanged += () => TryConstructChallenge (); challengeName.NameWidth = 0.2f; challengeName.ValueWidth = 0.8f; createButton = new Button ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, name: "Create!", onClick: OnCreateChallenge ); createButton.Bounds.Position = ScreenContentBounds.Position + ScreenContentBounds.FromLeft (0.50f).Size + new ScreenPoint (this, 0f, 0.050f); createButton.Bounds.Size = new ScreenPoint (this, 0.125f, 0.050f); createButtonBorder = new Border (this, DisplayLayer.ScreenUI + DisplayLayer.MenuItem, createButton, 4, 4); createButton.AlignX = HorizontalAlignment.Center; startKnotMenu.Bounds.Padding = targetKnotMenu.Bounds.Padding = new ScreenPoint (this, 0.010f, 0.010f); startKnotMenu.ItemAlignX = targetKnotMenu.ItemAlignX = HorizontalAlignment.Left; startKnotMenu.ItemAlignY = targetKnotMenu.ItemAlignY = VerticalAlignment.Center; lines.AddPoints (.000f, .050f, .030f, .970f, .760f, .895f, .880f, .970f, .970f, .050f, 1.000f); title = new TextItem (screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, text: "Create Challenge"); title.Bounds.Position = ScreenTitleBounds.Position; title.Bounds.Size = ScreenTitleBounds.Size; title.ForegroundColorFunc = (s) => Color.White; // Erstelle einen Parser für das Dateiformat KnotFileIO fileFormat = new KnotFileIO (); // Erstelle einen Spielstand-Loader loader = new SavegameLoader<Knot, KnotMetaData> (fileFormat, "index-knots"); backButton = new Button ( screen: this, drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem, name: "Back", onClick: (time) => NextScreen = Game.Screens.Where ((s) => !(s is ChallengeCreateScreen)).ElementAt (0) ); backButton.AddKey (Keys.Escape); backButton.SetCoordinates (left: 0.770f, top: 0.910f, right: 0.870f, bottom: 0.960f); backButton.AlignX = HorizontalAlignment.Center; }
/// <summary> /// Erzeugt ein neues ConfirmDialog-Objekt und initialisiert dieses mit dem zugehörigen IGameScreen-Objekt. /// Zudem ist die Angabe der Zeichenreihenfolge Pflicht. /// </summary> public ComboBox(IScreen screen, DisplayLayer drawOrder, string text) : base(screen, drawOrder, String.Empty) { dropdown = new Menu (screen: screen, drawOrder: Index + DisplayLayer.Menu); dropdown.Bounds.Position = ValueBounds.Position; dropdown.Bounds.Size = new ScreenPoint (Screen, () => ValueBounds.Size.OnlyX + ValueBounds.Size.OnlyY * 10); dropdown.ItemForegroundColor = Design.ComboBoxItemForegroundColorFunc; // (s) => Container.ItemForegroundColor (s); dropdown.ItemBackgroundColor = Design.ComboBoxItemBackgroundColorFunc; // (s) => Design.WidgetBackground; dropdown.BackgroundColorFunc = (s) => Design.WidgetBackground; dropdown.ItemAlignX = HorizontalAlignment.Left; dropdown.ItemAlignY = VerticalAlignment.Center; dropdown.IsVisible = false; dropdownBorder = new Border ( screen: screen, drawOrder: Index + DisplayLayer.Menu, widget: dropdown, lineWidth: 2, padding: 2 ); currentValue = new InputItem (screen: screen, drawOrder: Index, text: text, inputText: String.Empty); currentValue.Bounds = Bounds; currentValue.ForegroundColorFunc = (s) => ForegroundColor; currentValue.BackgroundColorFunc = (s) => Color.Transparent; currentValue.IsVisible = IsVisible; currentValue.IsMouseClickEventEnabled = false; ValidKeys.Add (Keys.Escape); }