示例#1
0
        private void DrawStrippingSection()
        {
            // "Stripping Preset"
            using (var content = ControlContent.Basic(
                       TileLang.ParticularText("Property", "Stripping Preset"),
                       TileLang.Text("Custom level of stripping can be applied to tile system upon build.")
                       )) {
                EditorGUILayout.PropertyField(this.propertyStrippingPreset, content);
            }

            // "Stripping Preset Toggles"
            if (!this.propertyStrippingPreset.hasMultipleDifferentValues)
            {
                var             targetSystems = this.targets.Cast <TileSystem>().ToArray();
                int             mixedMask     = RotorzEditorGUI.GetMixedStrippingOptionsMask(targetSystems);
                StrippingPreset preset        = targetSystems[0].StrippingPreset;
                int             options       = targetSystems[0].StrippingOptions & ~mixedMask;

                EditorGUI.showMixedValue = this.propertyStrippingOptionMask.hasMultipleDifferentValues;
                int diff = RotorzEditorGUI.StrippingOptions(preset, options, mixedMask);

                if (diff != 0 && preset == StrippingPreset.Custom)
                {
                    int addBits    = diff & ~options;
                    int removeBits = diff & options;

                    Undo.RecordObjects(this.targets, TileLang.ParticularText("Action", "Modify Stripping Options"));
                    foreach (var tileSystem in targetSystems)
                    {
                        tileSystem.StrippingOptions = (tileSystem.StrippingOptions & ~removeBits) | addBits;
                        EditorUtility.SetDirty(tileSystem);
                    }
                }
                EditorGUI.showMixedValue = false;
            }

            GUILayout.Space(5);
        }