技能继续重构
This commit is contained in:
@@ -5,7 +5,6 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { Timer } from "db://oops-framework/core/common/timer/Timer";
|
||||
import { randomSpeek, Speeks } from "../common/config/Tasks";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -13,8 +12,6 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('MissionHomeComp')
|
||||
@ecs.register('MissionHome', false)
|
||||
export class MissionHomeComp extends CCComp {
|
||||
speek_time:number=0
|
||||
speek_cd:Timer=new Timer(10)
|
||||
protected onLoad(): void {
|
||||
this.on(GameEvent.MissionEnd,this.mission_end,this)
|
||||
}
|
||||
@@ -25,12 +22,7 @@ export class MissionHomeComp extends CCComp {
|
||||
onEnable(){
|
||||
}
|
||||
update(dt:number){
|
||||
if(this.speek_cd.update(dt)){
|
||||
let speek=randomSpeek()
|
||||
let slot=Math.floor(Math.random()*2)
|
||||
oops.message.dispatchEvent(GameEvent.HeroSpeek,{words:speek[0],slot:slot})
|
||||
console.log("[MissionHomeComp]:speek",speek,slot)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,26 +9,18 @@ const { ccclass, property } = _decorator;
|
||||
export class topComp extends Component {
|
||||
protected onLoad(): void {
|
||||
oops.message.on(GameEvent.GOLD_UPDATE,this.onGoldUpdate,this);
|
||||
this.update_all()
|
||||
}
|
||||
start() {
|
||||
|
||||
}
|
||||
onGoldUpdate(event:string,data:any){
|
||||
this.update_gold(smc.data.gold)
|
||||
tween(this.node.getChildByName("bar").getChildByName("gold").getChildByName("num").getComponent(Label).node)
|
||||
.to(0.1,{scale:v3(1.2,1.2,1)})
|
||||
.to(0.1,{scale:v3(1,1,1)})
|
||||
.start()
|
||||
}
|
||||
update_gold(gold:number){
|
||||
this.node.getChildByName("bar").getChildByName("gold").getChildByName("num").getComponent(Label).string=NumberFormatter.formatNumber(gold);
|
||||
}
|
||||
|
||||
update_all(){
|
||||
this.update_gold(smc.vmdata.gold)
|
||||
}
|
||||
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user