add star
This commit is contained in:
parent
7698457578
commit
6e7acd1ba1
@ -47,8 +47,8 @@
|
||||
},
|
||||
"_scale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0.43101204247773867,
|
||||
"y": 0.43101204247773867,
|
||||
"x": 0.805834949016571,
|
||||
"y": 0.805834949016571,
|
||||
"z": 1
|
||||
},
|
||||
"_quat": {
|
||||
|
@ -4504,8 +4504,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 108,
|
||||
"height": 108
|
||||
"width": 180,
|
||||
"height": 180
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@ -4514,8 +4514,8 @@
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 225,
|
||||
"y": -132,
|
||||
"x": 219,
|
||||
"y": -142,
|
||||
"z": 0
|
||||
},
|
||||
"_scale": {
|
||||
@ -4626,6 +4626,9 @@
|
||||
"AverageDMG": {
|
||||
"__id__": 107
|
||||
},
|
||||
"nd_star": {
|
||||
"__id__": 136
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
|
@ -184,10 +184,8 @@ cc.Class({
|
||||
if (res.game_over) {
|
||||
this.btnNext();
|
||||
}
|
||||
console.log('SecondResult======', res);
|
||||
},
|
||||
setdata(res, itemarr, teamarr, iskillself) {
|
||||
console.log(`gameover res---${JSON.stringify(res)}`);
|
||||
this.rankmun = res.team_rank;
|
||||
this.nd_win.active = false;
|
||||
this.nd_lose.active = false;
|
||||
|
@ -57,6 +57,11 @@ cc.Class({
|
||||
type:cc.Label
|
||||
},
|
||||
|
||||
nd_star:{
|
||||
default:null,
|
||||
type:cc.Node
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
init(data){
|
||||
@ -77,6 +82,13 @@ cc.Class({
|
||||
this.MostDMG.string = this.playerData.info.history_seasons[0].max_damage_out;
|
||||
this.AverageDMG.string = this.playerData.info.history_seasons[0].avg_damage_out;
|
||||
//
|
||||
this.theStar(
|
||||
Number(this.playerData.info.history_seasons[0].star_kills) / 100,
|
||||
Number(this.playerData.info.history_seasons[0].star_damage) / 100,
|
||||
Number(this.playerData.info.history_seasons[0].star_alive) / 100,
|
||||
Number(this.playerData.info.history_seasons[0].star_recover) / 100,
|
||||
Number(this.playerData.info.history_seasons[0].star_win) / 100
|
||||
);
|
||||
})
|
||||
},
|
||||
|
||||
@ -103,6 +115,28 @@ cc.Class({
|
||||
});
|
||||
},
|
||||
|
||||
theStar(r1, r2, r3, r4, r5) {
|
||||
var temp = [r1, r2, r3, r4, r5];
|
||||
var leng = 108 / 2;
|
||||
var ctx = this.nd_star.getComponent(cc.Graphics);
|
||||
for (var i = 0; i < 5; i++) {
|
||||
let dir = cc.v2(
|
||||
Math.cos((-i * 72 + 90) * (Math.PI / 180)),
|
||||
Math.sin((-i * 72 + 90) * (Math.PI / 180))
|
||||
);
|
||||
dir = dir.normalize();
|
||||
let pos = cc.v2(dir.x * temp[i] * leng, dir.y * temp[i] * leng);
|
||||
|
||||
if (i == 0) {
|
||||
ctx.moveTo(pos.x, pos.y);
|
||||
} else {
|
||||
ctx.lineTo(pos.x, pos.y);
|
||||
}
|
||||
}
|
||||
ctx.close();
|
||||
ctx.stroke();
|
||||
ctx.fill();
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user