Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
babycare_xiaoxiao
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
翁阳
babycare_xiaoxiao
Commits
74debd0a
Commit
74debd0a
authored
Jul 29, 2020
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
334469c5
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
8758 additions
and
193 deletions
+8758
-193
index.html
index.html
+1
-1
output.js
output.js
+73
-16
output.js.map
output.js.map
+1
-1
res.json
resource/res.json
+52
-52
aaa.js
scripts/aaa.js
+209
-36
Main.ts
src/Main.ts
+32
-2
ResJson.ts
src/ResJson.ts
+8338
-61
SuccessPrizePanel.ts
src/panels/SuccessPrizePanel.ts
+18
-12
LotteryScene.ts
src/scene/LotteryScene.ts
+15
-10
PlayScene.ts
src/scene/PlayScene.ts
+19
-2
No files found.
index.html
View file @
74debd0a
...
...
@@ -56,11 +56,11 @@
canvas
.
width
=
document
.
body
.
clientWidth
*
(
window
.
devicePixelRatio
||
1
)
canvas
.
height
=
document
.
body
.
clientHeight
*
(
window
.
devicePixelRatio
||
1
)
var
main
=
new
Main
(
canvas
);
console
.
log
(
main
.
stage
)
var
mouseEvent
=
main
.
stage
.
onMouseEvent
.
bind
(
main
.
stage
);
canvas
.
addEventListener
(
"touchstart"
,
mouseEvent
,
false
);
canvas
.
addEventListener
(
'touchmove'
,
mouseEvent
,
false
);
canvas
.
addEventListener
(
'touchend'
,
mouseEvent
,
false
);
window
.
stage
=
main
.
stage
})
...
...
output.js
View file @
74debd0a
...
...
@@ -1746,7 +1746,6 @@ var Main = (function () {
exports.GDispatcher.dispatchEvent({ type: G_EVENT_1.G_EVENT.ON_SHOW });
};
Main.prototype.pause = function () {
this._pause = true;
exports.GDispatcher.dispatchEvent({ type: G_EVENT_1.G_EVENT.ON_HIDE });
};
Main.prototype.addGlobalEvent = function (name, fun, thisObj, once) {
...
...
@@ -1777,6 +1776,34 @@ var Main = (function () {
return Main;
}());
exports.Main = Main;
function createNineTextures(imageUrl) {
return new Promise(function (resolve, reject) {
var image = new Image();
image.setAttribute("crossOrigin", "anonymous");
image.onload = function () {
var obj = {};
var name = "lalala";
var row = 4, col = 3;
var w = image.width / col;
var h = image.height / row;
for (var i = 0; i < col * row; i++)
obj[name + i] = {
"x": i % col * w,
"y": ~~(i / col) * h,
w: w, h: h, sw: w, sh: h, ox: 0, oy: 0, ro: false
};
FYGE.createTextureSheet(new FYGE.BaseTexture(image), obj);
var arr = [];
for (var i = 0; i < col * row; i++)
arr.push(FYGE.TextureCache[name + i]);
resolve(arr);
};
image.onerror = function (err) {
reject(err);
};
image.src = imageUrl;
});
}
/***/ }),
...
...
@@ -10191,7 +10218,7 @@ exports.ResJson = {
}
}
],
"path": "https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1595
853182
/resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1595
928326
/resource/"
};
...
...
@@ -17626,7 +17653,7 @@ var SuccessNoPrizePanel = (function (_super) {
}
}
});
this.tipsTex.text = "
\u592A\u5389\u5BB3\u4E86\uFF01\n\u518D\u89E3\u9501" + dLevel_1 + "\u5173\u53EF\u4EE5\u5F00\u7EA2\u5305\u4E86";
this.tipsTex.text = "
\t\t\t
\u592A\u5389\u5BB3\u4E86\uFF01\n\u518D\u89E3\u9501" + dLevel_1 + "\u5173\u53EF\u4EE5\u5F00\u7EA2\u5305\u4E86";
this.tipsTex.textAlign = TEXT_ALIGN.CENTER;
this.tipsTex.textWidth = 750;
this.tipsTex.x = 0;
...
...
@@ -17861,6 +17888,8 @@ var SuccessPrizePanel = (function (_super) {
this.checkTex.textWidth = 750;
this.checkTex.x = 0;
this.checkTex.textAlign = TEXT_ALIGN.CENTER;
this.tipsTex.textWidth = 750;
this.tipsTex.x = 0;
this.tipsTex.textAlign = TEXT_ALIGN.CENTER;
this.starGroup = this.addChild(new SuccessNoPrizePanel_1.SuccessStarGroup());
this.starGroup.position.set(373, 678);
...
...
@@ -17874,6 +17903,7 @@ var SuccessPrizePanel = (function (_super) {
this.againBtn.visible = false;
this.goPrizeBtn.visible = false;
this.prizeImg.visible = false;
this.tipsTex.text = '\t\t满星过关!';
switch (this.data.tool.type) {
case PropType_1.PropType.BOOMS:
propImg.texture = RES_1.RES.getRes('boomBtn.png');
...
...
@@ -17893,9 +17923,16 @@ var SuccessPrizePanel = (function (_super) {
}
}
else if (this.data.prize && this.data.prize.image) {
this.noPrizeAgainBtn.visible = false;
if (this.data.level == 120) {
this.againBtn.visible = false;
this.goPrizeBtn.visible = false;
}
else {
this.noPrizeAgainBtn.visible = false;
}
this.prop.visible = false;
this.prizeImg.texture = Texture.fromUrl(this.data.prize.image);
this.tipsTex.text = '\t\t闯关成功!获得抽大奖机会!';
}
};
SuccessPrizePanel.prototype.lightEffect = function () {
...
...
@@ -18634,20 +18671,15 @@ var LotteryScene = (function (_super) {
configurable: true
});
LotteryScene.prototype.initUi = function () {
var _this = this;
this.y = -layers_1.layers.stageOffsetY;
this.addChild(new FYGE.Sprite(RES_1.RES.getRes("lotteryMachineBg.jpg")));
var upLevel = 120;
var dLevel = 120;
Tools_1.Tools.baseInfo.prizeLevels.forEach(function (value, index) {
var d = value - _this.data.level;
if (_this.data.level <= value && d >= 0 && d <= dLevel) {
upLevel = value;
dLevel = d + 1;
}
Tools_1.Tools.baseInfo.prizeLevels.sort(function (a, b) {
return a - b;
});
var index = Tools_1.Tools.baseInfo.prizeLevels.indexOf(this.data.level);
var upLevel = Tools_1.Tools.baseInfo.prizeLevels[index + 1];
this.addChild(Tools_1.Tools.getText(this.data.level + "关抽奖奖励", 53.19, "#ffffff", FYGE.TEXT_ALIGN.CENTER, 488, (750 - 488) / 2, 360)).bold = true;
this.addChild(Tools_1.Tools.getText(
"下一奖励关卡:" + upLevel + "关
", 32.54, "#ffffff", FYGE.TEXT_ALIGN.CENTER, 488, (750 - 488) / 2, 420));
this.addChild(Tools_1.Tools.getText(
upLevel ? "下一奖励关卡:" + upLevel + "关" : "
", 32.54, "#ffffff", FYGE.TEXT_ALIGN.CENTER, 488, (750 - 488) / 2, 420));
this.addChild(new FYGE.Button(RES_1.RES.getRes("lotteryBtn.png")))
.addEventListener(FYGE.MouseEvent.CLICK, this.lottery, this)
.position.set((750 - RES_1.RES.getRes("lotteryBtn.png").width) / 2, 797);
...
...
@@ -18984,6 +19016,8 @@ var MapScene_1 = __webpack_require__(/*! ./map/MapScene */ "./src/scene/map/MapS
var NoStepPanel_1 = __webpack_require__(/*! ../panels/NoStepPanel */ "./src/panels/NoStepPanel.ts");
var FirstPropGift_1 = __webpack_require__(/*! ../something/uis/FirstPropGift */ "./src/something/uis/FirstPropGift.ts");
var bonus_lottie_1 = __webpack_require__(/*! ../lotties/bonus_lottie */ "./src/lotties/bonus_lottie.ts");
var Main_1 = __webpack_require__(/*! ../Main */ "./src/Main.ts");
var G_EVENT_1 = __webpack_require__(/*! ../common/G_EVENT */ "./src/common/G_EVENT.ts");
var aniClass = {
"BoomAni": BoomAni_1.BoomAni,
"IceAni": IceAni_1.IceAni,
...
...
@@ -21132,8 +21166,19 @@ var SettingBtn = (function (_super) {
_this.texture = RES_1.RES.getRes(_this.isOn ? "musicOn.png" : "musicOff.png");
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.openMusic, { isOn: _this.isOn });
}, _this);
_this.isOn = true;
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.openMusic, { isOn: _this.isOn });
Main_1.GDispatcher.addEventListener(G_EVENT_1.G_EVENT.ON_SHOW, _this.onShow, _this);
return _this;
}
class_1.prototype.onShow = function () {
if (this.isOn)
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.openMusic, { isOn: true });
};
class_1.prototype.destroy = function () {
Main_1.GDispatcher.removeEventListener(G_EVENT_1.G_EVENT.ON_SHOW, this.onShow, this);
_super.prototype.destroy.call(this);
};
return class_1;
}(FYGE.Sprite)));
musicBtn.position.set(11, 97);
...
...
@@ -21144,9 +21189,12 @@ var SettingBtn = (function (_super) {
musicBtn.visible = !musicBtn.visible;
bg.visible = !bg.visible;
}, _this);
console.log(btn);
return _this;
}
SettingBtn.prototype.destroy = function () {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.openMusic, { isOn: false });
_super.prototype.destroy.call(this);
};
return SettingBtn;
}(FYGE.Container));
...
...
@@ -21222,6 +21270,7 @@ var CheckBtn = (function (_super) {
Object.defineProperty(CheckBtn.prototype, "data", {
set: function (data) {
this._data = data;
this.checkData.isPlayed = true;
if (!data)
return;
if (!data.isVisitSuccess)
...
...
@@ -22089,6 +22138,8 @@ var TaskPanel_1 = __webpack_require__(/*! ../../panels/TaskPanel */ "./src/panel
var TaoBaoNet_1 = __webpack_require__(/*! ../../TaoBaoNet */ "./src/TaoBaoNet.ts");
var Texture = FYGE.Texture;
var LotteryScene_1 = __webpack_require__(/*! ../LotteryScene */ "./src/scene/LotteryScene.ts");
var Main_1 = __webpack_require__(/*! ../../Main */ "./src/Main.ts");
var G_EVENT_1 = __webpack_require__(/*! ../../common/G_EVENT */ "./src/common/G_EVENT.ts");
var MapUI = (function (_super) {
__extends(MapUI, _super);
function MapUI() {
...
...
@@ -22123,7 +22174,8 @@ var MapUI = (function (_super) {
break;
case this.myPrizeBtn:
console.log('我的奖品');
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.navigateTo, { url: '/pages/myPrize/myPrize' }, function () { }, true);
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.navigateTo, { url: '/pages/myPrize/myPrize' }, function () {
}, true);
break;
case this.prizeBox:
console.log('奖励盒子');
...
...
@@ -22222,6 +22274,7 @@ var CreditsBox = (function (_super) {
return [4, this.updateCredits()];
case 1:
_a.sent();
Main_1.GDispatcher.addEventListener(G_EVENT_1.G_EVENT.ON_SHOW, this.updateCredits, this);
return [2];
}
});
...
...
@@ -22246,6 +22299,10 @@ var CreditsBox = (function (_super) {
});
});
};
CreditsBox.prototype.destroy = function () {
_super.prototype.destroy.call(this);
Main_1.GDispatcher.removeEventListener(G_EVENT_1.G_EVENT.ON_SHOW, this.updateCredits, this);
};
return CreditsBox;
}(Container));
var PrizeBox = (function (_super) {
output.js.map
View file @
74debd0a
This diff is collapsed.
Click to expand it.
resource/res.json
View file @
74debd0a
This diff is collapsed.
Click to expand it.
scripts/aaa.js
View file @
74debd0a
var
fs
=
require
(
"fs"
);
var
path
=
require
(
'path'
);
const
{
createCanvas
,
loadImage
}
=
require
(
'canvas'
)
let
MaxRectsPacker
=
require
(
"maxrects-packer"
).
MaxRectsPacker
;
const
options
=
{
smart
:
true
,
pot
:
true
,
square
:
false
,
allowRotation
:
true
,
tag
:
false
,
border
:
2
};
// Set packing options
let
packer
=
new
MaxRectsPacker
(
1024
,
1024
,
2
,
options
);
// width, height, padding, options
// console.log(packer.options)
let
input
=
[
// any object with width & height is OK since v2.1.0
{
width
:
600
,
height
:
20
,
name
:
"tree"
},
{
width
:
20
,
height
:
600
,
name
:
"flower"
},
// {width: 600, height: 20, name: "tree"},
// {width: 20, height: 600, name: "flower"},
// {width: 2000, height: 2000, name: "oversized background"},
// {width: 1000, height: 1000, name: "background"},
// {width: 1000, height: 1000, name: "overlay"}
];
packer
.
addArray
(
input
);
// Start packing with input array
// packer.next(); // Start a new packer bin
packer
.
addArray
([
{
width
:
600
,
height
:
20
,
name
:
"tree"
},
{
width
:
20
,
height
:
600
,
name
:
"flower"
},]);
// Adding to the new bin
// packer.addArray(input.slice());
// packer.addArray(input.slice());
packer
.
bins
.
forEach
(
bin
=>
{
console
.
log
(
bin
.
rects
);
});
// Reuse packer
// let bins = packer.save();
// packer.load(bins);
// console.log(packer.bins)
// packer.addArray(input);
\ No newline at end of file
var
aaa
=
require
()
var
pathName
=
"./psd/common"
//读文件夹
var
files
=
fs
.
readdirSync
(
pathName
);
//找出所有png图片
var
images
=
[];
let
count
=
0
,
countAll
=
files
.
length
;
files
.
forEach
(
async
function
(
fileName
)
{
if
(
path
.
extname
(
fileName
).
indexOf
(
".png"
)
<
0
)
{
if
(
++
count
==
countAll
)
tm
()
return
;
}
// console.log(img)
images
.
push
(
await
handleImage
(
fileName
)
)
if
(
++
count
==
countAll
)
tm
()
})
//开始处理
function
tm
()
{
// console.log(images)
// return
const
options
=
{
smart
:
true
,
pot
:
false
,
//是否powerOf2
square
:
false
,
allowRotation
:
true
,
tag
:
false
,
border
:
2
};
// Set packing options
let
packer
=
new
MaxRectsPacker
(
2048
,
2048
,
2
,
options
);
// width, height, padding, options
// console.log(packer.options)
packer
.
addArray
(
images
);
packer
.
bins
.
forEach
((
bin
,
i
)
=>
{
console
.
log
(
bin
);
var
canvas
=
createCanvas
(
bin
.
width
,
bin
.
height
)
var
ctx
=
canvas
.
getContext
(
"2d"
);
var
obj
=
{}
bin
.
rects
.
forEach
((
rect
)
=>
{
ctx
.
save
()
if
(
rect
.
rot
)
{
ctx
.
translate
(
rect
.
x
,
rect
.
y
);
ctx
.
rotate
(
Math
.
PI
/
2
)
ctx
.
translate
(
-
rect
.
x
,
-
rect
.
y
);
ctx
.
drawImage
(
rect
.
imgData
,
rect
.
x
,
rect
.
y
-
rect
.
height
)
}
else
{
ctx
.
drawImage
(
rect
.
imgData
,
rect
.
x
,
rect
.
y
)
}
ctx
.
restore
();
//数据
obj
[
rect
.
name
]
=
{
"x"
:
rect
.
x
,
"y"
:
rect
.
y
,
"w"
:
rect
.
width
,
"h"
:
rect
.
height
,
"ox"
:
rect
.
offsetX
?
rect
.
offsetX
:
0
,
"oy"
:
rect
.
offsetY
?
rect
.
offsetY
:
0
,
"sw"
:
rect
.
originW
,
"sh"
:
rect
.
originH
,
"ro"
:
rect
.
rot
,
}
})
canvas
.
createPNGStream
().
pipe
(
fs
.
createWriteStream
(
"./psd/out.png"
));
fs
.
writeFileSync
(
"./psd/out.json"
,
JSON
.
stringify
(
obj
,
""
,
"
\
t"
));
});
}
// console.log(images.length)
/**
* 处理图片
* @param {*} imgName
*/
async
function
handleImage
(
imgName
)
{
// console.log(image(fs.readFileSync(pathName + "/" + (imgName))))
const
myimg
=
await
loadImage
(
fs
.
readFileSync
(
pathName
+
"/"
+
(
imgName
))
/*'./image/b.png'*/
).
catch
((
err
)
=>
{
});
if
(
!
myimg
)
{
return
null
}
const
canvas
=
createCanvas
(
myimg
.
width
,
myimg
.
height
)
const
ctx
=
canvas
.
getContext
(
'2d'
);
ctx
.
drawImage
(
myimg
,
0
,
0
)
var
imageData
=
ctx
.
getImageData
(
0
,
0
,
myimg
.
width
,
myimg
.
height
);
if
(
!
needTrim
(
imageData
))
{
return
{
name
:
imgName
,
width
:
myimg
.
width
,
height
:
myimg
.
height
,
originW
:
myimg
.
width
,
originH
:
myimg
.
height
,
imgData
:
myimg
,
}
}
else
{
const
pixels
=
imageData
.
data
;
const
len
=
pixels
.
length
;
const
bound
=
{
top
:
null
,
left
:
null
,
right
:
null
,
bottom
:
null
,
};
let
i
;
let
x
;
let
y
;
let
width
=
myimg
.
width
,
height
=
myimg
.
height
for
(
i
=
0
;
i
<
len
;
i
+=
4
)
{
if
(
pixels
[
i
+
3
]
!==
0
)
{
x
=
(
i
/
4
)
%
width
;
y
=
~~
((
i
/
4
)
/
width
);
if
(
bound
.
top
===
null
)
{
bound
.
top
=
y
;
}
if
(
bound
.
left
===
null
)
{
bound
.
left
=
x
;
}
else
if
(
x
<
bound
.
left
)
{
bound
.
left
=
x
;
}
if
(
bound
.
right
===
null
)
{
bound
.
right
=
x
+
1
;
}
else
if
(
bound
.
right
<
x
)
{
bound
.
right
=
x
+
1
;
}
if
(
bound
.
bottom
===
null
)
{
bound
.
bottom
=
y
;
}
else
if
(
bound
.
bottom
<
y
)
{
bound
.
bottom
=
y
;
}
}
}
width
=
bound
.
right
-
bound
.
left
;
height
=
bound
.
bottom
-
bound
.
top
//+ 1;
const
data
=
ctx
.
getImageData
(
bound
.
left
,
bound
.
top
,
width
,
height
);
var
cc
=
createCanvas
(
width
,
height
)
cc
.
getContext
(
"2d"
).
putImageData
(
data
,
0
,
0
)
return
{
offsetX
:
bound
.
left
,
offsetY
:
bound
.
top
,
name
:
imgName
,
width
:
width
,
height
:
height
,
originW
:
myimg
.
width
,
originH
:
myimg
.
height
,
imgData
:
cc
,
};
}
}
/**
* 判断是否要进行透明度裁切
* @param {*} imageData
*/
function
needTrim
(
imageData
)
{
const
width
=
imageData
.
width
;
const
height
=
imageData
.
height
;
const
pixels
=
imageData
.
data
;
const
len
=
pixels
.
length
;
//4条边缘,有任何一条出现全透明像素就要进行裁切
let
hasPix
=
false
;
//上边缘
for
(
var
i
=
0
;
i
<
width
;
i
++
)
{
if
(
pixels
[
i
*
4
+
3
]
!==
0
)
{
hasPix
=
true
;
break
}
}
if
(
!
hasPix
)
return
true
;
//下边缘
hasPix
=
false
;
for
(
var
i
=
0
;
i
<
width
;
i
++
)
{
if
(
pixels
[
width
*
(
height
-
1
)
*
4
+
i
*
4
+
3
]
!==
0
)
{
hasPix
=
true
;
break
}
}
if
(
!
hasPix
)
return
true
;
//左边缘
hasPix
=
false
;
for
(
var
i
=
0
;
i
<
height
;
i
++
)
{
if
(
pixels
[
width
*
i
*
4
+
3
]
!==
0
)
{
hasPix
=
true
;
break
}
}
//右边缘
hasPix
=
false
;
for
(
var
i
=
0
;
i
<
height
;
i
++
)
{
if
(
pixels
[
width
*
i
*
4
+
3
+
(
width
-
1
)
*
4
]
!==
0
)
{
hasPix
=
true
;
break
}
}
if
(
!
hasPix
)
return
true
;
return
false
}
\ No newline at end of file
src/Main.ts
View file @
74debd0a
...
...
@@ -121,7 +121,7 @@ export class Main {
}
//在小程序隐藏时调用onHide
pause
()
{
this
.
_pause
=
true
;
// this._pause = true;//先不暂停了
GDispatcher
.
dispatchEvent
({
type
:
G_EVENT
.
ON_HIDE
});
}
...
...
@@ -183,4 +183,34 @@ export class Main {
function
createNineTextures
(
imageUrl
):
Promise
<
FYGE
.
Texture
[]
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
image
=
new
Image
();
image
.
setAttribute
(
"crossOrigin"
,
"anonymous"
);
image
.
onload
=
function
()
{
var
obj
=
{}
//名字。
var
name
=
"lalala"
;
var
row
=
4
,
col
=
3
;
var
w
=
image
.
width
/
col
;
var
h
=
image
.
height
/
row
;
//生成9张图的数据
for
(
var
i
=
0
;
i
<
col
*
row
;
i
++
)
obj
[
name
+
i
]
=
{
"x"
:
i
%
col
*
w
,
"y"
:
~~
(
i
/
col
)
*
h
,
w
,
h
,
sw
:
w
,
sh
:
h
,
ox
:
0
,
oy
:
0
,
ro
:
false
};
FYGE
.
createTextureSheet
(
new
FYGE
.
BaseTexture
(
image
),
obj
);
//取TextureCache里的
var
arr
=
[];
for
(
var
i
=
0
;
i
<
col
*
row
;
i
++
)
arr
.
push
(
FYGE
.
TextureCache
[
name
+
i
])
resolve
(
arr
)
}
image
.
onerror
=
function
(
err
)
{
reject
(
err
)
}
image
.
src
=
imageUrl
})
}
\ No newline at end of file
src/ResJson.ts
View file @
74debd0a
This diff is collapsed.
Click to expand it.
src/panels/SuccessPrizePanel.ts
View file @
74debd0a
...
...
@@ -28,8 +28,8 @@ export class SuccessPrizePanel extends Panel {
this
.
isShowing
=
true
;
this
.
anchor
.
set
(
375
,
812
);
Tween
.
get
(
this
)
.
set
({
scaleX
:
0
,
scaleY
:
0
})
.
to
({
scaleX
:
1
,
scaleY
:
1
},
400
,
Ease
.
backOut
)
.
set
({
scaleX
:
0
,
scaleY
:
0
})
.
to
({
scaleX
:
1
,
scaleY
:
1
},
400
,
Ease
.
backOut
)
.
call
(()
=>
{
this
.
isShowing
=
false
;
});
...
...
@@ -96,7 +96,13 @@ export class SuccessPrizePanel extends Panel {
break
;
}
}
else
if
(
this
.
data
.
prize
&&
this
.
data
.
prize
.
image
)
{
this
.
noPrizeAgainBtn
.
visible
=
false
;
if
(
this
.
data
.
level
==
120
)
{
//120关不显示闯关按钮,换图
this
.
againBtn
.
visible
=
false
;
this
.
goPrizeBtn
.
visible
=
false
;
}
else
{
this
.
noPrizeAgainBtn
.
visible
=
false
;
}
this
.
prop
.
visible
=
false
;
this
.
prizeImg
.
texture
=
Texture
.
fromUrl
(
this
.
data
.
prize
.
image
);
this
.
tipsTex
.
text
=
'
\
t
\
t闯关成功!获得抽大奖机会!'
;
...
...
@@ -104,13 +110,13 @@ export class SuccessPrizePanel extends Panel {
}
private
lightEffect
()
{
Tween
.
get
(
this
.
light1
,
{
loop
:
true
})
.
set
({
anchorX
:
219.5
,
anchorY
:
219.5
})
.
to
({
rotation
:
360
},
12000
);
Tween
.
get
(
this
.
light1
,
{
loop
:
true
})
.
set
({
anchorX
:
219.5
,
anchorY
:
219.5
})
.
to
({
rotation
:
360
},
12000
);
Tween
.
get
(
this
.
light2
,
{
loop
:
true
})
.
set
({
anchorX
:
219.5
,
anchorY
:
219.5
})
.
to
({
rotation
:
-
360
},
12000
);
Tween
.
get
(
this
.
light2
,
{
loop
:
true
})
.
set
({
anchorX
:
219.5
,
anchorY
:
219.5
})
.
to
({
rotation
:
-
360
},
12000
);
}
start
(
data
)
{
...
...
@@ -121,7 +127,7 @@ export class SuccessPrizePanel extends Panel {
* 挑战满星
*/
private
again
()
{
changeScene
(
MapScene
,
{
level
:
this
.
data
.
level
});
changeScene
(
MapScene
,
{
level
:
this
.
data
.
level
});
super
.
hidePanel
();
}
...
...
@@ -132,7 +138,7 @@ export class SuccessPrizePanel extends Panel {
if
(
this
.
data
.
level
==
120
)
{
changeScene
(
MapScene
);
}
else
{
changeScene
(
MapScene
,
{
level
:
this
.
data
.
level
+
1
});
changeScene
(
MapScene
,
{
level
:
this
.
data
.
level
+
1
});
}
super
.
hidePanel
();
}
...
...
@@ -140,7 +146,7 @@ export class SuccessPrizePanel extends Panel {
public
goPrize
()
{
// 去抽奖
changeScene
(
LotteryScene
,
{
level
:
this
.
data
.
level
})
changeScene
(
LotteryScene
,
{
level
:
this
.
data
.
level
})
super
.
hidePanel
();
}
...
...
src/scene/LotteryScene.ts
View file @
74debd0a
...
...
@@ -25,15 +25,20 @@ export class LotteryScene extends Scene {
//背景
this
.
addChild
(
new
FYGE
.
Sprite
(
RES
.
getRes
(
"lotteryMachineBg.jpg"
)))
//计算下一关的关数
let
upLevel
:
number
=
120
;
let
dLevel
:
number
=
120
;
Tools
.
baseInfo
.
prizeLevels
.
forEach
((
value
,
index
)
=>
{
const
d
:
number
=
value
-
this
.
data
.
level
;
if
(
this
.
data
.
level
<=
value
&&
d
>=
0
&&
d
<=
dLevel
)
{
upLevel
=
value
;
dLevel
=
d
+
1
;
}
});
// let upLevel: number = 120;
// let dLevel: number = 120;
// Tools.baseInfo.prizeLevels.forEach((value, index) => {
// const d: number = value - this.data.level;
// if (this.data.level <= value && d >= 0 && d <= dLevel) {
// upLevel = value;
// dLevel = d + 1;
// }
// });
Tools
.
baseInfo
.
prizeLevels
.
sort
((
a
,
b
)
=>
{
return
a
-
b
})
var
index
=
Tools
.
baseInfo
.
prizeLevels
.
indexOf
(
this
.
data
.
level
);
let
upLevel
=
Tools
.
baseInfo
.
prizeLevels
[
index
+
1
]
//标题文案
this
.
addChild
(
Tools
.
getText
(
this
.
data
.
level
+
"关抽奖奖励"
,
...
...
@@ -46,7 +51,7 @@ export class LotteryScene extends Scene {
)).
bold
=
true
;
//下一次抽奖文案
this
.
addChild
(
Tools
.
getText
(
"下一奖励关卡:"
+
upLevel
+
"关
"
,
upLevel
?
"下一奖励关卡:"
+
upLevel
+
"关"
:
"
"
,
32.54
,
"#ffffff"
,
FYGE
.
TEXT_ALIGN
.
CENTER
,
...
...
src/scene/PlayScene.ts
View file @
74debd0a
...
...
@@ -63,6 +63,8 @@ import { MapScene } from './map/MapScene';
import
{
NoStepPanel
}
from
'../panels/NoStepPanel'
;
import
{
FirstPropGift
}
from
'../something/uis/FirstPropGift'
;
import
{
bonus_lottie
}
from
'../lotties/bonus_lottie'
;
import
{
GDispatcher
}
from
'../Main'
;
import
{
G_EVENT
}
from
'../common/G_EVENT'
;
const
aniClass
=
{
"BoomAni"
:
BoomAni
,
...
...
@@ -2906,6 +2908,18 @@ class SettingBtn extends FYGE.Container {
//播放或暂停音乐接口
sendTbNet
(
TbNetName
.
openMusic
,
{
isOn
:
this
.
isOn
})
},
this
);
//默认开启
this
.
isOn
=
true
;
sendTbNet
(
TbNetName
.
openMusic
,
{
isOn
:
this
.
isOn
})
//添加onSHow事件
GDispatcher
.
addEventListener
(
G_EVENT
.
ON_SHOW
,
this
.
onShow
,
this
)
}
onShow
()
{
if
(
this
.
isOn
)
sendTbNet
(
TbNetName
.
openMusic
,
{
isOn
:
true
})
}
destroy
()
{
GDispatcher
.
removeEventListener
(
G_EVENT
.
ON_SHOW
,
this
.
onShow
,
this
)
super
.
destroy
()
}
});
musicBtn
.
position
.
set
(
11
,
97
);
...
...
@@ -2917,8 +2931,11 @@ class SettingBtn extends FYGE.Container {
musicBtn
.
visible
=
!
musicBtn
.
visible
bg
.
visible
=
!
bg
.
visible
},
this
)
}
console
.
log
(
btn
)
destroy
()
{
//关闭音乐
sendTbNet
(
TbNetName
.
openMusic
,
{
isOn
:
false
})
super
.
destroy
()
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment