永久数据不再mvvm显示
This commit is contained in:
@@ -17,9 +17,14 @@ export class HCardUICom extends Component {
|
||||
start() {
|
||||
console.log("[HCardUICom]:start")
|
||||
}
|
||||
|
||||
protected onLoad(): void {
|
||||
oops.message.on(GameEvent.UpdateHero,this.to_update_hero,this)
|
||||
}
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
to_update_hero(){
|
||||
this.update_data(this.h_uuid,{type:this.type})
|
||||
}
|
||||
update_data(uuid:number,args:any){
|
||||
this.type=args.type
|
||||
|
||||
27
assets/script/game/map/MInfoComp.ts
Normal file
27
assets/script/game/map/MInfoComp.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { _decorator, Component, Label, Node } from 'cc';
|
||||
import { oops } from 'db://oops-framework/core/Oops';
|
||||
import { GameEvent } from '../common/config/GameEvent';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MInfoComp')
|
||||
export class MInfoComp extends Component {
|
||||
protected onLoad(): void {
|
||||
oops.message.on(GameEvent.MISSION_UPDATE,this.onMissionUpdate,this);
|
||||
this.update_mission(smc.data.mission)
|
||||
}
|
||||
start() {
|
||||
this.update_mission(smc.data.mission)
|
||||
}
|
||||
onMissionUpdate(event:string,data:any){
|
||||
this.update_mission(smc.data.mission)
|
||||
}
|
||||
|
||||
update_mission(mission:number){
|
||||
this.node.getChildByName("mission").getComponent(Label).string="第 "+mission.toString()+" 关"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
9
assets/script/game/map/MInfoComp.ts.meta
Normal file
9
assets/script/game/map/MInfoComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "45cb2edd-7958-45ba-8eb9-bcf587448e5c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
61
assets/script/game/map/TopComp.ts
Normal file
61
assets/script/game/map/TopComp.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { _decorator, Component, Label, Node, tween, v3 } from 'cc';
|
||||
import { GameEvent } from '../common/config/GameEvent';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
import { BoxSet, NumberFormatter } from '../common/config/BoxSet';
|
||||
import { oops } from 'db://oops-framework/core/Oops';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('topComp')
|
||||
export class topComp extends Component {
|
||||
protected onLoad(): void {
|
||||
oops.message.on(GameEvent.GOLD_UPDATE,this.onGoldUpdate,this);
|
||||
oops.message.on(GameEvent.DIAMOND_UPDATE,this.onDiamondUpdate,this);
|
||||
oops.message.on(GameEvent.MEAT_UPDATE,this.onMeatUpdate,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()
|
||||
}
|
||||
onDiamondUpdate(event:string,data:any){
|
||||
this.update_diamond(smc.data.diamond)
|
||||
tween(this.node.getChildByName("bar").getChildByName("diamond").getChildByName("num").getComponent(Label).node)
|
||||
.to(0.1,{scale:v3(1.2,1.2,1)})
|
||||
.to(0.1,{scale:v3(1,1,1)})
|
||||
.start()
|
||||
}
|
||||
onMeatUpdate(event:string,data:any){
|
||||
this.update_meat(smc.data.meat)
|
||||
tween(this.node.getChildByName("bar").getChildByName("meat").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_diamond(diamond:number){
|
||||
this.node.getChildByName("bar").getChildByName("diamond").getChildByName("num").getComponent(Label).string=NumberFormatter.formatNumber(diamond);
|
||||
}
|
||||
update_meat(meat:number){
|
||||
this.node.getChildByName("bar").getChildByName("meat").getChildByName("num").getComponent(Label).string=NumberFormatter.formatNumber(meat);
|
||||
}
|
||||
update_all(){
|
||||
this.update_gold(smc.data.gold)
|
||||
this.update_diamond(smc.data.diamond)
|
||||
this.update_meat(smc.data.meat)
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
assets/script/game/map/TopComp.ts.meta
Normal file
9
assets/script/game/map/TopComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "f05bc555-1d6d-49b7-9047-33054a3b7adc",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user