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