Esempio n. 1
0
        public ResourceTransferCanonSynchronizer(
            IResourceTransferCanon resourceTransferCanon,
            IImprovementLocationCanon improvementLocationCanon,
            IPossessionRelationship <IHexCell, IResourceNode> resourceNodeLocationCanon,
            ICivilizationTerritoryLogic civTerritoryLogic,
            IPossessionRelationship <ICity, IHexCell> cityTerritoryCanon,
            IPossessionRelationship <ICivilization, ICity> cityPossessionCanon,
            ImprovementSignals improvementSignals,
            ResourceSignals resourceSignals,
            CitySignals citySignals,
            CivilizationSignals civSignals
            )
        {
            ResourceTransferCanon     = resourceTransferCanon;
            ImprovementLocationCanon  = improvementLocationCanon;
            ResourceNodeLocationCanon = resourceNodeLocationCanon;
            CivTerritoryLogic         = civTerritoryLogic;
            CityTerritoryCanon        = cityTerritoryCanon;
            CityPossessionCanon       = cityPossessionCanon;

            improvementSignals.RemovedFromLocation.Subscribe(OnImprovementRemovedFromLocation);
            improvementSignals.Pillaged.Subscribe(OnImprovementPillaged);
            resourceSignals.NodeRemovedFromLocation.Subscribe(OnResourceNodeRemovedFromLocation);
            citySignals.LostCellFromBoundaries.Subscribe(OnCityLostCellFromBoundaries);
            civSignals.CivLosingCity.Subscribe(OnCivLosingCity);
        }
        public void CommonInstall()
        {
            MockResourceTransferCanon     = new Mock <IResourceTransferCanon>();
            MockImprovementLocationCanon  = new Mock <IImprovementLocationCanon>();
            MockResourceNodeLocationCanon = new Mock <IPossessionRelationship <IHexCell, IResourceNode> >();
            MockCivTerritoryLogic         = new Mock <ICivilizationTerritoryLogic>();
            MockCityTerritoryCanon        = new Mock <IPossessionRelationship <ICity, IHexCell> >();
            MockCityPossessionCanon       = new Mock <IPossessionRelationship <ICivilization, ICity> >();

            ImprovementSignals = new ImprovementSignals();
            ResourceSignals    = new ResourceSignals();
            CivSignals         = new CivilizationSignals();

            Container.Bind <IResourceTransferCanon>                          ().FromInstance(MockResourceTransferCanon.Object);
            Container.Bind <IImprovementLocationCanon>                       ().FromInstance(MockImprovementLocationCanon.Object);
            Container.Bind <IPossessionRelationship <IHexCell, IResourceNode> >().FromInstance(MockResourceNodeLocationCanon.Object);
            Container.Bind <ICivilizationTerritoryLogic>                     ().FromInstance(MockCivTerritoryLogic.Object);
            Container.Bind <IPossessionRelationship <ICity, IHexCell> >        ().FromInstance(MockCityTerritoryCanon.Object);
            Container.Bind <IPossessionRelationship <ICivilization, ICity> >   ().FromInstance(MockCityPossessionCanon.Object);

            Container.Bind <ImprovementSignals> ().FromInstance(ImprovementSignals);
            Container.Bind <ResourceSignals>    ().FromInstance(ResourceSignals);
            Container.Bind <CivilizationSignals>().FromInstance(CivSignals);

            Container.Bind <CitySignals>().AsSingle();

            Container.Bind <ResourceTransferCanonSynchronizer>().AsSingle().NonLazy();
        }
Esempio n. 3
0
        public TerrainRefreshResponder(
            IHexGrid grid, IPossessionRelationship <ICity, IHexCell> cellPossessionCanon,
            CitySignals citySignals, CivilizationSignals civSignals, HexCellSignals cellSignals,
            ImprovementSignals improvementSignals, ResourceSignals resourceSignals
            )
        {
            Grid = grid;
            CellPossessionCanon = cellPossessionCanon;

            citySignals.LostCellFromBoundaries.Subscribe(OnCellPossessionChanged);
            citySignals.GainedCellToBoundaries.Subscribe(OnCellPossessionChanged);
            citySignals.CityAddedToLocation.Subscribe(OnCityChangedLocation);
            citySignals.CityRemovedFromLocation.Subscribe(OnCityChangedLocation);

            civSignals.CivGainedCity.Subscribe(OnCityPossessionChanged);
            civSignals.CivLostCity.Subscribe(OnCityPossessionChanged);

            cellSignals.TerrainChanged.Subscribe(OnCellTerrainChanged);
            cellSignals.ShapeChanged.Subscribe(OnCellShapeChanged);
            cellSignals.VegetationChanged.Subscribe(OnCellVegetationChanged);
            cellSignals.FeatureChanged.Subscribe(OnCellFeatureChanged);
            cellSignals.RoadStatusChanged.Subscribe(OnCellRoadStatusChanged);
            cellSignals.GainedRiveredEdge.Subscribe(OnCellRiverChanged);
            cellSignals.LostRiveredEdge.Subscribe(OnCellRiverChanged);
            cellSignals.GainedEncampment.Subscribe(OnCellEncampmentChanged);
            cellSignals.LostEncampment.Subscribe(OnCellEncampmentChanged);

            improvementSignals.AddedToLocation.Subscribe(OnCellImprovementsChanged);
            improvementSignals.RemovedFromLocation.Subscribe(OnCellImprovementsChanged);

            resourceSignals.NodeAddedToLocation.Subscribe(OnCellNodesChanged);
            resourceSignals.NodeRemovedFromLocation.Subscribe(OnCellNodesChanged);
        }