public override void CreateSettingsUI(VisualElement rootElement)
        {
            MarkdownElement markdown = new MarkdownElement
            {
                Data             = $@"Welcome and Thank you for trying ThunderKit.  Please configure your ThunderKit project by first clicking the Locate Game button below!

If this is your first time using ThunderKit, [Click Here](menulink://Tools/ThunderKit/Documentation) to launch the documentation",
                MarkdownDataType = MarkdownDataType.Text
            };

#if UNITY_2018
            markdown.AddStyleSheetPath("Packages/com.passivepicasso.thunderkit/Documentation/uss/markdown.uss");
            markdown.AddStyleSheetPath("Packages/com.passivepicasso.thunderkit/Documentation/uss/thunderkit_documentation.uss");
#else
            markdown.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>("Packages/com.passivepicasso.thunderkit/Documentation/uss/markdown.uss"));
            markdown.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>("Packages/com.passivepicasso.thunderkit/Documentation/uss/thunderkit_documentation.uss"));
#endif
            markdown.RefreshContent();
            markdown.AddToClassList("m4");

            var child = CreateStandardField(nameof(ShowOnStartup));
            child.tooltip = "Uncheck this to stop showing this window on startup";
            rootElement.Add(child);
            rootElement.Add(markdown);

            rootElement.Bind(new SerializedObject(this));
        }
Esempio n. 2
0
        public override void CreateSettingsUI(VisualElement rootElement)
        {
            MarkdownElement markdown = null;

            if (string.IsNullOrEmpty(GameExecutable) || string.IsNullOrEmpty(GamePath))
            {
                markdown = new MarkdownElement
                {
                    Data =
                        $@"
**_Warning:_**   No game configured. Click the Locate Game button to setup your ThunderKit Project before continuing
",
                    MarkdownDataType = MarkdownDataType.Text
                };

#if UNITY_2018
                markdown.AddStyleSheetPath("Packages/com.passivepicasso.thunderkit/Documentation/uss/markdown.uss");
#else
                markdown.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>("Packages/com.passivepicasso.thunderkit/Documentation/uss/markdown.uss"));
#endif
                markdown.AddToClassList("m4");
                markdown.RefreshContent();
                rootElement.Add(markdown);
            }

            rootElement.Add(CreateStandardField(nameof(GameExecutable)));

            rootElement.Add(CreateStandardField(nameof(GamePath)));

            var configureButton = new Button(() =>
            {
                ConfigureGame.Configure();
                if (!string.IsNullOrEmpty(GameExecutable) && !string.IsNullOrEmpty(GamePath))
                {
                    if (markdown != null)
                    {
                        markdown.RemoveFromHierarchy();
                    }
                }
            });
            configureButton.AddToClassList("configure-game-button");
            configureButton.text = "Locate Game";
            rootElement.Add(configureButton);

            if (thunderKitSettingsSO == null)
            {
                thunderKitSettingsSO = new SerializedObject(this);
            }
            rootElement.Bind(thunderKitSettingsSO);
        }