void GameComponents_ComponentAdded(object sender, GameComponentCollectionEventArgs e) { IDebugInfo debugInfoComp = e.GameComponent as IDebugInfo; if (debugInfoComp == null) { return; } AddComponants(debugInfoComp); }
private void InitGameComponents() { OptionControl oc; float y = 20f; LabelControl Titles; Titles = ToDispose(new LabelControl()); Titles.FontStyle = System.Drawing.FontStyle.Bold; Titles.Bounds = new UniRectangle(10.0f, 5.0f, 110.0f, 18.0f); Titles.Text = "Debugs Options"; Children.Add(Titles); oc = ToDispose(new OptionControl()); oc.Bounds = new UniRectangle(10f, y, 40.0f, 16.0f); oc.Text = "VSync Mode"; oc.Changed += (sender, e) => _game.VSync = !_game.VSync; oc.Selected = _game.VSync; Children.Add(oc); y = y + Step; oc = ToDispose(new OptionControl()); oc.Bounds = new UniRectangle(10f, y, 40.0f, 16.0f); oc.Text = "FPS computation"; oc.Changed += (sender, e) => { _fps.Updatable = !_fps.Updatable; _fps.Visible = !_fps.Visible; }; oc.Selected = _fps.Updatable; Children.Add(oc); y = y + Step; oc = ToDispose(new OptionControl()); oc.Bounds = new UniRectangle(10f, y, 40.0f, 16.0f); oc.Text = "Show Debug Information"; oc.Changed += (sender, e) => { _displayinfo.Updatable = !_displayinfo.Updatable; _displayinfo.Visible = !_displayinfo.Visible; }; oc.Selected = _displayinfo.Updatable; Children.Add(oc); y = y + Step; y = 20; Titles = ToDispose(new LabelControl()); Titles.FontStyle = System.Drawing.FontStyle.Bold; Titles.Bounds = new UniRectangle(180.0f, 5.0f, 110.0f, 18.0f); Titles.Text = "Show components Debug info"; Children.Add(Titles); //For each IDebugInfo Components registered foreach (var comp in _displayinfo.Components) { GameComponent gc = comp as GameComponent; if (gc != null) { oc = ToDispose(new OptionControl()); oc.Bounds = new UniRectangle(180.0f, y, 40.0f, 16.0f); oc.Text = gc.GetType().Name; oc.Tag = comp; oc.Changed += (sender, e) => { IDebugInfo gameComp = ((OptionControl)sender).Tag as IDebugInfo; gameComp.ShowDebugInfo = !gameComp.ShowDebugInfo; }; oc.Selected = comp.ShowDebugInfo; Children.Add(oc); y = y + Step; } } }
public ExecutorFactory(IStandardOut standardOut, IDebugInfo debugInfo) { _standardOut = standardOut; _debugInfo = debugInfo; }
public void RemoveComponants(IDebugInfo comp) { _components.Remove(comp); }
public void AddComponants(IDebugInfo comp) { _components.Add(comp); }
private void Setup() { systemO = new EmptySystem(); systemA = new SystemA(); systemB = new SystemB(); systemBC = new SystemBC(); world = CreateWorld(systemO, systemA, systemB, systemBC); info = world.DebugInfo; }
public void TestSystemAddedAfterEntity() { world = CreateWorld(); info = world.DebugInfo; AddComponents(world.CreateEntity(), new ComponentA()); AddComponents(world.CreateEntity(), new ComponentB()); AddComponents(world.CreateEntity(), new ComponentB(), new ComponentC()); systemO = new EmptySystem(); systemA = new SystemA(); systemB = new SystemB(); systemBC = new SystemBC(); world.AddSystem(systemO); world.AddSystem(systemA); world.AddSystem(systemB); world.AddSystem(systemBC); AddComponents(world.CreateEntity(), new ComponentA()); Assert.AreEqual(4, info.EntityCount(systemO)); Assert.AreEqual(2, info.EntityCount(systemA)); Assert.AreEqual(2, info.EntityCount(systemB)); Assert.AreEqual(1, info.EntityCount(systemBC)); }
public ArrayExecutor( IDebugInfo debug ) { }
public IfExecutor( IDebugInfo debug ) { _debug = debug; }
public AssignExecutor( IDebugInfo debug ) { _debug = debug; }
public VariableExecutor( IDebugInfo debug ) { _debug = debug; }
public PrintExecutor( IStandardOut output, IDebugInfo debug ) { _output = output; _debug = debug; }