Inheritance: MonoBehaviour
Exemplo n.º 1
0
        public static async void Command_SearchForMusic(ITelegramBotClient telegramBot, long cid)
        {
            #region SearchAreaSession
            if (SearchArea.All(x => x.chatId != cid))
            {
                Console.WriteLine("For someone in ChatId " + cid + " new session has been created");
                SearchArea.Add(new _SearchArea(1, cid));
            }
            else
            {
                SearchArea.Single(x => x.chatId == cid).area = 1;
            }
            #endregion

            #region markup settings
            Markup.ResizeKeyboard = true;
            Markup.Keyboard       = new[]
            {
                new[]
                {
                    new KeyboardButton(SearchForMusic),
                    new KeyboardButton(Back)
                }
            };
            #endregion

            await telegramBot.SendTextMessageAsync(cid, "Enter song name, sir! 🎵",
                                                   ParseMode.Default, false, false, 0, Markup);
        }
Exemplo n.º 2
0
        internal static HashObject GetAreaData(SearchArea area)
        {
            HashObject data = new HashObject();

            switch (area)
            {
            case SearchArea.Today:
                data.Add("startDate", DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
                data.Add("endDate", DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
                break;

            case SearchArea.Week:
                int dayofWeek = (int)DateTime.Now.DayOfWeek;
                data.Add("startDate", DateTime.Now.AddDays(-dayofWeek).ToString("yyyy-MM-dd 00:00:00"));
                data.Add("endDate", DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
                break;

            case SearchArea.Month:
                data.Add("startDate", DateTime.Now.ToString("yyyy-MM-01 00:00:00"));
                data.Add("endDate", DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
                break;

            case SearchArea.DaysOf30:
                data.Add("startDate", DateTime.Now.AddDays(-30).ToString("yyyy-MM-01 00:00:00"));
                data.Add("endDate", DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
                break;
            }
            return(data);
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string keywords = Request.QueryString["k"];

            if (string.IsNullOrEmpty(keywords))
            {
                Response.Redirect(AbleCommerce.Code.NavigationHelper.GetAdminUrl());
            }
            SearchArea searchArea = SearchArea.All;

            if (!string.IsNullOrEmpty(Request.QueryString["a"]))
            {
                searchArea = AlwaysConvert.ToEnum <SearchArea>(Request.QueryString["a"], SearchArea.All);
            }

            Caption.Text                   = String.Format(Caption.Text, keywords);
            _SearchAreaResults             = SearchDataSource.Search(keywords, searchArea, 100);
            ProductUrl                     = Page.ResolveUrl("~/Admin/Products/EditProduct.aspx?ProductId={0}");
            UserUrl                        = Page.ResolveUrl("~/Admin/People/Users/EditUser.aspx?UserId={0}");
            OrderUrl                       = Page.ResolveUrl("~/Admin/Orders/ViewOrder.aspx?OrderNumber={0}");
            CategoryUrl                    = Page.ResolveUrl("~/Admin/Catalog/EditCategory.aspx?CategoryId={0}");
            LinkUrl                        = Page.ResolveUrl("~/Admin/Catalog/EditLink.aspx?LinkId={0}");
            WebpageUrl                     = Page.ResolveUrl("~/Admin/Catalog/EditWebpage.aspx?WebpageId={0}");
            SearchAreasRepeater.DataSource = _SearchAreaResults;
            SearchAreasRepeater.DataBind();
        }
Exemplo n.º 4
0
        public static async void Command_Back(ITelegramBotClient telegramBot, long cid)
        {
            #region SearchAreaSession
            if (SearchArea.All(x => x.chatId != cid))
            {
                Console.WriteLine("For someone in ChatId " + cid + " new session has been created");
                SearchArea.Add(new _SearchArea(0, cid));
            }
            else
            {
                SearchArea.Single(x => x.chatId == cid).area = 0;
            }
            #endregion

            #region markup settings
            Markup.ResizeKeyboard = true;
            Markup.Keyboard       = new[]
            {
                new[]
                {
                    new KeyboardButton(SearchForMusic),
                    new KeyboardButton(SearchForAlbums)
                },
                new[]
                {
                    new KeyboardButton(SearchForArtists),
                    new KeyboardButton(GetRandomMusic)
                }
            };
            #endregion

            await telegramBot.SendTextMessageAsync(cid, "I'm ready to serve you 😉",
                                                   ParseMode.Default, false, false, 0, Markup);
        }
Exemplo n.º 5
0
        protected void SearchButton_Click(SearchArea searchArea)
        {
            string safeSearchPhrase = StringHelper.StripHtml(SearchPhrase.Text);
            int    orderNumber      = AlwaysConvert.ToInt(safeSearchPhrase, 0);

            if (orderNumber > 0 && (searchArea == SearchArea.All || searchArea == SearchArea.Orders))
            {
                int orderId = CommerceBuilder.Orders.OrderDataSource.LookupOrderId(orderNumber);
                if (orderId > 0)
                {
                    Response.Redirect(string.Format("~/Admin/Orders/ViewOrder.aspx?OrderId={0}", orderId));
                }
            }

            string parameters = string.Empty;

            if (searchArea != SearchArea.All)
            {
                parameters = "?a=" + searchArea.ToString();
            }

            if (!string.IsNullOrEmpty(safeSearchPhrase))
            {
                parameters += (string.IsNullOrEmpty(parameters) ? "?" : "&") + "k=" + Server.UrlEncode(safeSearchPhrase);
            }

            Response.Redirect("~/Admin/Search.aspx" + parameters);
        }
Exemplo n.º 6
0
 public SearchAreaDetail(SearchArea searchArea, String tableName, String keyField, String nameField, String[] searchFields)
 {
     this.SearchArea   = searchArea;
     this.TableName    = tableName;
     this.KeyField     = keyField;
     this.NameField    = nameField;
     this.SearchFields = searchFields;
 }
Exemplo n.º 7
0
 public override void End()
 {
     CalloutRunning = false;
     //Rage.Native.NativeFunction.Natives.RESET_AI_MELEE_WEAPON_DAMAGE_MODIFIER()
     if (Game.LocalPlayer.Character.IsDead)
     {
         GameFiber.Wait(1500);
         Functions.PlayScannerAudio("OFFICER HAS_BEEN_FATALLY_SHOT NOISE_SHORT OFFICER_NEEDS_IMMEDIATE_ASSISTANCE");
         GameFiber.Wait(3000);
     }
     base.End();
     if (SearchArea.Exists())
     {
         SearchArea.Delete();
     }
     foreach (Blip bl in SuspectBlips)
     {
         if (bl.Exists())
         {
             bl.Delete();
         }
     }
     if (CalloutFinished)
     {
         foreach (Entity ent in Suspects)
         {
             if (ent.Exists())
             {
                 ent.Dismiss();
             }
         }
         foreach (Entity ent in Vehicles)
         {
             if (ent.Exists())
             {
                 ent.Dismiss();
             }
         }
     }
     else
     {
         foreach (Entity ent in Suspects)
         {
             if (ent.Exists())
             {
                 ent.Delete();
             }
         }
         foreach (Entity ent in Vehicles)
         {
             if (ent.Exists())
             {
                 ent.Delete();
             }
         }
     }
 }
        private static SearchArea GetSearchArea(IncidentModel incident)
        {
            var searchArea = new SearchArea
            {
                Polygon = GetPoligonPoints(incident)
            };

            return(searchArea);
        }
Exemplo n.º 9
0
    void Start()
    {
        //サーチエリアを取得
        Sys = transform.parent.transform.parent.transform.parent.Find("SearchArea").GetComponent <SearchArea>();

        if (LeftFlag == 1)
        {
            Audio = GetComponent <AudioSource>();
        }
    }
Exemplo n.º 10
0
        public override void Initialize()
        {
            base.Initialize();
            SearchArea area = (SearchArea)Enum.Parse(typeof(SearchArea), RequestParams["area"]);
            UserInfo   info = (UserInfo)Session["user"];

            Context["grid"] = new list(info.User, area);
            Context["user"] = info.User;
            Context["area"] = (int)area;
        }
Exemplo n.º 11
0
        // Start is called before the first frame update
        void Start()
        {
            //プレイヤーのサーチエリア取得
            searchArea_ = FindObjectOfType <SearchArea>();

            // 初期化
            gauge_.fillAmount = 0f;
            coolTime_.text    = "00.00";
            coolTime_.gameObject.SetActive(false);
            isUpdate = false;
        }
Exemplo n.º 12
0
 public IEnumerable <AirportDto> FilterAirports(
     IEnumerable <AirportDto> sourceAirports, SearchArea searchArea)
 {
     return(sourceAirports.Where(airport =>
                                 WithinRectangle(
                                     searchArea.Nw.Lat,
                                     searchArea.Nw.Lng,
                                     searchArea.Se.Lat,
                                     searchArea.Se.Lng,
                                     airport.Lat,
                                     airport.Lng)));
 }
Exemplo n.º 13
0
        public bool SetNewFilter(SearchFilter newFilter)
        {
            bool flag = false;

            if (newFilter.m_NameFilter != this.m_NameFilter)
            {
                this.m_NameFilter = newFilter.m_NameFilter;
                flag = true;
            }
            if (newFilter.m_ClassNames != this.m_ClassNames)
            {
                this.m_ClassNames = newFilter.m_ClassNames;
                flag = true;
            }
            if (newFilter.m_Folders != this.m_Folders)
            {
                this.m_Folders = newFilter.m_Folders;
                flag           = true;
            }
            if ((UnityConnect.instance.userInfo.whitelisted && Collab.instance.collabInfo.whitelisted) && (newFilter.m_VersionControlStates != this.m_VersionControlStates))
            {
                this.m_VersionControlStates = newFilter.m_VersionControlStates;
                flag = true;
            }
            if (newFilter.m_AssetLabels != this.m_AssetLabels)
            {
                this.m_AssetLabels = newFilter.m_AssetLabels;
                flag = true;
            }
            if (newFilter.m_AssetBundleNames != this.m_AssetBundleNames)
            {
                this.m_AssetBundleNames = newFilter.m_AssetBundleNames;
                flag = true;
            }
            if (newFilter.m_ReferencingInstanceIDs != this.m_ReferencingInstanceIDs)
            {
                this.m_ReferencingInstanceIDs = newFilter.m_ReferencingInstanceIDs;
                flag = true;
            }
            if (newFilter.m_ScenePaths != this.m_ScenePaths)
            {
                this.m_ScenePaths = newFilter.m_ScenePaths;
                flag = true;
            }
            if (newFilter.m_SearchArea != this.m_SearchArea)
            {
                this.m_SearchArea = newFilter.m_SearchArea;
                flag = true;
            }
            this.m_ShowAllHits = newFilter.m_ShowAllHits;
            return(flag);
        }
 private void cargarAreas()
 {
     try
     {
         SearchArea sAreas = new SearchArea(this.ToString(), new HotelBooking.HotelBookingDataContext());
         this.cmbArea.DataSource = listadoArea = sAreas.getListadoAreas();
         this.cmbArea.DataBind();
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// Location determination by name, indicating the quantity of objects to return and preference language.
        /// Allows limit the search or affect the issuance result.
        /// </summary>
        /// <param name="location">Name of a geographic location.</param>
        /// <param name="results">Maximum number of objects to return.</param>
        /// <param name="lang">Preference language for describing objects.</param>
        /// <param name="searchArea">Search geographical area, affects to issuance of results.</param>
        /// <param name="rspn">Allows limit the search (true) or affect the issuance result (false - default).</param>
        /// <returns>Collection of found locations</returns>
        public async Task <GeoObjectCollection> GeocodeAsync(
            string location,
            short results,
            LangType lang,
            SearchArea searchArea,
            bool rspn = false)
        {
            string requestUlr =
                string.Format(RequestUrl, this.StringEncode(location), results, this.LangTypeToStr(lang))
                + $"&ll={searchArea.Center.ToString("{0},{1}")}&spn={searchArea.Center.ToString("{0},{1}")}&rspn={(rspn ? 1 : 0)}"
                + (string.IsNullOrEmpty(this.Key) ? string.Empty : "&key=" + this.Key);

            return(new GeoObjectCollection(await this.DownloadStringAsync(requestUlr)));
        }
Exemplo n.º 16
0
        public static SearchAreaResults Search(String keywords, SearchArea searchArea, int maximumRows)
        {
            List <SearchArea> list = new List <SearchArea>();

            list.Add(searchArea);
            List <SearchAreaResults> results = Search(keywords, list, maximumRows);

            if (results.Count > 0)
            {
                return(results[0]);
            }
            else
            {
                return(new SearchAreaResults());
            }
        }
Exemplo n.º 17
0
            public virtual async Task <PagedResult <OrgUnitLocation> > GetNearbyStores(decimal latitude, decimal longitude, int distance, QueryResultSettings queryResultSettings)
            {
                SearchArea searchArea = new SearchArea();

                searchArea.Latitude  = latitude;
                searchArea.Longitude = longitude;
                searchArea.Radius    = (distance == 0) ? 200 : distance; /* If the client does not specify the radius for search it is defaulted to 200 miles */

                ManagerFactory  managerFactory = Utilities.GetManagerFactory(this.EcommerceContext);
                IOrgUnitManager orgUnitManager = managerFactory.GetManager <IOrgUnitManager>();

                PagedResult <OrgUnitLocation> orgUnitLocations =
                    await orgUnitManager.GetOrgUnitLocationsByArea(searchArea, queryResultSettings);

                return(orgUnitLocations);
            }
Exemplo n.º 18
0
        public static CreateSearchRequest BuildSearch(PostAssetRequest assetRequest)
        {
            Availability derivedAvailability = DeriveAvailability(assetRequest);
            Dimensions   derivedDimensions   = DeriveDimensions(assetRequest);

            var origin = new SearchArea {
                stateProvinces = new[] { StateProvince.CA, StateProvince.IL }
            };

            var destination = new SearchArea {
                zones = new[] { Zone.MidAtlantic }
            };

            var searchCriteria = new SearchCriteria
            {
                ageLimitMinutes          = 90,
                ageLimitMinutesSpecified = true,
                assetType    = AssetType.Shipment,
                availability = derivedAvailability,
                destination  = new GeoCriteria {
                    Item = destination
                },
                equipmentClasses      = new[] { EquipmentClass.Flatbeds, EquipmentClass.Reefers },
                includeFulls          = true,
                includeFullsSpecified = true,
                includeLtls           = true,
                includeLtlsSpecified  = true,
                limits = derivedDimensions,
                origin = new GeoCriteria {
                    Item = origin
                }
            };

            var createSearchOperation = new CreateSearchOperation
            {
                criteria               = searchCriteria,
                includeSearch          = true,
                includeSearchSpecified = true,
                sortOrder              = SortOrder.Closest,
                sortOrderSpecified     = true
            };

            return(new CreateSearchRequest {
                createSearchOperation = createSearchOperation
            });
        }
Exemplo n.º 19
0
        public bool SetNewFilter(SearchFilter newFilter)
        {
            bool flag = false;

            if (newFilter.m_NameFilter != this.m_NameFilter)
            {
                this.m_NameFilter = newFilter.m_NameFilter;
                flag = true;
            }
            if (newFilter.m_ClassNames != this.m_ClassNames)
            {
                this.m_ClassNames = newFilter.m_ClassNames;
                flag = true;
            }
            if (newFilter.m_Folders != this.m_Folders)
            {
                this.m_Folders = newFilter.m_Folders;
                flag           = true;
            }
            if (newFilter.m_AssetLabels != this.m_AssetLabels)
            {
                this.m_AssetLabels = newFilter.m_AssetLabels;
                flag = true;
            }
            if (newFilter.m_AssetBundleNames != this.m_AssetBundleNames)
            {
                this.m_AssetBundleNames = newFilter.m_AssetBundleNames;
                flag = true;
            }
            if (newFilter.m_ReferencingInstanceIDs != this.m_ReferencingInstanceIDs)
            {
                this.m_ReferencingInstanceIDs = newFilter.m_ReferencingInstanceIDs;
                flag = true;
            }
            if (newFilter.m_SearchArea != this.m_SearchArea)
            {
                this.m_SearchArea = newFilter.m_SearchArea;
                flag = true;
            }
            this.m_ShowAllHits = newFilter.m_ShowAllHits;
            return(flag);
        }
Exemplo n.º 20
0
        private void toolStripMenuItemViewDetail_Click(object sender, EventArgs e)
        {
            if (this.dataGridViewOverall.Rows.Count > 0)
            {
                string      searchArea         = this.dataGridViewOverall.Rows[mouseLocation.RowIndex].Cells[5].Value.ToString();
                string      featureArea        = this.dataGridViewOverall.Rows[mouseLocation.RowIndex].Cells[6].Value.ToString();
                SearchArea  SelectedSearchArea = (PCCleaner.Common.SearchArea)Enum.Parse(typeof(PCCleaner.Common.SearchArea), searchArea);
                FeatureArea SelectedFeature    = (PCCleaner.Common.FeatureArea)Enum.Parse(typeof(PCCleaner.Common.FeatureArea), featureArea);


                var filteredData = CleanerApplicationContext.ResultSummary.DetailResult.Where(t => (int)t.SearchArea == (int)SelectedSearchArea && (int)t.FeatureArea == (int)SelectedFeature).ToList();

                this.ResultSummary.OverallResult = CleanerApplicationContext.ResultSummary.OverallResult;

                ResultSummary summary = new ResultSummary(this.ResultSummary.OverallResult, filteredData);

                summary.DetailResult = filteredData;

                ShowResult(ResultView.Detail, summary);
            }
        }
Exemplo n.º 21
0
            public virtual async Task <PagedResult <OrgUnitAvailability> > GetNearbyStoresWithAvailability(decimal latitude, decimal longitude, double searchRadius, IEnumerable <ItemUnit> itemUnits, QueryResultSettings queryResultSettings)
            {
                if (itemUnits == null)
                {
                    throw new ArgumentNullException(nameof(itemUnits));
                }

                SearchArea searchArea = new SearchArea();

                searchArea.Latitude  = latitude;
                searchArea.Longitude = longitude;
                searchArea.Radius    = (searchRadius > 0) ? searchRadius : 200;

                ManagerFactory  managerFactory = Utilities.GetManagerFactory(this.EcommerceContext);
                IOrgUnitManager orgUnitManager = managerFactory.GetManager <IOrgUnitManager>();

                PagedResult <OrgUnitAvailability> orgUnitAvailabilities =
                    await orgUnitManager.GetAvailableInventoryNearby(itemUnits, searchArea, queryResultSettings);

                return(orgUnitAvailabilities);
            }
Exemplo n.º 22
0
 private static void Display(SearchArea data, int indent)
 {
     if (data == null)
     {
         return;
     }
     DisplayLabel("Search Area", indent);
     if (data.zones != null)
     {
         foreach (Zone zone in data.zones)
         {
             DisplayValue("Zone", zone, indent + 1);
         }
     }
     if (data.stateProvinces != null)
     {
         foreach (StateProvince stateProvince in data.stateProvinces)
         {
             DisplayValue("State/Province", stateProvince, indent + 1);
         }
     }
 }
Exemplo n.º 23
0
        public object GetData(SearchArea area, SearchKind method)
        {
            HashObject    areaData = Utils.GetAreaData(area);
            List <string> xAxisData;
            Dictionary <string, Dictionary <string, decimal> > data = GetChatData(areaData.GetValue <string>("startDate"), areaData.GetValue <string>("endDate"), out xAxisData);

            if (method == SearchKind.ComeFrom)
            {
                return(GetPieData(data, xAxisData));
            }
            switch (area)
            {
            case SearchArea.Today:
                return(GetBarData(data, xAxisData));

            case SearchArea.Month:
            case SearchArea.Week:
            case SearchArea.DaysOf30:
                return(GetLineData(data, xAxisData));
            }
            return(GetLineData(data, xAxisData));
        }
Exemplo n.º 24
0
            internal static string GetBillSql(DbHelper db, string user, SearchArea area)
            {
                StringBuilder sbuilder = new StringBuilder(" where 1 = 1 ");

                sbuilder.Append(" and user = @user and date BETWEEN @startdate and @enddate ");

                db.AddParameter("user", user);
                HashObject date = Utils.GetAreaData(area);

                db.AddParameter("startdate", date["startDate"]);
                db.AddParameter("enddate", date["endDate"]);
                string sql = string.Format(@"select id,DATE_FORMAT(date, '%Y-%m-%d') as date,taobaocode,cname,ctel,caddress,carea,csendway,cremark,btotal,ltotal,preferential,scode,sname,status,
                                            case status when 0 then '待发货' 
	                                        when 1 then '已发货' 
	                                        when 2 then '已签收'
	                                        when 3 then '已确认'	
	                                        when 4 then '已核销'	
	                                        when 9 then '已退款' end as process, 
                                            case status when 1 then '运险保证' when 2  then '签售保证' when 3 then '售后保证' else '' end as after,status,cname,
                                            case scode is null or scode = '' when false then CONCAT(sname,'(',scode,')') else '' end as sender from bill {0} order by date desc", sbuilder.ToString());

                return(sql);
            }
            /// <summary>
            /// Gets the collection of stores within the specified search area.
            /// </summary>
            /// <param name="request">The get stores data request.</param>
            /// <returns>
            /// A collection of stores.
            /// </returns>
            private EntityDataServiceResponse <OrgUnitLocation> GetStores(GetStoresDataRequest request)
            {
                ThrowIf.Null(request, "request");
                ThrowIf.Null(request.SearchArea, "request.SearchArea");
                ThrowIf.Null(request.QueryResultSettings, "request.QueryResultSettings");

                QueryResultSettings settings   = request.QueryResultSettings;
                SearchArea          searchArea = request.SearchArea;

                if (settings.ColumnSet != null && settings.ColumnSet.Count > 0 && !settings.ColumnSet.Contains(OrgUnitLocation.DistanceColumn))
                {
                    settings.ColumnSet.Add(OrgUnitLocation.DistanceColumn);
                }

                var query = new SqlPagedQuery(settings)
                {
                    From    = GetNearbyStoresFunctionName,
                    OrderBy = searchArea.IsUnbounded ? "NAME ASC" : "DISTANCE ASC"
                };

                query.Parameters[ChannelIdVariable]      = request.ChannelId;
                query.Parameters[LongitudeVariable]      = searchArea.Longitude;
                query.Parameters[LatitudeVariable]       = searchArea.Latitude;
                query.Parameters[SearchDistanceVariable] = searchArea.Radius;
                query.Parameters[UnitConversionVariable] = searchArea.GetUnitConversion();

                PagedResult <OrgUnitLocation> storeLocationsRecords;

                using (var sqlServerdatabaseContext = new SqlServerDatabaseContext(request))
                {
                    storeLocationsRecords = sqlServerdatabaseContext.ReadEntity <OrgUnitLocation>(query);
                }

                storeLocationsRecords = this.ParseLocations(storeLocationsRecords.Results, request.RequestContext);

                return(new EntityDataServiceResponse <OrgUnitLocation>(storeLocationsRecords));
            }
Exemplo n.º 26
0
        public static string GetCookiesPath(SearchArea browser)
        {
            var path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData).Replace(@"AppData\Local", @"AppData\LocalLow");

            try
            {
                var directories = System.IO.Directory.GetDirectories(path, "*.*", SearchOption.AllDirectories);
                foreach (string dir in directories)
                {
                    if (dir.EndsWith(@"Internet Explorer"))
                    {
                        path = dir;
                        break;
                    }
                }

                path += "\\DomStore";
            }
            catch
            {
                ;
            }
            return(path);
        }
Exemplo n.º 27
0
        public void Run()
        {
            CoffeeEntities entities = new CoffeeEntities();
            DbSet<CoffeeShop> coffeeShops = entities.CoffeeShops;
            this.ClearDatabase(coffeeShops);
            entities.SaveChanges();

            SearchArea searchArea = new SearchArea
            {
                SouthwestCorner = new Coordinate
                {
                    latitude = (double)MinLatitude,
                    longitude = (double)MinLongitude,
                },
                NortheastCorner = new Coordinate
                {
                    latitude = (double)MaxLatitude,
                    longitude = (double)MaxLongitude,
                }
            };

            SearchResult result = this._coffeeSearcher.Search(searchArea).Result;
            if (result.Error != null)
            {
                throw new Exception(result.Error.Description);
            }
            else
            {
                foreach (CoffeeShop shop in result.Results)
                {
                    coffeeShops.Add(shop);
                }

                entities.SaveChanges();
            }
        }
Exemplo n.º 28
0
 public override void End()
 {
     base.End();
     CalloutRunning = false;
     SpeechHandler.HandlingSpeech = false;
     if (!CalloutFinished)
     {
         if (Shopkeeper.Exists())
         {
             Shopkeeper.Delete();
         }
         if (ShopkeeperBlip.Exists())
         {
             ShopkeeperBlip.Delete();
         }
         if (SearchArea.Exists())
         {
             SearchArea.Delete();
         }
     }
     else
     {
         if (Shopkeeper.Exists())
         {
             Shopkeeper.Dismiss();
         }
         if (ShopkeeperBlip.Exists())
         {
             ShopkeeperBlip.Delete();
         }
         if (SearchArea.Exists())
         {
             SearchArea.Delete();
         }
     }
 }
Exemplo n.º 29
0
        private void CalloutHandler()
        {
            CalloutRunning = true;
            GameFiber.StartNew(delegate
            {
                try
                {
                    //Destination = World.GetNextPositionOnStreet(SpawnPoint.Around(300f));
                    SpawnAllEntities();
                    SearchArea                = new Blip(Suspects[0].Position, 130f);
                    SearchArea.Color          = Color.Yellow;
                    SearchArea.IsRouteEnabled = true;
                    IsRouteEnabled            = true;
                    while (CalloutRunning)
                    {
                        GameFiber.Yield();
                        if (Functions.IsPlayerPerformingPullover())
                        {
                            if (Suspects.Contains(Functions.GetPulloverSuspect(Functions.GetCurrentPullover())))
                            {
                                break;
                            }
                        }

                        foreach (Ped suspect in Suspects)
                        {
                            GameFiber.Yield();
                            if (!Game.LocalPlayer.Character.IsInAnyVehicle(false))
                            {
                                if (Vector3.Distance(suspect.Position, Game.LocalPlayer.Character.Position) < 15f)
                                {
                                    break;
                                }
                            }

                            //if (Vector3.Distance(suspect.Position, Destination) < 50f)
                            //{
                            //    Destination = World.GetNextPositionOnStreet(Destination.Around(300f));

                            //    Suspects[0].Tasks.DriveToPosition(Destination, 60f, VehicleDrivingFlags.Emergency).WaitForCompletion(200);

                            //}
                        }
                        if (Game.LocalPlayer.Character.IsInAnyVehicle(false))
                        {
                            Ped nearestsuspect = (from x in Suspects where x.DistanceTo(Game.LocalPlayer.Character.Position) < 30f select x).FirstOrDefault();
                            if (nearestsuspect != null)
                            {
                                if (Game.LocalPlayer.Character.CurrentVehicle.IsPoliceVehicle)
                                {
                                    if (Game.LocalPlayer.Character.CurrentVehicle.IsSirenOn)
                                    {
                                        break;
                                    }
                                }
                            }
                        }

                        if (Vector3.Distance(Suspects[0].Position, SearchArea.Position) > 180f)
                        {
                            SearchArea.Delete();
                            SearchArea                = new Blip(Suspects[0].Position, 110f);
                            SearchArea.Color          = Color.Yellow;
                            SearchArea.IsRouteEnabled = IsRouteEnabled;
                            audiocount++;
                            if (audiocount >= 3)
                            {
                                Functions.PlayScannerAudioUsingPosition("SUSPECTS_LAST_REPORTED IN_OR_ON_POSITION", SearchArea.Position);
                                audiocount = 0;
                            }
                        }

                        if (IsRouteEnabled != Vector3.Distance(Game.LocalPlayer.Character.Position, SearchArea.Position) > 180f)
                        {
                            IsRouteEnabled            = Vector3.Distance(Game.LocalPlayer.Character.Position, SearchArea.Position) > 180f;
                            SearchArea.IsRouteEnabled = Vector3.Distance(Game.LocalPlayer.Character.Position, SearchArea.Position) > 180f;
                        }
                    }

                    if (CalloutRunning)
                    {
                        if (ComputerPlusRunning)
                        {
                            API.ComputerPlusFuncs.SetCalloutStatusToAtScene(CalloutID);
                            API.ComputerPlusFuncs.AddUpdateToCallout(CalloutID, "Vehicles located. In pursuit.");
                        }
                        GameFiber.Wait(1500);
                        Pursuit = Functions.CreatePursuit();

                        foreach (Ped suspect in Suspects.ToArray())
                        {
                            if (Vector3.Distance(suspect.Position, Game.LocalPlayer.Character.Position) < 150f)
                            {
                                Functions.AddPedToPursuit(Pursuit, suspect);
                                if (ComputerPlusRunning)
                                {
                                    API.ComputerPlusFuncs.AddVehicleToCallout(CalloutID, suspect.CurrentVehicle);
                                }
                            }
                            else
                            {
                                Suspects.Remove(suspect);
                                Vehicles.Remove(suspect.CurrentVehicle);
                                suspect.Dismiss();
                                suspect.CurrentVehicle.Dismiss();
                            }
                        }
                        Functions.SetPursuitIsActiveForPlayer(Pursuit, true);
                        Functions.ForceEndCurrentPullover();
                        if (SearchArea.Exists())
                        {
                            SearchArea.Delete();
                        }
                        Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_RESIST_ARREST IN_OR_ON_POSITION", Game.LocalPlayer.Character.Position);
                    }

                    while (CalloutRunning)
                    {
                        GameFiber.Yield();
                        foreach (Ped suspect in Suspects.ToArray())
                        {
                            if (!suspect.Exists())
                            {
                                EscapeCount++;
                                Suspects.Remove(suspect);
                            }
                            else if (Functions.IsPedArrested(suspect))
                            {
                                ArrestCount++;
                                Suspects.Remove(suspect);
                            }
                            else if (suspect.IsDead)
                            {
                                DeadCount++;
                                Suspects.Remove(suspect);
                            }
                            else if (Vector3.Distance(suspect.Position, Game.LocalPlayer.Character.Position) > 1000f)
                            {
                                EscapeCount++;
                                Suspects.Remove(suspect);
                                if (suspect.CurrentVehicle.Exists())
                                {
                                    suspect.CurrentVehicle.Delete();
                                }
                                suspect.Delete();
                                Game.DisplayNotification("A suspect has escaped.");
                            }
                        }
                        if (!Functions.IsPursuitStillRunning(Pursuit))
                        {
                            break;
                        }
                    }
                    DisplayCodeFourMessage();
                }
                catch (System.Threading.ThreadAbortException e)
                {
                    End();
                }
                catch (Exception e)
                {
                    if (CalloutRunning)
                    {
                        Game.LogTrivial(e.ToString());
                        Game.LogTrivial("Assorted Callouts handled the exception successfully.");
                        Game.DisplayNotification("~O~OrganisedStreetRace~s~ callout crashed, sorry. Please send me your log file.");
                        Game.DisplayNotification("Full LSPDFR crash prevented ~g~successfully.");
                        End();
                    }
                }
            });
        }
Exemplo n.º 30
0
        /// <summary>
        /// Location determination by name, indicating the quantity of objects to return and preference language.
        /// Allows limit the search or affect the issuance result.
        /// </summary>
        /// <param name="location">Name of a geographic location.</param>
        /// <param name="results">Maximum number of objects to return.</param>
        /// <param name="lang">Preference language for describing objects.</param>
        /// <param name="search_area">Search geographical area, affects to issuance of results.</param>
        /// <param name="rspn">Allows limit the search (true) or affect the issuance result (false - default).</param>
        /// <returns>Collection of found locations</returns>
        public static GeoObjectCollection Geocode(string location, short results, LangType lang, SearchArea search_area, bool rspn = false)
        {
            string request_ulr =
                string.Format(REQUESRT_URL, StringMakeValid(location), results, LangTypeToStr(lang)) +
                string.Format("&ll={0}&spn={1}&rspn={2}", search_area.LongLat.ToString("{0},{1}"), search_area.Spread.ToString("{0},{1}"), rspn ? 1 : 0) +
                (string.IsNullOrEmpty(_key) ? string.Empty : "&key=" + _key);

            return new GeoObjectCollection(DownloadString(request_ulr));
        }
Exemplo n.º 31
0
 void Start()
 {
     //1度親に行かないと同階層のものが取れない
     Sys = transform.parent.transform.parent.Find("SearchArea").GetComponent <SearchArea>();
 }
Exemplo n.º 32
0
        public override void End()
        {
            CalloutRunning = false;
            Rage.Native.NativeFunction.Natives.CLEAR_PED_NON_CREATION_AREA();
            NativeFunction.Natives.SET_STORE_ENABLED(true);
            if (Game.LocalPlayer.Character.Exists())
            {
                if (Game.LocalPlayer.Character.IsDead)
                {
                    GameFiber.Wait(1500);
                    Functions.PlayScannerAudio("OFFICER HAS_BEEN_FATALLY_SHOT NOISE_SHORT OFFICER_NEEDS_IMMEDIATE_ASSISTANCE");
                    GameFiber.Wait(3000);
                    if (ComputerPlusRunning)
                    {
                        API.ComputerPlusFuncs.AddUpdateToCallout(CalloutID, "Officer down. Urgent assistance required.");
                    }
                }
            }
            else
            {
                GameFiber.Wait(1500);
                Functions.PlayScannerAudio("OFFICER HAS_BEEN_FATALLY_SHOT NOISE_SHORT OFFICER_NEEDS_IMMEDIATE_ASSISTANCE");
                GameFiber.Wait(3000);
                if (ComputerPlusRunning)
                {
                    API.ComputerPlusFuncs.AddUpdateToCallout(CalloutID, "Officer down. Urgent assistance required.");
                }
            }
            base.End();
            if (SearchArea.Exists())
            {
                SearchArea.Delete();
            }

            if (CalloutFinished)
            {
                foreach (Ped ShopKeeper in ShopKeepers)
                {
                    if (ShopKeeper.Exists())
                    {
                        ShopKeeper.Tasks.Clear(); ShopKeeper.IsPersistent = false;
                    }
                }
                foreach (Ped suspect in Suspects)
                {
                    if (suspect.Exists())
                    {
                        Suspect.IsPersistent = false;
                    }
                }
                foreach (Rage.Object MoneyBag in MoneyBags)
                {
                    if (MoneyBag.Exists())
                    {
                        MoneyBag.Detach();
                        MoneyBag.Dismiss();
                    }
                }
                if (EscapeVanDriver.Exists())
                {
                    EscapeVanDriver.IsPersistent = false;
                }
                if (EscapeVan.Exists())
                {
                    EscapeVan.Dismiss();
                }
            }
            else
            {
                foreach (Ped ShopKeeper in ShopKeepers)
                {
                    if (ShopKeeper.Exists())
                    {
                        ShopKeeper.Delete();
                    }
                }
                foreach (Rage.Object MoneyBag in MoneyBags)
                {
                    if (MoneyBag.Exists())
                    {
                        MoneyBag.Delete();
                    }
                }
                foreach (Ped suspect in Suspects)
                {
                    if (suspect.Exists())
                    {
                        suspect.Delete();
                    }
                }
                if (EscapeVan.Exists())
                {
                    EscapeVan.Delete();
                }
                if (EscapeVanDriver.Exists())
                {
                    EscapeVanDriver.Delete();
                }
            }
        }
Exemplo n.º 33
0
        public async Task<SearchResult> Search(SearchArea searchArea)
        {
            SearchError error = null;
            List<CoffeeShop> coffeeShops = new List<CoffeeShop>();

            int numFound;
            int offset = 0;
            do
            {
                numFound = 0;
                SearchOptions query = new SearchOptions
                {
                    GeneralOptions = new GeneralOptions
                    {
                        category_filter = "coffee",
                        offset = offset,
                        limit = 20,
                        sort = 1,
                    },
                    LocationOptions = new BoundOptions
                    {
                        sw_latitude = searchArea.SouthwestCorner.latitude,
                        sw_longitude = searchArea.SouthwestCorner.longitude,
                        ne_latitude = searchArea.NortheastCorner.latitude,
                        ne_longitude = searchArea.NortheastCorner.longitude,
                    },
                };
                Task<SearchResults> searchTask = this._yelp.Search(query);
                SearchResults results = await searchTask;

                if (results.error != null)
                {
                    YelpSharp.Data.SearchError yelpError = results.error;
                    error = new SearchError
                    {
                        Id = ErrorId.YelpError,
                        Description = string.Format("ID: {0}; Description: {1}; Text: {2}; Field: {3}",
                            yelpError.id, yelpError.description, yelpError.text, yelpError.field),
                    };
                }
                else if (results.total >= MaxSearchResults)
                {
                    error = new SearchError
                    {
                        Id = ErrorId.TooManyResults,
                        Description = string.Format("Maximum number of results exceeded, use a smaller region. Max Results: {0}", MaxSearchResults),
                    };
                }
                else
                {
                    numFound = results.businesses.Count;
                    IEnumerable<CoffeeShop> newShops = results.businesses
                        .Where(b => b.location.city.IndexOf("seattle", StringComparison.OrdinalIgnoreCase) != -1)
                        .Select(b => new CoffeeShop
                        {
                            Name = b.name,
                            Location = new Coordinates
                            {
                                Latitude = b.location.coordinate.latitude,
                                Longitude = b.location.coordinate.longitude,
                            },
                            YelpId = b.id,
                        });

                    coffeeShops.AddRange(newShops);
                    offset += numFound;
                }
            } while (error == null && numFound > 0);

            return new SearchResult
            {
                Error = error,
                Results = coffeeShops,
            };
        }