private static void CheckIfAnyMaterialIsCorrupt(Control newControl) { if (newControl.Get<Material>().Shader == null) newControl.Set(new Theme().Button); if (newControl.GetType() == typeof(Button) || newControl.GetType() == typeof(InteractiveButton)) ChangeCorruptedButtonMaterial(newControl); if (newControl.GetType() == typeof(Slider)) ChangeCorruptedSliderMaterial(newControl); if (newControl.GetType() == typeof(Label)) if (newControl.Get<Theme>().Label.Shader == null) newControl.Get<Theme>().Label = new Theme().Label; }
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) { 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); }
private bool SetEntity2D(Control control) { Rectangle drawArea; if (control.GetType() == typeof(Button)) { drawArea = new Rectangle(control.DrawArea.TopLeft, (control).Size); IsInteractiveButton = false; } else if (control.GetType() == typeof(InteractiveButton)) { drawArea = Rectangle.FromCenter(control.Center, ((InteractiveButton)control).BaseSize); if (IsInteractiveButton == false) IsInteractiveButton = true; } else drawArea = control.DrawArea; ControlListIndex = Scene.Controls.IndexOf(control); if (ControlListIndex < 0) return true; //ncrunch: no coverage SelectedControlNameInList = control.GetTags()[0]; SelectedEntity2D = control; SetMaterials(); Messenger.Default.Send(SelectedControlNameInList, "SetSelectedName"); Messenger.Default.Send(ControlListIndex, "SetSelectedIndex"); uiEditorScene.ControlProcessor.UpdateOutLines(SelectedEntity2D); SetWidthAndHeight(drawArea); ControlLayer = control.RenderLayer; return false; }
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); }
public void ChangeUIControlWidthAndHeight(Control control, UIControl uiControl) { Rectangle drawArea; if (control.GetType() == typeof(Button)) { drawArea = new Rectangle(control.DrawArea.TopLeft, (control).Size); uiControl.IsInteractiveButton = false; } else if (control.GetType() == typeof(InteractiveButton)) { drawArea = Rectangle.FromCenter(control.Center, control.Size); if (uiControl.IsInteractiveButton == false) uiControl.IsInteractiveButton = true; } else drawArea = control.DrawArea; uiControl.SetWidthAndHeight(drawArea); }