Beispiel #1
0
        void DrawTagField()
        {
            if (PropertyField("modifyTag"))
            {
                var tagValue = FindProperty("setTag");
                EditorGUI.indentLevel++;
                EditorGUI.showMixedValue = tagValue.hasMultipleDifferentValues;
                EditorGUI.BeginChangeCheck();
                var newTag =
                    EditorGUILayoutx.TagField("Tag Value", tagValue.intValue, () => AstarPathEditor.EditTags());
                if (EditorGUI.EndChangeCheck())
                {
                    tagValue.intValue = newTag;
                }

                if (GUILayout.Button(
                        "Tags can be used to restrict which units can walk on what ground. Click here for more info",
                        "HelpBox"))
                {
                    Application.OpenURL(AstarUpdateChecker.GetURL("tags"));
                }

                EditorGUI.indentLevel--;
            }
        }
Beispiel #2
0
        void CaptureContextClick(string propertyPath)
        {
            var url = FindURL(target.GetType(), propertyPath);

            if (url != null)
            {
                Event.current.Use();
                var menu = new GenericMenu();
                menu.AddItem(showInDocContent, false, () => Application.OpenURL(AstarUpdateChecker.GetURL("documentation") + url));
                menu.ShowAsContext();
            }
        }
Beispiel #3
0
        bool PropertyField(SerializedProperty prop, string label, string tooltip, string propertyPath)
        {
            content.text    = label ?? prop.displayName;
            content.tooltip = tooltip ?? FindTooltip(propertyPath);
            var contextClick = Event.current.type == EventType.ContextClick;

            EditorGUILayout.PropertyField(prop, content, true, noOptions);
            if (contextClick && Event.current.type == EventType.Used)
            {
                var url = FindURL(target.GetType(), propertyPath);
                if (url != null)
                {
                    Event.current.Use();
                    var menu = new GenericMenu();
                    menu.AddItem(showInDocContent, false, () => Application.OpenURL(AstarUpdateChecker.GetURL("documentation") + url));
                    menu.ShowAsContext();
                }
            }
            return(prop.propertyType == SerializedPropertyType.Boolean ? !prop.hasMultipleDifferentValues && prop.boolValue : true);
        }
Beispiel #4
0
        void DrawTagField()
        {
            EditorGUILayout.PropertyField(modifyTag, new GUIContent("Modify Tag", "Should the tags of the nodes be modified"));
            if (!modifyTag.hasMultipleDifferentValues && modifyTag.boolValue)
            {
                EditorGUI.indentLevel++;
                EditorGUI.showMixedValue = tagValue.hasMultipleDifferentValues;
                EditorGUI.BeginChangeCheck();
                var newTag = EditorGUILayoutx.TagField("Tag Value", tagValue.intValue);
                if (EditorGUI.EndChangeCheck())
                {
                    tagValue.intValue = newTag;
                }
                EditorGUI.indentLevel--;
            }

            if (GUILayout.Button("Tags can be used to restrict which units can walk on what ground. Click here for more info", "HelpBox"))
            {
                Application.OpenURL(AstarUpdateChecker.GetURL("tags"));
            }
        }
        void OnGUI()
        {
            if (largeStyle == null)
            {
                largeStyle           = new GUIStyle(EditorStyles.largeLabel);
                largeStyle.fontSize  = 32;
                largeStyle.alignment = TextAnchor.UpperCenter;
                largeStyle.richText  = true;

                normalStyle          = new GUIStyle(EditorStyles.label);
                normalStyle.wordWrap = true;
                normalStyle.richText = true;
            }

            if (version == null)
            {
                return;
            }

            GUILayout.Label("New Update Available!", largeStyle);
            GUILayout.Label("There is a new version of the <b>A* Pathfinding Project</b> available for download.\n" +
                            "The new version is <b>" + version + "</b> you have <b>" + AstarPath.Version + "</b>\n\n" +
                            "<i>Summary:</i>\n" + summary, normalStyle
                            );

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            GUILayout.BeginVertical();

            Color col = GUI.color;

            GUI.backgroundColor *= new Color(0.5f, 1f, 0.5f);
            if (GUILayout.Button("Take me to the download page!", GUILayout.Height(30), GUILayout.MaxWidth(300)))
            {
                Application.OpenURL(AstarUpdateChecker.GetURL("download"));
            }
            GUI.backgroundColor = col;


            if (GUILayout.Button("What's new? (full changelog)"))
            {
                Application.OpenURL(AstarUpdateChecker.GetURL("changelog"));
            }

            GUILayout.EndVertical();

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Skip this version", GUILayout.MaxWidth(100)))
            {
                EditorPrefs.SetString("AstarSkipUpToVersion", version.ToString());
                setReminder = true;
                Close();
            }

            if (GUILayout.Button("Remind me later ( 1 week )", GUILayout.MaxWidth(200)))
            {
                EditorPrefs.SetString("AstarRemindUpdateDate", DateTime.UtcNow.AddDays(7).ToString(System.Globalization.CultureInfo.InvariantCulture));
                EditorPrefs.SetString("AstarRemindUpdateVersion", version.ToString());
                setReminder = true;
                Close();
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }