コード例 #1
0
 private void AutoFixActiveGenerator()
 {
     if (_activeGenerator == null) {
         _templateIndex = Mathf.Clamp(_templateIndex, 0, ScriptGeneratorDescriptor.Descriptors.Count);
         _activeGenerator = ScriptGeneratorDescriptor.Descriptors[_templateIndex].CreateInstance();
     }
 }
コード例 #2
0
 private void AutoFixActiveGenerator()
 {
     if (_activeGenerator == null)
     {
         _templateIndex   = Mathf.Clamp(_templateIndex, 0, ScriptGeneratorDescriptor.Descriptors.Count);
         _activeGenerator = ScriptGeneratorDescriptor.Descriptors[_templateIndex].CreateInstance();
     }
 }
コード例 #3
0
        private void DrawTemplateSelector()
        {
            if (_templateDescriptions == null)
            {
                _templateDescriptions = ScriptGeneratorDescriptor.Descriptors
                                        .Select(descriptor => descriptor.Attribute.Description)
                                        .ToArray();
            }

            // Allow user to select template from popup.
            EditorGUILayout.PrefixLabel("Template:");
            EditorGUI.BeginChangeCheck();
            _templateIndex = EditorGUILayout.Popup(_templateIndex, _templateDescriptions);
            if (EditorGUI.EndChangeCheck())
            {
                _activeGenerator = null;
            }

            AutoFixActiveGenerator();
        }
コード例 #4
0
        private void DrawTemplateSelector()
        {
            if (_templateDescriptions == null)
                _templateDescriptions = ScriptGeneratorDescriptor.Descriptors
                    .Select(descriptor => descriptor.Attribute.Description)
                    .ToArray();

            // Allow user to select template from popup.
            EditorGUILayout.PrefixLabel("Template:");
            EditorGUI.BeginChangeCheck();
            _templateIndex = EditorGUILayout.Popup(_templateIndex, _templateDescriptions);
            if (EditorGUI.EndChangeCheck())
                _activeGenerator = null;

            AutoFixActiveGenerator();
        }