Exemplo n.º 1
0
        private void BuildSettingList()
        {
            _foldoutList.Clear();
            _statusList.Clear();

            if (_groupSetting.Settings != null)
            {
                foreach (var setting in _groupSetting.Settings)
                {
                    if (setting == null)
                    {
                        continue;
                    }

                    var status  = new TemplateSettingStatus(new SerializedObject(setting));
                    var foldout = new FoldoutInfo(setting.name, () =>
                    {
                        status.TargetSerializedObject.Update();
                        DrawSetting(status);
                        status.TargetSerializedObject.ApplyModifiedProperties();
                    }
                                                  );

                    foldout.IsFoldout = false;
                    _foldoutList.Add(foldout);
                    _statusList.Add(status);
                }
            }

            UpdateReplaceList(true);
        }
Exemplo n.º 2
0
        private void OnEnable()
        {
            _instanceId   = target.GetInstanceID().ToString();
            SettingStatus = new TemplateSettingStatus(serializedObject);

            _foldouts = new FoldoutInfo[]
            {
                new FoldoutInfo("Code", () => DrawCode(SettingStatus)),
                new FoldoutInfo("Replace Texts", () => DrawReplace(_replaceList, _instanceId)),
                new FoldoutInfo("Pre Process", () => DrawChain(SettingStatus)),
            };

            var property = SettingStatus.GetProperty(TemplateSettingStatus.Property.IsFoldouts);

            for (int i = 0; i < _foldouts.Length; ++i)
            {
                if (property.arraySize <= i)
                {
                    break;
                }

                _foldouts[i].IsFoldout = property.GetArrayElementAtIndex(i).boolValue;
            }

            _descriptionFoldout           = new FoldoutInfo("Description", DrawDescription);
            _descriptionFoldout.IsFoldout = string.IsNullOrEmpty(SettingStatus.GetProperty(TemplateSettingStatus.Property.Description).stringValue) == false;

            UpdateReplaceList(true);
        }
Exemplo n.º 3
0
 void OnEnable()
 {
     _groupSetting             = target as TemplateGroupSetting;
     _settingsProperty         = serializedObject.FindProperty("Settings");
     _isAssetsMenuItemProperty = serializedObject.FindProperty("AssetsMenuItem");
     _descriptionProperty      = serializedObject.FindProperty("Description");
     _descriptionFoldout       = new FoldoutInfo("Description", DrawDescription);
     BuildSettingList();
 }
Exemplo n.º 4
0
        /// <summary>
        /// 折りたたみ表示
        /// </summary>
        public static void DrawFoldout(FoldoutInfo foldout)
        {
            EditorGUI.indentLevel++;
            foldout.IsFoldout = EditorGUILayout.Foldout(foldout.IsFoldout, foldout.DrawName);
            EditorGUI.indentLevel--;
            if (foldout.IsFoldout == false)
            {
                return;
            }

            foldout.DrawAction();
        }