Esempio n. 1
0
 public void Prepare()
 {
     SyncMessages = new List <ISyncEventArgs>();
     Scene        = SceneSamples.CreateSimpleScene(this.EventHandler, false);
     SyncMessages.Clear();
     _actor = (Actor)Scene.TempTileObject;
 }
Esempio n. 2
0
 public void Prepare()
 {
     SyncMessages = new List <ISyncEventArgs>();
     Scene        = SceneSamples.CreateSimpleScene(this.EventHandler, false);
     _effect      = Scene.CreateEffect(Scene.Players.First(), "test_effect", Scene.Tiles[1][2], null, null, 2, null);
     SyncMessages.Clear();
 }
Esempio n. 3
0
 public void Prepare()
 {
     SyncMessages = new List <ISyncEventArgs>();
     Scene        = SceneSamples.CreateSimpleScene(this.EventHandler, true);
     Scene.Actors.Find(x => SceneHelper.GetOrderByGuid(x.ExternalId) == 1).ChangePosition(Scene.Tiles[17][2], true);
     SyncMessages.Clear();
 }
Esempio n. 4
0
 public void Prepare()
 {
     SyncMessages = new List <ISyncEventArgs>();
     Scene        = SceneSamples.CreateSimpleScene(this.EventHandler, false);
     Scene.ChangeTile("test_tile_effect", 1, 2, null, Scene.Players.ToArray()[0]);
     Scene.ChangeTile("test_tile_effect", 17, 2, null, null);
     SyncMessages.Clear();
 }
Esempio n. 5
0
 public void Prepare()
 {
     SyncMessages = new List <ISyncEventArgs>();
     Scene        = SceneSamples.CreateSimpleScene(this.EventHandler, false);
     Scene.Actors.Find(x => SceneHelper.GetOrderByGuid(x.ExternalId) == 1).Kill();
     Scene.EndTurn();
     _decoration = Scene.CreateDecoration(Scene.Players.First(), "test_decoration", Scene.Tiles[4][4], null, null, null, null, null);
     SyncMessages.Clear();
 }
Esempio n. 6
0
        public void CreateSynchronizer()
        {
            Scene = SceneSamples.CreateSimpleScene(this.EventHandler, false);
            Scene.Actors.Find(x => SceneHelper.GetOrderByGuid(x.ExternalId) == 1).ChangePosition(Scene.Tiles[17][2], true);
            Scene.CreateEffect(Scene.Players.First(), "test_effect", Scene.Tiles[1][2], null, null, 2, null);
            Scene.CreateDecoration(Scene.Players.First(), "test_decoration", Scene.Tiles[4][4], null, null, null, null, null);
            ISynchronizer synchronizer = new Synchronizer(
                Scene.TempTileObject,
                Scene.Players.ToList(),
                new List <Actor>()
            {
                Scene.Actors[0]
            },
                new List <ActiveDecoration>()
            {
                Scene.Decorations[0]
            },
                new List <SpecEffect>(),
                new List <Actor>()
            {
                Scene.Actors[1]
            },
                new List <ActiveDecoration>(),
                new List <SpecEffect>()
            {
                Scene.SpecEffects[0]
            },
                new ProjectArena.Engine.Helpers.Point(20, 20),
                new List <Tile>()
            {
                Scene.Tiles[4][4]
            },
                Scene.RandomCounter);

            Assert.That(synchronizer.TempActor, Is.EqualTo(Scene.TempTileObject.Id), "Temp tile actor");
            Assert.That(synchronizer.TempDecoration, Is.EqualTo(null), "No temp tile decoration");
            Assert.That(synchronizer.ChangedActors.ToArray()[0].Id, Is.EqualTo(Scene.Actors[0].Id), "Rigth actors");
            Assert.That(synchronizer.ChangedDecorations.ToArray()[0].Id, Is.EqualTo(Scene.Decorations[0].Id), "Rigth decorations");
            Assert.That(synchronizer.ChangedEffects.Count(), Is.EqualTo(0), "Rigth effects");
            Assert.That(synchronizer.DeletedActors.ToArray()[0], Is.EqualTo(Scene.Actors[1].Id), "Rigth deleted actors");
            Assert.That(synchronizer.DeletedDecorations.Count(), Is.EqualTo(0), "Rigth deleted decorations");
            Assert.That(synchronizer.DeletedEffects.ToArray()[0], Is.EqualTo(Scene.SpecEffects[0].Id), "Rigth deleted effects");
            Assert.That(synchronizer.ChangedTiles.ToArray()[0].X, Is.EqualTo(4), "Rigth tiles");
            Assert.That(synchronizer.ChangedTiles.ToArray()[0].Y, Is.EqualTo(4), "Rigth tiles");
        }
Esempio n. 7
0
        public void CreateSimpleScene()
        {
            Scene = SceneSamples.CreateSimpleScene(this.EventHandler, false);

            Assert.That(Scene, Is.Not.Null, "Check scene object existence");
            Assert.That(SyncMessages.Count, Is.EqualTo(2), "Check messages count");
            Assert.That(SyncMessages[0].Action, Is.EqualTo(ProjectArena.Engine.Helpers.SceneAction.StartGame), "Check StartGame message action");
            Assert.That(SyncMessages[0].Version, Is.EqualTo(1), "Check version of StartGame message");
            Assert.That(SyncMessages[0].SyncInfo.TempActor, Is.Null, "Check tempActor in StartGame message");
            Assert.That(SyncMessages[0].SyncInfo.Players.Count(), Is.EqualTo(2), "Check players count in StartGame message");
            Assert.That(SyncMessages[0].SyncInfo.ChangedActors.Count(), Is.EqualTo(2), "Check changedActors count in StartGame message");
            Assert.That(SyncMessages[0].SyncInfo.ChangedDecorations.Count(), Is.EqualTo(0), "Check changedDecorations count in StartGame message");
            Assert.That(SyncMessages[0].SyncInfo.ChangedEffects.Count(), Is.EqualTo(0), "Check changedEffects count in StartGame message");
            Assert.That(SyncMessages[0].SyncInfo.ChangedTiles.Count(), Is.EqualTo(400), "Check changedTiles count in StartGame message");
            Assert.That(SyncMessages[0].SyncInfo.DeletedActors.ToList().Count, Is.EqualTo(0), "Check deletedActors count in StartGame message");
            Assert.That(SyncMessages[1].Action, Is.EqualTo(ProjectArena.Engine.Helpers.SceneAction.EndTurn), "Check EndTurn message action");
            Assert.That(SyncMessages[1].Version, Is.EqualTo(2), "Check version of EndTurn message");
            Assert.That(SyncMessages[1].SyncInfo.TempActor, Is.Not.Null, "Check tempActor in EndTurn message");
            Assert.That(SyncMessages[1].SyncInfo.ChangedActors.Count(), Is.EqualTo(2), "Check changedActors count in EndTurn message");
            Assert.That(SyncMessages[1].SyncInfo.ChangedTiles.Count(), Is.EqualTo(0), "Check changedTiles count in EndTurn message");
            Assert.That(SyncMessages[1].SyncInfo.DeletedActors.Count(), Is.EqualTo(0), "Check deletedActors count in EndTurn message");
        }