DaFuWeng/assets/GlobalScript/Animation/BaseSprite.ts

38 lines
1.0 KiB
TypeScript

import { _decorator, Component, Node, Animation, Sprite, resources, SpriteFrame, CCString, CCInteger, Vec2 } from 'cc';
import { MyAnimation } from './MyAnimation';
const { ccclass, property, requireComponent, executeInEditMode } = _decorator;
@ccclass('BaseSprite')
@executeInEditMode
@requireComponent(Sprite)//依赖组件 精灵
export default class BaseSprite extends MyAnimation {
AnimationFrameCount: number = 1;
@property({ type: CCString, displayName: '默认img路径', tooltip: "img路径" })
DefaultImgPath: string = "";
ImgPath: string[] = ["", ""];
@property({ type: CCInteger, displayName: 'img编号', tooltip: "img编号" })
GImgIndex = 0;
ImgIndex: number[] = [0, 1];
FrameDelay: Array<number> = [0, 9999999999];
@property({ type: [CCInteger], displayName: '是否显示', tooltip: "1为显示 0为不显示" })
PlayState = 0;
onGImgIndexChanged() {
this.ImgIndex[0] = this.GImgIndex;
}
start() {
this.onGImgIndexChanged();
super.start();
}
}