Commit 55cac8e5 authored by 王炽's avatar 王炽

6666666

parent c7d2c572
No preview for this file type
......@@ -17,7 +17,7 @@ function launchWithCustomModule(customModule) {
//engine.registerCustomCodeModule(customModule);
engine.registerCustomModule(customId, window[customId]);
const {props: propsOption, assets} = customModule;
const { props: propsOption, assets } = customModule;
let props = engine.computeProps(customModuleProps, propsOption);
const customModuleIns = {
id: customId,
......@@ -45,43 +45,74 @@ function launchWithCustomModule(customModule) {
engine.addCustomModule(customId, engine.gameStage.sceneContainer.getChildAt(0));
engine.globalEvent.dispatchEvent('rock-info', {prizes:[
{
"icon":"//yun.duiba.com.cn/aurora/assets/88d89ba9c3ddac732f2e017023a216be915655e4.png",
"id":"o58df634f",
"index":1,
"name":"一等奖",
"prizeId":"sss_3",
"prizeType":2,
"refId":"49781",
"refType":"virtual"
},
{
"icon":"//yun.duiba.com.cn/aurora/assets/1c0e0fcb192b2e0772bd555c3aae1c86621ccb09.png",
"id":"o4a578392",
"index":2,
"name":"二等奖",
"prizeId":"sss_2",
"prizeType":2,
"refId":"49780",
"refType":"virtual"
},
{
"icon":"//yun.duiba.com.cn/aurora/assets/bc23cd948cdd20467af9abc1f65e08e4f1e9bf30.png",
"id":"o26efbbeb",
"index":3,
"name":"三等奖",
"prizeId":"sss_1",
"prizeType":2,
"refId":"49779",
"refType":"virtual"
}]
engine.globalEvent.dispatchEvent('rock-info', {
prizes: [
{
"icon": "//yun.duiba.com.cn/polaris/odzr8wuh7y.3417f09f476bd948682b54ec13018796a63aa15f.jpeg",
"id": "o58df634f",
"index": 1,
"name": "一等奖",
"prizeId": "sss_3",
"prizeType": 2,
"refId": "49781",
"refType": "virtual"
},
{
"icon": "//yun.duiba.com.cn/polaris/o0shhpxtoy.22951ab8ac8975c1c08ba7933caa21fe2d629806.jpg",
"id": "o4a578392",
"index": 2,
"name": "二等奖",
"prizeId": "sss_2",
"prizeType": 2,
"refId": "49780",
"refType": "virtual"
},
{
"icon": "//yun.duiba.com.cn/polaris/xnjwcjf5ip.b7e68855228ddc5ef86bed1fefe63e7b1a65ebdf.jpeg",
"id": "o26efbbeb",
"index": 3,
"name": "三等奖",
"prizeId": "sss_1",
"prizeType": 2,
"refId": "49779",
"refType": "virtual"
},
{
"icon": "//yun.duiba.com.cn/polaris/u9vmvsvdeb.ebd3ca0774faddbf7220feca9eba30dfda1a343a.jpg",
"id": "o26efbbeb",
"index": 3,
"name": "三等奖",
"prizeId": "sss_4",
"prizeType": 2,
"refId": "49779",
"refType": "virtual"
},
{
"icon": "//yun.duiba.com.cn/polaris/v6uikiq60u.cbf7c5a21b83079aa3ea2a4fd41e7234fb8578a4.jpg",
"id": "o26efbbeb",
"index": 3,
"name": "三等奖",
"prizeId": "sss_5",
"prizeType": 2,
"refId": "49779",
"refType": "virtual"
},
{
"icon": "//yun.duiba.com.cn/polaris/10元话费.a34ae4a9411cfd82065fa366f8c3e3ec7a897fed.png",
"id": "o26efbbeb",
"index": 3,
"name": "三等奖",
"prizeId": "sss_6",
"prizeType": 2,
"refId": "49779",
"refType": "virtual"
}]
});
}, 100);
setTimeout(() => {
engine.globalEvent.dispatchEvent('rock-start',{
prizeId:"sss_3"
engine.globalEvent.dispatchEvent('rock-start', {
prizeId: "sss_2"
});
}, 5000);
});
......
......@@ -23,6 +23,7 @@
_this.prizes = props.prizes;
_this.countdown = 150;
_this.timeSpace = 500;
console.log("props.prizes=", props.prizes);
return _this;
}
GameView.prototype.setup = function () {
......@@ -37,7 +38,7 @@
this.viewContainer.width = props.viewWidth;
this.viewContainer.height = props.viewHeight;
this.bgImg = new engine.Image();
this.bgImg.source = getAssetByName("rock-背景").url;
this.bgImg.source = engine.getAssetByName("rock-背景").url;
this.viewContainer.addChild(this.bgImg);
this.container0 = new engine.Container();
this.container1 = new engine.Container();
......@@ -82,15 +83,14 @@
this.itemInfo["items" + j] = [];
for (var i = 0; i < len; i++) {
var url = this.prizes[i % this.prizes.length].icon;
var item = new engine.Image();
item.source = url;
var item = new engine.Sprite();
item.texture = engine.Texture.fromImage(url);
this.itemInfo["items" + j][i] = item;
this["container" + j].addChild(item);
item.width = props.imgSizeW;
item.height = props.imgSizeH;
item.x = props.spaceSizeX;
item.y = props.spaceSizeY + i * (props.imgSizeH + props.spaceSizeY);
console.log('i=', i);
}
}
};
......@@ -102,6 +102,7 @@
GameView.prototype.start = function () {
var _this = this;
this.prizeId = props.prizeId;
console.log("this.prizeId=", this.prizeId);
var _loop_1 = function (i) {
engine.Tween.removeTweens(this_1["container" + i]);
setTimeout(function () {
......@@ -139,15 +140,15 @@
for (var i = 0; i < len; i++) {
var plen = this.prizes.length;
if (direct > 0) {
this.itemInfo["items" + j][i].source = this.prizes[(plen - 1) - (i % plen)].icon;
this.itemInfo["items" + j][i].texture = engine.Texture.fromImage(this.prizes[(plen - 1) - (i % plen)].icon);
}
else {
this.itemInfo["items" + j][i].source = this.prizes[(i % plen)].icon;
this.itemInfo["items" + j][i].texture = engine.Texture.fromImage(this.prizes[(i % plen)].icon);
}
}
}
for (var i = 0; i < 3; i++) {
this.itemInfo["items" + i][1].source = this.getPrizeUrl(this.prizeId);
this.itemInfo["items" + i][1].texture = engine.Texture.fromImage(this.getPrizeUrl(this.prizeId));
}
};
GameView.prototype.getPrizeUrl = function (pid) {
......@@ -170,7 +171,6 @@
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
......
This diff is collapsed.
......@@ -108,6 +108,8 @@ export default class GameView extends engine.Container {
this.prizes = props.prizes;
this.countdown = 150;
this.timeSpace = 500;
console.log("props.prizes=",props.prizes);
}
private waterSvga
......@@ -136,7 +138,7 @@ export default class GameView extends engine.Container {
// this.bgImg = new engine.Sprite(getTextureByName('rock-背景'));
this.bgImg = new engine.Image();
this.bgImg.source = getAssetByName("rock-背景").url;
this.bgImg.source = engine.getAssetByName("rock-背景").url;
this.viewContainer.addChild(this.bgImg);
this.container0 = new engine.Container();
......@@ -205,8 +207,8 @@ export default class GameView extends engine.Container {
this.itemInfo["items" + j] = [];
for(let i = 0; i < len; i++){
let url = this.prizes[i % this.prizes.length].icon;
let item = new engine.Image();
item.source = url;
let item = new engine.Sprite();
item.texture = engine.Texture.fromImage(url);
this.itemInfo["items" + j][i] = item;
this["container" + j].addChild(item);
......@@ -215,7 +217,7 @@ export default class GameView extends engine.Container {
item.x = props.spaceSizeX;
item.y = props.spaceSizeY + i * (props.imgSizeH + props.spaceSizeY);
console.log('i=', i)
// console.log('i=', i)
}
}
......@@ -236,6 +238,7 @@ export default class GameView extends engine.Container {
*/
start() {
this.prizeId = props.prizeId;
console.log("this.prizeId=",this.prizeId);
for(let i = 0; i < 3; i++){
engine.Tween.removeTweens(this["container" + i]);
setTimeout(() => {
......@@ -271,16 +274,19 @@ export default class GameView extends engine.Container {
for(let i = 0; i < len; i++){
let plen = this.prizes.length;
if(direct > 0){
this.itemInfo["items" + j][i].source = this.prizes[(plen - 1) - (i % plen)].icon;
this.itemInfo["items" + j][i].texture = engine.Texture.fromImage(this.prizes[(plen - 1) - (i % plen)].icon);
// this.itemInfo["items" + j][i].source = this.prizes[(plen - 1) - (i % plen)].icon;
}else{
this.itemInfo["items" + j][i].source = this.prizes[(i % plen)].icon;
this.itemInfo["items" + j][i].texture = engine.Texture.fromImage(this.prizes[(i % plen)].icon);
// this.itemInfo["items" + j][i].source = this.prizes[(i % plen)].icon;
}
}
}
for(let i = 0; i < 3; i++){
// this.prizeId = "sss_3";
this.itemInfo["items" + i][1].source = this.getPrizeUrl(this.prizeId);
this.itemInfo["items" + i][1].texture = engine.Texture.fromImage(this.getPrizeUrl(this.prizeId));
// this.itemInfo["items" + i][1].source = this.getPrizeUrl(this.prizeId);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment