Пример #1
0
        public void TakeNextSearchTrack()
        {
            SearchTrack searchTrack = _searchTracks[_currentSearchTrackIndex];

            _leader.GetComponent <SquadLeaderBehaviour>()._strategicPoint =
                (StrategicPoint)searchTrack.Exits[0];
        }
Пример #2
0
    public static void RegisterSearchTrack(SearchTrack searchTrack)
    {
        if (!searchTracksInstantiated)
        {
            searchTracks             = new List <SearchTrack> ();
            searchTracksInstantiated = true;
        }

        searchTracks.Add(searchTrack);
    }
Пример #3
0
    // TODO: Perhaps separate this method?
    public static List <IStrategicPoint> GetAllExits()
    {
        List <IStrategicPoint> allExits = new List <IStrategicPoint> ();

        for (int i = 0; i < searchTracks.Count; i++)
        {
            SearchTrack searchTrack = searchTracks [i];
            allExits.AddRange(searchTrack.Exits);
        }

        return(allExits);
    }
        public SearchTrackManager(
            SearchTrack searchTrack,
            List <GuardStateBrainPBT> guards,
            NodeSearchedSignal nodeSearchedSignal,
            GuardReachedRoomSignal guardReachedRoomSignal,
            SearchTrackSearchedSignal searchTrackSearchedSignal,
            List <SearchTrackNode> likelyNodes
            )
        {
            _nodesToSearchIndex = 0;
            _coveringGuards     = new List <GuardStateBrainPBT>();
            _searchingGuards    = new List <GuardStateBrainPBT>();
            _allGuards          = new List <GuardStateBrainPBT>();

            _nodeSearchedSignal     = nodeSearchedSignal;
            _guardReachedRoomSignal = guardReachedRoomSignal;

            _searchTrack = searchTrack;

            _assignedExitIndex = 0;
            _coveredExits      = 0;

            SetUpDelegates();
            // CheckIfReady();


            _searchTrackSearchedSignal = searchTrackSearchedSignal;

            _guardsPerNode = new Dictionary <SearchTrackNode, GuardStateBrainPBT>();

            if (likelyNodes != null)
            {
                _nodesToSearch = likelyNodes;
            }
            else
            {
                _nodesToSearch = searchTrack.GetSearchTrackNodes();
            }

            if (searchTrack.GetSearchTrackNodes().Count == 0)
            {
                // _searchTrackSearchedSignal.Fire(searchTrack);
                RegisterComplete();
            }
            else
            {
                Init();
                AddGuards(guards);
            }
        }
Пример #5
0
        public void LeaderPositionReached()
        {
            SearchTrack searchTrack = _searchTracks[_currentSearchTrackIndex];

            _searchTrackManager = _searchTrackManagerFactory.Create(
                searchTrack,
                _allSquadMembers.Map(
                    (guard) => guard.GetComponent <GuardStateBrainPBT>()
                    ),
                null
                );

            _searchTrackManager.OnSearchTrackComplete += OnSearchTrackComplete;
        }
Пример #6
0
    public static List <SearchTrackNode> GetAllSearchTrackNodes()
    {
        if (allSearchTrackNodesInstantiated)
        {
            return(allSearchTrackNodes);
        }

        allSearchTrackNodes = new List <SearchTrackNode> ();

        List <SearchTrack> searchTracks = GetSearchTracks();

        for (int i = 0; i < searchTracks.Count; i++)
        {
            SearchTrack            searchTrack      = searchTracks [i];
            List <SearchTrackNode> searchTrackNodes = searchTrack.GetSearchTrackNodes();
            allSearchTrackNodes.AddRange(searchTrackNodes);
        }

        return(allSearchTrackNodes);
    }
Пример #7
0
        public async System.Threading.Tasks.Task <ActionResult <IEnumerable <SearchTrack> > > EmotionsAsync(string emotion)
        {
            string url = "https://secure.galiboo.com/api/discover/tracks/smart_search/?token=" + GalibooKey + "&q=" + emotion;

            string[] array = new string[50];
            string   jsonString;

            using (var httpClient = new HttpClient())
            {
                jsonString = await httpClient.GetStringAsync(url);

                // Now parse with JSON.Net
            }
            RootObject         json = JsonConvert.DeserializeObject <RootObject>(jsonString);
            List <SearchTrack> list = new List <SearchTrack>();

            foreach (var element in json.results)
            {
                SearchTrack track = new SearchTrack();
                track.Title = element.title;
                string artist = "";
                foreach (var artistEl in element.artists)
                {
                    artist = artistEl.name;
                    if (element.artists.Count == 1)
                    {
                        break;
                    }
                    else
                    {
                        artist = artist + ", ";
                    }
                }
                track.Artist = artist;
                list.Add(track);
            }

            return(list);
        }
        public IActionResult SearchUpdatePosition(string lat, string lon, int ticketId)
        {
            if (!HttpContext.Request.Cookies.TryGetValue("uid", out string uid))
            {
                return(new JsonResult(new QueryResult(QueryResultEnum.Error_SessionError)));
            }

            using (var trans = _db.Database.BeginTransaction())
            {
                int lastId = _db.SearchTracks.Select(s => s.Id).OrderBy(s => s).LastOrDefault();
                lastId++;
                SearchTrack st = new SearchTrack()
                {
                    Id = lastId, TicketId = ticketId
                };
                st.UserId    = int.Parse(uid);
                st.Longitude = lon;
                st.Latitude  = lat;
                _db.SearchTracks.Add(st);
                _db.SaveChanges();
                trans.Commit();
            }
            return(new JsonResult(new QueryResult(QueryResultEnum.Executed)));
        }
 public void Init(SearchTrack track)
 {
     coordinates = transform.position;
     this.track  = track;
 }