12345678910111213141516171819202122232425 |
- import { _decorator, Component, Node, Sprite, UITransform } from 'cc';
- import { Global } from './Global';
- const { ccclass, property } = _decorator;
- @ccclass('ProgressAction')
- export class ProgressAction extends Component {
- @property({ type: Node })
- level_progress: Node
- @property({ type: Node })
- particle: Node
- start() {
- }
- update(deltaTime: number) {
- let data = Global.cur_lvl_pin_move_num / Global.cur_lvl_pin_total;
- // console.log("data>>",data);
- let width = this.level_progress.getComponent(UITransform).contentSize.width;
- let add = width * data;
- this.particle.setPosition(width / 2 * -1 + add, 0);
- this.level_progress.getComponent(Sprite).fillRange = data;
- }
- }
|