// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik //
using System;
using UnityEngine;
namespace Animancer
{
/// [Assert-Conditional]
/// A which points to Animancer's documentation.
///
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
[System.Diagnostics.Conditional(Strings.Assertions)]
public class AnimancerHelpUrlAttribute : HelpURLAttribute
{
/************************************************************************************************************************/
/// Creates a new .
public AnimancerHelpUrlAttribute(string url)
: base(url)
{ }
/************************************************************************************************************************/
/// Creates a new .
public AnimancerHelpUrlAttribute(Type type)
: base(GetApiDocumentationUrl(type))
{ }
/************************************************************************************************************************/
/// Returns a URL for the given `type`'s API Documentation page.
public static string GetApiDocumentationUrl(Type type)
=> GetApiDocumentationUrl(Strings.DocsURLs.Documentation + "/api/", type);
/// Returns a URL for the given `type`'s API Documentation page.
public static string GetApiDocumentationUrl(string prefix, Type type)
{
var url = StringBuilderPool.Instance.Acquire();
url.Append(prefix);
if (!string.IsNullOrEmpty(type.Namespace))
url.Append(type.Namespace).Append('/');
url.Append(type.Name.Replace('`', '_'));
return url.ReleaseToString();
}
/************************************************************************************************************************/
}
}