public UserControl_GraphicsInstanceDefinition(GraphicsInstanceDefinition_Ex graphicsInstanceDefinition_ex) : base("Graphics Instance Type Definition", false) { m_graphicsInstanceDefinition = graphicsInstanceDefinition_ex.GraphicsInstanceDefinition; GraphicsInstanceDefinitionType = graphicsInstanceDefinition_ex.TypeOfInstance; if (DataIsNull()) { m_textBlock_id.Text = "N/A"; m_textBox_name.Text = string.Empty; m_integerUpDown_zOrder.Value = null; m_integerUpDown_renderPass.Value = null; } else { m_textBlock_id.Text = m_graphicsInstanceDefinition.Id.ToString(); m_textBox_name.Text = m_graphicsInstanceDefinition.Name; m_integerUpDown_zOrder.Value = m_graphicsInstanceDefinition.ZOrder; m_integerUpDown_renderPass.Value = m_graphicsInstanceDefinition.RenderPass; if (DataManager.AnimationStateDefinitions.Any(x => x.GraphicsInstanceDefinition == m_graphicsInstanceDefinition)) m_radioButton_animation.IsChecked = true; else if (DataManager.FontTextureDefinitions.Any(x => x.GraphicsInstanceDefinition == m_graphicsInstanceDefinition)) m_radioButton_font.IsChecked = true; } }
public UserControl_GraphicsInstanceDefinition() : base("Graphics Instance Type Definition", false) { m_graphicsInstanceDefinition = null; GraphicsInstanceDefinitionType = GraphicsInstanceDefinition_Ex.GraphicsInstanceDefinitionType.Undetermined; if (DataIsNull()) { m_textBlock_id.Text = "N/A"; m_textBox_name.Text = string.Empty; m_integerUpDown_zOrder.Value = null; m_integerUpDown_renderPass.Value = null; } else { m_textBlock_id.Text = m_graphicsInstanceDefinition.Id.ToString(); m_textBox_name.Text = m_graphicsInstanceDefinition.Name; m_integerUpDown_zOrder.Value = m_graphicsInstanceDefinition.ZOrder; m_integerUpDown_renderPass.Value = m_graphicsInstanceDefinition.RenderPass; } }
private void SelectGraphicsInstanceDefinition(GraphicsInstanceDefinition graphicsInstanceDefinition) { RemoveUserControls(); if(DataManager.AnimationStateDefinitions.Any(x => x.GraphicsInstanceDefinition == graphicsInstanceDefinition)) { m_selectedGraphicsInstanceDefinition = new GraphicsInstanceDefinition_WithAnimationStateDefinitions(graphicsInstanceDefinition); AddAnimationStateControls(); } else if (DataManager.FontTextureDefinitions.Any(x => x.GraphicsInstanceDefinition == graphicsInstanceDefinition)) { m_selectedGraphicsInstanceDefinition = new GraphicsInstanceDefinition_WithFontTextureDefinitions(graphicsInstanceDefinition); AddFontControls(); } else { // we might be trying to load GraphicsInstanceDefinitions before we've loaded the AnimationStateDefinitions or FontTextureDefinitions; // just be patient return; } m_userControl_graphicsInstanceDefinition = new UserControl_GraphicsInstanceDefinition(m_selectedGraphicsInstanceDefinition); m_grid_main.SetRowColumn(m_userControl_graphicsInstanceDefinition, 1, 0); }
public GraphicsInstanceDefinition_WithFontTextureDefinitions(GraphicsInstanceDefinition graphicsDefinition) : base(graphicsDefinition, GraphicsInstanceDefinitionType.Animation) { Refresh(); DataManager.FontTextureDefinitions.CollectionChanged += FontTextureDefinitions_CollectionChanged; }
public GraphicsInstanceDefinition_Ex(GraphicsInstanceDefinition graphicsInstanceDefinition, GraphicsInstanceDefinitionType typeOfInstance) { m_graphicsInstanceDefinition = graphicsInstanceDefinition; m_typeOfInstance = typeOfInstance; }
protected override int AddNewData() { m_graphicsInstanceDefinition = DataManager.Generate<GraphicsInstanceDefinition>(); m_graphicsInstanceDefinition.Name = m_textBox_name.Text; m_graphicsInstanceDefinition.EntityInstanceDefinition = m_comboBox_entityInstanceDefinition.SelectedItem as EntityInstanceDefinition; m_graphicsInstanceDefinition.ZOrder = m_integerUpDown_zOrder.Value.Value; m_graphicsInstanceDefinition.RenderPass = m_integerUpDown_renderPass.Value.Value; // we need to add the AnimationStateDefinition or FontTextureDefinition first, or we won't // be able to select the appropriate GraphicsInstanceDefinition in the ComboBox if (m_radioButton_animation.IsChecked.HasValue && m_radioButton_animation.IsChecked.Value) { var animationStateDefinition = DataManager.Generate<AnimationStateDefinition>(); animationStateDefinition.GraphicsInstanceDefinition = m_graphicsInstanceDefinition; animationStateDefinition.Name = string.Format("{0} State 0", m_graphicsInstanceDefinition.Name); DataManager.AnimationStateDefinitions.Add(animationStateDefinition); var animationFrameDefinition = DataManager.Generate<AnimationFrameDefinition>(); animationFrameDefinition.AnimationStateDefinition = animationStateDefinition; animationFrameDefinition.Name = string.Format("{0} Frame 0", animationStateDefinition.Name); DataManager.AnimationFrameDefinitions.Add(animationFrameDefinition); } else if (m_radioButton_font.IsChecked.HasValue && m_radioButton_font.IsChecked.Value) { var fontTextureDefinition = DataManager.Generate<FontTextureDefinition>(); fontTextureDefinition.GraphicsInstanceDefinition = m_graphicsInstanceDefinition; DataManager.FontTextureDefinitions.Add(fontTextureDefinition); } DataManager.GraphicsInstanceDefinitions.Add(m_graphicsInstanceDefinition); return m_graphicsInstanceDefinition.Id; }