Ejemplo n.º 1
0
        public void System_Should_Be_Available_After_Added_To_Game_Manager()
        {
            var system = new LabelSystem(_channelManager, 10);

            _gameManager.AddSystem(system);
            Assert.True(_gameManager.Systems.GetBySystemType(system.GetType()) != null);
        }
Ejemplo n.º 2
0
        public LabelSystem GetLabelSystemByProjectNumberFromReader(IDataReader reader)
        {
            EntityConverter <LabelSystem> labelSystemEntity = new EntityConverter <LabelSystem>();
            LabelSystem labelSystem = labelSystemEntity.Convert(reader);

            return(labelSystem);
        }
Ejemplo n.º 3
0
        public void Should_Be_Active_On_Start()
        {
            var system = new LabelSystem(_channelManager, 10, new[] { "default" });

            Assert.False(system.IsActive);
            system.Start();
            Assert.True(system.IsActive);
        }
Ejemplo n.º 4
0
        public void System_Should_Not_Be_Available_After_Removed_From_Game_Manager()
        {
            var system = new LabelSystem(_channelManager, 10);

            _gameManager.AddSystem(system);
            Assert.True(_gameManager.Systems.GetBySystemType(system.GetType()) != null);
            _gameManager.RemoveSystem <LabelSystem>(false);
            Assert.True(_gameManager.Systems.GetBySystemType(typeof(LabelSystem)) == null);
        }
Ejemplo n.º 5
0
        public void SystemAdded_Should_Notify_After_System_Is_Added()
        {
            var notified = false;
            var system   = new LabelSystem(_channelManager, 10);

            _gameManager.SystemAdded += (s, e) => notified = true;
            _gameManager.AddSystem(system);
            Assert.True(notified);
        }
Ejemplo n.º 6
0
        public void AddSystem_Should_Increase_Count_Of_Systems()
        {
            const int expected = 1;
            var       system   = new LabelSystem(_channelManager, 10);

            Assert.Equal(0, _gameManager.Systems.Count());
            _gameManager.AddSystem(system);
            Assert.Equal(expected, _gameManager.Systems.Count());
        }
Ejemplo n.º 7
0
        public void SystemRemoved_Should_Notify_Only_If_Flag_Is_Set(bool shouldNotify)
        {
            var notified = false;
            var system   = new LabelSystem(_channelManager, 10);

            _gameManager.AddSystem(system);
            _gameManager.SystemRemoved += (s, e) => notified = true;
            _gameManager.RemoveSystem <LabelSystem>(shouldNotify);
            Assert.Equal(shouldNotify, notified);
        }
Ejemplo n.º 8
0
        public void RemoveSystem_Should_Reduce_Count_Of_Systems()
        {
            var system = new LabelSystem(_channelManager, 10);

            Assert.Equal(0, _gameManager.Systems.Count());
            _gameManager.AddSystem(system);
            Assert.Equal(1, _gameManager.Systems.Count());
            _gameManager.RemoveSystem <LabelSystem>(false);
            Assert.Equal(0, _gameManager.Systems.Count());
        }
Ejemplo n.º 9
0
        public void Should_Notify_AddedToGameManager_When_Added_To_GameManager()
        {
            var        raised   = false;
            const bool expected = true;
            var        em       = new EntityManager(_channelManager, new EntityPool());
            var        tgm      = new TestGameManager(new DefaultEntityAspectManager(_channelManager, em), em, _systemManager);
            var        system   = new LabelSystem(_channelManager, 10, new[] { "default" });

            system.AddedToGameManager += (s, e) => raised = true;
            system.AddToGameManager(tgm);
            Assert.Equal(expected, raised);
        }
Ejemplo n.º 10
0
        protected override IEnumerator ProcessPayload(VisualPayload payload)
        {
            Debug.LogWarning("[BOUND DEBUG] IsoGrid rendering to bound.", payload.VisualData.Bound);

            IsoGrid = VisualizerFactory.InstantiateIsoGrid();

            IsoGrid.Initialize(this, payload);
            //payload.VisualData.Bound.ChildVisualizer(this, IsoGrid);

            IsoGrid.DrawBackgrounds = ShowBackgrounds.GetLastKeyValue(payload.Data);

            IsoGrid.InitializeIsoGrid(payload.VisualData.Bound);

            IsoGrid.AllowSlicer = AllowSlicerField.GetLastKeyValue(payload.Data);

            AssignStates(IsoGrid);

            var entries = EntryField.GetFirstValue(payload.Data);

            if (entries == null)
            {
                throw new Exception("Illegal mutable field here!  " + EntryField.AbsoluteKey + " is not an enumerable of mutables!");
            }


            // Determine the full size of the entire isogrid
            int numCellsXAxis = 0;
            int numCellsZAxis = 0;

            if (entries.Any())
            {
                numCellsXAxis = XAxis.GetEntries(payload.Data).Max(e => XAxis.GetValue(e)) + 1;
                numCellsZAxis = ZAxis.GetEntries(payload.Data).Max(e => ZAxis.GetValue(e)) + 1;
            }

            IsoGrid.UpdateHorizontalScale(numCellsXAxis);
            IsoGrid.UpdateDepthScale(numCellsZAxis);

            AssignElements(entries);

            var iterator = IsoGrid.Apply();

            while (iterator.MoveNext( ))
            {
                yield return(null);
            }

            // PROCESS the label stuff, that was specified by the author:
            LabelSystem.Render(payload, IsoGrid.transform, IsoGrid.SelectionManager);
        }
Ejemplo n.º 11
0
        public void System_CompareTo_Should_Sort_Correctly()
        {
            var systems = new List <BaseSystem>();

            var sys1 = new LabelSystem(_channelManager, 30);
            var sys2 = new LabelSystem(_channelManager, 10);
            var sys3 = new LabelSystem(_channelManager, 40);

            systems.Add(sys1);
            systems.Add(sys2);
            systems.Add(sys3);

            systems.Sort();

            Assert.Equal(sys2.Priority, systems[0].Priority);
            Assert.Equal(sys1.Priority, systems[1].Priority);
            Assert.Equal(sys3.Priority, systems[2].Priority);
        }