コード例 #1
0
        static void SetPlatformCompatibility(AssemblyDefintionState state, MixedBool compatibility)
        {
            var platforms = Compilation.CompilationPipeline.GetAssemblyDefinitionPlatforms();

            for (int i = 0; i < platforms.Length; ++i)
            {
                state.platformCompatibility[i] = compatibility;
            }
        }
コード例 #2
0
        static bool ToBool(MixedBool value)
        {
            if (value == MixedBool.Mixed)
            {
                throw new System.ArgumentException("Cannot convert MixedBool.Mixed to bool");
            }

            return(value == MixedBool.True);
        }
コード例 #3
0
        static MixedBool InverseCompability(MixedBool compatibility)
        {
            if (compatibility == MixedBool.True)
            {
                return(MixedBool.False);
            }

            if (compatibility == MixedBool.False)
            {
                return(MixedBool.True);
            }

            return(MixedBool.Mixed);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
            }
        }