Files
pixelheros/assets/script/game/map/view/map/layer/MapLayer.ts
2024-08-23 10:35:15 +08:00

47 lines
1.1 KiB
TypeScript

import { Component, Layers, Node, Sprite, SpriteFrame, Texture2D, UITransform, Vec3, _decorator } from 'cc';
import { oops } from '../../../../../../../extensions/oops-plugin-framework/assets/core/Oops';
import { LayerUtil } from '../../../../../../../extensions/oops-plugin-framework/assets/core/utils/LayerUtil';
import { smc } from '../../../../common/SingletonModuleComp';
const { ccclass, property } = _decorator;
/**
* 地图层
* @author 落日故人 QQ 583051842
*
*/
@ccclass('MapLayer')
export default class MapLayer extends Component {
@property(Sprite)
private bgImg: Sprite | null = null;
public init(): void {
this.getComponent(UITransform)!.width = this.width;
this.getComponent(UITransform)!.height = this.height;
}
public clear(): void {
this.bgImg!.spriteFrame = null;
}
public get bgImage(): Sprite {
return this.bgImg!;
}
public get width(): number {
if (this.bgImg) {
return this.bgImg.getComponent(UITransform)!.width;
}
}
public get height(): number {
if (this.bgImg) {
return this.bgImg.getComponent(UITransform)!.height;
}
}
}