Пример #1
0
        public override void ApplyOptions(GUILayoutOption[] options)
        {
            if (options != null)
            {
                base.ApplyOptions(options);
                for (int i = 0; i < options.Length; i++)
                {
                    GUILayoutOption gUILayoutOption = options[i];
                    switch (GUILayoutOptionHelper.GetType(gUILayoutOption))
                    {
                    case GUILayoutOptionType.fixedWidth:
                    case GUILayoutOptionType.minWidth:
                    case GUILayoutOptionType.maxWidth:
                        m_UserSpecifiedHeight = true;
                        break;

                    case GUILayoutOptionType.fixedHeight:
                    case GUILayoutOptionType.minHeight:
                    case GUILayoutOptionType.maxHeight:
                        m_UserSpecifiedWidth = true;
                        break;

                    case GUILayoutOptionType.spacing:
                        spacing = (float)((int)GUILayoutOptionHelper.GetValue(gUILayoutOption));
                        break;
                    }
                }
            }
        }
Пример #2
0
        public virtual void ApplyOptions(GUILayoutOption[] options)
        {
            if (options != null)
            {
                for (int i = 0; i < options.Length; i++)
                {
                    GUILayoutOption gUILayoutOption = options[i];

                    GUILayoutOptionType type = GUILayoutOptionHelper.GetType(gUILayoutOption);

                    switch (type)
                    {
                    case GUILayoutOptionType.fixedWidth:
                        minWidth     = (maxWidth = GUILayoutOptionHelper.GetValue(gUILayoutOption));
                        stretchWidth = 0;
                        break;

                    case GUILayoutOptionType.fixedHeight:
                        minHeight     = (maxHeight = GUILayoutOptionHelper.GetValue(gUILayoutOption));
                        stretchHeight = 0;
                        break;

                    case GUILayoutOptionType.minWidth:
                        minWidth = GUILayoutOptionHelper.GetValue(gUILayoutOption);
                        if (maxWidth < minWidth)
                        {
                            maxWidth = minWidth;
                        }
                        break;

                    case GUILayoutOptionType.maxWidth:
                        maxWidth = GUILayoutOptionHelper.GetValue(gUILayoutOption);
                        if (minWidth > maxWidth)
                        {
                            minWidth = maxWidth;
                        }
                        stretchWidth = 0;
                        break;

                    case GUILayoutOptionType.minHeight:
                        minHeight = GUILayoutOptionHelper.GetValue(gUILayoutOption);
                        if (maxHeight < minHeight)
                        {
                            maxHeight = minHeight;
                        }
                        break;

                    case GUILayoutOptionType.maxHeight:
                        maxHeight = GUILayoutOptionHelper.GetValue(gUILayoutOption);
                        if (minHeight > maxHeight)
                        {
                            minHeight = maxHeight;
                        }
                        stretchHeight = 0;
                        break;

                    case GUILayoutOptionType.stretchWidth:
                        stretchWidth = (int)GUILayoutOptionHelper.GetValue(gUILayoutOption);
                        break;

                    case GUILayoutOptionType.stretchHeight:
                        stretchHeight = (int)GUILayoutOptionHelper.GetValue(gUILayoutOption);
                        break;
                    }
                }
                if (maxWidth != 0f && maxWidth < minWidth)
                {
                    maxWidth = minWidth;
                }
                if (maxHeight != 0f && maxHeight < minHeight)
                {
                    maxHeight = minHeight;
                }
            }
        }