예제 #1
0
        private void UpdateSelectedScript()
        {
            SaveResources();
            map.Clear();

            if (!ObjectUtils.IsValid(script))
            {
                return;
            }

            var extractedCommands = script.ExtractCommands()
                                    .Where(c => c is Commands.PrintText)
                                    .Cast <Commands.PrintText>();

            foreach (var cmd in extractedCommands)
            {
                if (!cmd?.Text?.HasValue ?? true)
                {
                    continue;
                }

                var hash  = AudioConfiguration.GetAutoVoiceClipPath(cmd);
                var label = $"#{cmd.PlaybackSpot.LineNumber}.{cmd.PlaybackSpot.InlineIndex} ";
                if (!string.IsNullOrEmpty(cmd.AuthorId))
                {
                    label += $"{cmd.AuthorId}: ";
                }
                label += cmd.Text.DynamicValue ? cmd.Text.DynamicValueText : cmd.Text.Value;
                var clipPath = PathUtils.Combine(audioConfig.VoiceLoader.PathPrefix, hash);
                var clipGuid = editorResources.GetGuidByPath(clipPath);
                var mapItem  = new MapItem {
                    Label = new GUIContent(label, label), ClipGuid = clipGuid
                };
                map[hash] = mapItem;
            }
        }
예제 #2
0
 private void OnEnable()
 {
     editorResources = EditorResources.LoadOrDefault();
     audioConfig     = ProjectConfigurationProvider.LoadOrDefault <AudioConfiguration>();
     UpdateSelectedScript();
 }