public ClearZone(int t0, Actor who, ZoneLoc dest) : base(t0, who) { m_Zone = dest; threats = who.Threats // these two should agree on whether they're null or not #if DEBUG ?? throw new ArgumentNullException("who.Threats") #endif ; tourism = who.InterestingLocs #if DEBUG ?? throw new ArgumentNullException("who.InterestingLocs") #endif ; Func <Point, bool> ok = pt => m_Zone.Rect.Contains(pt); m_Unverified.UnionWith(threats.ThreatWhere(dest.m).Where(ok)); m_Unverified.UnionWith(tourism.In(dest.m).Where(ok)); #if OBSOLETE // the civilian case if (null == threats && null == sights_to_see) { m_Unverified.UnionWith(m_Zone.Rect.Where(pt => who.CanEnter(new Location(m_Zone.m, pt)))); // \todo? eliminate GC thrashing } #endif // nonserialized fields oai = (m_Actor.Controller as ObjectiveAI) #if DEBUG ?? throw new ArgumentNullException("who.Controller is ObjectiveAI") #endif ; }
public bool Equals(LocationSet right) { if (this == right) { return(true); } else if (this.hashCode != right.hashCode) { return(false); } else if (this.locs.Count != right.locs.Count) { return(false); } else { int n = this.locs.Count; for (int i = 0; i < n; i++) { if (!this.locs[i].Equals(right.locs[i])) { return(false); } } return(true); } }
void Start() { InitializePlatformLocations(); currentLocationSet = platformLocationSets[0]; Spawn(); }
private async Task <LocationSet> GetLocationsAsync(string url) { using (var client = new HttpClient()) { var response = await client.GetStringAsync(url); var apiResponse = JsonConvert.DeserializeObject <SearchResultSet>(response); var results = new LocationSet(); if (apiResponse != null && apiResponse.Results != null) { results.EstimatedTotal = apiResponse.Results.Count; results.Locations = new List <Bing.Location>(); foreach (var r in apiResponse.Results) { results.Locations.Add(r.ToLocation()); } } return(results); } }
//location chosen void OnLocChosen(object sender, EventArgs args) { Picker modePicker = (Picker)sender; mode = modePicker.SelectedItem.ToString(); rolePicker.IsEnabled = false; rolePicker.ItemsSource = null; rolePicker.Items.Clear(); Character temp = _viewModel.DatasetCharacter.FirstOrDefault(a => a.Id == player); List <Item> templist; CurrentItem.Text = temp.GetItemAtLocation((ItemLocationEnum)Enum.Parse(typeof(ItemLocationEnum), mode)); LocationSet.Clear(); PoolSet = PoolSet.Where(a => a != null).ToList(); if (mode == ItemLocationEnum.LeftFinger.ToString() || mode == ItemLocationEnum.RightFinger.ToString()) { templist = PoolSet.FindAll(a => a.Location.ToString() == mode || a.Location.ToString() == "Finger"); } else { templist = PoolSet.FindAll(a => a.Location.ToString() == mode); } foreach (var data in templist) { LocationSet.Add(data); } rolePicker.ItemsSource = LocationSet; rolePicker.IsEnabled = true; }
protected async Task <DialogTurnResult> GetPointOfInterestLocations(WaterfallStepContext sc, CancellationToken cancellationToken = default(CancellationToken)) { try { // Defensive for scenarios where locale isn't correctly set var country = "US"; try { var cultureInfo = new RegionInfo(sc.Context.Activity.Locale); country = cultureInfo.TwoLetterISORegionName; } catch (Exception) { // Default to everything if we can't restrict the country } var state = await Accessor.GetAsync(sc.Context); var service = ServiceManager.InitMapsService(GetAzureMapsKey(), sc.Context.Activity.Locale ?? "en-us"); var locationSet = new LocationSet(); state.CheckForValidCurrentCoordinates(); if (string.IsNullOrEmpty(state.SearchText) && string.IsNullOrEmpty(state.SearchAddress)) { // No entities identified, find nearby locations locationSet = await service.GetLocationsNearby(state.CurrentCoordinates.Latitude, state.CurrentCoordinates.Longitude); await GetPointOfInterestLocationViewCards(sc, locationSet); } else if (!string.IsNullOrEmpty(state.SearchText)) { // Fuzzy search locationSet = await service.GetLocationsByFuzzyQueryAsync(state.CurrentCoordinates.Latitude, state.CurrentCoordinates.Longitude, state.SearchText, country); await GetPointOfInterestLocationViewCards(sc, locationSet); } else if (!string.IsNullOrEmpty(state.SearchAddress)) { // Query search locationSet = await service.GetLocationsByFuzzyQueryAsync(state.CurrentCoordinates.Latitude, state.CurrentCoordinates.Longitude, state.SearchAddress, country); await GetPointOfInterestLocationViewCards(sc, locationSet); } if (locationSet?.Locations?.ToList().Count == 1) { return(await sc.PromptAsync(Action.ConfirmPrompt, new PromptOptions { Prompt = sc.Context.Activity.CreateReply(POISharedResponses.PromptToGetRoute, ResponseBuilder) })); } state.ClearLuisResults(); return(await sc.EndDialogAsync(true)); } catch { await HandleDialogException(sc); throw; } }
public ActionResult DeleteConfirmed(int id) { LocationSet locationSet = db.LocationSets.Find(id); db.LocationSets.Remove(locationSet); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Locatio_Id,Location_Name,Latitude,Longtitude")] LocationSet locationSet) { if (ModelState.IsValid) { db.Entry(locationSet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(locationSet)); }
public WidgetV2() { Locations = new LocationSet(); CredentialFilters = new FilterSet(); OrganizationFilters = new FilterSet(); AssessmentFilters = new FilterSet(); LearningOpportunityFilters = new FilterSet(); WidgetColors = new List <ColorPair>(); InitializeLists(this); }
// Picks a new platform location set for the next round of spawning private void SetNextPlatformLocations() { LocationSet set = currentLocationSet; while (set == currentLocationSet) { set = platformLocationSets[Random.Range(0, platformLocationSets.Count)]; } currentLocationSet = set; }
public ActionResult Create([Bind(Include = "Locatio_Id,Location_Name,Latitude,Longtitude")] LocationSet locationSet) { if (ModelState.IsValid) { db.LocationSets.Add(locationSet); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(locationSet)); }
public ExplicitRadio(RadioFaction faction, Item radio) { #if DEBUG if (faction.RadioID != radio.Model.ID) { throw new InvalidOperationException("faction radio not provided"); } #endif Threats = faction.Threats; Investigate = faction.Investigate; FactionID = faction.FactionID; Radio = radio; }
public ActionResult DeleteConfirmed(int id) { LocationSet locationSet = db.LocationSets.Find(id); var userId = User.Identity.GetUserId(); if (userId == "02540576-eb9b-4583-bc4b-6c5f200a9118" || userId == "27f27b4d-9faf-4d02-b405-5592f9de1f08") { db.LocationSets.Remove(locationSet); db.SaveChanges(); } return(RedirectToAction("Index")); }
// GET: LocationSets/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LocationSet locationSet = db.LocationSets.Find(id); if (locationSet == null) { return(HttpNotFound()); } return(View(locationSet)); }
public ActionResult Edit([Bind(Include = "Id,Name,Description,Latitude,Longitude")] LocationSet locationSet) { if (ModelState.IsValid) { var userId = User.Identity.GetUserId(); if (userId == "02540576-eb9b-4583-bc4b-6c5f200a9118" || userId == "27f27b4d-9faf-4d02-b405-5592f9de1f08") { db.Entry(locationSet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } return(View(locationSet)); }
public LocationSet Get구매창고() { // Sql Command 명령문 System.Data.IDbCommand sqlSelectCommand = EnterpriseManager.DbFactory.CreateDbCommand(); sqlSelectCommand.CommandText = @" select * from Location where LocationType = 1 and CostCenterLocationFlag = 0 order by LocationNo "; sqlSelectCommand.CommandType = System.Data.CommandType.Text; // // // 명령문을 호출한다 LocationSet entitySet = ((LocationSet)(this.GetEntitySet(sqlSelectCommand, typeof(LocationSet)))); sqlSelectCommand.Dispose(); return(entitySet); }
public static List <CrewMember> SpawnCrew(Main instance, LocationSet locationSet) { List <CrewMember> crew = new List <CrewMember>(); for (int i = 0; i < locationSet.heistCrewSpawnLocations.Count; i++) { Vector3 crewMemberPos = locationSet.heistCrewSpawnLocations[i]; crewMemberPos.Z = World.GetGroundHeight(new Vector2(crewMemberPos.X, crewMemberPos.Y)); var crewPed = World.CreatePed(PedHash.Michael, crewMemberPos); crewPed.Rotation = locationSet.heistCrewSpawnRotation; crewPed.Money = 69; crewPed.Weapons.Give(WeaponHash.Pistol, 20, false, true); CrewMember crewMember = new CrewMember(instance, crewPed); crewMember.setToDefaultOutfit(); crew.Add(crewMember); PedGroup playerGroup = Game.Player.Character.CurrentPedGroup; Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, crewPed, playerGroup); Function.Call(Hash.SET_PED_COMBAT_ABILITY, crewPed, 100); } return(crew); }
public LocationSet GetForLocationType(int locationType) { // Sql Command 명령문 System.Data.IDbCommand sqlSelectCommand = EnterpriseManager.DbFactory.CreateDbCommand(); sqlSelectCommand.CommandText = @"SELECT * FROM Location WHERE LocationType = @locationType order by LocationName"; sqlSelectCommand.CommandType = System.Data.CommandType.Text; // // 파라미터2값을 만든다 System.Data.IDataParameter locationTypeParam = EnterpriseManager.DbFactory.CreateDataParameter("@locationType", typeof(int)); locationTypeParam.Value = locationType; sqlSelectCommand.Parameters.Add(locationTypeParam); // // // 명령문을 호출한다 LocationSet entitySet = ((LocationSet)(this.GetEntitySet(sqlSelectCommand, typeof(LocationSet)))); sqlSelectCommand.Dispose(); return(entitySet); }
public ImplicitRadio(RadioFaction faction) { Threats = faction.Threats; Investigate = faction.Investigate; FactionID = faction.FactionID; }
public TryToClearZones(RadioFaction faction, Actor act) { Threats = faction.Threats; Investigate = faction.Investigate; m_Actor = act; }
private void HandleLocationSetEvent(LocationSet @event) { Context.GetLogger().Info("YEAH"); }
public override void RepairLoad() { threats = m_Actor.Threats !; tourism = m_Actor.InterestingLocs !; }
private List <LayoutNode> determineNodes(IEnumerable <LocationSet> newSets, List <LayoutNode> newNodes) { Dictionary <LocationSet, LayoutNode> oldSets = new Dictionary <LocationSet, LayoutNode>(); foreach (LayoutNode n in this.curNodes) { oldSets[n.locs] = n; } HashSet <LocationSet> unmatched = new HashSet <LocationSet>(); foreach (LocationSet newSet in newSets) { if (oldSets.ContainsKey(newSet)) { newNodes.Add(oldSets[newSet]); oldSets.Remove(newSet); } else { unmatched.Add(newSet); } } if (oldSets.Count == 0 && unmatched.Count == 0) { return(new List <LayoutNode>(0)); } List <LayoutNode> changedNodes = new List <LayoutNode>(oldSets.Values); List <LocationSet> toReplace = new List <LocationSet>(oldSets.Keys); toReplace.Sort((a, b) => b.Count - a.Count); foreach (LocationSet replSrc in toReplace) { LayoutNode replNode = oldSets[replSrc]; HashSet <Location> replLocs = new HashSet <Location>(replSrc); int maxCount = 0; LocationSet maxSet = null; foreach (LocationSet candidate in unmatched) { int count = 0; foreach (Location loc in candidate) { if (replLocs.Contains(loc)) { ++count; } } if (count > maxCount) { maxCount = count; maxSet = candidate; } } replNode.prev = replNode.locs; replNode.locs = maxSet; if (maxSet != null) { newNodes.Add(replNode); unmatched.Remove(maxSet); } } foreach (LocationSet newSet in unmatched) { this.nodeId++; LayoutNode n = new LayoutNode(this.nodeId, newSet); changedNodes.Add(n); newNodes.Add(n); } return(changedNodes); }
// Helpers protected async Task GetPointOfInterestLocationViewCards(DialogContext sc, LocationSet locationSet) { var locations = locationSet.Locations; var state = await Accessor.GetAsync(sc.Context); var cardsData = new List <LocationCardModelData>(); var service = ServiceManager.InitMapsService(GetAzureMapsKey()); if (locations != null && locations.Count > 0) { var optionNumber = 1; state.FoundLocations = locations.ToList(); foreach (var location in locations) { var imageUrl = service.GetLocationMapImageUrl(location); var locationCardModel = new LocationCardModelData() { ImageUrl = imageUrl, LocationName = location.Name, Address = location.Address.FormattedAddress, SpeakAddress = location.Address.AddressLine, OptionNumber = optionNumber, }; cardsData.Add(locationCardModel); optionNumber++; } if (cardsData.Count() > 1) { if (sc.ActiveDialog.Id.Equals(Action.FindAlongRoute) && state.ActiveRoute != null) { var replyMessage = sc.Context.Activity.CreateAdaptiveCardGroupReply(POISharedResponses.MultipleLocationsFoundAlongActiveRoute, "Dialogs/Shared/Resources/Cards/PointOfInterestViewCard.json", AttachmentLayoutTypes.Carousel, cardsData, ResponseBuilder); await sc.Context.SendActivityAsync(replyMessage); } else { var replyMessage = sc.Context.Activity.CreateAdaptiveCardGroupReply(POISharedResponses.MultipleLocationsFound, "Dialogs/Shared/Resources/Cards/PointOfInterestViewCard.json", AttachmentLayoutTypes.Carousel, cardsData, ResponseBuilder); await sc.Context.SendActivityAsync(replyMessage); } } else { state.ActiveLocation = state.FoundLocations.Single(); if (sc.ActiveDialog.Id.Equals(Action.FindAlongRoute) && state.ActiveRoute != null) { var replyMessage = sc.Context.Activity.CreateAdaptiveCardReply(POISharedResponses.SingleLocationFoundAlongActiveRoute, "Dialogs/Shared/Resources/Cards/PointOfInterestViewNoDrivingButtonCard.json", cardsData.SingleOrDefault(), ResponseBuilder); await sc.Context.SendActivityAsync(replyMessage); } else { var replyMessage = sc.Context.Activity.CreateAdaptiveCardReply(POISharedResponses.SingleLocationFound, "Dialogs/Shared/Resources/Cards/PointOfInterestViewNoDrivingButtonCard.json", cardsData.SingleOrDefault(), ResponseBuilder); await sc.Context.SendActivityAsync(replyMessage); } } } else { var replyMessage = sc.Context.Activity.CreateReply(POISharedResponses.NoLocationsFound, ResponseBuilder); await sc.Context.SendActivityAsync(replyMessage); } }
// Helpers protected async Task GetPointOfInterestLocationViewCards(DialogContext sc, LocationSet locationSet) { var locations = locationSet.Locations; var state = await Accessor.GetAsync(sc.Context); var cardData = new List <LocationCardModelData>(); var service = ServiceManager.InitMapsService(GetAzureMapsKey()); if (locations != null && locations.Count > 0) { var optionNumber = 1; state.FoundLocations = locations.ToList(); foreach (var location in locations) { var imageUrl = service.GetLocationMapImageUrl(location); var locationCardModel = new LocationCardModelData() { ImageUrl = imageUrl, LocationName = location.Name, Address = location.Address.FormattedAddress, SpeakAddress = location.Address.AddressLine, OptionNumber = optionNumber, }; cardData.Add(locationCardModel); optionNumber++; } if (cardData.Count() > 1) { var templateId = string.Empty; var cards = new List <Card>(); if (sc.ActiveDialog.Id.Equals(Action.FindAlongRoute) && state.ActiveRoute != null) { templateId = POISharedResponses.MultipleLocationsFoundAlongActiveRoute; } else { templateId = POISharedResponses.MultipleLocationsFound; } foreach (var data in cardData) { cards.Add(new Card("PointOfInterestViewCard", data)); } var replyMessage = ResponseManager.GetCardResponse(templateId, cards); await sc.Context.SendActivityAsync(replyMessage); } else { state.ActiveLocation = state.FoundLocations.Single(); var templateId = string.Empty; if (sc.ActiveDialog.Id.Equals(Action.FindAlongRoute) && state.ActiveRoute != null) { templateId = POISharedResponses.SingleLocationFoundAlongActiveRoute; } else { templateId = POISharedResponses.SingleLocationFound; } var card = new Card("PointOfInterestViewNoDrivingButtonCard", cardData.SingleOrDefault()); var replyMessage = ResponseManager.GetCardResponse(templateId, card); await sc.Context.SendActivityAsync(replyMessage); } } else { var replyMessage = ResponseManager.GetResponse(POISharedResponses.NoLocationsFound); await sc.Context.SendActivityAsync(replyMessage); } }
internal LayoutNode(int id, LocationSet locs) { this.id = id; this.locs = locs; }