Ejemplo n.º 1
0
        public static void ShowWindow()
        {
            FindOrCreateWorldDescriptor();
            FindOrCreateCamera();
            FillDefaultDataIfNull();

            GetWindowWithRect(typeof(CreateSceneTemplateWindow),
                              _windowRect,
                              false,
                              "Create scene template");
            _locationName           = _worldDescriptor.Name;
            _locationDesc           = _worldDescriptor.Description;
            _guid                   = _worldDescriptor.Guid;
            _rootGuid               = _worldDescriptor.RootGuid;
            _mobileReady            = SdkSettings.MobileFeature.Enabled && _worldDescriptor.MobileReady;
            _currentVersionWasBuilt = _worldDescriptor.CurrentVersionWasBuilt;

            if (string.IsNullOrWhiteSpace(_worldDescriptor.AuthorName))
            {
                AuthorSettings.Initialize();
                _authorName  = AuthorSettings.Name;
                _authorEmail = AuthorSettings.Email;
                _authorUrl   = AuthorSettings.Url;
            }
            else
            {
                _authorName  = _worldDescriptor.AuthorName;
                _authorEmail = _worldDescriptor.AuthorEmail;
                _authorUrl   = _worldDescriptor.AuthorUrl;
            }
        }
Ejemplo 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;
        }
Ejemplo n.º 3
0
        private void DrawAuthorSettings()
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            GUILayout.Label("Author:", EditorStyles.miniBoldLabel);
            _authorName  = EditorGUILayout.TextField("Name", _authorName);
            _authorEmail = EditorGUILayout.TextField("E-Mail", _authorEmail);
            _authorUrl   = EditorGUILayout.TextField("URL", _authorUrl);

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Reset to default author settings"))
            {
                AuthorSettings.Initialize();

                if (string.IsNullOrWhiteSpace(AuthorSettings.Name))
                {
                    AuthorSettingsWindow.Init();
                }
                else
                {
                    _authorName  = AuthorSettings.Name;
                    _authorEmail = AuthorSettings.Email;
                    _authorUrl   = AuthorSettings.Url;
                }
            }

            GUILayout.EndHorizontal();

            DrawAuthorCanNotBeEmptyHelpBox();

            EditorGUILayout.EndVertical();
        }
Ejemplo n.º 4
0
 private void OnDestroy()
 {
     if (AuthorSettings.IsChanged() && !string.IsNullOrWhiteSpace(AuthorSettings.Name))
     {
         if (EditorUtility.DisplayDialog("Default Author Info", $"Save default author info changes?", "Yes", "No"))
         {
             AuthorSettings.SaveAll();
         }
     }
 }
Ejemplo n.º 5
0
        public static void Init()
        {
            _window = GetWindow <AuthorSettingsWindow>(false, "Default Author Info", true);

            _window.minSize = WindowSize;
            _window.maxSize = WindowSize;

            _window.Show();

            AuthorSettings.Initialize();
        }
Ejemplo n.º 6
0
        private void DrawReloadButton()
        {
            bool enabled = AuthorSettings.IsChanged();

            EditorGUI.BeginDisabledGroup(!enabled);
            if (GUILayout.Button("Reload"))
            {
                AuthorSettings.Initialize();
                Debug.Log("Default author info have been reloaded.");
            }
            EditorGUI.EndDisabledGroup();
        }
Ejemplo n.º 7
0
 private void DrawRevertToDefaultValuesButton()
 {
     if (GUILayout.Button("Clear"))
     {
         if (EditorUtility.DisplayDialog("Default author info", $"Default author info will revert", "OK", "Cancel"))
         {
             AuthorSettings.Clear();
             AuthorSettings.Initialize();
             Debug.Log("Default author info have been reverted.");
         }
     }
 }
Ejemplo n.º 8
0
        private void DrawSaveButton()
        {
            bool enabled = AuthorSettings.IsChanged() && !string.IsNullOrWhiteSpace(AuthorSettings.Name);

            EditorGUI.BeginDisabledGroup(!enabled);
            if (GUILayout.Button("Save"))
            {
                AuthorSettings.SaveAll();
                AuthorSettings.Initialize();
                Debug.Log("Default author info have been updated.");
            }
            EditorGUI.EndDisabledGroup();
        }
Ejemplo n.º 9
0
        private void OnGUI()
        {
            if (string.IsNullOrWhiteSpace(AuthorSettings.SavedName))
            {
                AuthorSettings.Initialize();
            }

            GUILayout.BeginVertical(EditorStyles.inspectorFullWidthMargins);
            DrawFields();
            EditorGUILayout.Space();
            DrawControls();
            DrawNameCanNotBeEmptyHelpBox();
            GUILayout.EndVertical();
        }