| | 1 | | using System.Collections; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using System.Linq; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | public class FeatureFlag |
| | 7 | | { |
| | 8 | | public const string GPU_ONLY_MESHES = "use-gpu-only-meshes"; |
| | 9 | |
|
| 642 | 10 | | public readonly Dictionary<string, bool> flags = new Dictionary<string, bool>(); |
| 642 | 11 | | public readonly Dictionary<string, FeatureFlagVariant> variants = new Dictionary<string, FeatureFlagVariant>(); |
| | 12 | |
|
| | 13 | | public bool IsFeatureEnabled(string featureName) |
| | 14 | | { |
| 233 | 15 | | if (flags.ContainsKey(featureName)) |
| 6 | 16 | | return flags[featureName]; |
| | 17 | |
|
| 227 | 18 | | return false; |
| | 19 | | } |
| | 20 | |
|
| | 21 | | public string ToString() |
| | 22 | | { |
| 0 | 23 | | string result = ""; |
| | 24 | |
|
| 0 | 25 | | foreach ( var flag in flags ) |
| | 26 | | { |
| 0 | 27 | | result += $"{flag.Key}: {flag.Value}\n"; |
| | 28 | | } |
| | 29 | |
|
| 0 | 30 | | return result; |
| | 31 | | } |
| | 32 | | } |
| | 33 | |
|
| | 34 | | public class FeatureFlagVariant |
| | 35 | | { |
| | 36 | | private string name; |
| | 37 | | private bool enable; |
| | 38 | | private Payload payload; |
| | 39 | |
|
| | 40 | | struct Payload |
| | 41 | | { |
| | 42 | | private string type; |
| | 43 | | private string value; |
| | 44 | | } |
| | 45 | | } |