Base class for Spine animation template

Spine动画模板基类

层级 (查看完整内容)

属性

_id: number = 0
destroyedImmediately: boolean

Whether to delete the resource immediately when the reference count is 0.

是否在引用计数为0的时候立马删除他

height: number

Base height of spine animation

spine 动画基础高度

lock?: boolean

Whether to lock the resource, if true, the resource cannot be automatically released.

是否加锁,如果true为不能使用自动释放机制。

materialMap: Map<string, Material> = ...

Map of materials used in the Spine animation

Spine动画中使用的材质映射

name?: string

The name of the resource.

资源名称。

offsetX: number = 0

X-axis offset of spine animation

spine 动画X轴偏移

offsetY: number = 0

Y-axis offset of spine animation

spine 动画Y轴偏移

url: string

The URL of the resource.

获取资源的URL地址。

uuid: string

The UUID of the resource.

获取资源的UUID。

width: number

Base width of spine animation

spine 动画基础宽度

x: number = 0

X of spine data

spine 数据 x

y: number = 0

Y of spine animation

spine 数据 y

DEBUG: boolean = false

Whether the debug mode is enabled.

是否开启调试模式。

访问器

  • get obsolute(): boolean
  • 返回 boolean

    If a cached resource observer is set to true, then:

      1. getRes will still return this resource;
      1. next time loading will ignore this cached resource and reload it.

    如果设置一个已缓存的资源obsolute为true,则

    • 1)getRes仍然可以返回这个资源;
    • 2)下次加载时会忽略这个缓存而去重新加载。。
  • set obsolute(value): void
  • 参数

    • value: boolean

    返回 void

方法

  • 参数

    • count: number = 1

      The amount by which to increment the reference count, default is 1.

    返回 void

    Increments the reference count of the resource by the specified amount.

    按指定数量增加资源的引用计数。

  • 参数

    • count: number = 1

      The amount by which to decrement the reference count, default is 1.

    返回 void

    Decrements the reference count of the resource by the specified amount. If the reference count reaches zero and certain conditions are met, the resource may be destroyed.

    按指定数量减少资源的引用计数。如果引用计数达到零并且满足特定条件,资源可能会被销毁。

  • 参数

    • url: string

      The URL used to create the resource.

    • 可选uuid: string

      The optional UUID of the resource.

    返回 void

    Sets the URL and UUID used to create this resource.

    设置用于创建此资源的 URL 和 UUID。

  • 参数

    • type: string

      The type of event.

    • 可选data: any

      (Optional) Data to pass to the callback. If multiple parameters p1, p2, p3, ... need to be passed, use an array structure such as [p1, p2, p3, ...]. If a single parameter p needs to be passed and p is an array, use a structure such as [p]. For other single parameters p, you can directly pass parameter p. If data is Event.EMPTY, it means passing an Event object to the callback function. Note that it is not passing Event.TEMP, but an independent Event object.

    返回 boolean

    True if there are listeners for this event type, false otherwise.

    Dispatch an event.

    派发事件。

  • 参数

    • name: string

      The name of the animation to find

    返回 any

    The found animation index, or -1 if not found

    only web

    Find the animation by its name

    通过动画名称查找动画

  • 参数

    • index: number

      The index of the animation

    返回 string

    Get the animation name by its index

    通过索引获取动画名称

  • 参数

    • texture: Texture2D

      The texture to use

    • blendMode: number

      The blend mode to use

    • premultipliedAlpha: boolean

      Whether to enable transparent premultiplied

    • is3D: boolean = false

      Whether this is for 3D rendering (default: false for 2D)

    返回 Material

    Get or create a material for the given texture and blend mode

    获取或创建给定纹理和混合模式的材质

  • 参数

    • skinName: string

      The name of the skin

    返回 number

    Get the skin index by its name

    通过皮肤名称获取皮肤索引

  • 参数

    • name: string

      The name of the animation to check

    返回 boolean

    boolean

    Check if the animation exists

    检查动画是否存在

  • 参数

    • type: string

      The type of event.

    返回 boolean

    True if a listener of the specified type is registered, false otherwise.

    Check if the EventDispatcher object has any listeners registered for a specific type of event.

    检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。

  • 参数

    • url: string

      The URL to check against the resource's creation URL.

    返回 boolean

    True if the resource is created from the specified URL, otherwise false.

    Checks if the resource is created from the specified URL.

    检查资源是否从指定的 URL 创建。

  • 参数

    • 可选type: string

      (Optional) The type of event. If the value is null, all types of listeners on this object are removed.

    返回 EventDispatcher

    This EventDispatcher object.

    Remove all listeners of the specified event type from the EventDispatcher object.

    从 EventDispatcher 对象中删除指定事件类型的所有侦听器。

  • 参数

    • type: string

      The type of event.

    • listener: Function

      The listener function.

    返回 EventDispatcher

    This EventDispatcher object.

    Register an event listener object with the EventDispatcher object so that the listener receives event notifications.

    使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知。

  • 参数

    • type: string

      The type of event.

    • caller: any

      The execution scope of the event listener function.

    • listener: Function

      The listener function.

    • 可选args: any[]

      (Optional) The callback parameters of the event listener function.

    返回 EventDispatcher

    This EventDispatcher object.

    Register an event listener object with the EventDispatcher object so that the listener receives event notifications.

    使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知。

  • 参数

    • type: string

      The type of event.

    • listener: Function

      The listener function.

    返回 EventDispatcher

    This EventDispatcher object.

    Register an event listener object with the EventDispatcher object so that the listener receives event notifications. This event listener responds once and is automatically removed after the first call.

    使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知,此侦听事件响应一次后自动移除。

  • 参数

    • type: string

      The type of event.

    • caller: any

      The execution scope of the event listener function.

    • listener: Function

      The listener function.

    • 可选args: any[]

      (Optional) The callback parameters of the event listener function.

    返回 EventDispatcher

    This EventDispatcher object.

    Register an event listener object with the EventDispatcher object so that the listener receives event notifications. This event listener responds once and is automatically removed after the first call.

    使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知,此侦听事件响应一次后自动移除。

  • 参数

    • texture: Texture

      Texture 对象,对应 TextureRegion

    返回 void

    注册纹理,将 Texture 对象与 Spine 的 TextureRegion 和 AtlasPage 建立对应关系

    Register texture, establish correspondence between Texture object and Spine's TextureRegion and AtlasPage