Exemplo n.º 1
0
    private PatrolInfo patrolInfo;       //侦查兵数据

    public static TrackAction GetAction(GameObject player)
    {
        TrackAction action = CreateInstance <TrackAction>();

        action.player = player;
        return(action);
    }
Exemplo n.º 2
0
 public override void UpdateFrame(float dt)
 {
     if (TrackAction != null)
     {
         TrackAction.Update();
     }
     IsMoveNow = false;
     base.UpdateFrame(dt);
 }
Exemplo n.º 3
0
 //开始追踪
 void TrackPos(Vector2 pos)
 {
     if (TrackAction.IsTracking == false &&
         trackCd.IsOver == true)
     {
         TrackAction.SetTarger(pos);
         trackCd.Start();
     }
 }
Exemplo n.º 4
0
 public void SSActionEvent(SSAction source, int intParam = 0, GameObject objectParam = null)
 {
     if (intParam == 0)
     {
         TrackAction follow = TrackAction.GetAction(objectParam.gameObject.GetComponent <PatrolInfo>().player);
         this.RunAction(objectParam, follow, this);
     }
     else
     {
         PatrolAction move = PatrolAction.GetAction(objectParam.gameObject.GetComponent <PatrolInfo>().start_position);
         this.RunAction(objectParam, move, this);
     }
 }
Exemplo n.º 5
0
 public virtual void Track(TrackAction tracAction)
 {
 }
Exemplo n.º 6
0
 void SetTargetPos(Vector2 pos)
 {
     TrackAction.SetTarger(pos);
 }
Exemplo n.º 7
0
        private async Task <List <PlaylistAction> > GetPlaylistActions(List <MusicBeePlaylist> playlistsToSync, List <Playlist> existingGroovePlaylists)
        {
            List <PlaylistAction> playlistActions = new List <PlaylistAction>();
            int totalPlaylistsProcessed           = 0;

            foreach (MusicBeePlaylist playlist in playlistsToSync)
            {
                _window.WriteOutputLine($"Preparing {playlist.Name} for sync");

                // If playlist already exists,
                // for now, delete playlist and remake completely
                // eventually, calculate diff
                Playlist matchingGroovePlaylist = existingGroovePlaylists.Where(p => p.Name == playlist.Name).FirstOrDefault();
                if (matchingGroovePlaylist != null)
                {
                    PlaylistAction deletePlaylist = new PlaylistAction()
                    {
                        Id = matchingGroovePlaylist.Id,
                    };
                    playlistActions.Add(deletePlaylist);
                }

                // Get list of file paths to tracks in music bee library
                string[] playlistFiles = null;
                if (_mbApiInterface.Playlist_QueryFiles(playlist.MusicBeeName))
                {
                    bool success = _mbApiInterface.Playlist_QueryFilesEx(playlist.MusicBeeName, ref playlistFiles);
                    if (!success)
                    {
                        _window.WriteOutputLine($"Couldn't find playlist file for: {playlist.Name}");
                        return(null);
                    }
                }
                else
                {
                    playlistFiles = new string[] { };
                }

                // Map the track in music bee to Groove
                List <TrackAction> tracksToAdd = new List <TrackAction>();
                foreach (string file in playlistFiles)
                {
                    string title  = _mbApiInterface.Library_GetFileTag(file, MetaDataType.TrackTitle);
                    string artist = _mbApiInterface.Library_GetFileTag(file, MetaDataType.Artist);

                    ContentResponse response = await _client.SearchAsync(MediaNamespace.music, HttpUtility.UrlEncode(title), ContentSource.Collection, SearchFilter.Tracks);

                    if (response.Error == null || response.Error.ErrorCode == Enum.GetName(typeof(ErrorCode), ErrorCode.COLLECTION_INVALID_DATA))
                    {
                        TrackAction  action      = null;
                        List <Track> tracksFound = response.Tracks.Items.Cast <Track>().ToList();
                        foreach (Track track in tracksFound)
                        {
                            if (track.Name == title &&
                                track.Artists.Where(c => c.Artist.Name == artist).FirstOrDefault() != null)
                            {
                                action = new TrackAction()
                                {
                                    Action = TrackActionType.Add,
                                    Id     = track.Id
                                };
                                tracksToAdd.Add(action);
                            }
                        }

                        if (action == null)
                        {
                            _window.WriteOutputLine($"Could not match track {artist} - {title}");
                        }
                    }
                    else
                    {
                        _window.WriteOutputLine($"Could not match track {artist} - {title}");
                    }
                }

                PlaylistAction createPlaylist = new PlaylistAction()
                {
                    Name         = playlist.Name,
                    TrackActions = tracksToAdd
                };
                playlistActions.Add(createPlaylist);

                totalPlaylistsProcessed++;
                _window.UpdatePreparationProgress(100 * totalPlaylistsProcessed / playlistsToSync.Count);
            }

            return(playlistActions);
        }