public void BindList(Customer customer, Employee emp, Territory terr, DateTime? startDate, DateTime? endDate, Dictionary orderStatus) { gvOrders.DataSource = SalesService.GetOrders(customer, emp, terr, startDate,endDate, orderStatus).OrderByDescending( o => o.OrderDate ).ToList(); gvOrders.DataBind(); }
public void editDisabledOrders(Territory passedTerritory, Button button) { button.IsEnabled = false; OrderToken newOrder = resources.buttonOrderTokenDict[button]; foreach (OrderToken o in passedTerritory.getHouseOccupied().getAvailableOrderTokens()) { if (o.Equals(newOrder)) { newOrder = o; break; } } newOrder.setIsAvailable(false); passedTerritory.getHouseOccupied().getAvailableOrderTokens().Remove(newOrder); if (!(passedTerritory.getOrderToken() is PlaceHolderOrderToken)) { passedTerritory.getOrderToken().setIsAvailable(true); passedTerritory.getHouseOccupied().getAvailableOrderTokens().Add(passedTerritory.getOrderToken()); foreach (OrderToken o1 in resources.allOrderTokens) { if (o1.Equals(passedTerritory.getOrderToken()) && !(resources.orderTokenButtonDict[o1].IsEnabled)) { resources.orderTokenButtonDict[o1].IsEnabled = true; break; } } } passedTerritory.setOrderToken(newOrder); }
private void OnIslandAdded(Territory t) { if (IslandAdded != null) { IslandAdded(t); } }
public ContentTerritory(Engine engine, Territory territory) : base(engine) { this.Territory = territory; if (territory.Terrain != null) { foreach (var part in territory.Terrain.Parts) _TerrainContainer.Add(new ContentModel(engine, part)); } foreach (var lgb in territory.LgbFiles) { foreach(var group in lgb.Groups) { foreach(var part in group.Entries) { var asMdl = part as Lgb.LgbModelEntry; var asGim = part as Lgb.LgbGimmickEntry; if (asMdl != null && asMdl.Model != null) _LgbPartsContainer.Add(new ContentModel(engine, asMdl.Model)); if (asGim != null && asGim.Gimmick != null) _LgbPartsContainer.Add(new ContentSgb(engine, asGim.Gimmick) { Transformation = Matrix.Scaling(asGim.Header.Scale.ToDx()) * Matrix.RotationX(asGim.Header.Rotation.X) * Matrix.RotationY(asGim.Header.Rotation.Y) * Matrix.RotationZ(asGim.Header.Rotation.Z) * Matrix.Translation(asGim.Header.Translation.ToDx()) }); } } } }
public void RunTests() { session = NHSessionHelper.OpenSession(); transaction = session.BeginTransaction(); territory = session.CreateCriteria(typeof(Territory)) .Add(Restrictions.Eq("TerritoryID", "10019")).UniqueResult<Territory>(); }
protected void ButtonDone_Click(object sender, EventArgs e) { Territory thisTerritory = new Territory(CurrentUser.TerritoryId); thisTerritory.CoordinatesPerimeter = HiddenFieldMemory.Value; thisTerritory.CoordinatesCenter = HiddenFieldCenterMemory.Value; thisTerritory.AccountId = CurrentUser.CurrentAccount.AccountId; thisTerritory.Save(); LabelSaved.Visible = true; }
public virtual bool Equals(Territory other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; if (TerritoryId != default(string)) { return other.TerritoryId == TerritoryId; } return other.TerritoryId == TerritoryId && other.TerritoryDescription == TerritoryDescription && 1 == 1 && other.Region == Region; }
private void Visit(Territory t) { visited[t] = true; foreach(Territory neighbor in t.Neighbors) { if (!visited[neighbor]) { Visit(neighbor); } } }
private void CloseSave() { Territory t = new Territory() { Name = txtName.Text, IsMainland = (bool)rbMainland.IsChecked, ID = _CurrentTerritoryID, //InitialPlacementAllowed = }; OnIslandAdded(t); }
void OnTerritoryClicked(Territory territory) { if (gameState==GameStates.reinforce) { if (reinforceTroopAmount>0) { territory.troops+=1; reinforceTroopAmount-=1; } } }
public void intermediateTerritoryPrintOut(Territory passedTerritory, Button button) { editDisabledOrders(passedTerritory, button); /* if (passedTerritory is LandTerritory) { return territoryPrintOut((LandTerritory)passedTerritory); } else { return territoryPrintOut((SeaTerritory)passedTerritory); }*/ }
public void Add(Territory territory) { var entity = new TerritoryEntity { Description = territory.Description, IsActive = true, }; _context.Territories.AddObject(entity); _context.SaveChanges(); territory.Id = entity.Id; }
public Territory SaveInfo() { Territory territory = BasicService<Territory, Guid>.GetByID(this.TerritoryID); if (territory == null) { territory = new Territory(); } territory.Name = txtName.Text; territory.FullDescription = txtDescription.Text; territory.ParentTerritory = BasicService<Territory, Guid>.GetByID(ctrlParentTerritory.SelectedTerritoryId); BasicService<Territory, Guid>.SaveOrUpdate(territory); return territory; }
/// <summary> /// Generates the organizations for the indicated root territory. All territories /// capable of sustaining life will be considered viable territories /// for organizations to be spawned in. /// </summary> /// <param name="rootTerritory">The root territory.</param> /// <param name="random">The random.</param> public void GenerateOrganizations(Territory rootTerritory, Random random, int count = 300) { var professions = _professionGenerator.GenerateProfessions(count).Select(p => _professionCache.Save(p)).ToArray(); var territories = rootTerritory.GetLiveableTerritories(); foreach (var company in professions.Select(p => p.Company).Distinct()) { var selectedTerritory = territories.OrderBy(_ => Guid.NewGuid()).First(); foreach (var profession in professions.Where(p => p.Company.Equals(company))) { selectedTerritory.AddProfession(profession); } } }
/// <summary> /// This creates "shallow" territories; there's no need to build out the remainder of the /// model as there are other tests which confirm the DTO creation process. /// </summary> private List<Territory> CreateTerritories() { List<Territory> territories = new List<Territory>(); Territory territory1 = new Territory(); EntityIdSetter.SetIdOf<string>(territory1, "08837"); territory1.Description = "Edison"; territories.Add(territory1); Territory territory2 = new Territory(); EntityIdSetter.SetIdOf<string>(territory2, "00042"); territory2.Description = "Galactic"; territories.Add(territory2); return territories; }
public void TestEqualityOnSimpleKey() { Territory t1 = new Territory(); t1.Id = "asd"; Territory t2 = new Territory(); t2.Id = "asd"; Territory t3 = new Territory(); t3.Id = "asd2"; t2.Should().Be(t1); t1.Should().Be(t2); t3.Should().Not.Be(t1); t1.Should().Not.Be(t3); t3.Should().Not.Be(t2); t2.Should().Not.Be(t3); }
private Territory CreateTerritory() { Territory territory = new Territory(); EntityIdSetter.SetIdOf<string>(territory, "08837"); territory.Description = "Edison"; territory.RegionBelongingTo = new Region("Eastern"); territory.RegionBelongingTo.SetAssignedIdTo(1); Employee employee1 = new Employee(); EntityIdSetter.SetIdOf<int>(employee1, 5); territory.Employees.Add(employee1); Employee employee2 = new Employee(); EntityIdSetter.SetIdOf<int>(employee2, 10); territory.Employees.Add(employee2); return territory; }
/// <summary> /// Transfers the territory entity's property values to the DTO. /// Strongly consider Jimmy Bogard's AutoMapper (http://automapper.codeplex.com/) /// for doing this kind of work in a more automated fashion. /// </summary> public static TerritoryDto Create(Territory territory) { if (territory == null) { return null; } var territoryDto = new TerritoryDto(); territoryDto.Id = territory.Id; territoryDto.RegionBelongingTo = RegionDto.Create(territory.RegionBelongingTo); territoryDto.Description = territory.Description; foreach (var employee in territory.Employees) { territoryDto.Employees.Add(EmployeeDto.Create(employee)); } return territoryDto; }
public ActionResult Edit(int id, FormCollection collection) { try { string name = collection.Get("Name"); Territory Territory = new Territory(); IRepository <Territory> repo = new TerritoryRepository(); Territory = repo.GetById(id); Territory.ClearRegions(); Territory.Name = name; string param_regions; string[] arrayRegions; if (collection.Get("Regions") != null) { param_regions = collection.Get("Regions");; arrayRegions = param_regions.Split(','); foreach (string str in arrayRegions) { int RegionID = Convert.ToInt32(str); Region region = new Region(); IRepository <Region> repo_region = new RegionRepository(); region = repo_region.GetById(RegionID); Territory.Regions.Add(region); } } repo.Update(Territory); return(RedirectToAction("Index")); } catch { return(View()); } }
public static Territory[] RelatedArray(this EntityCollection <TerritoryEntity> entities, Hashtable seenObjects, Hashtable parents) { if (null == entities) { return(null); } var arr = new Territory[entities.Count]; var i = 0; foreach (var entity in entities) { if (parents.Contains(entity)) { // - avoid all cyclic references and return null // - another option is to 'continue' and just disregard this one entity; however, // if this is a collection this would lead the client app to believe that other // items are part of the collection and not the parent item, which is misleading and false // - it is therefore better to just return null, indicating nothing is being retrieved // for the property all-together return(null); } } foreach (var entity in entities) { if (seenObjects.Contains(entity)) { arr[i++] = seenObjects[entity] as Territory; } else { arr[i++] = entity.ToDto(seenObjects, parents); } } return(arr); }
public Territory Get(string id) { const string commandText = "select * from Territories where TerritoryID = @id"; var territory = default(Territory); var dbCommand = default(SqlCommand); try { dbCommand = DbHelper.CreateCommand(commandText); dbCommand.Parameters.AddWithValue("@id", id ?? (object)DBNull.Value); using (var dataReader = dbCommand.ExecuteReader()) { if (dataReader.Read()) { territory = new Territory { Id = (string)dataReader["TerritoryID"], TerritoryDescription = (string)dataReader["TerritoryDescription"], RegionID = (int)dataReader["RegionID"] }; } } } catch (Exception) { // TODO: Loglama yapılacak throw; } finally { dbCommand?.Connection?.Dispose(); dbCommand?.Dispose(); } return(territory); }
public static Territory Get(string territoryname) { LoadXML(); XmlNode xmlterritory = mapxml.DocumentElement.SelectSingleNode("/Territories/Territory[@name='" + territoryname + "']"); if (xmlterritory == null) { Debug.Log(string.Format("Territory {0} is missing in XML - trying 'Default'", territoryname)); xmlterritory = mapxml.DocumentElement.SelectSingleNode("/Territories/Territory[@name='Default']"); } if (xmlterritory == null) { return(null); } Territory t = new Territory(); t.name = territoryname; t.startLives = int.Parse(xmlterritory.Attributes["startlives"].Value); t.startMoney = int.Parse(xmlterritory.Attributes["startmoney"].Value); string[] mapxy = xmlterritory.Attributes["mapxy"].Value.Split(','); t.map.x = int.Parse(mapxy[0]); t.map.y = int.Parse(mapxy[1]); string[] neighbours = xmlterritory.Attributes["neighbours"].Value.Split(','); t.neighbours = new int[neighbours.Length]; int i = 0; for (i = 0; i < neighbours.Length; i++) { t.neighbours[i] = int.Parse(neighbours[i]); } ReadTurretNodes(xmlterritory.SelectNodes("TurretNodes/Location"), t); ReadWaypoints(xmlterritory.SelectNodes("Waypoints/Location"), t); ReadEnemyWaves(xmlterritory.SelectNodes("Waves/Wave"), t); // we wouldn't need this if the xml file was properly filled out Validate(t); return(t); }
void ClickOn(Vector3 pos) { Vector3Int coord = grid.WorldToCell(pos); Debug.Log("Click on: " + coord.ToString()); Territory t = map.GetTerritoryAt(coord); ArmyUnit u = map.GetUnitAt(coord); Player p = PlayerHandler.instance.GetCurrent(); // Probably work on states // State 1: nothing selected // Staet 2: Selected unit (waiting on move/atk) // State 3: selected ability (waiting on target) // State 4: multipoint ability (waiting on n targets) if (u != null) { // getThe Actions? Debug.Log("Found unit!"); } Dictionary <Territory.Type, int> mobMods = new Dictionary <Territory.Type, int>(); mobMods.Add(Territory.Type.PLAIN, 3); mobMods.Add(Territory.Type.FOREST, 3); mobMods.Add(Territory.Type.MOUNTAIN, 6); mobMods.Add(Territory.Type.CIRCLE, 4); // Onliy highlight path on selecting unit path.HighlightPath(coord, 1, 12, mobMods); switch (_state) { case 1: ClickState1(coord); break; case 2: ClickState2(coord); break; default: ClickState0(coord); break; } }
public int AssignUpazillaToTerritory(Territory aTerritory) { ConnectionObj.Open(); SqlTransaction sqlTransaction = ConnectionObj.BeginTransaction(); try { int rowAffected = 0; foreach (var item in aTerritory.UpazillaList) { CommandObj.Transaction = sqlTransaction; CommandObj.CommandText = "spAddNewUpazillaToTerritory"; CommandObj.CommandType = CommandType.StoredProcedure; CommandObj.Parameters.AddWithValue("@UpazillaId", item.UpazillaId); CommandObj.Parameters.AddWithValue("@TerritoryId", aTerritory.TerritoryId); CommandObj.Parameters.Add("@RowAffected", SqlDbType.Int); CommandObj.Parameters["@RowAffected"].Direction = ParameterDirection.Output; CommandObj.ExecuteNonQuery(); rowAffected += Convert.ToInt32(CommandObj.Parameters["@RowAffected"].Value); CommandObj.Parameters.Clear(); } sqlTransaction.Commit(); return(rowAffected); } catch (Exception e) { sqlTransaction.Rollback(); throw new Exception("Could not assign dristict or upazila to territory", e); } finally { ConnectionObj.Close(); CommandObj.Dispose(); CommandObj.Parameters.Clear(); } }
private void AddAetherytes(Territory territory) { var aetheryteName = territory.NameList[ClientLanguage.English] switch { "The Dravanian Hinterlands" => "Idyllshire", "Limsa Lominsa Upper Decks" => "Limsa Lominsa Lower Decks", "Mist" => "Limsa Lominsa Lower Decks", "Old Gridania" => "New Gridania", "The Lavender Beds" => "New Gridania", "The Goblet" => "Ul'dah - Steps of Nald", "Shirogane" => "Kugane", "The Endeavor" => "Limsa Lominsa Lower Decks", "The Diadem" => "Foundation", _ => null, }; if (aetheryteName == null) return; var aetheryte = Aetherytes.Aetherytes.FirstOrDefault(a => a.NameList[ClientLanguage.English] == aetheryteName); if (aetheryte != null) territory.Aetherytes.Add(aetheryte); else PluginLog.Error($"Tried to add {aetheryteName} to {territory.NameList[ClientLanguage.English]}, but aetheryte not found."); }
public Territory[] GenerateCountries(Territory planet, int count) { var countries = new List<Territory>(); for (var i = 0; i < count; i++) { var newCountry = new Territory(_professionCache, _personCache, planet) { Name = _countryNames.OrderBy(_ => Guid.NewGuid()).First(), Category = GalaxyCategoryEnum.Country.ToString(), SustainsLife = true }; while (_usedNames.Contains(newCountry.Name)) { newCountry.Name = _countryNames.OrderBy(_ => Guid.NewGuid()).First(); } _usedNames.Add(newCountry.Name); countries.Add(newCountry); } return countries.ToArray(); }
public void InitiateCombat(Territory atkTer, Territory defTer, Player atkPlayer, TerritoryOwner defPlayer) { float combatDif = atkTer.Atk / defTer.Def; if (combatDif <= 0.2) { GameManager.Instance.ShowMessage("You lose!", 3); LoseUnits(atkPlayer); } else if (combatDif >= 1.5) { defTer.ChangeOwnership(atkPlayer); atkPlayer.fortune = 0; GameManager.Instance.ShowMessage("You win!", 3); } else if (combatDif > 0.2 && combatDif < 1.5) { float result = Random.Range(0f, 1f); Debug.Log(result + atkPlayer.fortune + "/" + combatDif); if (result + atkPlayer.fortune >= combatDif) { defTer.ChangeOwnership(atkPlayer); atkPlayer.fortune = 0; GameManager.Instance.ShowMessage("You win!", 3); } else if (result + atkPlayer.fortune < combatDif) { atkPlayer.fortune += combatDif - result; GameManager.Instance.ShowMessage("You lose!", 3); LoseUnits(atkPlayer); } } defPlayer.UpdateStats(); atkPlayer.UpdateStats(); //atkPlayer.EndStep(); }
public List <Territory> GetTerritoryName() { conn = new SqlConnection(cs.DBConn); conn.Open(); string query = "Select TerritoryId,TerritoryName from Territory "; cmd = new SqlCommand(query, conn); List <Territory> aTerritories = new List <Territory>(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { string territoryId = reader[0].ToString(); string territopryName = reader[1].ToString(); Territory aterritory = new Territory(); aterritory.TerritoryId = Convert.ToInt32(territoryId); aterritory.TerritoryName = territopryName; aTerritories.Add(aterritory); } conn.Close(); return(aTerritories); }
/// <summary> /// Checks whether coordinate system is located within specified extents (taking into account SelectionMode) /// </summary> private bool WithinExtents(BoundingBox extents, Territory cs) { switch (_selectionMode) { case ProjectionSelectionMode.Include: // extents should cover coordinate system return(extents.xMin <= cs.Left && extents.xMax >= cs.Right && extents.yMin <= cs.Bottom && extents.yMax >= cs.Top); case ProjectionSelectionMode.IsIncluded: // coordinate system should cover extents return(cs.Left <= extents.xMin && cs.Right >= extents.xMax && cs.Bottom <= extents.yMin && cs.Top >= extents.yMax); case ProjectionSelectionMode.Intersection: // the case of intersection ( the non-intersection hypothesis is checked ) return (!(cs.Left > extents.xMax || cs.Right < extents.xMin || cs.Bottom > extents.yMax || cs.Top < extents.yMin)); default: return(true); } }
public bool Insertar(Territory territory) { Console.WriteLine("Digite el ID:"); territory.TerritoryID = Console.ReadLine(); Console.WriteLine("Digite la descripcion:"); territory.TerritoryDescription = Console.ReadLine(); Console.WriteLine("Digite el ID de region:"); try { territory.RegionID = Convert.ToInt32(Console.ReadLine()); } catch (Exception) { Console.WriteLine("Valor invalido"); Console.ReadLine(); return(false); } try { using (NorthwindEntities n = new NorthwindEntities()) { n.Territories.Add(territory); n.SaveChanges(); Console.WriteLine("El territorio ha sido agregado"); Console.ReadLine(); } return(true); } catch (Exception) { Console.WriteLine("No se pudo ejecutar la accion"); Console.ReadLine(); return(false); } }
public bool Eliminar(Territory territory) { Console.WriteLine("Digite el ID:"); territory.TerritoryID = Console.ReadLine(); try { using (NorthwindEntities n = new NorthwindEntities()) { var resultado = n.Territories.Where(a => a.TerritoryID == territory.TerritoryID).Select(x => x).FirstOrDefault(); n.Territories.Remove(resultado); n.SaveChanges(); Console.WriteLine("El territorio ha sido eliminado"); Console.ReadLine(); } return(true); } catch (Exception) { Console.WriteLine("No se pudo ejecutar la accion"); Console.ReadLine(); return(false); } }
public ActionResult AddNewTerritory(Territory model) { ViewBag.RegionId = new SelectList(_iRegionManager.GetAll(), "RegionId", "RegionName"); try { if (ModelState.IsValid) { var user = (ViewUser)Session["user"]; model.AddedByUserId = user.UserId; var result = _iTerritoryManager.Add(model); if (result) { ModelState.Clear(); return(RedirectToAction("All")); } } return(View()); } catch (Exception exception) { string message = exception.Message; return(View()); } }
private Tile GetTile(Territory t) { Tile tile; switch (t.GetTerritoryType()) { case Territory.Type.PLAIN: tile = Instantiate(plains); break; case Territory.Type.FOREST: tile = Instantiate(forests); break; case Territory.Type.MOUNTAIN: tile = Instantiate(mountains); break; case Territory.Type.SWAMP: tile = Instantiate(swamps); break; case Territory.Type.DESERT: tile = Instantiate(deserts); break; case Territory.Type.WATER: tile = Instantiate(waters); break; case Territory.Type.CIRCLE: tile = Instantiate(circle); break; default: tile = null; break; } return(tile); }
public string GetTerritoryNameByTerritoryGUID(Guid TerritoryGUID) { //using (var dataContext = new WorkersInMotionDB()) //{ // return (from p in dataContext.Territories // where p.TerritoryGUID == TerritoryGUID // select p.Name).SingleOrDefault(); //} SqlParameter[] Param = new SqlParameter[1]; Param[0] = new SqlParameter("@pTerritoryGUID", SqlDbType.UniqueIdentifier); Param[0].Value = TerritoryGUID; Territory uTerritory = context.Database.SqlQuery <Territory>("Select * from Territories where TerritoryGUID=@pTerritoryGUID", Param).FirstOrDefault(); if (uTerritory != null) { return(uTerritory.Name); } else { return(string.Empty); } }
public static IEnumerable <Employee> GetEmployees(this Territory territory) { return(EmployesImpl().Compile()(territory)); }
private void InitiateCapture(Territory defTer) { float combatDif = Atk / defTer.Def; if (combatDif <= 0.2) { GameManager.Instance.ShowMessage("You Lose!", 3); if (GameManager.Instance.whoseTurn.playerName == "Eye") { EventManager.Instance.OnStartCombatAnimation("Defeat", "attackEye"); } if (GameManager.Instance.whoseTurn.playerName == "Teeth") { EventManager.Instance.OnStartCombatAnimation("Defeat", "attackTeeth"); } } else if (combatDif >= 1.5) { CaptureCultists(defTer, Settings.Instance.captureAmount); GameManager.Instance.ShowMessage("You Win!", 3); if (GameManager.Instance.whoseTurn.playerName == "Eye") { EventManager.Instance.OnStartCombatAnimation("Victory", "attackEye"); } if (GameManager.Instance.whoseTurn.playerName == "Teeth") { EventManager.Instance.OnStartCombatAnimation("Victory", "attackTeeth"); } } else if (combatDif > 0.2 && combatDif < 1.5) { float result = Random.Range(0f, 1f); Debug.Log(result + owner.fortune + "/" + combatDif); if (result + owner.fortune >= combatDif) { CaptureCultists(defTer, captureAmount); GameManager.Instance.ShowMessage("You Win!", 3); if (GameManager.Instance.whoseTurn.playerName == "Eye") { EventManager.Instance.OnStartCombatAnimation("Victory", "attackEye"); } if (GameManager.Instance.whoseTurn.playerName == "Teeth") { EventManager.Instance.OnStartCombatAnimation("Victory", "attackTeeth"); } } else if (result + owner.fortune < combatDif) { if (GameManager.Instance.whoseTurn.playerName == "Eye") { EventManager.Instance.OnStartCombatAnimation("Defeat", "attackEye"); } if (GameManager.Instance.whoseTurn.playerName == "Teeth") { EventManager.Instance.OnStartCombatAnimation("Defeat", "attackTeeth"); } } } GameManager.Instance.ClearCombatTerritories(); UpdateStats(); if (owner != null) { owner.UpdateStats(); } defTer.UpdateStats(); if (defTer.owner != null) { defTer.owner.UpdateStats(); } }
public Territory[] getPath(Territory from, Territory to, int range) { Node[] path = map.getPathFinder().findPath(map.getPathFinder().getNode(from.gameObject.transform.position.x, from.gameObject.transform.position.z, 0), map.getPathFinder().getNode(to.gameObject.transform.position.x, to.gameObject.transform.position.z, 0), range); return(map.getPathFinder().toTerritories(path)); }
private void FactionWins(Territory territory, Player player) { Debug.Log("This faction wins !" + territory.FactionNum); }
public virtual void setTerritory(Territory territory) { this.territory = territory; transform.position = new Vector3(territory.transform.position.x, transform.position.y, territory.transform.position.z); }
public static void TerritoryRefresh(bool resetStoredData = false) { Territories.Clear(); TerritoryList.Clear(); SpawnResources.RefreshEntityLists(); FirstRun = false; var regularSpawnGroups = MyDefinitionManager.Static.GetSpawnGroupDefinitions(); foreach (var spawnGroup in regularSpawnGroups) { if (spawnGroup.Enabled == false) { continue; } //Check For New Tags if (spawnGroup.DescriptionText != null) { if (spawnGroup.DescriptionText.Contains("[Modular Encounters Territory]") == true) { var territory = GetNewTerritoryDetails(spawnGroup); if (resetStoredData == false) { territory.Active = GetSetTerritoryData(territory.Name, territory.Active); } else { ResetStoredTerritoryData(territory.Name, territory.Active); } Territories.Add(territory); Logger.AddMsg("Custom Territory Found: " + territory.Name); continue; } } //Check For Old Tags if (spawnGroup.Prefabs.Count > 0) { if (spawnGroup.Prefabs[0].SubtypeId == "TerritoryPlaceholder") { var territory = GetOldTerritoryDetails(spawnGroup); if (resetStoredData == false) { territory.Active = GetSetTerritoryData(territory.Name, territory.Active); } else { ResetStoredTerritoryData(territory.Name, territory.Active); } Territories.Add(territory); Logger.AddMsg("Custom Territory Found: " + territory.Name); continue; } } } foreach (var fullTerritory in Territories) { if (fullTerritory.BadTerritory == true && fullTerritory.Active == false) { continue; } if (fullTerritory.Type == "Static") { var territory = new Territory(); territory.Name = fullTerritory.Name; territory.TerritoryDefinition = fullTerritory; territory.Active = fullTerritory.Active; territory.Position = fullTerritory.Position; territory.Radius = fullTerritory.Radius; territory.NoSpawnZone = fullTerritory.NoSpawnZone; territory.StrictTerritory = fullTerritory.StrictTerritory; territory.FactionTagWhitelist = fullTerritory.FactionTagWhitelist; territory.FactionTagBlacklist = fullTerritory.FactionTagBlacklist; territory.AnnounceArriveDepart = fullTerritory.AnnounceArriveDepart; territory.CustomArriveMessage = fullTerritory.CustomArriveMessage; territory.CustomDepartMessage = fullTerritory.CustomDepartMessage; TerritoryList.Add(territory); } else { foreach (var planet in SpawnResources.PlanetList) { if (planet == null) { continue; } var planetName = planet.Generator.Id.SubtypeId.ToString(); if (fullTerritory.PlanetGeneratorName != planetName) { continue; } var surfaceCoords = Vector3D.Zero; var planetEntity = planet as IMyEntity; if (fullTerritory.Position != Vector3D.Zero) { var directional = fullTerritory.Position * 1000 + planetEntity.GetPosition(); surfaceCoords = SpawnResources.GetNearestSurfacePoint(directional, planet); } else { surfaceCoords = planetEntity.GetPosition(); } var territory = new Territory(); territory.Name = fullTerritory.Name; territory.TerritoryDefinition = fullTerritory; territory.Active = fullTerritory.Active; territory.Position = surfaceCoords; if (fullTerritory.ScaleRadiusWithPlanetSize == true) { var unit = territory.Radius / 60000; var radius = (double)planet.AverageRadius * unit; territory.Radius = radius; } else { territory.Radius = fullTerritory.Radius; } territory.NoSpawnZone = fullTerritory.NoSpawnZone; territory.StrictTerritory = fullTerritory.StrictTerritory; territory.FactionTagWhitelist = fullTerritory.FactionTagWhitelist; territory.FactionTagBlacklist = fullTerritory.FactionTagBlacklist; territory.AnnounceArriveDepart = fullTerritory.AnnounceArriveDepart; territory.CustomArriveMessage = fullTerritory.CustomArriveMessage; territory.CustomDepartMessage = fullTerritory.CustomDepartMessage; TerritoryList.Add(territory); } } } }
private void detach_Territories(Territory entity) { this.SendPropertyChanging(); entity.Region = null; }
partial void DeleteTerritory(Territory instance);
partial void UpdateTerritory(Territory instance);
partial void InsertTerritory(Territory instance);
public TerritoryVisual(Point2D point, Territory territory) : base(point) { _Territory = territory; Init(); }
public static List<Territory> MakeTerritories() { List<Territory> AllTerritories = new List<Territory>(); Territory CastleBlack = new Territory("CastleBlack", null, TerritoryType.LandArea, false, false, 1, 0); AllTerritories.Add(CastleBlack); Territory Karhold = new Territory("Karhold", null, TerritoryType.LandArea, false, false, 1, 0); AllTerritories.Add(Karhold); Territory Winterfell = new Territory("Winterfell", null, TerritoryType.LandArea, false, true, 1, 1); AllTerritories.Add(Winterfell); Territory WinterfellHarbor = new Territory("WinterfellHarbor", null, TerritoryType.HarborArea, false, false, 0, 0); AllTerritories.Add(WinterfellHarbor); Territory TheStonyShore = new Territory("TheStonyShore", null, TerritoryType.LandArea, false, false, 0, 1); AllTerritories.Add(TheStonyShore); Territory WhiteHarbor = new Territory("WhiteHarbor", null, TerritoryType.LandArea, true, false, 0, 0); AllTerritories.Add(WhiteHarbor); Territory WhiteHarborHarbor = new Territory("WhiteHarborHarbor", null, TerritoryType.HarborArea, false, false, 0, 0); AllTerritories.Add(WhiteHarborHarbor); Territory WidowsWatch = new Territory("WidowsWatch", null, TerritoryType.LandArea, false, false, 0, 1); AllTerritories.Add(WidowsWatch); Territory TheShiveringSea = new Territory("TheShiveringSea", null, TerritoryType.SeaArea, false, false, 0, 0); AllTerritories.Add(TheShiveringSea); Territory BayOfIce = new Territory("BayOfIce", null, TerritoryType.SeaArea, false, false, 0, 0); AllTerritories.Add(BayOfIce); Territory MoatCalin = new Territory("MoatCalin", null, TerritoryType.LandArea, true, false, 0, 0); AllTerritories.Add(MoatCalin); Territory GreywaterWatch = new Territory("GreywaterWatch", null, TerritoryType.LandArea, false, false, 0, 1); AllTerritories.Add(GreywaterWatch); Territory FlintsFinger = new Territory("FlintsFinger", null, TerritoryType.LandArea, true, false, 0, 0); AllTerritories.Add(FlintsFinger); Territory Seagard = new Territory("Seagard", null, TerritoryType.LandArea, false, true, 1, 1); AllTerritories.Add(Seagard); Territory TheTwins = new Territory("TheTwins", null, TerritoryType.LandArea, false, false, 1, 0); AllTerritories.Add(TheTwins); Territory TheFingers = new Territory("TheFingers", null, TerritoryType.LandArea, false, false, 0, 1); AllTerritories.Add(TheFingers); Territory TheMountiansOfTheMoon = new Territory("TheMountiansOfTheMoon", null, TerritoryType.LandArea, false, false, 0, 1); AllTerritories.Add(TheMountiansOfTheMoon); Territory TheEyrie = new Territory("TheEyrie", null, TerritoryType.LandArea, true, false, 1, 1); AllTerritories.Add(TheEyrie); Territory Pyke = new Territory("Pyke", null, TerritoryType.LandArea, false, true, 1, 1); AllTerritories.Add(Pyke); Territory PykeHarbor = new Territory("PykeHarbor", null, TerritoryType.HarborArea, false, false, 0, 0); AllTerritories.Add(PykeHarbor); Territory IronmansBay = new Territory("IronmansBay", null, TerritoryType.SeaArea, false, false, 0, 0); AllTerritories.Add(IronmansBay); Territory SunsetSea = new Territory("SunsetSea", null, TerritoryType.SeaArea, false, false, 0, 0); AllTerritories.Add(SunsetSea); Territory Riverrun = new Territory("Riverrun", null, TerritoryType.LandArea, false, true, 1, 1); AllTerritories.Add(Riverrun); Territory Lannisport = new Territory("Lannisport", null, TerritoryType.LandArea, false, true, 0, 2); AllTerritories.Add(Lannisport); Territory LannisportHarbor = new Territory("LannisportHarbor", null, TerritoryType.HarborArea, false, false, 0, 0); AllTerritories.Add(LannisportHarbor); Territory TheGoldenSound = new Territory("TheGoldenSound", null, TerritoryType.SeaArea, false, false, 0, 0); AllTerritories.Add(TheGoldenSound); Territory StonySept = new Territory("StoneySept", null, TerritoryType.LandArea, false, false, 1, 0); AllTerritories.Add(StonySept); Territory Harrenhal = new Territory("Harrenhal", null, TerritoryType.LandArea, true, false, 1, 0); AllTerritories.Add(Harrenhal); Territory SearoadMarches = new Territory("SearoadMarches", null, TerritoryType.LandArea, false, false, 0, 1); AllTerritories.Add(SearoadMarches); Territory CracklawPoint = new Territory("CracklawPoint", null, TerritoryType.LandArea, true, false, 0, 0); AllTerritories.Add(CracklawPoint); Territory Blackwater = new Territory("Blackwater", null, TerritoryType.LandArea, false, false, 0, 2); AllTerritories.Add(Blackwater); Territory KingsLanding = new Territory("KingsLanding", null, TerritoryType.LandArea, false, true, 2, 0); AllTerritories.Add(KingsLanding); Territory TheNarrowSea = new Territory("TheNarrowSea", null, TerritoryType.SeaArea, false, false, 0, 0); AllTerritories.Add(TheNarrowSea); Territory BlackwaterBay = new Territory("BlackwaterBay", null, TerritoryType.SeaArea, false, false, 0, 0); AllTerritories.Add(BlackwaterBay); Territory ShipbreakerBay = new Territory("ShipbreakerBay", null, TerritoryType.SeaArea, false, false, 0, 0); AllTerritories.Add(ShipbreakerBay); Territory Dragonstone = new Territory("Dragonstone", null, TerritoryType.LandArea, false, true, 1, 1); AllTerritories.Add(Dragonstone); Territory DragonstoneHarbor = new Territory("DragonstoneHarbor", null, TerritoryType.HarborArea, false, false, 0, 0); AllTerritories.Add(DragonstoneHarbor); Territory Kingswood = new Territory("Kingswood", null, TerritoryType.LandArea, false, false, 1, 1); AllTerritories.Add(Kingswood); Territory TheReach = new Territory("TheReach", null, TerritoryType.LandArea, true, false, 0, 0); AllTerritories.Add(TheReach); Territory Highgarden = new Territory("Highgarden", null, TerritoryType.LandArea, false, true, 0, 2); AllTerritories.Add(Highgarden); Territory Oldtown = new Territory("Oldtown", null, TerritoryType.LandArea, false, true, 0, 0); AllTerritories.Add(Oldtown); Territory OldtownHarbor = new Territory("OldtownHarbor", null, TerritoryType.HarborArea, false, false, 0, 0); AllTerritories.Add(OldtownHarbor); Territory RedwyneStraights = new Territory("RedwyneStraights", null, TerritoryType.SeaArea, false, false, 0, 0); AllTerritories.Add(RedwyneStraights); Territory TheArbor = new Territory("TheArbor", null, TerritoryType.LandArea, false, false, 1, 0); AllTerritories.Add(TheArbor); Territory WestSummerSea = new Territory("WestSummerSea", null, TerritoryType.SeaArea, false, false, 0, 0); AllTerritories.Add(WestSummerSea); Territory ThreeTowers = new Territory("ThreeTowers", null, TerritoryType.LandArea, false, false, 0, 1); AllTerritories.Add(ThreeTowers); Territory DornishMarches = new Territory("DornishMarches", null, TerritoryType.LandArea, false, false, 1, 0); AllTerritories.Add(DornishMarches); Territory PrincesPass = new Territory("PrincesPass", null, TerritoryType.LandArea, false, false, 1, 1); AllTerritories.Add(PrincesPass); Territory TheBoneway = new Territory("TheBoneway", null, TerritoryType.LandArea, false, false, 1, 0); AllTerritories.Add(TheBoneway); Territory StormsEnd = new Territory("StormsEnd", null, TerritoryType.LandArea, true, false, 0, 0); AllTerritories.Add(StormsEnd); Territory StormsEndHarbor = new Territory("StormsEndHarbor", null, TerritoryType.HarborArea, false, false, 0, 0); AllTerritories.Add(StormsEndHarbor); Territory Starfall = new Territory("Starfall", null, TerritoryType.LandArea, true, false, 0, 0); AllTerritories.Add(Starfall); Territory Yronwood = new Territory("Yronwood", null, TerritoryType.LandArea, true, false, 0, 0); AllTerritories.Add(Yronwood); Territory SaltShore = new Territory("SaltShore", null, TerritoryType.LandArea, false, false, 0, 1); AllTerritories.Add(SaltShore); Territory Sunspear = new Territory("Sunspear", null, TerritoryType.LandArea, false, true, 1, 1); AllTerritories.Add(Sunspear); Territory SunspearHarbor = new Territory("SunspearHarbor", null, TerritoryType.HarborArea, false, false, 0, 0); AllTerritories.Add(SunspearHarbor); Territory SeaOfDorne = new Territory("SeaOfDorne", null, TerritoryType.SeaArea, false, false, 0, 0); AllTerritories.Add(SeaOfDorne); Territory EastSummerSea = new Territory("EastSummerSea", null, TerritoryType.SeaArea, false, false, 0, 0); AllTerritories.Add(EastSummerSea); List<Territory> CastleBlackAdj = new List<Territory>(); CastleBlackAdj.Add(BayOfIce); CastleBlackAdj.Add(TheShiveringSea); CastleBlackAdj.Add(Karhold); CastleBlackAdj.Add(Winterfell); CastleBlack.AdjecantTerritories = CastleBlackAdj; List<Territory> KarholdAdj = new List<Territory>(); KarholdAdj.Add(CastleBlack); KarholdAdj.Add(TheShiveringSea); KarholdAdj.Add(Winterfell); Karhold.AdjecantTerritories = KarholdAdj; List<Territory> WinterfellAdj = new List<Territory>(); WinterfellAdj.Add(BayOfIce); WinterfellAdj.Add(TheShiveringSea); WinterfellAdj.Add(Karhold); WinterfellAdj.Add(CastleBlack); WinterfellAdj.Add(WhiteHarbor); WinterfellAdj.Add(TheStonyShore); WinterfellAdj.Add(MoatCalin); Winterfell.AdjecantTerritories = WinterfellAdj; List<Territory> WinterfellHarborAdj = new List<Territory>(); WinterfellHarborAdj.Add(BayOfIce); WinterfellHarbor.AdjecantTerritories = WinterfellHarborAdj; List<Territory> BayOfIceAdj = new List<Territory>(); BayOfIceAdj.Add(CastleBlack); BayOfIceAdj.Add(WinterfellHarbor); BayOfIceAdj.Add(Winterfell); BayOfIceAdj.Add(TheStonyShore); BayOfIceAdj.Add(SunsetSea); BayOfIceAdj.Add(FlintsFinger); BayOfIceAdj.Add(GreywaterWatch); BayOfIce.AdjecantTerritories = BayOfIceAdj; List<Territory> TheStonyShoreAdj = new List<Territory>(); TheStonyShoreAdj.Add(BayOfIce); TheStonyShoreAdj.Add(Winterfell); TheStonyShore.AdjecantTerritories = TheStonyShoreAdj; List<Territory> WhiteHarborAdj = new List<Territory>(); WhiteHarborAdj.Add(Winterfell); WhiteHarborAdj.Add(TheShiveringSea); WhiteHarborAdj.Add(TheNarrowSea); WhiteHarborAdj.Add(WidowsWatch); WhiteHarborAdj.Add(MoatCalin); WhiteHarbor.AdjecantTerritories = WhiteHarborAdj; List<Territory> TheShiveringSeaAdj = new List<Territory>(); TheShiveringSeaAdj.Add(CastleBlack); TheShiveringSeaAdj.Add(Karhold); TheShiveringSeaAdj.Add(Winterfell); TheShiveringSeaAdj.Add(WidowsWatch); TheShiveringSeaAdj.Add(WhiteHarbor); TheShiveringSeaAdj.Add(TheNarrowSea); TheShiveringSea.AdjecantTerritories = TheShiveringSeaAdj; List<Territory> WhiteHarborHarborAdj = new List<Territory>(); WhiteHarborHarborAdj.Add(TheNarrowSea); WhiteHarborHarbor.AdjecantTerritories = WhiteHarborHarborAdj; List<Territory> WidowsWatchAdj = new List<Territory>(); WidowsWatchAdj.Add(WhiteHarbor); WidowsWatchAdj.Add(TheShiveringSea); WidowsWatchAdj.Add(TheNarrowSea); WidowsWatch.AdjecantTerritories = WidowsWatchAdj; List<Territory> MoatCalinAdj = new List<Territory>(); MoatCalinAdj.Add(Winterfell); MoatCalinAdj.Add(WhiteHarbor); MoatCalinAdj.Add(TheNarrowSea); MoatCalinAdj.Add(GreywaterWatch); MoatCalinAdj.Add(Seagard); MoatCalinAdj.Add(TheTwins); MoatCalin.AdjecantTerritories = MoatCalinAdj; List<Territory> GreywaterWatchAdj = new List<Territory>(); GreywaterWatchAdj.Add(BayOfIce); GreywaterWatchAdj.Add(IronmansBay); GreywaterWatchAdj.Add(FlintsFinger); GreywaterWatchAdj.Add(MoatCalin); GreywaterWatchAdj.Add(Seagard); GreywaterWatch.AdjecantTerritories = GreywaterWatchAdj; List<Territory> FlintsFingerAdj = new List<Territory>(); FlintsFingerAdj.Add(BayOfIce); FlintsFingerAdj.Add(IronmansBay); FlintsFingerAdj.Add(GreywaterWatch); FlintsFingerAdj.Add(SunsetSea); FlintsFinger.AdjecantTerritories = FlintsFingerAdj; List<Territory> SunsetSeaAdj = new List<Territory>(); SunsetSeaAdj.Add(BayOfIce); SunsetSeaAdj.Add(IronmansBay); SunsetSeaAdj.Add(FlintsFinger); SunsetSeaAdj.Add(SearoadMarches); SunsetSeaAdj.Add(TheGoldenSound); SunsetSeaAdj.Add(WestSummerSea); SunsetSea.AdjecantTerritories = SunsetSeaAdj; List<Territory> IronmansBayAdj = new List<Territory>(); IronmansBayAdj.Add(Pyke); IronmansBayAdj.Add(PykeHarbor); IronmansBayAdj.Add(FlintsFinger); IronmansBayAdj.Add(GreywaterWatch); IronmansBayAdj.Add(Seagard); IronmansBayAdj.Add(TheGoldenSound); IronmansBayAdj.Add(SunsetSea); IronmansBayAdj.Add(Riverrun); IronmansBay.AdjecantTerritories = IronmansBayAdj; List<Territory> PykeAdj = new List<Territory>(); PykeAdj.Add(IronmansBay); Pyke.AdjecantTerritories = PykeAdj; List<Territory> PykeHarborAdj = new List<Territory>(); PykeHarborAdj.Add(IronmansBay); PykeHarbor.AdjecantTerritories = PykeHarborAdj; List<Territory> SeagardAdj = new List<Territory>(); SeagardAdj.Add(GreywaterWatch); SeagardAdj.Add(IronmansBay); SeagardAdj.Add(MoatCalin); SeagardAdj.Add(TheTwins); SeagardAdj.Add(Riverrun); Seagard.AdjecantTerritories = SeagardAdj; List<Territory> TheTwinsAdj = new List<Territory>(); TheTwinsAdj.Add(Seagard); TheTwinsAdj.Add(MoatCalin); TheTwinsAdj.Add(TheFingers); TheTwinsAdj.Add(TheMountiansOfTheMoon); TheTwinsAdj.Add(TheNarrowSea); TheTwins.AdjecantTerritories = TheTwinsAdj; List<Territory> TheFingersAdj = new List<Territory>(); TheFingersAdj.Add(TheTwins); TheFingersAdj.Add(TheNarrowSea); TheFingersAdj.Add(TheMountiansOfTheMoon); TheFingers.AdjecantTerritories = TheFingersAdj; List<Territory> TheMountiansOfTheMoonAdj = new List<Territory>(); TheMountiansOfTheMoonAdj.Add(TheTwins); TheMountiansOfTheMoonAdj.Add(TheNarrowSea); TheMountiansOfTheMoonAdj.Add(TheFingers); TheMountiansOfTheMoonAdj.Add(TheEyrie); TheMountiansOfTheMoon.AdjecantTerritories = TheMountiansOfTheMoonAdj; List<Territory> TheEyrieAdj = new List<Territory>(); TheEyrieAdj.Add(TheMountiansOfTheMoon); TheEyrieAdj.Add(TheNarrowSea); TheEyrie.AdjecantTerritories = TheEyrieAdj; List<Territory> TheNarrowSeaAdj = new List<Territory>(); TheNarrowSeaAdj.Add(TheShiveringSea); TheNarrowSeaAdj.Add(WhiteHarbor); TheNarrowSeaAdj.Add(WhiteHarborHarbor); TheNarrowSeaAdj.Add(WidowsWatch); TheNarrowSeaAdj.Add(MoatCalin); TheNarrowSeaAdj.Add(TheTwins); TheNarrowSeaAdj.Add(TheFingers); TheNarrowSeaAdj.Add(TheMountiansOfTheMoon); TheNarrowSeaAdj.Add(TheEyrie); TheNarrowSeaAdj.Add(ShipbreakerBay); TheNarrowSeaAdj.Add(CracklawPoint); TheNarrowSea.AdjecantTerritories = TheNarrowSeaAdj; List<Territory> TheGoldenSoundAdj = new List<Territory>(); TheGoldenSoundAdj.Add(IronmansBay); TheGoldenSoundAdj.Add(SunsetSea); TheGoldenSoundAdj.Add(Lannisport); TheGoldenSoundAdj.Add(LannisportHarbor); TheGoldenSoundAdj.Add(Riverrun); TheGoldenSoundAdj.Add(SearoadMarches); TheGoldenSound.AdjecantTerritories = TheGoldenSoundAdj; List<Territory> RiverrunAdj = new List<Territory>(); RiverrunAdj.Add(Seagard); RiverrunAdj.Add(IronmansBay); RiverrunAdj.Add(TheGoldenSound); RiverrunAdj.Add(Lannisport); RiverrunAdj.Add(Harrenhal); RiverrunAdj.Add(StonySept); Riverrun.AdjecantTerritories = RiverrunAdj; List<Territory> LannisportAdj = new List<Territory>(); LannisportAdj.Add(TheGoldenSound); LannisportAdj.Add(Riverrun); LannisportAdj.Add(SearoadMarches); LannisportAdj.Add(StonySept); Lannisport.AdjecantTerritories = LannisportAdj; List<Territory> LannisportHarborAdj = new List<Territory>(); LannisportHarborAdj.Add(TheGoldenSound); LannisportHarbor.AdjecantTerritories = LannisportHarborAdj; List<Territory> SearoadMarchesAdj = new List<Territory>(); SearoadMarchesAdj.Add(WestSummerSea); SearoadMarchesAdj.Add(SunsetSea); SearoadMarchesAdj.Add(TheGoldenSound); SearoadMarchesAdj.Add(Highgarden); SearoadMarchesAdj.Add(TheReach); SearoadMarchesAdj.Add(Blackwater); SearoadMarchesAdj.Add(StonySept); SearoadMarchesAdj.Add(Lannisport); SearoadMarches.AdjecantTerritories = SearoadMarchesAdj; List<Territory> StonySeptAdj = new List<Territory>(); StonySeptAdj.Add(Riverrun); StonySeptAdj.Add(Lannisport); StonySeptAdj.Add(SearoadMarches); StonySeptAdj.Add(Harrenhal); StonySeptAdj.Add(Blackwater); StonySept.AdjecantTerritories = StonySeptAdj; List<Territory> HarrenhalAdj = new List<Territory>(); HarrenhalAdj.Add(Riverrun); HarrenhalAdj.Add(StonySept); HarrenhalAdj.Add(Blackwater); HarrenhalAdj.Add(CracklawPoint); Harrenhal.AdjecantTerritories = HarrenhalAdj; List<Territory> CracklawPointAdj = new List<Territory>(); CracklawPointAdj.Add(TheMountiansOfTheMoon); CracklawPointAdj.Add(Harrenhal); CracklawPointAdj.Add(Blackwater); CracklawPointAdj.Add(KingsLanding); CracklawPointAdj.Add(BlackwaterBay); CracklawPointAdj.Add(ShipbreakerBay); CracklawPointAdj.Add(TheNarrowSea); CracklawPoint.AdjecantTerritories = CracklawPointAdj; List<Territory> BlackwaterBayAdj = new List<Territory>(); BlackwaterBayAdj.Add(CracklawPoint); BlackwaterBayAdj.Add(KingsLanding); BlackwaterBayAdj.Add(Kingswood); BlackwaterBayAdj.Add(ShipbreakerBay); BlackwaterBay.AdjecantTerritories = BlackwaterBayAdj; List<Territory> KingsLandingAdj = new List<Territory>(); KingsLandingAdj.Add(CracklawPoint); KingsLandingAdj.Add(Blackwater); KingsLandingAdj.Add(Kingswood); KingsLandingAdj.Add(TheReach); KingsLandingAdj.Add(BlackwaterBay); KingsLanding.AdjecantTerritories = KingsLandingAdj; List<Territory> ShipbreakerBayAdj = new List<Territory>(); ShipbreakerBayAdj.Add(TheNarrowSea); ShipbreakerBayAdj.Add(Dragonstone); ShipbreakerBayAdj.Add(DragonstoneHarbor); ShipbreakerBayAdj.Add(CracklawPoint); ShipbreakerBayAdj.Add(BlackwaterBay); ShipbreakerBayAdj.Add(Kingswood); ShipbreakerBayAdj.Add(StormsEnd); ShipbreakerBayAdj.Add(StormsEndHarbor); ShipbreakerBayAdj.Add(EastSummerSea); ShipbreakerBay.AdjecantTerritories = ShipbreakerBayAdj; List<Territory> DragonStoneAdj = new List<Territory>(); DragonStoneAdj.Add(ShipbreakerBay); Dragonstone.AdjecantTerritories = DragonStoneAdj; List<Territory> DragonStoneHarborAdj = new List<Territory>(); DragonStoneHarborAdj.Add(ShipbreakerBay); DragonstoneHarbor.AdjecantTerritories = DragonStoneHarborAdj; List<Territory> KingswoodAdj = new List<Territory>(); KingswoodAdj.Add(KingsLanding); KingswoodAdj.Add(TheReach); KingswoodAdj.Add(TheBoneway); KingswoodAdj.Add(StormsEnd); KingswoodAdj.Add(BlackwaterBay); KingswoodAdj.Add(ShipbreakerBay); Kingswood.AdjecantTerritories = KingswoodAdj; List<Territory> StormsEndAdj = new List<Territory>(); StormsEndAdj.Add(Kingswood); StormsEndAdj.Add(TheBoneway); StormsEndAdj.Add(SeaOfDorne); StormsEndAdj.Add(EastSummerSea); StormsEndAdj.Add(ShipbreakerBay); StormsEnd.AdjecantTerritories = StormsEndAdj; List<Territory> StormsEndHarborAdj = new List<Territory>(); StormsEndHarborAdj.Add(ShipbreakerBay); StormsEndHarbor.AdjecantTerritories = StormsEndHarborAdj; List<Territory> BlackwaterAdj = new List<Territory>(); BlackwaterAdj.Add(Harrenhal); BlackwaterAdj.Add(StonySept); BlackwaterAdj.Add(SearoadMarches); BlackwaterAdj.Add(TheReach); BlackwaterAdj.Add(KingsLanding); BlackwaterAdj.Add(CracklawPoint); Blackwater.AdjecantTerritories = BlackwaterAdj; List<Territory> TheReachAdj = new List<Territory>(); TheReachAdj.Add(KingsLanding); TheReachAdj.Add(Blackwater); TheReachAdj.Add(SearoadMarches); TheReachAdj.Add(Highgarden); TheReachAdj.Add(DornishMarches); TheReachAdj.Add(TheBoneway); TheReachAdj.Add(Kingswood); TheReach.AdjecantTerritories = TheReachAdj; List<Territory> HighgardenAdj = new List<Territory>(); HighgardenAdj.Add(WestSummerSea); HighgardenAdj.Add(RedwyneStraights); HighgardenAdj.Add(Oldtown); HighgardenAdj.Add(DornishMarches); HighgardenAdj.Add(TheReach); HighgardenAdj.Add(SearoadMarches); Highgarden.AdjecantTerritories = HighgardenAdj; List<Territory> WestSummerSeaAdj = new List<Territory>(); WestSummerSeaAdj.Add(SunsetSea); WestSummerSeaAdj.Add(SearoadMarches); WestSummerSeaAdj.Add(Highgarden); WestSummerSeaAdj.Add(RedwyneStraights); WestSummerSeaAdj.Add(TheArbor); WestSummerSeaAdj.Add(ThreeTowers); WestSummerSeaAdj.Add(Starfall); WestSummerSeaAdj.Add(EastSummerSea); WestSummerSea.AdjecantTerritories = WestSummerSeaAdj; List<Territory> RedwyneStraightsAdj = new List<Territory>(); RedwyneStraightsAdj.Add(WestSummerSea); RedwyneStraightsAdj.Add(Highgarden); RedwyneStraightsAdj.Add(Oldtown); RedwyneStraightsAdj.Add(OldtownHarbor); RedwyneStraightsAdj.Add(TheArbor); RedwyneStraightsAdj.Add(ThreeTowers); RedwyneStraights.AdjecantTerritories = RedwyneStraightsAdj; List<Territory> TheArborAdj = new List<Territory>(); TheArborAdj.Add(RedwyneStraights); TheArborAdj.Add(WestSummerSea); TheArbor.AdjecantTerritories = TheArborAdj; List<Territory> OldtownHarborAdj = new List<Territory>(); OldtownHarborAdj.Add(RedwyneStraights); OldtownHarbor.AdjecantTerritories = OldtownHarborAdj; List<Territory> OldtownAdj = new List<Territory>(); OldtownAdj.Add(Highgarden); OldtownAdj.Add(RedwyneStraights); OldtownAdj.Add(DornishMarches); OldtownAdj.Add(ThreeTowers); Oldtown.AdjecantTerritories = OldtownAdj; List<Territory> ThreeTowersAdj = new List<Territory>(); ThreeTowersAdj.Add(RedwyneStraights); ThreeTowersAdj.Add(WestSummerSea); ThreeTowersAdj.Add(Oldtown); ThreeTowersAdj.Add(DornishMarches); ThreeTowersAdj.Add(PrincesPass); ThreeTowers.AdjecantTerritories = ThreeTowersAdj; List<Territory> DornishMarchesAdj = new List<Territory>(); DornishMarchesAdj.Add(Highgarden); DornishMarchesAdj.Add(Oldtown); DornishMarchesAdj.Add(ThreeTowers); DornishMarchesAdj.Add(PrincesPass); DornishMarchesAdj.Add(TheBoneway); DornishMarchesAdj.Add(TheReach); DornishMarches.AdjecantTerritories = DornishMarchesAdj; List<Territory> PrincesPassAdj = new List<Territory>(); PrincesPassAdj.Add(ThreeTowers); PrincesPassAdj.Add(DornishMarches); PrincesPassAdj.Add(TheBoneway); PrincesPassAdj.Add(Yronwood); PrincesPassAdj.Add(Starfall); PrincesPass.AdjecantTerritories = PrincesPassAdj; List<Territory> StarfallAdj = new List<Territory>(); StarfallAdj.Add(PrincesPass); StarfallAdj.Add(Yronwood); StarfallAdj.Add(SaltShore); StarfallAdj.Add(WestSummerSea); StarfallAdj.Add(EastSummerSea); Starfall.AdjecantTerritories = StarfallAdj; List<Territory> SaltShoreAdj = new List<Territory>(); SaltShoreAdj.Add(Starfall); SaltShoreAdj.Add(Yronwood); SaltShoreAdj.Add(Sunspear); SaltShoreAdj.Add(EastSummerSea); SaltShore.AdjecantTerritories = SaltShoreAdj; List<Territory> TheBonewayAdj = new List<Territory>(); TheBonewayAdj.Add(StormsEnd); TheBonewayAdj.Add(Kingswood); TheBonewayAdj.Add(TheReach); TheBonewayAdj.Add(DornishMarches); TheBonewayAdj.Add(PrincesPass); TheBonewayAdj.Add(Yronwood); TheBonewayAdj.Add(SeaOfDorne); TheBoneway.AdjecantTerritories = TheBonewayAdj; List<Territory> YronwoodAdj = new List<Territory>(); YronwoodAdj.Add(TheBoneway); YronwoodAdj.Add(PrincesPass); YronwoodAdj.Add(Starfall); YronwoodAdj.Add(SaltShore); YronwoodAdj.Add(SunsetSea); YronwoodAdj.Add(SeaOfDorne); Yronwood.AdjecantTerritories = YronwoodAdj; List<Territory> SunspearAdj = new List<Territory>(); SunspearAdj.Add(SeaOfDorne); SunspearAdj.Add(Yronwood); SunspearAdj.Add(SaltShore); SunspearAdj.Add(EastSummerSea); Sunspear.AdjecantTerritories = SunspearAdj; List<Territory> SunspearHarborAdj = new List<Territory>(); SunspearHarborAdj.Add(EastSummerSea); SunspearHarbor.AdjecantTerritories = SunspearHarborAdj; List<Territory> SeaOfDorneAdj = new List<Territory>(); SeaOfDorneAdj.Add(StormsEnd); SeaOfDorneAdj.Add(TheBoneway); SeaOfDorneAdj.Add(Yronwood); SeaOfDorneAdj.Add(Sunspear); SeaOfDorneAdj.Add(EastSummerSea); SeaOfDorne.AdjecantTerritories = SeaOfDorneAdj; List<Territory> EastSummerSeaAdj = new List<Territory>(); EastSummerSeaAdj.Add(ShipbreakerBay); EastSummerSeaAdj.Add(StormsEnd); EastSummerSeaAdj.Add(SeaOfDorne); EastSummerSeaAdj.Add(Sunspear); EastSummerSeaAdj.Add(SunspearHarbor); EastSummerSeaAdj.Add(SaltShore); EastSummerSeaAdj.Add(Starfall); EastSummerSeaAdj.Add(WestSummerSea); EastSummerSea.AdjecantTerritories = EastSummerSeaAdj; return AllTerritories; }
public void SetTerritoryAt(Vector3Int pos, Territory t) { // tiles[pos] = t; }
public static Territory CreateTerritory(string territoryID, int regionID) { Territory territory = new Territory(); territory.TerritoryID = territoryID; territory.RegionID = regionID; return territory; }
public static void CreateSampleData(string pictureFile) { using (var session = NHWebConsoleSetup.OpenSession()) { var customer = new Customer { Name = "John Doe", Title = "CEO", History = LipsumGenerator.Generate(5), SomeHtml = LipsumGenerator.GenerateHtml(5), Picture = pictureFile == null ? null : File.ReadAllBytes(pictureFile), Address = new Address { City = "Buenos Aires", Country = "Argentina", State = "Buenos Aires", Street = "El Cuco 123", } }; session.Save(customer); var employee = new Employee { FirstName = "Employee", LastName = "of the Month", Address = new Address { City = "Düsseldorf", Country = "Deutschland", State = "Nordrhein-Westfalen", Street = "Königsallee 44", } }; session.Save(employee); foreach (var i in Enumerable.Range(1, 100)) { session.Save(new Employee { FirstName = "Juan", LastName = "Perez", }); } session.Save(new Order { Customer = customer, Employee = employee, OrderDate = DateTime.Now, }); session.Save(new Order { Customer = customer, Employee = employee, OrderDate = DateTime.Now.AddMonths(1), }); session.Save(new Order { Customer = customer, Employee = employee, OrderDate = DateTime.Now.AddDays(1), }); var territory = new Territory { Name = "America", }; session.Save(territory); employee.Territories = new HashedSet <Territory> { territory, }; session.Save(employee); session.Flush(); } }
void LateUpdate() { for (int i = 0; i < units.Count; i++) { if (!units[i].isAlive()) { units.Remove(units[i]); } if (myTurn == false) { units[i].reset(); } } if (this.game == null || myTurn == false) { return; } Debug.Log("wew"); game.map.clear(); Unit selected = game.unitManager.getSelectedUnit(); if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { GameObject o = Mouse.getInstance().hoverObject(); if (o == null) { return; } Territory territory = game.map.getTerritory((int)o.transform.position.x, (int)o.transform.position.z); if (territory != null) { if (selected != null) { if (selected.Equals(territory.getUnit())) { game.unitManager.unSelectUnit(); return; } } if (territory.hasPlaceable() && territory.getUnit().isActive() && territory.getTeam().Equals(this.team)) { game.unitManager.selectUnit(territory.getUnit()); return; } } } else if (EventSystem.current.IsPointerOverGameObject() && game.unitManager.characterPage.isClosed()) { game.unitManager.unSelectUnit(); } if (selected != null && selected.hasPreparedAbility()) { GameObject mouseNode = Mouse.getInstance().hoverObject(); //This is the node the mouse is hovering over Territory[] pathTerritories = null; if (selected.getPreparedAbility().getData().range > 0) { //Mark the gray nodes selected.markNearbyTerritories(game.map); //Mark the attack nodes if (mouseNode != null && !Mouse.getInstance().compareOldNode(mouseNode)) //if mouse has moved { int range = selected.getPreparedAbility().getData().range; pathTerritories = game.getPath(selected.getTerritory(), game.map.getTerritory((int)mouseNode.gameObject.transform.position.x, (int)mouseNode.gameObject.transform.position.z), range); if (selected.getPreparedAbility().getData().attackType == AbilityAttackType.SINGLE_TILE) { Territory[] newPath = new Territory[1]; newPath[0] = pathTerritories[pathTerritories.Length - 1]; pathTerritories = newPath; } if (pathTerritories != null) { for (int i = 0; i < pathTerritories.Length; i++) { Territory above = pathTerritories[i].getAboveBlock(game.map, 1); if (above != null) { if (!above.hasAboveBlock(game.map)) { pathTerritories[i] = above; } else { pathTerritories[i] = null; } } } } if (!selected.getPreparedAbility().getData().neutral) { game.map.markTerritories(pathTerritories); } } } if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { if (game.map.getTerritory((int)mouseNode.transform.position.x, (int)mouseNode.transform.position.y, (int)mouseNode.transform.position.z).isMarked() && pathTerritories != null) { selected.getPreparedAbility().execute(selected.getTerritory(), pathTerritories); } game.unitManager.unSelectUnit(); } /*//Use ability * if(Input.GetMouseButtonDown(0) && pathTerritories != null && ){ * selected.getPreparedAbility().execute(selected.getTerritory(), pathTerritories); * game.unitManager.unSelectUnit(); * }*/ } //Temporary spawning if (Input.GetMouseButtonDown(1)) { GameObject o = Mouse.getInstance().hoverObject(); if (o == null) { return; } Territory territory = game.map.getTerritory((int)o.transform.position.x, (int)o.transform.position.z); if (territory != null) { if (!territory.hasPlaceable()) { Unit u = null; if (Random.Range(0, 2) == 1) { u = game.unitManager.createNewInstance(game.unitManager.warrior); } else { u = game.unitManager.createNewInstance(game.unitManager.mage); } territory.place(u); units.Add(u); } } } }
private void handleAttack(Ability ability, Territory from, Territory to) { //from.getUnit().getAnimator().SetTrigger("attack"); from.getUnit().rotate(to); from.getUnit().basicAttack(to); }
public void move(moveDelegate method, Territory territory, float movespeed) { StartCoroutine(method.Invoke(territory, movespeed)); }
public static List <UserLocation> GetUserLocationList(HuntingEntities dataContext, Territory territory) { try { var userLocationList = new List <UserLocation>(); var stewardLocation = territory.AclUserSteward.UserLocations.OrderByDescending(item => item.SysCreated).FirstOrDefault(); if (stewardLocation != null && stewardLocation.SysCreated > DateTime.Now.AddMinutes(-Settings.Default.UserLocationLastMinutes)) { userLocationList.Add(stewardLocation); } foreach (var territoryUser in territory.TerritoryUsers) { var userLocation = territoryUser.AclUser.UserLocations.OrderByDescending(item => item.SysCreated).FirstOrDefault(); if (userLocation != null && userLocation.SysCreated > DateTime.Now.AddMinutes(-Settings.Default.UserLocationLastMinutes)) { userLocationList.Add(userLocation); } } return(userLocationList); } catch (Exception exception) { logger.Error(exception, "GetUserLocationList"); return(null); } }
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lbxTerritories.SelectedIndex != -1) { CurrentTerritory = (Territory)lbxTerritories.SelectedItem; SetUI(true); } else { SetUI(false); } }
public void AddToTerritories(Territory territory) { base.AddObject("Territories", territory); }
public static bool CanMove(Territory t1, Territory t2) { return(t1.WhereCanMove.Contains(t2) || t2.WhereCanMove.Contains(t1)); // shouldn't need second statement, but got it just in case // it wont be executed anyway if the first half returns true }
public virtual void TestCreateAndDeleteEmployeeAndTerritoryAddingEmployeeToTerritoryEmployees() { using (IContext context = GetContext()) { context.ExecutingSql += new ExecutingSqlEventHandler(Context_ExecutingSql); //Encapsulate our whole test in a transaction, //so that any changes to the database are rolled back in case //of a test failure ITransaction tx = context.BeginTransaction(); try { //Ask the context to create the new employee Employee employee = (Employee)context.CreateObject(typeof(Employee)); //Assert that the context didn't return a null value Assert.IsNotNull(employee); //Set the properties of the new employee object employee.FirstName = "Mats"; employee.LastName = "Helander"; employee.HireDate = DateTime.Now; //Ask the context to create the new territory Territory territory = (Territory)context.CreateObject(typeof(Territory)); territory.Id = "Terra"; territory.TerritoryDescription = "A cool place"; territory.Employees.Add(employee); // <-------------------- this is the crucial line differing from the next test //Ask the context to insert our new employee and territory into the database context.Commit(); //The employee has an Id mapping to an autoincreasing column. //Make sure the employee object has been updated with its new identity Assert.IsTrue(employee.Id > 0, "Employee was not given identity!"); //Make sure that the employee row was inserted into the database... //To do this we resort to some good old sql... string sql = "Select Count(*) From Employees Where EmployeeId = " + employee.Id.ToString() + " And FirstName = 'Mats'" + " And LastName = 'Helander'"; //Execute the sql statement via the context (so that it is in the same transaction...that helps ;-)) int result = (int)context.SqlExecutor.ExecuteScalar(sql); //Make sure that the query for our new row returned exactly one hit Assert.AreEqual(1, result, "Employee Row not inserted!"); //Make sure that the territory row was inserted into the database... //To do this we resort to some good old sql... sql = "Select Count(*) From Territories Where TerritoryId = '" + territory.Id + "' And TerritoryDescription = 'A cool place'"; //Execute the sql statement via the context (so that it is in the same transaction...that helps ;-)) result = (int)context.SqlExecutor.ExecuteScalar(sql); //Make sure that the query for our new row returned exactly one hit Assert.AreEqual(1, result, "Territory Row not inserted!"); //Make sure that the row holding the reference was inserted into the database... //To do this we resort to some good old sql... sql = "Select Count(*) From EmployeeTerritories Where EmployeeId = " + employee.Id.ToString() + " And TerritoryID = '" + territory.Id + "'"; //Execute the sql statement via the context (so that it is in the same transaction...that helps ;-)) result = (int)context.SqlExecutor.ExecuteScalar(sql); //Make sure that the query for our new row returned exactly one hit Assert.AreEqual(1, result, "EmployeeTerritories Row not inserted!"); //Assert that the properties have the correct values Assert.AreEqual("Mats", employee.FirstName, "FirstName"); Assert.AreEqual("Helander", employee.LastName, "LastName"); //Ask the context to delete our employee context.DeleteObject(employee); //Ask the context to delete our territory context.DeleteObject(territory); //Ask the context to remove the employee and territory from the database again context.Commit(); //Execute the sql statement again result = (int)context.SqlExecutor.ExecuteScalar(sql); //Make sure that the query for our new row returns no hits Assert.AreEqual(0, result, "Row not deleted!"); //The whole test went fine! Commit the transaction! tx.Commit(); } catch (CompositeException cex) { //Something went wrong! //Rollback the transaction and retheow the exception tx.Rollback(); throw (Exception)cex.InnerExceptions[0]; } catch (Exception ex) { //Something went wrong! //Rollback the transaction and retheow the exception tx.Rollback(); throw ex; } } }
public void Insert(string TerritoryID,string TerritoryDescription,int RegionID) { Territory item = new Territory(); item.TerritoryID = TerritoryID; item.TerritoryDescription = TerritoryDescription; item.RegionID = RegionID; item.Save(UserName); }
/// <summary> /// Update the region by processing all child modifications. /// <remarks>Note: The order of operations below is very important. Only by /// processing the related changes in this order will the update succeed.</remarks> /// </summary> /// <param name="region">The region to update.</param> public void UpdateRegion(Region region) { Region originalRegion = this.ChangeSet.GetOriginal(region); // Attach all unmodified entities foreach (Territory territory in this.ChangeSet.GetAssociatedChanges(region, p => p.Territories, ChangeOperation.None)) { this.DbContext.Territories.Attach(territory); } if (originalRegion == null) { this.DbContext.Regions.Attach(region); } // Attach and apply changes to modified entities if (originalRegion != null) { this.DbContext.Regions.AttachAsModified(region, originalRegion, this.DbContext); } foreach (Territory territory in this.ChangeSet.GetAssociatedChanges(region, p => p.Territories, ChangeOperation.Update)) { this.DbContext.Territories.AttachAsModified(territory, this.ChangeSet.GetOriginal(territory), this.DbContext); } // Add new entities foreach (Territory territory in this.ChangeSet.GetAssociatedChanges(region, p => p.Territories, ChangeOperation.Insert)) { DbEntityEntry <Territory> entityEntry = this.DbContext.Entry(territory); if (entityEntry.State != EntityState.Detached) { // need to change the object state if the entity was already eagerly added entityEntry.State = EntityState.Added; } else { this.DbContext.Territories.Add(territory); } } // Finally, process any deleted entites and relationships foreach (Territory territory in this.ChangeSet.GetAssociatedChanges(region, p => p.Territories, ChangeOperation.Delete)) { Territory origTerrigory = this.ChangeSet.GetOriginal(territory); if (origTerrigory != null) { this.DbContext.Territories.AttachAsModified(territory, origTerrigory, this.DbContext); } else { this.DbContext.Territories.Attach(territory); } // need to remove any employee territory rows DbEntityEntry tEntityEntry = this.DbContext.Entry(territory); DbCollectionEntry employeesCollection = tEntityEntry.Collection("Employees"); employeesCollection.Load(); territory.Employees.Clear(); this.DbContext.Territories.Remove(territory); } }
public void performButtonFunction(SeaTerritory passedTerritory, TextBlock passedText) { switch (turnPhase) { case TurnPhase.PlaceTokens: // takeTurn.updateDisableButtons(); currentTerritory = passedTerritory; ChooseOrderTokenPopup.IsOpen = false; ChooseOrderTokenPopup.IsOpen = true; //passedTerritory.setOrderToken(new MarchOrder(false, true, false)); //passedText.Text = takeTurn.territoryPrintOut(passedTerritory); break; case TurnPhase.Westeros: break; case TurnPhase.Raid: break; case TurnPhase.March: resolveMarch.doMarchOrder(passedTerritory, passedText); break; case TurnPhase.ConsolidatePower: turnNum++; break; } }