public void MarkTileAsInfrastructureToBuild(Vector2Int tilePosition, InfrastructureType infrastructureType) { if (infrastructureType == InfrastructureType.pipe && checkTile.BuildPipe(tilePosition)) { Tile tile = GridData.GridDictionary[tilePosition]; tile.InfrastructureToBuild = infrastructureType; infrastructureBM.MarkTileToBuild(tile); mapDisplay.DisplayTile(tile); } else if (infrastructureType == InfrastructureType.substructure && checkTile.BuildSubstructure(tilePosition)) { Tile tile = GridData.GridDictionary[tilePosition]; tile.InfrastructureToBuild = infrastructureType; infrastructureBM.MarkTileToBuild(tile); mapDisplay.DisplayTile(tile); Tile lowerTile = GridData.GridDictionary[tilePosition + Vector2Int.down]; if (lowerTile.DigIt == true) { lowerTile.DigIt = false; digManager.EraseTileToDig(lowerTile); mapDisplay.DisplayTile(lowerTile); } } }
public List <TerrainPathConnect> GetTargets(InfrastructureType type) { if (!this.targets.ContainsKey(type)) { this.targets.Add(type, new List <TerrainPathConnect>()); } return(this.targets[type]); }
public void AddTarget(TerrainPathConnect target) { InfrastructureType type = target.Type; if (!this.targets.ContainsKey(type)) { this.targets.Add(type, new List <TerrainPathConnect>()); } this.targets[type].Add(target); }
private TileBase GetInfrastructureTile(InfrastructureType type, bool SelectionTile) { foreach (var tile in infrastructureTiles) { if (tile.type == type) { return(SelectionTile ? tile.tileSelection : tile.tile); } } Debug.LogError("Cant find tile!"); return(null); }
public HexTile(HexCoordinates hexCoords, Vector3Int tilemapCoords, TileBase mapTile) { HexCoords = hexCoords; TilemapCoords = tilemapCoords; MapTile = mapTile; Height = 0f; Biome = "DEFAULT"; BiomeIndex = -1; Elevation = ElevationType.FLAT; MoistureLevel = 0f; Moisture = MoistureType.NORMAL; Infrastructure = InfrastructureType.NONE; }
protected void Awake() { List <Vector3> vector3s = new List <Vector3>(); foreach (Transform transforms in base.transform) { vector3s.Add(transforms.position); } if (vector3s.Count >= 2) { InfrastructureType type = this.Type; if (type == InfrastructureType.Road) { PathList pathList = new PathList(string.Concat("Road ", TerrainMeta.Path.Roads.Count), vector3s.ToArray()) { Width = this.Width, InnerFade = this.Fade * 0.5f, OuterFade = this.Fade * 0.5f, MeshOffset = this.Offset * 0.3f, TerrainOffset = this.Offset, Topology = (int)this.Topology, Splat = (int)this.Splat, Spline = this.Spline }; TerrainMeta.Path.Roads.Add(pathList); } else if (type == InfrastructureType.Power) { PathList pathList1 = new PathList(string.Concat("Powerline ", TerrainMeta.Path.Powerlines.Count), vector3s.ToArray()) { Width = this.Width, InnerFade = this.Fade * 0.5f, OuterFade = this.Fade * 0.5f, MeshOffset = this.Offset * 0.3f, TerrainOffset = this.Offset, Topology = (int)this.Topology, Splat = (int)this.Splat, Spline = this.Spline }; TerrainMeta.Path.Powerlines.Add(pathList1); } } GameManager.Destroy(base.gameObject, 0f); }
public TestManifests(bool isHttpGatewayEnabled, bool isUpgrade, bool isLogicalDirectories, int nNodeTypes, bool isScaleMin, InfrastructureType infrastructureType, int[] nNodes, int[] nSeedNodes, int[] nFaultDomains, int[] nUpgradeDomains, string testName, string version, bool isConfigure, bool disallowDnsSetup) { this.InitializeFabricSettings(isHttpGatewayEnabled, isUpgrade, isConfigure, disallowDnsSetup, testName); this.InitializeInfrastructureSettings( nNodeTypes, isScaleMin, isLogicalDirectories, nNodes, nSeedNodes, nFaultDomains, nUpgradeDomains, infrastructureType); InitializeInfrastructureSettings(infrastructureType, isScaleMin, nNodeTypes, nSeedNodes); this.ClusterManifest = new ClusterManifestType() { Certificates = null, Description = testName, FabricSettings = this.sections, Infrastructure = this.infrastructure, Name = testName, NodeTypes = this.nodeTypes, Version = version }; this.InfrastructureManifest = new InfrastructureInformationType() { NodeList = infraNodes }; InitializeClusterSettings(); }
private int SaveIndoorDistributions(IEnumerable<CollegeIndoorExcel> indoorExcels, IIndoorDistributioinRepository distributioinRepository, InfrastructureType type) { int count = 0; foreach (CollegeIndoorExcel excel in indoorExcels) { IndoorDistribution distribution = distributioinRepository.IndoorDistributions.FirstOrDefault(x => x.Name == excel.Name && x.Range == excel.Range && x.SourceName == excel.SourceName); if (distribution == null) { distribution = new IndoorDistribution { Name = excel.Name, Range = excel.Range, SourceName = excel.SourceName, SourceType = excel.SourceType, Longtitute = excel.Longtitute, Lattitute = excel.Lattitute }; distribution = distributioinRepository.AddOneDistribution(distribution); distributioinRepository.SaveChanges(); } InfrastructureInfo infrastructure = _repository.FirstOrDefault(x => x.HotspotName == excel.CollegeName && x.HotspotType == HotspotType.College && x.InfrastructureType == type && x.InfrastructureId == distribution.Id); if (infrastructure == null) { infrastructure = new InfrastructureInfo { HotspotName = excel.CollegeName, HotspotType = HotspotType.College, InfrastructureType = type, InfrastructureId = distribution.Id }; _repository.Insert(infrastructure); } count++; } return count; }
public IEnumerable <int> GetHotSpotInfrastructureIds(string name, InfrastructureType type, HotspotType hotspotType) { return(GetAll().Where(x => x.HotspotName == name && x.InfrastructureType == type && x.HotspotType == hotspotType ).Select(x => x.InfrastructureId).ToList()); }
public IEnumerable <int> GetCollegeInfrastructureIds(string collegeName, InfrastructureType type) { return(GetAll().Where(x => x.HotspotName == collegeName && x.InfrastructureType == type && x.HotspotType == HotspotType.College ).Select(x => x.InfrastructureId).ToList()); }
public void onInfFilterChanged(Dropdown dropdown) { infFilter = (InfrastructureType)dropdown.value; }
private void GenerateValidClusterManifest(InfrastructureType infaType) { this.ClusterManifest = new ClusterManifestType(); this.ClusterManifest.Name = "TestClusterManifestAllSettings"; this.ClusterManifest.Version = "1.0"; this.ClusterManifest.Infrastructure = new ClusterManifestTypeInfrastructure(); if (infaType == InfrastructureType.WindowsServer) { ClusterManifestTypeInfrastructureWindowsServer infra = new ClusterManifestTypeInfrastructureWindowsServer(); infra.IsScaleMin = false; infra.NodeList = new FabricNodeType[1]; infra.NodeList[0] = new FabricNodeType() { FaultDomain = "fd:/RACK1", UpgradeDomain = "MYUD1", NodeName = "Node1", NodeTypeRef = "NodeType1", IPAddressOrFQDN = "localhost", IsSeedNode = true }; this.ClusterManifest.Infrastructure.Item = infra; } else { ClusterManifestTypeInfrastructurePaaS infra = new ClusterManifestTypeInfrastructurePaaS(); infra.Roles = new PaaSRoleType[] { new PaaSRoleType() { NodeTypeRef = "NodeType1", RoleName = "NodeType1", RoleNodeCount = 5 } }; infra.Votes = new PaaSVoteType[] { new PaaSVoteType() { IPAddressOrFQDN = "10.0.0.1", NodeName = "_NodeType1_0", Port = 19005 }, new PaaSVoteType() { IPAddressOrFQDN = "10.0.0.2", NodeName = "_NodeType1_1", Port = 19005 }, new PaaSVoteType() { IPAddressOrFQDN = "10.0.0.3", NodeName = "_NodeType1_2", Port = 19005 } }; this.ClusterManifest.Infrastructure.Item = infra; } this.ClusterManifest.NodeTypes = new ClusterManifestTypeNodeType[1]; this.ClusterManifest.NodeTypes[0] = new ClusterManifestTypeNodeType(); this.ClusterManifest.NodeTypes[0].Name = "NodeType1"; this.ClusterManifest.NodeTypes[0].Endpoints = new FabricEndpointsType() { ClientConnectionEndpoint = new InputEndpointType() { Port = "19000" }, LeaseDriverEndpoint = new InternalEndpointType() { Port = "19001" }, ClusterConnectionEndpoint = new InternalEndpointType() { Port = "19002" }, ServiceConnectionEndpoint = new InternalEndpointType() { Port = "19003" }, HttpGatewayEndpoint = new InputEndpointType() { Port = "19004" }, ApplicationEndpoints = new FabricEndpointsTypeApplicationEndpoints() { StartPort = 30001, EndPort = 31000 }, }; this.ClusterManifest.FabricSettings = new SettingsOverridesTypeSection[3]; List <SettingsOverridesTypeSectionParameter> parameters = new List <SettingsOverridesTypeSectionParameter>(); parameters.Add(new SettingsOverridesTypeSectionParameter() { Name = FabricValidatorConstants.ParameterNames.ClusterCredentialType, Value = "None", IsEncrypted = false }); parameters.Add(new SettingsOverridesTypeSectionParameter() { Name = FabricValidatorConstants.ParameterNames.ServerAuthCredentialType, Value = "None", IsEncrypted = false }); this.ClusterManifest.FabricSettings[0] = new SettingsOverridesTypeSection() { Name = FabricValidatorConstants.SectionNames.Security, Parameter = parameters.ToArray() }; parameters = new List <SettingsOverridesTypeSectionParameter>(); parameters.Add(new SettingsOverridesTypeSectionParameter() { Name = "ExpectedClustersize", Value = "1", IsEncrypted = false }); this.ClusterManifest.FabricSettings[1] = new SettingsOverridesTypeSection() { Name = "FailoverManager", Parameter = parameters.ToArray() }; parameters = new List <SettingsOverridesTypeSectionParameter>(); parameters.Add(new SettingsOverridesTypeSectionParameter() { Name = "ImageStoreConnectionString", Value = "_default_", IsEncrypted = false }); this.ClusterManifest.FabricSettings[2] = new SettingsOverridesTypeSection() { Name = "Management", Parameter = parameters.ToArray() }; }
public void InfrastructureTileSelected(InfrastructureType type) { typeOfTileToBuild = type; playerInput.CurrentState = State.infrastructure; }
private int SaveIndoorDistributions(IEnumerable <CollegeIndoorExcel> indoorExcels, IIndoorDistributioinRepository distributioinRepository, InfrastructureType type) { int count = 0; foreach (CollegeIndoorExcel excel in indoorExcels) { IndoorDistribution distribution = distributioinRepository.IndoorDistributions.FirstOrDefault(x => x.Name == excel.Name && x.Range == excel.Range && x.SourceName == excel.SourceName); if (distribution == null) { distribution = new IndoorDistribution { Name = excel.Name, Range = excel.Range, SourceName = excel.SourceName, SourceType = excel.SourceType, Longtitute = excel.Longtitute, Lattitute = excel.Lattitute }; distribution = distributioinRepository.AddOneDistribution(distribution); distributioinRepository.SaveChanges(); } InfrastructureInfo infrastructure = _repository.InfrastructureInfos.FirstOrDefault(x => x.HotspotName == excel.CollegeName && x.HotspotType == HotspotType.College && x.InfrastructureType == type && x.InfrastructureId == distribution.Id); if (infrastructure == null) { infrastructure = new InfrastructureInfo { HotspotName = excel.CollegeName, HotspotType = HotspotType.College, InfrastructureType = type, InfrastructureId = distribution.Id }; _repository.AddOneInfrastructure(infrastructure); _repository.SaveChanges(); } count++; } return(count); }
public ClusterManifestHelper(InfrastructureType infraType) { GenerateValidClusterManifest(infraType); }
private void InitializeInfrastructureSettings( int nNodeTypes, bool isScaleMin, bool isLogicalDirectories, int[] nNodes, int[] nSeedNodes, int[] nFaultDomains, int[] nUpgradDomains, InfrastructureType infrastructureType) { this.nodeTypes = new ClusterManifestTypeNodeType[nNodeTypes]; int totalNodes = 0; for (int i = 0; i < nNodeTypes; i++) { totalNodes += nNodes[i]; } this.nodes = new FabricNodeType[totalNodes]; this.infraNodes = new InfrastructureNodeType[totalNodes]; int nodeIndex = 0; for (int i = 0; i < nNodeTypes; i++) { int clientConnectionPort = 19000 + i; int leaseDriverPort = 19000 + nNodeTypes + i; int clusterConnectionPort = 19000 + 2 * nNodeTypes + i; int httpGatewayPort = 19000 + 3 * nNodeTypes + i; int serviceConnectionPort = 19000 + 4 * nNodeTypes + i; int startAppPort = 30000 + 1000 * i + 1; int endAppPort = 30000 + 1000 * (i + 1); string host = isScaleMin ? "localhost" : System.Net.Dns.GetHostName(); string roleOrTierName = GetRoleOrTiername(i); string faultDomain = string.Format(CultureInfo.InvariantCulture, "fd:/Rack{0}", i % nFaultDomains[i]); string upgradeDomain = string.Format(CultureInfo.InvariantCulture, "MYUD{0}", i % nUpgradDomains[i]); FabricEndpointsType endpoints = new FabricEndpointsType() { ApplicationEndpoints = new FabricEndpointsTypeApplicationEndpoints() { StartPort = startAppPort, EndPort = endAppPort }, LeaseDriverEndpoint = new InternalEndpointType() { Port = leaseDriverPort.ToString(CultureInfo.InvariantCulture) }, ClusterConnectionEndpoint = new InternalEndpointType() { Port = clusterConnectionPort.ToString(CultureInfo.InvariantCulture) }, ClientConnectionEndpoint = new InputEndpointType() { Port = clientConnectionPort.ToString(CultureInfo.InvariantCulture) }, HttpGatewayEndpoint = new InputEndpointType() { Port = httpGatewayPort.ToString(CultureInfo.InvariantCulture) }, ServiceConnectionEndpoint = new InternalEndpointType() { Port = serviceConnectionPort.ToString(CultureInfo.InvariantCulture) } }; for (int j = 0; j < nNodes[i]; j++) { bool isSeedNode = j < nSeedNodes[i]; string nodeName = string.Format(CultureInfo.InvariantCulture, "{0}.Node.{1}", roleOrTierName, j); FabricNodeType node = new FabricNodeType() { NodeName = nodeName, FaultDomain = faultDomain, IPAddressOrFQDN = host, IsSeedNode = isSeedNode, NodeTypeRef = roleOrTierName, UpgradeDomain = upgradeDomain }; InfrastructureNodeType infraNode = new InfrastructureNodeType() { NodeName = nodeName, FaultDomain = faultDomain, IPAddressOrFQDN = host, IsSeedNode = isSeedNode, NodeTypeRef = roleOrTierName, UpgradeDomain = upgradeDomain, RoleOrTierName = roleOrTierName, Certificates = null, Endpoints = endpoints }; this.nodes[nodeIndex] = node; this.infraNodes[nodeIndex] = infraNode; nodeIndex++; } nodeTypes[i] = new ClusterManifestTypeNodeType(); nodeTypes[i].Certificates = null; if (infrastructureType == InfrastructureType.WindowsServer || infrastructureType == InfrastructureType.VMM || infrastructureType == InfrastructureType.PaaS) { nodeTypes[i].Endpoints = endpoints; } nodeTypes[i].Name = roleOrTierName; } if (isLogicalDirectories) { nodeTypes[0].LogicalDirectories = new LogicalDirectoryType[5]; nodeTypes[0].LogicalDirectories[0] = new LogicalDirectoryType { LogicalDirectoryName = "0", MappedTo = TestUtility.LogicalDirectoriesApplicationCheckPointFilesDir, Context = LogicalDirectoryTypeContext.node }; nodeTypes[0].LogicalDirectories[1] = new LogicalDirectoryType { LogicalDirectoryName = "1", MappedTo = TestUtility.LogicalDirectoriesLogDir, Context = LogicalDirectoryTypeContext.node }; nodeTypes[0].LogicalDirectories[2] = new LogicalDirectoryType { LogicalDirectoryName = "2", MappedTo = TestUtility.LogicalDirectoriesBackupDir, Context = LogicalDirectoryTypeContext.application }; nodeTypes[0].LogicalDirectories[3] = new LogicalDirectoryType { LogicalDirectoryName = "3", MappedTo = TestUtility.LogicalDirectoriesUserDefined1Dir }; nodeTypes[0].LogicalDirectories[4] = new LogicalDirectoryType { LogicalDirectoryName = "4", MappedTo = TestUtility.LogicalDirectoriesUserDefined2Dir, Context = LogicalDirectoryTypeContext.node }; nodeTypes[1].LogicalDirectories = new LogicalDirectoryType[5]; nodeTypes[1].LogicalDirectories[0] = new LogicalDirectoryType { LogicalDirectoryName = "0", MappedTo = TestUtility.LogicalDirectoriesApplicationCheckPointFilesDir2, Context = LogicalDirectoryTypeContext.application }; nodeTypes[1].LogicalDirectories[1] = new LogicalDirectoryType { LogicalDirectoryName = "1", MappedTo = TestUtility.LogicalDirectoriesLogDir2, Context = LogicalDirectoryTypeContext.application }; nodeTypes[1].LogicalDirectories[2] = new LogicalDirectoryType { LogicalDirectoryName = "2", MappedTo = TestUtility.LogicalDirectoriesBackupDir2, Context = LogicalDirectoryTypeContext.node }; nodeTypes[1].LogicalDirectories[3] = new LogicalDirectoryType { LogicalDirectoryName = "3", MappedTo = TestUtility.LogicalDirectoriesUserDefined1Dir2, Context = LogicalDirectoryTypeContext.application }; nodeTypes[1].LogicalDirectories[4] = new LogicalDirectoryType { LogicalDirectoryName = "4", MappedTo = TestUtility.LogicalDirectoriesUserDefined2Dir2, Context = LogicalDirectoryTypeContext.application }; } }
private void InitializeInfrastructureSettings(InfrastructureType infrastructureType, bool isScaleMin, int nNodeTypes, int[] nSeedNodes) { switch (infrastructureType) { case InfrastructureType.Blackbird: return; case InfrastructureType.VMM: return; case InfrastructureType.PaaS: var paasInfra = new ClusterManifestTypeInfrastructurePaaS(); paasInfra.Roles = new PaaSRoleType[nNodeTypes]; for (int i = 0; i < nNodeTypes; i++) { paasInfra.Roles[i] = new PaaSRoleType(); paasInfra.Roles[i].RoleName = GetRoleOrTiername(i); paasInfra.Roles[i].NodeTypeRef = GetRoleOrTiername(i); paasInfra.Roles[i].RoleNodeCount = nSeedNodes[i]; } var paasVotes = new List <PaaSVoteType>(); foreach (var node in this.infraNodes) { if (node.IsSeedNode) { paasVotes.Add(new PaaSVoteType() { NodeName = node.NodeName, IPAddressOrFQDN = node.IPAddressOrFQDN, Port = Convert.ToInt32(node.Endpoints.ClusterConnectionEndpoint.Port) }); } } paasInfra.Votes = paasVotes.ToArray(); this.infrastructure = new ClusterManifestTypeInfrastructure(); this.infrastructure.Item = paasInfra; return; case InfrastructureType.WindowsAzure: var azureInfra = new ClusterManifestTypeInfrastructureWindowsAzure(); azureInfra.Roles = new AzureRoleType[nNodeTypes]; for (int i = 0; i < nNodeTypes; i++) { azureInfra.Roles[i] = new AzureRoleType(); azureInfra.Roles[i].RoleName = GetRoleOrTiername(i); azureInfra.Roles[i].NodeTypeRef = GetRoleOrTiername(i); azureInfra.Roles[i].SeedNodeCount = nSeedNodes[i]; } this.infrastructure = new ClusterManifestTypeInfrastructure(); this.infrastructure.Item = azureInfra; return; case InfrastructureType.WindowsServer: var infra = new ClusterManifestTypeInfrastructureWindowsServer(); infra.IsScaleMin = isScaleMin; infra.NodeList = this.nodes; this.infrastructure = new ClusterManifestTypeInfrastructure(); this.infrastructure.Item = infra; return; } }