123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import { _decorator, Component, director, instantiate, Node, Prefab, resources, Sprite, SpriteFrame, UITransform, Vec3 } from 'cc';
- const { ccclass, property } = _decorator;
- @ccclass('MainScene')
- export class MainScene extends Component {
- @property(Prefab)
- countDown:Prefab;
- countDownTS:any = null;
- bg: Node = null;
- protected onLoad(){
- }
- start() {
- let countDown = instantiate(this.countDown);
- this.node.addChild(countDown);
- //获取倒计时预制体脚本
- this.countDownTS = countDown.getComponent("CountDown");
- this.bg = this.node.getChildByPath("GameRoot/Bg");
- const path: string = "Res/Theme/Theme1/BG0/BG1-hd.pvr.ccz"
- resources.load(path, SpriteFrame, (error: Error, frame: SpriteFrame)=>{
- if(error){
- console.error("No found!")
- //console.log(frame)
- } else{
- this.bg.getComponent(Sprite).spriteFrame = frame;
- }
- })
- }
- update(deltaTime: number) {
- //倒计时结束,游戏开始
- if(this.countDownTS.isOver){
-
- }
- }
- }
|