Commit af293eef authored by wildfirecode's avatar wildfirecode

1

parent fd8d7693
......@@ -1873,7 +1873,9 @@
"properties": {
"pic": "entity|5e468650-9e44-4f2d-8dba-be066cd89c37",
"label": "entity|e6dc4c00-8481-4356-8610-8abe1a354663",
"getOrderStatus": "dynamic|API|getOrderStatus"
"getOrderStatus": "dynamic|API|getOrderStatus",
"title": "entity|2f9d765f-8904-4e70-bde6-d885f1fbb937",
"name": "entity|3f462085-e29d-4e3a-b3a4-11246b001b6b"
}
}
],
......@@ -2013,14 +2015,17 @@
"script": "components/renderer/TextRenderer",
"properties": {
"fillColor": "rgba(130, 81, 2, 1)",
"text": "获得一等奖"
"text": "获得一等奖",
"textStyle": {
"fontSize": 30
}
}
}
],
"uuid": "2f9d765f-8904-4e70-bde6-d885f1fbb937"
},
{
"name": "Label",
"name": "name",
"components": [
{
"script": "components/base/Transform",
......@@ -2040,9 +2045,31 @@
}
],
"uuid": "3f462085-e29d-4e3a-b3a4-11246b001b6b"
},
{
"name": "tips",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": 0,
"y": 104.12698412698413
}
}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"fillColor": "rgba(130, 81, 2, 1)",
"text": "请于婚宴现场领取奖品~"
}
}
],
"uuid": "69f9ba75-e78e-47fa-8b31-caf5db5cddc5"
}
],
"disabled": true
"disabled": false
},
{
"name": "Score",
......
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, engine, Entity } from "scilla/src";
import Toast from "./common/Toast";
import { engine, Entity } from "scilla/src";
import { initEnv } from "./common/BuriedPoint";
import Toast from "./common/Toast";
import Popup from "./popup/Popup";
export default class MainController extends ScillaComponent {
......@@ -10,9 +10,6 @@ export default class MainController extends ScillaComponent {
private _toast: Toast;
private _popup: Popup;
// fuckNavigator(p) {
// console.log('fuckNavigator from MainController', p)
// }
onAwake() {
super.onAwake();
......@@ -31,12 +28,16 @@ export default class MainController extends ScillaComponent {
}
onResponse_rankInfo(data) {
// console.log(data);
if (data.openPrize) {
if (true)
this.showDialog('Prize', data);
if (data.openPrize) {//开奖了,都是线下奖品
let prize;
window['CFG'].activity.prizeList.forEach(p => {
if (p.rank == data.rank)
prize = p;
});
if (prize) //中奖了
this.showDialog('Prize', prize);
else
this.showDialog('Alert', '您与奖品擦肩而过~')
this.showDialog('Alert', '您与奖品擦肩而过~');
}
}
......
......@@ -7,11 +7,12 @@
import { TextureRenderer } from "scilla-components/src";
import { AssetsManager, createTexture, EngineConfig, Entity, Texture, dynamic } from "scilla/src";
import DialogContent from "../popup/DialogContent";
import { setScale } from "../transformUtils";
import { setScale, setText } from "../transformUtils";
export default class PrizeDialogContent extends DialogContent {
pic: Entity;
getOrderStatus:dynamic;
name:Entity;
title:Entity;
private loadImage = (url: string): Promise<HTMLImageElement> => {
return new Promise<HTMLImageElement>((resolve, reject) => {
......@@ -36,16 +37,18 @@ export default class PrizeDialogContent extends DialogContent {
}
onClick_usebtn(){
window.location.href=this.getOrderStatus.lottery.link
// window.location.href=this.getOrderStatus.lottery.link
}
onAwake() {
super.onAwake();
}
async setup(dat1a: any = {}) {
async setup(data: any = {}) {
setText(this.name,data.title);
setText(this.title,this.getTypeStr(data.prizeType))
const texRender = this.pic.getComponent(TextureRenderer);
const texture = await this.loadTexture(this.getOrderStatus.lottery.imgUrl);
const texture = await this.loadTexture(data.imgurl);
texRender.texture = texture;
if (texture.bounds.width > texture.bounds.height) {
const maxWidth = 500;
......@@ -55,4 +58,19 @@ export default class PrizeDialogContent extends DialogContent {
setScale(this.pic, width / texture.bounds.width)
}
}
private getTypeStr(type: number) {
if (type == 1) {
return `获得一等奖`
}
if (type == 2) {
return `获得二等奖`
}
if (type == 3) {
return `获得三等奖`
}
if (type == 4) {
return `获得四等奖`
}
}
}
......@@ -8016,67 +8016,6 @@
return RankList;
}(ScillaComponent));
var Toast = (function (_super) {
__extends(Toast, _super);
function Toast() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.ypadding = 20;
_this.xpadding = 50;
_this.offsetY = 0;
_this.showDuration = 300;
_this.hideDuration = 300;
return _this;
}
Toast.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
if (!this._bgTransform) {
var _a = this, offsetY = _a.offsetY, hideDuration = _a.hideDuration, showDuration = _a.showDuration, transform = _a.transform;
this._bgTransform = this.getComponent(Transform);
this._labelRenderer = this.Label.getComponent(TextRenderer);
this._labelTransform = this.Label.getComponent(Transform);
this._tweenIn = createTween(this, transform, false, { autoPlay: false })
.to({ position: { x: 0, y: offsetY } }, showDuration, cubicOut);
this._tweenOut = createTween(this, transform, false, { autoPlay: false })
.to({ position: { y: 0 } }, hideDuration, cubicIn)
.call(this.onHidden);
this.transform.position.y = this.outPos;
}
};
Object.defineProperty(Toast.prototype, "outPos", {
get: function () {
return engine.renderContext.stageCenter.y + this._bgTransform.height;
},
enumerable: true,
configurable: true
});
Toast.prototype.show = function (_a) {
var _this = this;
var content = _a.content, _b = _a.duration, duration = _b === void 0 ? 1000 : _b;
this.entity.enabled = true;
var _c = this, _bgTransform = _c._bgTransform, _labelRenderer = _c._labelRenderer, _labelTransform = _c._labelTransform, xpadding = _c.xpadding, ypadding = _c.ypadding;
_labelRenderer.text = content;
_labelRenderer.measureBounds();
_bgTransform.width = _labelTransform.width + xpadding * 2;
_bgTransform.height = _labelTransform.height + ypadding * 2;
this._tweenOut.queue[0].props.position.y = this.outPos;
this._tweenIn.play(true);
if (this._timerDuration) {
clearTimeout(this._timerDuration);
this._timerDuration = null;
}
this._timerDuration = setTimeout(function () {
_this.hide();
}, duration);
};
Toast.prototype.hide = function () {
this._tweenOut.play(true);
};
Toast.prototype.onHidden = function () {
this.entity.enabled = false;
};
return Toast;
}(ScillaComponent));
var BuriedPoint = (function (_super) {
__extends(BuriedPoint, _super);
function BuriedPoint() {
......@@ -8150,6 +8089,67 @@
return BuriedPointData;
}());
var Toast = (function (_super) {
__extends(Toast, _super);
function Toast() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.ypadding = 20;
_this.xpadding = 50;
_this.offsetY = 0;
_this.showDuration = 300;
_this.hideDuration = 300;
return _this;
}
Toast.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
if (!this._bgTransform) {
var _a = this, offsetY = _a.offsetY, hideDuration = _a.hideDuration, showDuration = _a.showDuration, transform = _a.transform;
this._bgTransform = this.getComponent(Transform);
this._labelRenderer = this.Label.getComponent(TextRenderer);
this._labelTransform = this.Label.getComponent(Transform);
this._tweenIn = createTween(this, transform, false, { autoPlay: false })
.to({ position: { x: 0, y: offsetY } }, showDuration, cubicOut);
this._tweenOut = createTween(this, transform, false, { autoPlay: false })
.to({ position: { y: 0 } }, hideDuration, cubicIn)
.call(this.onHidden);
this.transform.position.y = this.outPos;
}
};
Object.defineProperty(Toast.prototype, "outPos", {
get: function () {
return engine.renderContext.stageCenter.y + this._bgTransform.height;
},
enumerable: true,
configurable: true
});
Toast.prototype.show = function (_a) {
var _this = this;
var content = _a.content, _b = _a.duration, duration = _b === void 0 ? 1000 : _b;
this.entity.enabled = true;
var _c = this, _bgTransform = _c._bgTransform, _labelRenderer = _c._labelRenderer, _labelTransform = _c._labelTransform, xpadding = _c.xpadding, ypadding = _c.ypadding;
_labelRenderer.text = content;
_labelRenderer.measureBounds();
_bgTransform.width = _labelTransform.width + xpadding * 2;
_bgTransform.height = _labelTransform.height + ypadding * 2;
this._tweenOut.queue[0].props.position.y = this.outPos;
this._tweenIn.play(true);
if (this._timerDuration) {
clearTimeout(this._timerDuration);
this._timerDuration = null;
}
this._timerDuration = setTimeout(function () {
_this.hide();
}, duration);
};
Toast.prototype.hide = function () {
this._tweenOut.play(true);
};
Toast.prototype.onHidden = function () {
this.entity.enabled = false;
};
return Toast;
}(ScillaComponent));
function bearingsToOutPos(bearings) {
var _a = engine.renderContext.stageSize, width = _a.width, height = _a.height;
var x, y;
......@@ -8487,7 +8487,6 @@
this._toast = this.Toast.getComponent(Toast);
this._popup = this.Popup.getComponent(Popup);
initEnv();
this.broadcast('callApi', 1, 'ajaxElement', { duibaId: this.hdToolId, activityId: this.actId });
this.broadcast('callApi', 1, 'rankInfo', {
weddingId: window['CFG']._weddingId,
activityId: window['CFG']._activityId
......@@ -8495,20 +8494,17 @@
};
MainController.prototype.onResponse_rankInfo = function (data) {
if (data.openPrize) {
this.showDialog('Prize', data);
var prize_1;
window['CFG'].activity.prizeList.forEach(function (p) {
if (p.rank == data.rank)
prize_1 = p;
});
if (prize_1)
this.showDialog('Prize', prize_1);
else
this.showDialog('Alert', '您与奖品擦肩而过~');
}
};
MainController.prototype.onGotAjaxElement = function () {
var _this = this;
setTimeout(function () {
_this.broadcast('initGameStage');
}, 1000);
};
MainController.prototype.onGotAjaxElementError = function (e) {
console.log(e);
};
MainController.prototype.showErrorToast = function (e) {
};
MainController.prototype.showToast = function (content, duration) {
this._toast.show({
content: content,
......@@ -8684,20 +8680,21 @@
return _this;
}
PrizeDialogContent.prototype.onClick_usebtn = function () {
window.location.href = this.getOrderStatus.lottery.link;
};
PrizeDialogContent.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
};
PrizeDialogContent.prototype.setup = function (dat1a) {
if (dat1a === void 0) { dat1a = {}; }
PrizeDialogContent.prototype.setup = function (data) {
if (data === void 0) { data = {}; }
return __awaiter(this, void 0, void 0, function () {
var texRender, texture, maxWidth, width;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
setText$1(this.name, data.title);
setText$1(this.title, this.getTypeStr(data.prizeType));
texRender = this.pic.getComponent(TextureRenderer);
return [4, this.loadTexture(this.getOrderStatus.lottery.imgUrl)];
return [4, this.loadTexture(data.imgurl)];
case 1:
texture = _a.sent();
texRender.texture = texture;
......@@ -8714,6 +8711,20 @@
});
});
};
PrizeDialogContent.prototype.getTypeStr = function (type) {
if (type == 1) {
return "\u83B7\u5F97\u4E00\u7B49\u5956";
}
if (type == 2) {
return "\u83B7\u5F97\u4E8C\u7B49\u5956";
}
if (type == 3) {
return "\u83B7\u5F97\u4E09\u7B49\u5956";
}
if (type == 4) {
return "\u83B7\u5F97\u56DB\u7B49\u5956";
}
};
return PrizeDialogContent;
}(DialogContent));
......
This diff is collapsed.
......@@ -63,7 +63,12 @@
'freeLimit': 0,
'weixinUid': 00000,
'nickname': 'honingwon',
'activity': 123
'activity': {
prizeList: [
{ rank: 1, imgurl: '//yun.duiba.com.cn/developer/img/activityTool/slotMachine/alipay.png', prizeType: 1, title: 'title1' },
{ rank: 2, imgurl: '//yun.duiba.com.cn/developer/img/activityTool/slotMachine/alipay.png', prizeType: 2, title: 'title2' }
]
}
};
CFG._rule = 'starttttttt<br>第1行第1行第1行第1行第1行第1行第1行第1行第1行第1行第1行第1行第1行第1行<br>第2行<br>第3行<br>第4行<br>第5行<br>第6行<br>第7行<br>第1行<br>第2行<br>第3行<br>第4行<br>第5行<br>第6行<br>第7行endddddd';
......
......@@ -4,8 +4,8 @@
"desc": null,
"timestamp": 1561377481101,
"data": {
"openPrize": false,
"rank": "3",
"openPrize": true,
"rank": "2",
"list": [
{
"weiXinUid": "weiXinUid",
......
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