123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import { FightTeam } from "../../common/Xys";
- import { FightType } from "../../data/const/TypeConst";
- import ResSpine from "../../frameWork/compment/ResSpine";
- import UERole from "../ui/UERole";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class UEBattleRole extends UERole {
- public m_ResSpine: ResSpine;
- m_IsLoadComplete: boolean;
- team: FightTeam;
- type: FightType;
- posX: number;
- onLoad() {
- this.m_ResSpine = this.node.getChildByName("spine").getComponent(ResSpine);
- }
- start() {
- }
- setRole(posX: number, team: FightTeam, type: FightType) {
- this.team = team;
- this.type = type;
- this.node.x = posX;
- this.posX = posX;
- this.LoadRoleRes();
- }
- GetSpinePath() {
- let spinePath = "role/nv";
- if (this.team?.fid == "1022") {
- spinePath = "mon/10001";
- }
- return spinePath;
- }
- public LoadRoleRes(cb?: Function): void {
- let spinePath = this.GetSpinePath();
- let that = this;
- this.m_IsLoadComplete = false;
- this.m_ResSpine.spSkeleton.skeletonData = null;
- this.m_ResSpine.setSpineData("spine", spinePath, (asset: sp.SkeletonData) => {
- if (asset) {
- }
- if (that.m_ResSpine && that.m_ResSpine.isValid) {
- that.m_ResSpine.addEventListener(that.OnEventListener.bind(that));
- that.m_ResSpine.AddSpineCompleteListener(that.OnCompleteListener.bind(that));
- }
- this.m_IsLoadComplete = true;
- cb && cb();
- }, false, "stand", true, 1);
- }
- playAni(aniName: string, loop: boolean, showLast?: boolean) {
- this.m_ResSpine.playAnimation(aniName, loop, showLast);
- }
- /** 监听事件帧 */
- OnEventListener(name: string) {
- // console.log("角色事件帧", name);
- if (name === "skill" || name === "atk") {
- }
- }
- OnCompleteListener(name: string) {
- }
- }
|