private void DrawMainMenu(eSettingsType[] _options)
        {
//			GUILayout.Label("Native Plugins Settings",
//			                style: CreateBoldLabel(_size: kTitleFontSize, _alignement: TextAnchor.MiddleCenter));

            // get menu button content
            GUIContent[] _contents = Array.ConvertAll(_options, (_option) =>
            {
                SerializedProperty _property = m_settingsCollection[_option];
                return(new GUIContent(text: _property.displayName,
                                      tooltip: _property.tooltip,
                                      image: null));
            });

            // display grid buttons
            GUILayout.BeginVertical();
            GUILayout.Space(2f);
            int _selectedIndex = GUILayout.SelectionGrid(selected: -1,
                                                         contents: _contents,
                                                         xCount: kGridRowCount,
                                                         style: "LargeButton",
                                                         options: GUILayout.MinHeight(220f));

            if (_selectedIndex != -1)
            {
                m_activeType = _options[_selectedIndex];
            }
            GUILayout.EndVertical();
        }
Пример #2
0
        public Template AddMany(string aggrSpec, params object[] values)
        {
            if (aggrSpec == null)
            {
                throw new ArgumentNullException("aggrSpec");
            }
            if (values == null)
            {
                throw new ArgumentNullException("values");
            }

            if (values.Length == 0)
            {
                throw new ArgumentException(string.Format("missing values for aggregate attribute format: {0}", aggrSpec), "aggrSpec");
            }

            int dot        = aggrSpec.IndexOf(".{");
            int finalCurly = aggrSpec.IndexOf('}');

            if (dot < 0 || finalCurly < 0)
            {
                throw new ArgumentException(string.Format("invalid aggregate attribute format: {0}", aggrSpec), "aggrSpec");
            }

            string aggrName   = aggrSpec.Substring(0, dot);
            string propString = aggrSpec.Substring(dot + 2, aggrSpec.Length - dot - 3);

            propString = propString.Trim();
            string[] propNames = Array.ConvertAll(propString.Split(','), p => p.Trim());
            if (propNames == null || propNames.Length == 0)
            {
                throw new ArgumentException(string.Format("invalid aggregate attribute format: {0}", aggrSpec), "aggrSpec");
            }

            if (values.Length != propNames.Length)
            {
                throw new ArgumentException(string.Format("number of properties and values mismatch for aggregate attribute format: {0}", aggrSpec), "aggrSpec");
            }

            int       i    = 0;
            Aggregate aggr = new Aggregate();

            foreach (string p in propNames)
            {
                object value = values[i++];
                aggr[p] = value;
            }

            Add(aggrName, aggr); // now add as usual
            return(this);
        }