/// <summary> /// Ajoute l'élément sans le selectionner /// </summary> /// <param name="layer">La couche à ajouter</param> public virtual void Add(GameMapLayer layer) { LayerControl layerControl = new LayerControl(layer.Name, layer.Visible, layer.Type); this.Controls.Add(layerControl); this.ItemAdded?.Invoke(this, this.ControlsCount - 1, layer); this.ItemsCountChanged?.Invoke(this, this.ControlsCount); }
/// <summary> /// Insert l'élément à la position spécifiée /// </summary> /// <param name="index">L'index de la position d'insertion</param> /// <param name="layer">La couche à insérer</param> public virtual void InsertAt(int index, GameMapLayer layer) { if (index >= 0 && layer != null) { this.Controls.Add(new LayerControl(layer.Name, layer.Visible, layer.Type)); LayerControl layerControl = this.Controls[this.Controls.Count - 1] as LayerControl; this.Controls.SetChildIndex(layerControl, index); this.Refresh(); this.SelectedIndex = index; this.ItemAdded?.Invoke(this, index, layer); this.ItemsCountChanged?.Invoke(this, this.ControlsCount); } else { throw new IndexOutOfRangeException("Insertion de la couche impossible, l'index spécifié est en dehors des limites du tableau."); } }
private void buttonValidNewOverlay_Click(object sender, EventArgs e) { if (this.textBoxName.Text.Length > 0) { GameMapLayer layer = new GameMapLayer(this.textBoxName.Text) { Visible = this.checkBoxLayerState.Checked, Type = this.checkBoxLayerType.Checked ? LayerType.Upper : LayerType.Lower }; this.MapLayerAdded?.Invoke(this, layer); this.Close(); } else { ConsolePanel.Instance.WriteLine("Impossible de créer une couche avec un nom vide", RowType.Error); } }
/// <summary> /// Insert l'élément à la position spécifiée /// </summary> /// <param name="index">L'index de la position d'insertion</param> /// <param name="layer">La couche à insérer</param> public virtual void InsertAt(int index, GameMapLayer layer) { if (index >= 0 && layer != null) { this.Controls.Add(new LayerControl(layer.Name, layer.Visible, layer.Type)); LayerControl layerControl = this.Controls[this.Controls.Count - 1] as LayerControl; this.Controls.SetChildIndex(layerControl, index); this.Refresh(); this.SelectedIndex = index; this.ItemAdded?.Invoke(this, index, layer); this.ItemsCountChanged?.Invoke(this, this.ControlsCount); } else throw new IndexOutOfRangeException("Insertion de la couche impossible, l'index spécifié est en dehors des limites du tableau."); }
/// <summary> /// /// </summary> public GameScene() { AddChild(MapLayer = new GameMapLayer()); Schedule(Update); }