Exemple #1
0
        void DisplayTriStateBool(string label, Platform platform, Platform.PropertyAccessor <TriStateBool> property)
        {
            TriStateBool current = property.Get(platform);

            if (platform.Parent != null)
            {
                bool         overriden = property.HasValue(platform);
                TriStateBool parent    = property.Get(platform.Parent);

                string[] toggleChild = new string[ToggleParent.Length + 1];
                Array.Copy(ToggleParent, 0, toggleChild, 1, ToggleParent.Length);
                toggleChild[0] = string.Format("Inherit ({0})", ToggleParent[(int)parent]);

                int next = EditorGUILayout.Popup(label, overriden ? (int)current + 1 : 0, toggleChild);

                if (next == 0)
                {
                    property.Clear(platform);
                }
                else
                {
                    property.Set(platform, (TriStateBool)(next - 1));
                }
            }
            else if (platform is PlatformPlayInEditor)
            {
                int next = EditorGUILayout.Popup(label, (current != TriStateBool.Disabled) ? 0 : 1, ToggleEditor);
                property.Set(platform, next == 0 ? TriStateBool.Enabled : TriStateBool.Disabled);
            }
            else
            {
                int next = EditorGUILayout.Popup(label, (int)current, ToggleParent);
                property.Set(platform, (TriStateBool)next);
            }
        }
Exemple #2
0
        void DisplayInt(string label, Platform platform, Platform.PropertyAccessor <int> property, int min, int max)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(label);

            int currentValue = property.Get(platform);

            if (platform.Parent != null)
            {
                bool inherit = !property.HasValue(platform);

                inherit = GUILayout.Toggle(inherit, "Inherit");

                EditorGUI.BeginDisabledGroup(inherit);
                int next = EditorGUILayout.IntSlider(currentValue, min, max);
                EditorGUI.EndDisabledGroup();

                if (inherit)
                {
                    property.Clear(platform);
                }
                else
                {
                    property.Set(platform, next);
                }
            }
            else
            {
                int next = EditorGUILayout.IntSlider(currentValue, min, max);
                property.Set(platform, next);
            }

            EditorGUILayout.EndHorizontal();
        }
Exemple #3
0
        private void MigrateLegacyPlatforms <TValue, TSetting>(List <TSetting> settings,
                                                               Platform.PropertyAccessor <TValue> property, Func <Legacy.Platform, Platform> getMigrationTarget)
            where TSetting : Legacy.PlatformSetting <TValue>
        {
            foreach (TSetting setting in settings)
            {
                Platform platform = getMigrationTarget(setting.Platform);

                if (platform != null)
                {
                    property.Set(platform, setting.Value);
                }
            }
        }