using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DragonBones;

public class DragonDemo : MonoBehaviour
{
    [SerializeField]
    private UnityArmatureComponent dragon;

    private ListenerDelegate<EventObject> dbDelegate;
    // Start is called before the first frame update
    void Start()
    {
        this.dbDelegate = new ListenerDelegate<EventObject>(this.OnAnimationEventHandler);
        this.dragon.AddEventListener(EventObject.COMPLETE, this.dbDelegate);
        this.dragon.animation.Play("walk", 1);
    }

    private void OnAnimationEventHandler(string type, EventObject obj) {
        Debug.Log("Complete");
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}


参考:

        加载
        UnityFactory.factory.LoadDragonBonesData("progress_bar/progress_bar_ske");
        UnityFactory.factory.LoadTextureAtlasData("progress_bar/progress_bar_tex");

        // Build Armature
        this._armatureComp = UnityFactory.factory.BuildArmatureComponent("progress_bar");
        // 添加各种事件
        this._armatureComp.AddDBEventListener(EventObject.START, this.OnAnimationEventHandler);
        this._armatureComp.AddDBEventListener(EventObject.LOOP_COMPLETE, this.OnAnimationEventHandler);
        this._armatureComp.AddDBEventListener(EventObject.COMPLETE, this.OnAnimationEventHandler);
        this._armatureComp.AddDBEventListener(EventObject.FADE_IN, this.OnAnimationEventHandler);
        this._armatureComp.AddDBEventListener(EventObject.FADE_IN_COMPLETE, this.OnAnimationEventHandler);
        this._armatureComp.AddDBEventListener(EventObject.FADE_OUT, this.OnAnimationEventHandler);
        this._armatureComp.AddDBEventListener(EventObject.FADE_OUT_COMPLETE, this.OnAnimationEventHandler);
        this._armatureComp.AddDBEventListener(EventObject.FRAME_EVENT, this.OnAnimationEventHandler);
        //播放
        this._armatureComp.animation.Play("idle");