| | 1 | | using System.Collections.Generic; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace DCL.ProfanityFiltering |
| | 5 | | { |
| | 6 | | public class ProfanityWordProviderFromResourcesJson : IProfanityWordProvider |
| | 7 | | { |
| | 8 | | private readonly string jsonFilePath; |
| | 9 | |
|
| 115 | 10 | | public ProfanityWordProviderFromResourcesJson(string jsonFilePath) |
| | 11 | | { |
| 115 | 12 | | this.jsonFilePath = jsonFilePath; |
| 115 | 13 | | } |
| | 14 | |
|
| | 15 | | public IEnumerable<string> GetExplicitWords() |
| | 16 | | { |
| 115 | 17 | | var asset = Resources.Load<TextAsset>(jsonFilePath); |
| 115 | 18 | | var json = JsonUtility.FromJson<ProfanityWordsJsonStructure>(asset.text); |
| 115 | 19 | | return json.explicitWords; |
| | 20 | | } |
| | 21 | |
|
| | 22 | | public IEnumerable<string> GetNonExplicitWords() |
| | 23 | | { |
| 115 | 24 | | var asset = Resources.Load<TextAsset>(jsonFilePath); |
| 115 | 25 | | var json = JsonUtility.FromJson<ProfanityWordsJsonStructure>(asset.text); |
| 115 | 26 | | return json.nonExplicitWords; |
| | 27 | | } |
| | 28 | |
|
| | 29 | | private struct ProfanityWordsJsonStructure |
| | 30 | | { |
| | 31 | | public string[] explicitWords; |
| | 32 | | public string[] nonExplicitWords; |
| | 33 | | } |
| | 34 | | } |
| | 35 | | } |