public UserControl_LevelEditor(Level level) : base("Level Layout", false) { m_level = level; if (DataIsNull()) { throw new ArgumentNullException("level"); } else { Binding binding_canvas_width = new Binding("Width") { Source = m_level, Mode = BindingMode.OneWay }; m_canvas.BackgroundCanvas.SetBinding(Canvas.WidthProperty, binding_canvas_width); Binding binding_canvas_height = new Binding("Height") { Source = m_level, Mode = BindingMode.OneWay }; m_canvas.BackgroundCanvas.SetBinding(Canvas.HeightProperty, binding_canvas_height); ResetLevelLayoutList(); foreach (var l in m_levelLayouts) CreateLevelLayoutControl(l); AddPlayerLevelLayoutControl(); } }
protected override int AddNewData() { m_level = DataManager.Generate<Level>(); m_level.Name = m_textBox_name.Text; m_level.Order = m_integerUpDown_order.Value; m_level.Width = m_doubleUpDown_width.Value.Value; m_level.Height = m_doubleUpDown_height.Value.Value; DataManager.Levels.Add(m_level); return m_level.Id; }
private void Select(Level level) { RemoveUserControl(); m_userControl_level = new UserControl_Level(level); m_expander_level = new Expander() { Header = level.Name, Content = m_userControl_level, ExpandDirection = System.Windows.Controls.ExpandDirection.Down, IsExpanded = !level.HasLayout() }; m_grid_main.SetRowColumn(m_expander_level, 1, 0); if (level != null) { m_userControl_levelLayout = new UserControl_LevelEditor(level); m_grid_main.SetRowColumn(m_userControl_levelLayout, 2, 0); } }
public UserControl_Level(Level level) : base("Level", false) { m_level = level; if (DataIsNull()) { m_textBlock_id.Text = "N/A"; m_textBox_name.Text = string.Empty; m_integerUpDown_order.Value = null; m_doubleUpDown_width.Value = null; m_doubleUpDown_height.Value = null; } else { m_textBlock_id.Text = m_level.Id.ToString(); m_textBox_name.Text = m_level.Name; m_integerUpDown_order.Value = m_level.Order; m_doubleUpDown_width.Value = m_level.Width; m_doubleUpDown_height.Value = m_level.Height; } }