1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- const DWTool = require("../utils/DWTool");
- cc.Class({
- extends: cc.Component,
- properties: {
- ///背景图
- bgNode: cc.Sprite,
- /// 明星图像
- starIcon: cc.Sprite,
- },
- init(backgroudId, propId = 0) {
- this.loadBackGroud(backgroudId);
- if (propId <= 0) {
- return;
- }
- let imageId = 50000 + propId;
- DWTool.loadResSpriteFrame(`./textures/star_handbook/${imageId}`)
- .then((spriteFrame) => {
- this.starIcon.spriteFrame = spriteFrame;
- }).catch((err) => {
- console.log(err);
- });
- },
- loadBackGroud(backgroudId) {
- let path = './textures/draw/bg0' + (backgroudId + 1);
- DWTool.loadResSpriteFrame(path)
- .then((spriteFrame) => {
- this.bgNode.spriteFrame = spriteFrame;
- });
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- },
- start () {
- },
- });
|