Example #1
0
        void GameComponents_ComponentAdded(object sender, GameComponentCollectionEventArgs e)
        {
            IDebugInfo debugInfoComp = e.GameComponent as IDebugInfo;

            if (debugInfoComp == null)
            {
                return;
            }
            AddComponants(debugInfoComp);
        }
Example #2
0
        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;
                }
            }
        }
Example #3
0
 public ExecutorFactory(IStandardOut standardOut, IDebugInfo debugInfo)
 {
     _standardOut = standardOut;
     _debugInfo = debugInfo;
 }
Example #4
0
 public void RemoveComponants(IDebugInfo comp)
 {
     _components.Remove(comp);
 }
Example #5
0
 public void AddComponants(IDebugInfo comp)
 {
     _components.Add(comp);
 }
Example #6
0
 private void Setup()
 {
     systemO = new EmptySystem();
     systemA = new SystemA();
     systemB = new SystemB();
     systemBC = new SystemBC();
     world = CreateWorld(systemO, systemA, systemB, systemBC);
     info = world.DebugInfo;
 }
Example #7
0
        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));
        }
Example #8
0
 public ArrayExecutor( IDebugInfo debug )
 {
 }
Example #9
0
 public IfExecutor( IDebugInfo debug )
 {
     _debug = debug;
 }
Example #10
0
 public AssignExecutor( IDebugInfo debug )
 {
     _debug = debug;
 }
Example #11
0
 public VariableExecutor( IDebugInfo debug )
 {
     _debug = debug;
 }
Example #12
0
 public PrintExecutor( IStandardOut output, IDebugInfo debug )
 {
     _output = output;
     _debug = debug;
 }