mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交开宝箱
This commit is contained in:
49
JisolGameCocos/assets/script/ui/Home/Item/MainPlayerInfo.ts
Normal file
49
JisolGameCocos/assets/script/ui/Home/Item/MainPlayerInfo.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Label } from 'cc';
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import PlayerData from '../../../data/PlayerData';
|
||||
import GBattleData, { GBattleDataEnum } from '../../../data/GBattleData';
|
||||
import { app } from '../../../App';
|
||||
import { tween } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MainPlayerInfo')
|
||||
export class MainPlayerInfo extends Component {
|
||||
|
||||
//玩家名称
|
||||
@property(Label)
|
||||
playerNameLabel:Label;
|
||||
|
||||
//玩家战力
|
||||
@property(Label)
|
||||
playerFC:Label;
|
||||
|
||||
_FC:number = 0;
|
||||
get FC(){
|
||||
return this._FC
|
||||
}
|
||||
set FC(value:number){
|
||||
this._FC = value;
|
||||
this.playerFC.string = `${Math.floor(value)}`;
|
||||
}
|
||||
|
||||
protected onLoad(): void {
|
||||
this.onUpdateView();
|
||||
app.event.on(GBattleDataEnum.UPDARE_ATTRIBUTE_SUCCESS,this.onUpdateView,this);
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
app.event.off(GBattleDataEnum.UPDARE_ATTRIBUTE_SUCCESS,this.onUpdateView,this);
|
||||
}
|
||||
|
||||
onUpdateView() {
|
||||
this.playerNameLabel.string = `${PlayerData.getIns().getInfo().playerName}`;
|
||||
|
||||
//过度
|
||||
tween(this.getComponent(MainPlayerInfo))
|
||||
.to(.5,{FC:GBattleData.getIns().data.getAllFC()})
|
||||
.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "fea8eb51-1d9e-4683-a678-05e498a071a8",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user