Exemplo n.º 1
0
        private void Initialize(string path, bool isFolder)
        {
            if (_modelsList != null)
            {
                _modelsList.Clear();
                _modelsList = null;
            }

            _existingObjectNames = ObjectBuildHelper.GetExistingObjectsNames();

            _modelsList = new List <CreateObjectModel>();

            if (isFolder)
            {
                _selectedFolder = path + Path.AltDirectorySeparatorChar;
                AddFolder(path);
            }
            else
            {
                _selectedFolder = path.Substring(0, path.IndexOf(Path.GetFileName(path), StringComparison.Ordinal));
                AddFile(path);
            }

            if (_modelsList.Count == 0)
            {
                _window.Close();
                EditorUtility.DisplayDialog("No models to import", $"No models to import", "Ok");
                return;
            }

            _window.Show();

            CleanUp();
        }
Exemplo n.º 2
0
        static void Init()
        {
            var window = GetWindow <CreateObjectWindow>(true, "Create object", true);

            window.minSize = MinWindowSize;
            window.maxSize = MaxWindowSize;
            window.Show();

            _existingObjectNames = ObjectBuildHelper.GetExistingObjectsNames();

            if (Selection.activeGameObject != null)
            {
                _gameObject = Selection.activeGameObject;

                string objectTypeName = Regex.Replace(_gameObject.name, "([A-ZА-Я])", " $1");
                objectTypeName   = ObjectBuildHelper.ConvertToNiceName(objectTypeName).Trim();
                _objectClassName = objectTypeName
                                   .Replace(" ", "")
                                   .Replace("(", "")
                                   .Replace(")", "")
                                   .Replace("-", "");

                _localizedName   = objectTypeName;
                _localizedNameRU = objectTypeName;
            }

            AuthorSettings.Initialize();
            _authorName  = AuthorSettings.Name;
            _authorEmail = AuthorSettings.Email;
            _authorUrl   = AuthorSettings.Url;

            _scrollPosition = Vector2.zero;
        }