示例#1
0
    void Start()
    {
        manager = FindObjectOfType <GameManager>();
        source  = GetComponent <AudioSource>();

        List <TrainActionLabel> actions = TrainActionLabel.RetrieveFromDataset(dataset.text);


        narrationStrings         = new List <string>();
        videoDictionary          = new Dictionary <string, List <VideoData> >();
        player.prepareCompleted += (x) => {
            PreparationComplete();
        };

        int count = 0;

        foreach (TrainActionLabel act in actions)
        {
            if (!narrationStrings.Contains(act.narration))
            {
                narrationStrings.Add(act.narration);
            }

            VideoData data = new VideoData();
            data.video_id   = act.video_id;
            data.start_time = act.start_frame / 60.0;
            data.stop_time  = act.stop_frame / 60.0;
            data.unique_id  = count;
            data.narration  = act.narration.ToLower().Trim();
            count++;

            if (act.narration == act.verb || act.verb == "video" || act.noun == "video" || act.narration.Contains("video") || act.narration.Contains("recording"))
            {
                // Debug.Log("SKIPPED " + act.narration);
            }
            else
            {
                if (!videoDictionary.ContainsKey(data.narration))
                {
                    videoDictionary[data.narration] = new List <VideoData>();
                }

                videoDictionary[data.narration].Add(data);
            }
        }
    }