/************************************************************************************************************************/

            private void OnEnable()
            {
                Target = (ReadMe)target;

                _PreviousVersion = PlayerPrefs.GetInt(ReleaseNumberPrefKey, -1);
                if (_PreviousVersion < 0)
                {
                    _PreviousVersion = EditorPrefs.GetInt(ReleaseNumberPrefKey, -1);// Animancer v2.0 used EditorPrefs.
                }
                _Examples = ExampleGroup.Gather(Target._ExamplesFolder, out _ExamplesDirectory);
            }
Beispiel #2
0
            /************************************************************************************************************************/

            private void OnEnable()
            {
                _Target = (ReadMe)target;
                _Icon   = AssetPreview.GetMiniThumbnail(target);

                var key = _Target.ReleaseNumberPrefKey;

                _PreviousVersion = PlayerPrefs.GetInt(key, -1);
                if (_PreviousVersion < 0)
                {
                    _PreviousVersion = EditorPrefs.GetInt(key, -1);// Animancer v2.0 used EditorPrefs.
                }
                _Examples = ExampleGroup.Gather(_Target._ExamplesFolder, out _ExamplesDirectory);

                _Title     = $"{_Target.ProductName}\n{_Target.VersionName}";
                _EmailLink = $"mailto:{_Target.DeveloperEmail}?subject={_Target.ProductName.Replace(" ", "%20")}";
                _DontShowOnStartupProperty = serializedObject.FindProperty(nameof(_DontShowOnStartup));
            }
Beispiel #3
0
        /************************************************************************************************************************/

        /// <summary>
        /// Finds the most recently modified <see cref="ReadMe"/> asset with <see cref="DontShowOnStartup"/> disabled.
        /// </summary>
        private static ReadMe FindReadMe()
        {
            DateTime latestWriteTime = default;
            ReadMe   latestReadMe    = null;
            string   latestGUID      = null;

            var guids = AssetDatabase.FindAssets($"t:{nameof(ReadMe)}");

            for (int i = 0; i < guids.Length; i++)
            {
                var guid = guids[i];
                if (SessionState.GetBool(guid, false))
                {
                    continue;
                }

                var assetPath = AssetDatabase.GUIDToAssetPath(guid);
                var asset     = AssetDatabase.LoadAssetAtPath <ReadMe>(assetPath);
                if (asset != null && !asset.DontShowOnStartup)
                {
                    var writeTime = File.GetLastWriteTimeUtc(assetPath);
                    if (latestWriteTime < writeTime)
                    {
                        latestWriteTime = writeTime;
                        latestReadMe    = asset;
                        latestGUID      = guid;
                    }
                }
            }

            if (latestGUID != null)
            {
                SessionState.SetBool(latestGUID, true);
            }

            return(latestReadMe);
        }