public void Setup() { scene = new Scene(); for (int i = 0; i < 5; ++i) scene.Add(new Button(new Rectangle())); for (int i = 0; i < 5; ++i) scene.Add(new Slider(new Rectangle())); generator = new SceneCodeGenerator(new MockService("", "TestProject"), scene, "TestScene"); generator.GenerateSourceCodeClass(); }
public TreeManager(Team playerTeam) { gameScene = new Scene(); MainMenu.PlayerTeam = playerTeam; if (MainMenu.State != GameState.CountDown) MainMenu.State = GameState.Game; statusText = new FontText(MainMenu.Font, "", Rectangle.FromCenter(new Vector2D(0.5f, 0.25f), new Size(0.2f))); statusText.RenderLayer = 5; statusText.Color = Team.HumanYellow.ToColor(); var logo = new Sprite(new Material(Shader.Position2DUV, "Logo"), new Rectangle(0.02f, 0.205f, 0.15f, 0.15f)); logo.RenderLayer = -15; gameScene.Add(logo); CreateArrowSelectionAndBars(); OnClickSelectTree(); }
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 OverwriteCreatedClass() { var sceneSpy = new Scene(); var spyGenerator = new SceneCodeGeneratorSpy(new MockService("", "TestProject"), sceneSpy, "TestScene"); spyGenerator.GenerateSourceCodeClass(); var firstClassString = spyGenerator.CreatedSourceClass; Assert.IsTrue(spyGenerator.CreatedSourceClass); sceneSpy.Add(new Button(new Rectangle())); spyGenerator.GenerateSourceCodeClass(); Assert.AreNotEqual(firstClassString, spyGenerator.CreatedClassString); }
public void GenerateSourceCodeShouldApplyToCodingStyle() { var newScene = new Scene(); newScene.Add(new Button(new Rectangle())); newScene.Add(new Slider(new Rectangle())); generator = new SceneCodeGenerator(new MockService("", "TestProject"), newScene, "" + "FullTestScene"); generator.GenerateSourceCodeClass(); CheckIfGeneratedCodeIsValid(); }