Skip to content

Commit 936cdb0

Browse files
committed
add parameter cloneMaterial to GLoader3D.SetSpine
1 parent f2bbc54 commit 936cdb0

File tree

2 files changed

+34
-19
lines changed

2 files changed

+34
-19
lines changed

Assets/Extensions/Spine/SpineLoader.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,21 @@ public SkeletonAnimation spineAnimation
2727
/// <param name="asset"></param>
2828
/// <param name="width"></param>
2929
/// <param name="height"></param>
30+
/// <param name="anchor"></param>
3031
public void SetSpine(SkeletonDataAsset asset, int width, int height, Vector2 anchor)
32+
{
33+
SetSpine(asset, width, height, anchor, true);
34+
}
35+
36+
/// <summary>
37+
///
38+
/// </summary>
39+
/// <param name="asset"></param>
40+
/// <param name="width"></param>
41+
/// <param name="height"></param>
42+
/// <param name="anchor"></param>
43+
/// <param name="cloneMaterial"></param>
44+
public void SetSpine(SkeletonDataAsset asset, int width, int height, Vector2 anchor, bool cloneMaterial)
3145
{
3246
if (_spineAnimation != null)
3347
FreeSpine();
@@ -37,7 +51,7 @@ public void SetSpine(SkeletonDataAsset asset, int width, int height, Vector2 anc
3751
Spine.SkeletonData dat = asset.GetSkeletonData(false);
3852
_spineAnimation.gameObject.transform.localScale = new Vector3(1 / asset.scale, 1 / asset.scale, 1);
3953
_spineAnimation.gameObject.transform.localPosition = new Vector3(anchor.x, -anchor.y, 0);
40-
SetWrapTarget(_spineAnimation.gameObject, true, width, height);
54+
SetWrapTarget(_spineAnimation.gameObject, cloneMaterial, width, height);
4155

4256
_spineAnimation.skeleton.R = _color.r;
4357
_spineAnimation.skeleton.G = _color.g;

Assets/Scripts/UI/UIPackage.cs

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class UIPackage
2222
public static bool unloadBundleByFGUI = true;
2323

2424
/// <summary>
25-
/// Package id. It is generated by the Editor, or set by customId.
25+
/// Package id. It is generated by the Editor.
2626
/// </summary>
2727
public string id { get; private set; }
2828

@@ -32,21 +32,22 @@ public class UIPackage
3232
public string name { get; private set; }
3333

3434
/// <summary>
35-
///
35+
/// Use this callback to provide resources to the package.
3636
/// </summary>
37-
/// <param name="name"></param>
38-
/// <param name="extension"></param>
39-
/// <param name="type"></param>
37+
/// <param name="name">Resource name without extension.</param>
38+
/// <param name="extension">Resource extension. e.g. '.png' '.wav'</param>
39+
/// <param name="type">Resource type. e.g. 'Texture' 'AudioClip'</param>
40+
/// <param name="destroyMethod">How to destroy this resource.</param>
4041
/// <returns></returns>
4142
public delegate object LoadResource(string name, string extension, System.Type type, out DestroyMethod destroyMethod);
4243

4344
/// <summary>
44-
/// A async load resource callback. After loaded, call item.owner.SetItemAsset.
45+
/// A async load resource callback. After loaded, you should call item.owner.SetItemAsset.
4546
/// </summary>
46-
/// <param name="name"></param>
47-
/// <param name="extension"></param>
48-
/// <param name="type"></param>
49-
/// <param name="item"></param>
47+
/// <param name="name">Resource name without extension.</param>
48+
/// <param name="extension">Resource extension. e.g. '.png' '.wav'</param>
49+
/// <param name="type">Resource type. e.g. 'Texture' 'AudioClip'</param>
50+
/// <param name="item">Resource item object.</param>
5051
/// <returns></returns>
5152
public delegate void LoadResourceAsync(string name, string extension, System.Type type, PackageItem item);
5253

@@ -325,11 +326,11 @@ public static UIPackage AddPackage(string assetPath, LoadResource loadFunc)
325326
}
326327

327328
/// <summary>
328-
/// 使用自定义的加载方式载入一个包。
329+
/// Load Package by custom load method.
329330
/// </summary>
330-
/// <param name="descData">描述文件数据。</param>
331-
/// <param name="assetNamePrefix">资源文件名前缀。如果包含,则载入资源时名称将传入assetNamePrefix_resFileName这样格式。可以为空。</param>
332-
/// <param name="loadFunc">载入函数</param>
331+
/// <param name="descData">Description file data</param>
332+
/// <param name="assetNamePrefix">Prefix of the resource file name. The file name would be in format of 'assetNamePrefix_resFileName'. It can be empty.</param>
333+
/// <param name="loadFunc">Load method</param>
333334
/// <returns></returns>
334335
public static UIPackage AddPackage(byte[] descData, string assetNamePrefix, LoadResource loadFunc)
335336
{
@@ -348,11 +349,11 @@ public static UIPackage AddPackage(byte[] descData, string assetNamePrefix, Load
348349
}
349350

350351
/// <summary>
351-
/// 使用自定义的加载方式载入一个包。
352+
/// Load Package async by custom load method.
352353
/// </summary>
353-
/// <param name="descData">描述文件数据。</param>
354-
/// <param name="assetNamePrefix">资源文件名前缀。如果包含,则载入资源时名称将传入assetNamePrefix_resFileName这样格式。可以为空。</param>
355-
/// <param name="loadFunc">载入函数</param>
354+
/// <param name="descData">Description file data</param>
355+
/// <param name="assetNamePrefix">refix of the resource file name. The file name would be in format of 'assetNamePrefix_resFileName'. It can be empty.</param>
356+
/// <param name="loadFunc">Load method</param>
356357
/// <returns></returns>
357358
public static UIPackage AddPackage(byte[] descData, string assetNamePrefix, LoadResourceAsync loadFunc)
358359
{

0 commit comments

Comments
 (0)