Browse Source

Added support for links and most text flags

Added Consolas font asset
Attempted to make code tags work
pull/11/head
Anairkoen Schno 5 years ago
parent
commit
1f0cbf32db
8 changed files with 828 additions and 51 deletions
  1. +4
    -0
      BSIPA-ModList/BSIPA-ModList.csproj
  2. BIN
      BSIPA-ModList/Bundles/consolas
  3. +232
    -42
      BSIPA-ModList/UI/ViewControllers/MarkdownView.cs
  4. +89
    -1
      BSIPA-ModList/Utilities.cs
  5. +8
    -8
      BSIPA-ModList/manifest.json
  6. BIN
      Refs/UnityEngine.AssetBundleModule.dll
  7. +492
    -0
      Refs/UnityEngine.AssetBundleModule.xml
  8. +3
    -0
      Refs/refs.txt

+ 4
- 0
BSIPA-ModList/BSIPA-ModList.csproj View File

@ -54,6 +54,9 @@
<Reference Include="UnityEngine"> <Reference Include="UnityEngine">
<HintPath>..\Refs\UnityEngine.dll</HintPath> <HintPath>..\Refs\UnityEngine.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<HintPath>..\Refs\UnityEngine.AssetBundleModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule"> <Reference Include="UnityEngine.CoreModule">
<HintPath>..\Refs\UnityEngine.CoreModule.dll</HintPath> <HintPath>..\Refs\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private> <Private>False</Private>
@ -116,6 +119,7 @@
<EmbeddedResource Include="Icons\library.png" /> <EmbeddedResource Include="Icons\library.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Bundles\consolas" />
<None Include="README.md" /> <None Include="README.md" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />


BIN
BSIPA-ModList/Bundles/consolas View File


+ 232
- 42
BSIPA-ModList/UI/ViewControllers/MarkdownView.cs View File

@ -10,6 +10,10 @@ using UnityEngine.UI;
using TMPro; using TMPro;
using CustomUI.BeatSaber; using CustomUI.BeatSaber;
using IPA.Utilities; using IPA.Utilities;
using System.Reflection;
using UnityEngine.EventSystems;
using System.Diagnostics;
using System.Collections;
namespace BSIPA_ModList.UI.ViewControllers namespace BSIPA_ModList.UI.ViewControllers
{ {
@ -70,8 +74,50 @@ namespace BSIPA_ModList.UI.ViewControllers
return arg; return arg;
} }
private static string GetLinkUri(string uri)
{
if (uri[0] == '!')
{
Logger.md.Error($"Cannot link to embedded resource in mod description");
return null;
}
else
return uri.Substring(3);
}
private static AssetBundle _bundle;
private static AssetBundle Bundle
{
get
{
if (_bundle == null)
_bundle = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("BSIPA_ModList.Bundles.consolas"));
return _bundle;
}
}
private static TMP_FontAsset _consolas;
private static TMP_FontAsset Consolas
{
get
{
if (_consolas == null)
{
_consolas = Bundle?.LoadAsset<TMP_FontAsset>("CONSOLAS");
if (_consolas != null)
{
_consolas.material.color = new Color(1f, 1f, 1f, 0f);
_consolas.material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.None;
}
}
return _consolas;
}
}
protected void Awake() protected void Awake()
{ {
if (Consolas == null)
Logger.md.Error($"Loading of Consolas font failed");
gameObject.SetActive(false); gameObject.SetActive(false);
var vpgo = new GameObject("Viewport"); var vpgo = new GameObject("Viewport");
@ -173,21 +219,20 @@ namespace BSIPA_ModList.UI.ViewControllers
} }
#endif #endif
if (mdDirty) if (mdDirty)
UpdateMd();
else if (resetContentPosition)
{
resetContentPosition = false;
scrView.Setup();
StartCoroutine(UpdateMd());
}
// this is the bullshit I have to use to make it work properly
content.gameObject.GetComponent<VerticalLayoutGroup>().enabled = false;
var childRt = content.GetChild(0) as RectTransform;
childRt.anchoredPosition = new Vector2(0f, childRt.anchoredPosition.y);
}
[Flags]
private enum CurrentTextFlags
{
None = 0, Bold = 1, Italic = 2, Underline = 4, Strikethrough = 8,
} }
private const string LinkDefaultColor = "#0061ff";
private const string LinkHoverColor = "#009dff";
private bool resetContentPosition = false; private bool resetContentPosition = false;
private void UpdateMd()
private IEnumerator UpdateMd()
{ {
mdDirty = false; mdDirty = false;
Clear(); Clear();
@ -200,6 +245,8 @@ namespace BSIPA_ModList.UI.ViewControllers
Stack<RectTransform> layout = new Stack<RectTransform>(); Stack<RectTransform> layout = new Stack<RectTransform>();
layout.Push(content); layout.Push(content);
TextMeshProUGUI currentText = null; TextMeshProUGUI currentText = null;
List<TextMeshProUGUI> texts = new List<TextMeshProUGUI>();
CurrentTextFlags textFlags = 0;
foreach (var node in doc.AsEnumerable()) foreach (var node in doc.AsEnumerable())
{ {
Logger.md.Debug($"node {node}"); Logger.md.Debug($"node {node}");
@ -365,49 +412,192 @@ namespace BSIPA_ModList.UI.ViewControllers
{ // inline element { // inline element
var inl = node.Inline; var inl = node.Inline;
void Flag(CurrentTextFlags flag)
{
if (node.IsOpening)
textFlags |= flag;
else if (node.IsClosing)
textFlags &= ~flag;
}
const float PSize = 3.5f; const float PSize = 3.5f;
const float H1Size = 4.8f; const float H1Size = 4.8f;
const float HLevelDecrease = 0.5f; const float HLevelDecrease = 0.5f;
switch (inl.Tag)
void EnsureText()
{ {
case InlineTag.String:
if (currentText == null)
if (currentText == null)
{
Logger.md.Debug($"Adding new text element");
var tt = layout.Peek().gameObject.GetComponent<TagTypeComponent>();
currentText = BeatSaberUI.CreateText(layout.Peek(), "", Vector2.zero);
currentText.gameObject.AddComponent<TextLinkDecoder>();
/*if (Consolas != null)
{ {
Logger.md.Debug($"Adding new text element");
var tt = layout.Peek().gameObject.GetComponent<TagTypeComponent>();
currentText = BeatSaberUI.CreateText(layout.Peek(), "", Vector2.zero);
//var le = currentText.gameObject.AddComponent<LayoutElement>();
switch (tt.Tag)
{
case BlockTag.List:
case BlockTag.ListItem:
case BlockTag.Paragraph:
currentText.fontSize = PSize;
currentText.enableWordWrapping = true;
break;
case BlockTag.AtxHeading:
var size = H1Size;
size -= HLevelDecrease * (tt.hData.Level - 1);
currentText.fontSize = size;
currentText.enableWordWrapping = true;
break;
case BlockTag.SetextHeading:
currentText.fontSize = H1Size;
currentText.enableWordWrapping = true;
break;
// Set the font to Consolas so code blocks work
currentText.font = Instantiate(Consolas);
currentText.text = $"<font={DefaultFontName}>";
}*/
switch (tt.Tag)
{
case BlockTag.List:
case BlockTag.ListItem:
case BlockTag.Paragraph:
currentText.fontSize = PSize;
currentText.enableWordWrapping = true;
break;
case BlockTag.AtxHeading:
var size = H1Size;
size -= HLevelDecrease * (tt.hData.Level - 1);
currentText.fontSize = size;
currentText.enableWordWrapping = true;
break;
case BlockTag.SetextHeading:
currentText.fontSize = H1Size;
currentText.enableWordWrapping = true;
break;
// TODO: add other relevant types // TODO: add other relevant types
}
} }
Logger.md.Debug($"Appending '{inl.LiteralContent}' to current element");
currentText.text += inl.LiteralContent;
texts.Add(currentText);
}
}
switch (inl.Tag)
{
case InlineTag.String:
EnsureText();
string head = "<noparse>", tail = "</noparse>";
if (textFlags.HasFlag(CurrentTextFlags.Bold))
{ head = "<b>" + head; tail += "</b>"; }
if (textFlags.HasFlag(CurrentTextFlags.Italic))
{ head = "<i>" + head; tail += "</i>"; }
if (textFlags.HasFlag(CurrentTextFlags.Strikethrough))
{ head = "<s>" + head; tail += "</s>"; }
if (textFlags.HasFlag(CurrentTextFlags.Underline))
{ head = "<u>" + head; tail += "</u>"; }
currentText.text += head + inl.LiteralContent + tail;
break;
case InlineTag.Strong:
Flag(CurrentTextFlags.Bold);
break;
case InlineTag.Strikethrough:
Flag(CurrentTextFlags.Strikethrough);
break;
case InlineTag.Emphasis:
Flag(CurrentTextFlags.Italic);
break;
case InlineTag.Code:
EnsureText();
currentText.text += $"<link=\"$$codeBlock\"><noparse>{inl.LiteralContent}</noparse></link>";
break;
case InlineTag.Link:
EnsureText();
Flag(CurrentTextFlags.Underline);
if (node.IsOpening)
currentText.text += $"<color={LinkDefaultColor}><link=\"{ResolveUri(inl.TargetUrl)}\">";
else if (node.IsClosing)
currentText.text += "</link></color>";
break; break;
} }
} }
} }
resetContentPosition = true;
yield return null; // delay one frame
scrView.Setup();
// this is the bullshit I have to use to make it work properly
content.gameObject.GetComponent<VerticalLayoutGroup>().enabled = false;
var childRt = content.GetChild(0) as RectTransform;
childRt.anchoredPosition = new Vector2(0f, childRt.anchoredPosition.y);
if (Consolas != null)
{
foreach (var link in texts.Select(t => t.textInfo.linkInfo).Aggregate<IEnumerable<TMP_LinkInfo>>(Enumerable.Concat).Where(l => l.GetLinkID() == "$$codeBlock"))
{
//link.textComponent.font = Consolas;
var texinfo = link.textComponent.textInfo;
texinfo.characterInfo[link.linkTextfirstCharacterIndex].DebugPrintTo(Logger.md.Debug, 2);
for (int i = link.linkTextfirstCharacterIndex; i < link.linkTextfirstCharacterIndex + link.linkTextLength; i++)
{
texinfo.characterInfo[i].fontAsset = Consolas;
texinfo.characterInfo[i].material = Consolas.material;
texinfo.characterInfo[i].isUsingAlternateTypeface = true;
}
}
foreach (var text in texts)
{
text.SetLayoutDirty();
text.SetVerticesDirty();
}
}
}
private class TextLinkDecoder : MonoBehaviour, IPointerClickHandler
{
private TextMeshProUGUI tmp;
public void Awake()
{
tmp = GetComponent<TextMeshProUGUI>();
}
public void OnPointerClick(PointerEventData eventData)
{
// this may not actually get me what i want
int linkIndex = TMP_TextUtilities.FindIntersectingLink(tmp, eventData.pointerPressRaycast.worldPosition, null);
if (linkIndex != -1)
{ // was a link clicked?
TMP_LinkInfo linkInfo = tmp.textInfo.linkInfo[linkIndex];
// open the link id as a url, which is the metadata we added in the text field
var qualifiedUrl = linkInfo.GetLinkID();
if (qualifiedUrl.StartsWith("$$"))
return; // this means its used for something else
Logger.md.Debug($"Link pressed {qualifiedUrl}");
var uri = GetLinkUri(qualifiedUrl);
if (uri != null)
Process.Start(uri);
}
}
private List<Color32[]> SetLinkToColor(int linkIndex, Color32 color)
{
TMP_LinkInfo linkInfo = tmp.textInfo.linkInfo[linkIndex];
var oldVertColors = new List<Color32[]>(); // store the old character colors
for (int i = 0; i < linkInfo.linkTextLength; i++)
{ // for each character in the link string
int characterIndex = linkInfo.linkTextfirstCharacterIndex + i; // the character index into the entire text
var charInfo = tmp.textInfo.characterInfo[characterIndex];
int meshIndex = charInfo.materialReferenceIndex; // Get the index of the material / sub text object used by this character.
int vertexIndex = charInfo.vertexIndex; // Get the index of the first vertex of this character.
Color32[] vertexColors = tmp.textInfo.meshInfo[meshIndex].colors32; // the colors for this character
oldVertColors.Add(vertexColors.ToArray());
if (charInfo.isVisible)
{
vertexColors[vertexIndex + 0] = color;
vertexColors[vertexIndex + 1] = color;
vertexColors[vertexIndex + 2] = color;
vertexColors[vertexIndex + 3] = color;
}
}
// Update Geometry
tmp.UpdateVertexData(TMP_VertexDataUpdateFlags.All);
return oldVertColors;
}
} }
private void Clear() private void Clear()


+ 89
- 1
BSIPA-ModList/Utilities.cs View File

@ -4,8 +4,10 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using UnityEngine; using UnityEngine;
using System.Runtime.CompilerServices;
using IPA.Utilities;
namespace BSIPA_ModList namespace BSIPA_ModList
{ {
@ -75,5 +77,91 @@ namespace BSIPA_ModList
return null; return null;
} }
} }
public static void DebugPrintTo<T>(this T obj, Action<string> log, int maxDepth = -1) =>
DebugPrintTo(obj?.GetType() ?? typeof(T), obj, log, "", new ConditionalWeakTable<object, Ref<bool>>(), maxDepth);
private static void DebugPrintTo(Type type, object obj, Action<string> log, string indent, ConditionalWeakTable<object, Ref<bool>> table, int maxDepth)
{
if (maxDepth == 0)
{
log(indent + "<Max depth reached>");
return;
}
if (obj == null)
{
log(indent + "null");
return;
}
table.Add(obj, true);
if (type.IsPrimitive)
{
log(indent + obj.ToString());
return;
}
if (type.IsEnum)
{
log(indent + obj.ToString());
return;
}
if (type == typeof(string))
{
log(indent + $"\"{obj.ToString()}\"");
return;
}
if (type.IsArray)
{
log(indent + $"{type.GetElementType()} [");
foreach (var o in obj as Array)
{
if (type.GetElementType().IsPrimitive)
log(indent + "- " + o?.ToString() ?? "null");
else if (type.GetElementType().IsEnum)
log(indent + "- " + o?.ToString() ?? "null");
else if (type.GetElementType() == typeof(string))
log(indent + "- " + $"\"{o?.ToString()}\"");
else
{
log(indent + $"- {o?.GetType()?.ToString() ?? "null"}");
if (o != null)
{
if (!table.TryGetValue(o, out _))
DebugPrintTo(o.GetType(), o, log, indent + " ", table, maxDepth - 1);
else
log(indent + " <Already printed>");
}
}
}
log(indent + "]");
return;
}
var fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (var field in fields)
{
var value = field.GetValue(obj);
if (field.FieldType.IsPrimitive)
log(indent + field.Name + ": " + value?.ToString() ?? "null");
else if (field.FieldType.IsEnum)
log(indent + field.Name + ": " + value?.ToString() ?? "null");
else if (field.FieldType == typeof(string))
log(indent + field.Name + ": " + $"\"{value?.ToString()}\"");
else
{
log(indent + field.Name + ": " + value?.GetType()?.ToString() ?? "null");
if (value != null)
{
if (!table.TryGetValue(value, out _))
DebugPrintTo(value?.GetType() ?? field.FieldType, value, log, indent + " ", table, maxDepth - 1);
else
log(indent + " <Already printed>");
}
}
}
}
} }
} }

+ 8
- 8
BSIPA-ModList/manifest.json View File

@ -9,19 +9,19 @@
"", "",
"***", "***",
"", "",
"Look, ma! Markdown! Its **[CommonMark](w::https://commonmark.org/)**!",
"Look, `ma`! Markdown! Its **[CommonMark](w::https://commonmark.org/)**!",
"", "",
"# H1 type 2 test", "# H1 type 2 test",
"", "",
"***", "***",
"", "",
"and many lines to come!",
"",
"and many lines to come!",
"",
"and many lines to come!",
"",
"and many lines to come!",
">and many lines to come!",
">",
">and many lines to come!",
">",
">and many lines to come!",
">",
">and many lines to come!",
], ],
"gameVersion": "0.13.2", "gameVersion": "0.13.2",
"id": "BSIPA Mod List", "id": "BSIPA Mod List",


BIN
Refs/UnityEngine.AssetBundleModule.dll View File


+ 492
- 0
Refs/UnityEngine.AssetBundleModule.xml View File

@ -0,0 +1,492 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<doc>
<members>
<assembly>
<name>UnityEngine.AssetBundleModule</name>
</assembly>
<member name="T:UnityEngine.AssetBundle">
<summary>
<para>AssetBundles let you stream additional assets via the UnityWebRequest class and instantiate them at runtime. AssetBundles are created via BuildPipeline.BuildAssetBundle.</para>
</summary>
</member>
<member name="P:UnityEngine.AssetBundle.isStreamedSceneAssetBundle">
<summary>
<para>Return true if the AssetBundle is a streamed Scene AssetBundle.</para>
</summary>
</member>
<member name="M:UnityEngine.AssetBundle.Contains(System.String)">
<summary>
<para>Check if an AssetBundle contains a specific object.</para>
</summary>
<param name="name"></param>
</member>
<member name="M:UnityEngine.AssetBundle.GetAllAssetNames">
<summary>
<para>Return all asset names in the AssetBundle.</para>
</summary>
</member>
<member name="M:UnityEngine.AssetBundle.GetAllLoadedAssetBundles">
<summary>
<para>To use when you need to get a list of all the currently loaded Asset Bundles.</para>
</summary>
<returns>
<para>Returns IEnumerable&lt;AssetBundle&gt; of all currently loaded Asset Bundles.</para>
</returns>
</member>
<member name="M:UnityEngine.AssetBundle.GetAllScenePaths">
<summary>
<para>Return all the Scene asset paths (paths to *.unity assets) in the AssetBundle.</para>
</summary>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAllAssets(System.Type)">
<summary>
<para>Loads all assets contained in the asset bundle that inherit from type.</para>
</summary>
<param name="type"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAllAssets">
<summary>
<para>Loads all assets contained in the asset bundle.</para>
</summary>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAllAssets">
<summary>
<para>Loads all assets contained in the asset bundle that inherit from type T.</para>
</summary>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAllAssetsAsync">
<summary>
<para>Loads all assets contained in the asset bundle asynchronously.</para>
</summary>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAllAssetsAsync">
<summary>
<para>Loads all assets contained in the asset bundle that inherit from T asynchronously.</para>
</summary>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAllAssetsAsync(System.Type)">
<summary>
<para>Loads all assets contained in the asset bundle that inherit from type asynchronously.</para>
</summary>
<param name="type"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAsset(System.String)">
<summary>
<para>Loads asset with name from the bundle.</para>
</summary>
<param name="name"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAsset(System.String,System.Type)">
<summary>
<para>Loads asset with name of a given type from the bundle.</para>
</summary>
<param name="name"></param>
<param name="type"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAsset(System.String)">
<summary>
<para>Loads asset with name of type T from the bundle.</para>
</summary>
<param name="name"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAssetAsync(System.String)">
<summary>
<para>Asynchronously loads asset with name from the bundle.</para>
</summary>
<param name="name"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAssetAsync(System.String)">
<summary>
<para>Asynchronously loads asset with name of a given T from the bundle.</para>
</summary>
<param name="name"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAssetAsync(System.String,System.Type)">
<summary>
<para>Asynchronously loads asset with name of a given type from the bundle.</para>
</summary>
<param name="name"></param>
<param name="type"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAssetWithSubAssets(System.String)">
<summary>
<para>Loads asset and sub assets with name from the bundle.</para>
</summary>
<param name="name"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAssetWithSubAssets(System.String,System.Type)">
<summary>
<para>Loads asset and sub assets with name of a given type from the bundle.</para>
</summary>
<param name="name"></param>
<param name="type"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAssetWithSubAssets(System.String)">
<summary>
<para>Loads asset and sub assets with name of type T from the bundle.</para>
</summary>
<param name="name"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAssetWithSubAssetsAsync(System.String)">
<summary>
<para>Loads asset with sub assets with name from the bundle asynchronously.</para>
</summary>
<param name="name"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAssetWithSubAssetsAsync(System.String)">
<summary>
<para>Loads asset with sub assets with name of type T from the bundle asynchronously.</para>
</summary>
<param name="name"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadAssetWithSubAssetsAsync(System.String,System.Type)">
<summary>
<para>Loads asset with sub assets with name of a given type from the bundle asynchronously.</para>
</summary>
<param name="name"></param>
<param name="type"></param>
</member>
<member name="M:UnityEngine.AssetBundle.LoadFromFile(System.String,System.UInt32,System.UInt64)">
<summary>
<para>Synchronously loads an AssetBundle from a file on disk.</para>
</summary>
<param name="path">Path of the file on disk.</param>
<param name="crc">An optional CRC-32 checksum of the uncompressed content. If this is non-zero, then the content will be compared against the checksum before loading it, and give an error if it does not match.</param>
<param name="offset">An optional byte offset. This value specifies where to start reading the AssetBundle from.</param>
<returns>
<para>Loaded AssetBundle object or null if failed.</para>
</returns>
</member>
<member name="M:UnityEngine.AssetBundle.LoadFromFile">
<summary>
<para>Synchronously loads an AssetBundle from a file on disk.</para>
</summary>
<param name="path">Path of the file on disk.</param>
<param name="crc">An optional CRC-32 checksum of the uncompressed content. If this is non-zero, then the content will be compared against the checksum before loading it, and give an error if it does not match.</param>
<param name="offset">An optional byte offset. This value specifies where to start reading the AssetBundle from.</param>
<returns>
<para>Loaded AssetBundle object or null if failed.</para>
</returns>
</member>
<member name="M:UnityEngine.AssetBundle.LoadFromFileAsync(System.String,System.UInt32,System.UInt64)">
<summary>
<para>Asynchronously loads an AssetBundle from a file on disk.</para>
</summary>
<param name="path">Path of the file on disk.</param>
<param name="crc">An optional CRC-32 checksum of the uncompressed content. If this is non-zero, then the content will be compared against the checksum before loading it, and give an error if it does not match.</param>
<param name="offset">An optional byte offset. This value specifies where to start reading the AssetBundle from.</param>
<returns>
<para>Asynchronous create request for an AssetBundle. Use AssetBundleCreateRequest.assetBundle property to get an AssetBundle once it is loaded.</para>
</returns>
</member>
<member name="M:UnityEngine.AssetBundle.LoadFromMemory(System.Byte[],System.UInt32)">
<summary>
<para>Synchronously create an AssetBundle from a memory region.</para>
</summary>
<param name="binary">Array of bytes with the AssetBundle data.</param>
<param name="crc">An optional CRC-32 checksum of the uncompressed content. If this is non-zero, then the content will be compared against the checksum before loading it, and give an error if it does not match.</param>
<returns>
<para>Loaded AssetBundle object or null if failed.</para>
</returns>
</member>
<member name="M:UnityEngine.AssetBundle.LoadFromMemoryAsync(System.Byte[],System.UInt32)">
<summary>
<para>Asynchronously create an AssetBundle from a memory region.</para>
</summary>
<param name="binary">Array of bytes with the AssetBundle data.</param>
<param name="crc">An optional CRC-32 checksum of the uncompressed content. If this is non-zero, then the content will be compared against the checksum before loading it, and give an error if it does not match.</param>
<returns>
<para>Asynchronous create request for an AssetBundle. Use AssetBundleCreateRequest.assetBundle property to get an AssetBundle once it is loaded.</para>
</returns>
</member>
<member name="M:UnityEngine.AssetBundle.LoadFromStream(System.IO.Stream,System.UInt32,System.UInt32)">
<summary>
<para>Synchronously loads an AssetBundle from a managed Stream.</para>
</summary>
<param name="stream">The managed Stream object. Unity calls Read(), Seek() and the Length property on this object to load the AssetBundle data.</param>
<param name="crc">An optional CRC-32 checksum of the uncompressed content.</param>
<param name="managedReadBufferSize">You can use this to override the size of the read buffer Unity uses while loading data. The default size is 32KB.</param>
<returns>
<para>The loaded AssetBundle object or null when the object fails to load.</para>
</returns>
</member>
<member name="M:UnityEngine.AssetBundle.LoadFromStreamAsync(System.IO.Stream,System.UInt32,System.UInt32)">
<summary>
<para>Asynchronously loads an AssetBundle from a managed Stream.</para>
</summary>
<param name="stream">The managed Stream object. Unity calls Read(), Seek() and the Length property on this object to load the AssetBundle data.</param>
<param name="crc">An optional CRC-32 checksum of the uncompressed content.</param>
<param name="managedReadBufferSize">You can use this to override the size of the read buffer Unity uses while loading data. The default size is 32KB.</param>
<returns>
<para>Asynchronous create request for an AssetBundle. Use AssetBundleCreateRequest.assetBundle property to get an AssetBundle once it is loaded.</para>
</returns>
</member>
<member name="M:UnityEngine.AssetBundle.RecompressAssetBundleAsync(System.String,System.String,UnityEngine.BuildCompression,System.UInt32,UnityEngine.ThreadPriority)">
<summary>
<para>Asynchronously recompress a downloaded/stored AssetBundle from one BuildCompression to another.</para>
</summary>
<param name="inputPath">Path to the AssetBundle to recompress.</param>
<param name="outputPath">Path to the recompressed AssetBundle to be generated. Can be the same as inputPath.</param>
<param name="method">The compression method, level and blocksize to use during recompression. Only some BuildCompression types are supported (see note).</param>
<param name="expectedCRC">CRC of the AssetBundle to test against. Testing this requires additional file reading and computation. Pass in 0 to skip this check.</param>
<param name="priority">The priority at which the recompression operation should run. This sets thread priority during the operation and does not effect the order in which operations are performed. Recompression operations run on a background worker thread.</param>
</member>
<member name="M:UnityEngine.AssetBundle.Unload(System.Boolean)">
<summary>
<para>Unloads all assets in the bundle.</para>
</summary>
<param name="unloadAllLoadedObjects"></param>
</member>
<member name="M:UnityEngine.AssetBundle.UnloadAllAssetBundles(System.Boolean)">
<summary>
<para>Unloads all currently loaded Asset Bundles.</para>
</summary>
<param name="unloadAllObjects">Determines whether the current instances of objects loaded from Asset Bundles will also be unloaded.</param>
</member>
<member name="T:UnityEngine.AssetBundleCreateRequest">
<summary>
<para>Asynchronous create request for an AssetBundle.</para>
</summary>
</member>
<member name="P:UnityEngine.AssetBundleCreateRequest.assetBundle">
<summary>
<para>Asset object being loaded (Read Only).</para>
</summary>
</member>
<member name="T:UnityEngine.AssetBundleLoadResult">
<summary>
<para>The result of an Asset Bundle Load or Recompress Operation.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.AlreadyLoaded">
<summary>
<para>The Asset Bundle is already loaded.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.Cancelled">
<summary>
<para>The operation was cancelled.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.FailedCache">
<summary>
<para>The Asset Bundle was not successfully cached.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.FailedDecompression">
<summary>
<para>Failed to decompress the Asset Bundle.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.FailedDeleteRecompressionTarget">
<summary>
<para>The target path given for the Recompression operation could not be deleted for swap with recompressed bundle file.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.FailedRead">
<summary>
<para>Failed to read the Asset Bundle file.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.FailedWrite">
<summary>
<para>Failed to write to the file system.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.NoSerializedData">
<summary>
<para>The Asset Bundle does not contain any serialized data. It may be empty, or corrupt.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.NotCompatible">
<summary>
<para>The AssetBundle is incompatible with this version of Unity.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.NotMatchingCrc">
<summary>
<para>The decompressed Asset data did not match the precomputed CRC. This may suggest that the AssetBundle did not download correctly.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.NotValidAssetBundle">
<summary>
<para>This does not appear to be a valid Asset Bundle.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.RecompressionTargetExistsButNotArchive">
<summary>
<para>The target path given for the Recompression operation exists but is not an Archive container.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.RecompressionTargetIsLoaded">
<summary>
<para>The target path given for the Recompression operation is an Archive that is currently loaded.</para>
</summary>
</member>
<member name="F:UnityEngine.AssetBundleLoadResult.Success">
<summary>
<para>The operation completed successfully.</para>
</summary>
</member>
<member name="T:UnityEngine.AssetBundleManifest">
<summary>
<para>Manifest for all the AssetBundles in the build.</para>
</summary>
</member>
<member name="M:UnityEngine.AssetBundleManifest.GetAllAssetBundles">
<summary>
<para>Get all the AssetBundles in the manifest.</para>
</summary>
<returns>
<para>An array of asset bundle names.</para>
</returns>
</member>
<member name="M:UnityEngine.AssetBundleManifest.GetAllAssetBundlesWithVariant">
<summary>
<para>Get all the AssetBundles with variant in the manifest.</para>
</summary>
<returns>
<para>An array of asset bundle names.</para>
</returns>
</member>
<member name="M:UnityEngine.AssetBundleManifest.GetAllDependencies(System.String)">
<summary>
<para>Get all the dependent AssetBundles for the given AssetBundle.</para>
</summary>
<param name="assetBundleName">Name of the asset bundle.</param>
</member>
<member name="M:UnityEngine.AssetBundleManifest.GetAssetBundleHash(System.String)">
<summary>
<para>Get the hash for the given AssetBundle.</para>
</summary>
<param name="assetBundleName">Name of the asset bundle.</param>
<returns>
<para>The 128-bit hash for the asset bundle.</para>
</returns>
</member>
<member name="M:UnityEngine.AssetBundleManifest.GetDirectDependencies(System.String)">
<summary>
<para>Get the direct dependent AssetBundles for the given AssetBundle.</para>
</summary>
<param name="assetBundleName">Name of the asset bundle.</param>
<returns>
<para>Array of asset bundle names this asset bundle depends on.</para>
</returns>
</member>
<member name="T:UnityEngine.AssetBundleRecompressOperation">
<summary>
<para>Asynchronous AssetBundle recompression from one compression method and level to another.</para>
</summary>
</member>
<member name="P:UnityEngine.AssetBundleRecompressOperation.humanReadableResult">
<summary>
<para>A string describing the recompression operation result (Read Only).</para>
</summary>
</member>
<member name="P:UnityEngine.AssetBundleRecompressOperation.inputPath">
<summary>
<para>Path of the AssetBundle being recompressed (Read Only).</para>
</summary>
</member>
<member name="P:UnityEngine.AssetBundleRecompressOperation.outputPath">
<summary>
<para>Path of the resulting recompressed AssetBundle (Read Only).</para>
</summary>
</member>
<member name="P:UnityEngine.AssetBundleRecompressOperation.result">
<summary>
<para>Result of the recompression operation.</para>
</summary>
</member>
<member name="P:UnityEngine.AssetBundleRecompressOperation.success">
<summary>
<para>True if the recompress operation is complete and was successful, otherwise false (Read Only).</para>
</summary>
</member>
<member name="T:UnityEngine.AssetBundleRequest">
<summary>
<para>Asynchronous load request from an AssetBundle.</para>
</summary>
</member>
<member name="P:UnityEngine.AssetBundleRequest.allAssets">
<summary>
<para>Asset objects with sub assets being loaded. (Read Only)</para>
</summary>
</member>
<member name="P:UnityEngine.AssetBundleRequest.asset">
<summary>
<para>Asset object being loaded (Read Only).</para>
</summary>
</member>
<member name="T:UnityEngine.BuildCompression">
<summary>
<para>Contains information about compression methods, compression levels and block sizes that are supported by Asset Bundle compression at build time and recompression at runtime.</para>
</summary>
</member>
<member name="F:UnityEngine.BuildCompression.LZ4">
<summary>
<para>LZ4HC "Chunk Based" Compression.</para>
</summary>
</member>
<member name="F:UnityEngine.BuildCompression.LZ4Runtime">
<summary>
<para>LZ4 Compression for runtime recompression.</para>
</summary>
</member>
<member name="F:UnityEngine.BuildCompression.LZMA">
<summary>
<para>LZMA Compression.</para>
</summary>
</member>
<member name="F:UnityEngine.BuildCompression.Uncompressed">
<summary>
<para>Uncompressed Asset Bundle.</para>
</summary>
</member>
<member name="F:UnityEngine.BuildCompression.UncompressedRuntime">
<summary>
<para>Uncompressed Asset Bundle.</para>
</summary>
</member>
<member name="T:UnityEngine.CompressionLevel">
<summary>
<para>Compression Levels relate to how much time should be spent compressing Assets into an Asset Bundle.</para>
</summary>
</member>
<member name="F:UnityEngine.CompressionLevel.None">
<summary>
<para>No compression.</para>
</summary>
</member>
<member name="T:UnityEngine.CompressionType">
<summary>
<para>Compression Method for Asset Bundles.</para>
</summary>
</member>
<member name="F:UnityEngine.CompressionType.Lz4">
<summary>
<para>LZ4 compression results in larger compressed files than LZMA, but does not require the entire bundle to be decompressed before use.</para>
</summary>
</member>
<member name="F:UnityEngine.CompressionType.Lz4HC">
<summary>
<para>LZ4HC is a high compression variant of LZ4. LZ4HC compression results in larger compressed files than LZMA, but does not require the entire bundle to be decompressed before use.</para>
</summary>
</member>
<member name="F:UnityEngine.CompressionType.Lzma">
<summary>
<para>LZMA compression results in smaller compressed Asset Bundles but they must be entirely decompressed before use.</para>
</summary>
</member>
<member name="F:UnityEngine.CompressionType.None">
<summary>
<para>Uncompressed Asset Bundles are larger than compressed Asset Bundles, but they are the fastest to access once downloaded.</para>
</summary>
</member>
<member name="A:UnityEngine.AssetBundleModule">
<summary>
<para>The AssetBundle module implements the AssetBundle class and related APIs to load data from AssetBundles.</para>
</summary>
</member>
</members>
</doc>

+ 3
- 0
Refs/refs.txt View File

@ -15,6 +15,9 @@
""""TextRenderingModule. """"TextRenderingModule.
"""""dll """""dll
"""""xml """""xml
""""AssetBundleModule.
"""""dll
"""""xml
""""UI """"UI
""""".dll """"".dll
"""""Module. """""Module.


Loading…
Cancel
Save