static void SetPlatformCompatibility(AssemblyDefintionState state, MixedBool compatibility) { var platforms = Compilation.CompilationPipeline.GetAssemblyDefinitionPlatforms(); for (int i = 0; i < platforms.Length; ++i) { state.platformCompatibility[i] = compatibility; } }
static bool ToBool(MixedBool value) { if (value == MixedBool.Mixed) { throw new System.ArgumentException("Cannot convert MixedBool.Mixed to bool"); } return(value == MixedBool.True); }
static MixedBool InverseCompability(MixedBool compatibility) { if (compatibility == MixedBool.True) { return(MixedBool.False); } if (compatibility == MixedBool.False) { return(MixedBool.True); } return(MixedBool.Mixed); }
static MixedBool ToggleWithMixedValue(GUIContent title, MixedBool value) { EditorGUI.showMixedValue = value == MixedBool.Mixed; EditorGUI.BeginChangeCheck(); bool newBoolValue = EditorGUILayout.Toggle(title, value == MixedBool.True); if (EditorGUI.EndChangeCheck()) { return(newBoolValue ? MixedBool.True : MixedBool.False); } EditorGUI.showMixedValue = false; return(value); }
static void UpdatePlatformCompatibility(MixedBool compatibleWithAnyPlatform, AssemblyDefintionState[] states) { if (compatibleWithAnyPlatform == MixedBool.Mixed) { throw new ArgumentOutOfRangeException("compatibleWithAnyPlatform"); } foreach (var state in states) { // Same include/exclude compatibility if (state.compatibleWithAnyPlatform == compatibleWithAnyPlatform) { continue; } // Opposite compatibility, invert. state.compatibleWithAnyPlatform = compatibleWithAnyPlatform; InversePlatformCompatibility(state); } }