|
@@ -3,6 +3,7 @@ cc.Class({
|
|
|
|
|
|
properties: {
|
|
|
itemList: [cc.Node],
|
|
|
+ myScore: -1,
|
|
|
},
|
|
|
|
|
|
// onLoad () {},
|
|
@@ -89,6 +90,27 @@ cc.Class({
|
|
|
|
|
|
|
|
|
bindRank(rankList) {
|
|
|
+
|
|
|
+ if (this.myScore >= 0) {
|
|
|
+ for (var i = 0; i < rankList.length; i++) {
|
|
|
+ if (rd.selfFlag) {
|
|
|
+ rankList[i].score = this.myScore;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rankList.sort((a, b) => {
|
|
|
+ if (a.length == 0 && b.length == 0) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ if (a.length == 0) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ if (b.length == 0) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ return b.score - a.score;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
for (var i = 0; i < rankList.length; ++i) {
|
|
|
var rd = rankList[i]
|
|
|
// rd 的字段如下:
|
|
@@ -128,6 +150,9 @@ cc.Class({
|
|
|
},
|
|
|
|
|
|
|
|
|
+ setMyScore(score) {
|
|
|
+ this.myScore = score;
|
|
|
+ },
|
|
|
|
|
|
start() {},
|
|
|
|