|
@@ -1,6 +1,7 @@
|
|
|
import { EventType, ObserverManager } from '../Manager/core/EventManager';
|
|
|
import PrefabManager from '../Manager/core/PrefabManager';
|
|
|
import { UIID } from '../Manager/core/UIID';
|
|
|
+import { gameModel } from '../Module/Module';
|
|
|
import CCUtils from '../Utiles/CCUtils';
|
|
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
@@ -35,6 +36,22 @@ export default class MainHome extends cc.Component {
|
|
|
this.selectPrefab = node;
|
|
|
this.setZindex();
|
|
|
});
|
|
|
+ // 总分数 gameModel.historyScores数组内所有分数相加
|
|
|
+ let totalScore: number = 0;
|
|
|
+ console.log('gameModel.historyScores.', gameModel.historyScores)
|
|
|
+ if (gameModel.historyScores.length) {
|
|
|
+ totalScore = gameModel.historyScores.reduce((a, b) => a + b, 0);
|
|
|
+ }
|
|
|
+ CCUtils.getLabel(this.node, 'headLayer/noteNumBg/value').string = totalScore.toString();
|
|
|
+ let starNum: number = Math.floor(totalScore / 2000);
|
|
|
+ if (starNum > 4) starNum = 4;
|
|
|
+ const node: cc.Node = CCUtils.findChild(this.node, 'headLayer/liveNumBg/starNode');
|
|
|
+ for (let i: number = 0; i < starNum; i++) {
|
|
|
+ // liveNumBg
|
|
|
+ CCUtils.findChild(node.children[i], 'light').active = true;
|
|
|
+ console.log('i', i);
|
|
|
+ }
|
|
|
+ // 适配
|
|
|
this.setAdaptation();
|
|
|
}
|
|
|
|