public void AddControlToScene(Control control) { Control newControl = null; if (control.GetType() == typeof(Picture)) newControl = new Picture(control.Get<Theme>(), control.Get<Material>(), control.DrawArea); else if (control.GetType() == typeof(Label)) { newControl = new Label(control.Get<Theme>(), control.DrawArea, (control as Label).Text); newControl.Set(control.Get<BlendMode>()); newControl.Set(control.Get<Material>()); } else if (control.GetType() == typeof(Button)) newControl = new Button(control.Get<Theme>(), control.DrawArea, (control as Button).Text); else if (control.GetType() == typeof(InteractiveButton)) newControl = new InteractiveButton(control.Get<Theme>(), control.DrawArea, (control as Button).Text); else if (control.GetType() == typeof(Slider)) newControl = new Slider(control.Get<Theme>(), control.DrawArea); newControl.RenderLayer = control.RenderLayer; if (!newControl.Contains<AnchoringState>()) newControl.Add(new AnchoringState()); //ncrunch: no coverage CheckIfAnyMaterialIsCorrupt(newControl); Scene.Add(newControl); }
public void AddControlToScene(Control control, UIEditorScene scene) { Control newControl = null; if (control.GetType() == typeof(Picture)) newControl = new Picture(control.Get<Theme>(), control.Get<Material>(), control.DrawArea); else if (control.GetType() == typeof(Label)) { newControl = new Label(control.Get<Theme>(), control.DrawArea, (control as Label).Text); newControl.Set(control.Get<Material>()); } else if (control.GetType() == typeof(Button)) newControl = new Button(control.Get<Theme>(), control.DrawArea, (control as Button).Text); else if (control.GetType() == typeof(Slider)) newControl = new Slider(control.Get<Theme>(), control.DrawArea); newControl.AddTag(control.GetTags()[0]); newControl.RenderLayer = control.RenderLayer; scene.Scene.Add(newControl); }
public void AddControlToScene(Control control, Scene scene) { Control newControl = null; if (control.GetType() == typeof(Picture)) newControl = new Picture((control as Picture).Theme, control.Material, control.DrawArea); else if (control.GetType() == typeof(Label)) { newControl = new Label((control as Picture).Theme, control.DrawArea, (control as Label).Text); newControl.Set(control.Get<BlendMode>()); newControl.Set(control.Material); } else if (control.GetType() == typeof(Button)) newControl = new Button((control as Picture).Theme, control.DrawArea, (control as Button).Text); else if (control.GetType() == typeof(InteractiveButton)) newControl = new InteractiveButton((control as Picture).Theme, control.DrawArea, (control as Button).Text); else if (control.GetType() == typeof(Slider)) newControl = new Slider((control as Picture).Theme, control.DrawArea); newControl.Name = control.Name; if (newControl.Name == null && newControl.GetTags()[0] != null) newControl.Name = newControl.GetTags()[0]; newControl.RenderLayer = control.RenderLayer; if (!control.Contains<AnchoringState>()) newControl.Set(new AnchoringState()); //ncrunch: no coverage else newControl.Set(control.Get<AnchoringState>()); scene.Add(newControl); }
private static Label AddNewLabelToList(Vector2D position, UIEditorScene uiEditorScene) { var newLabel = new Label(new Theme(), Rectangle.FromCenter(position, new Size(0.2f, 0.1f)), "DefaultLabel"); uiEditorScene.Scene.Add(newLabel); SetDefaultNameOfLable(newLabel, uiEditorScene); newLabel.Set(BlendMode.Normal); return newLabel; }