Commit 349310b0 authored by wildfirecode's avatar wildfirecode

1

parent 755c98f5
...@@ -63,6 +63,28 @@ ...@@ -63,6 +63,28 @@
], ],
"uri": "/hdtool/recon/ajaxElement" "uri": "/hdtool/recon/ajaxElement"
} }
},
{
"script": "./scripts/api/SampleApi",
"properties": {
"method": "GET",
"name": "rankInfo",
"onError": [
{
"entity": "entity|20181212032053",
"component": null,
"method": null
}
],
"onResponse": [
{
"entity": "entity|20181212032053",
"component": 2,
"method": "onResponse_rankInfo"
}
],
"uri": "/customActivity/sjf/activity/rankInfo"
}
} }
], ],
"children": [ "children": [
...@@ -688,11 +710,27 @@ ...@@ -688,11 +710,27 @@
"myname": "entity|61fc871c-9f18-499e-abb5-2dfe8b381223", "myname": "entity|61fc871c-9f18-499e-abb5-2dfe8b381223",
"myscore": "entity|d30c7a2a-e95a-42e4-a288-ebe7022e1f3e", "myscore": "entity|d30c7a2a-e95a-42e4-a288-ebe7022e1f3e",
"myrank": "entity|3ed68a8c-bbcc-4a85-a9da-5f44eff0d08e" "myrank": "entity|3ed68a8c-bbcc-4a85-a9da-5f44eff0d08e"
},
"disabled": false
},
{
"script": "./scripts/api/SampleApi",
"properties": {
"method": "GET",
"name": "rankInfo",
"onResponse": [
{
"entity": "entity|5f2a7508-4728-430b-b306-06f719ea81e3",
"component": 1,
"method": "onResponse"
}
],
"uri": "/customActivity/sjf/activity/rankInfo"
} }
} }
], ],
"uuid": "5f2a7508-4728-430b-b306-06f719ea81e3", "uuid": "5f2a7508-4728-430b-b306-06f719ea81e3",
"disabled": false, "disabled": true,
"children": [ "children": [
{ {
"name": "cankao", "name": "cankao",
......
...@@ -27,10 +27,26 @@ export default class MainController extends ScillaComponent { ...@@ -27,10 +27,26 @@ export default class MainController extends ScillaComponent {
initEnv(); initEnv();
this.broadcast('callApi', 1, 'ajaxElement', { duibaId: this.hdToolId, activityId: this.actId }) this.broadcast('callApi', 1, 'ajaxElement', { duibaId: this.hdToolId, activityId: this.actId })
this.broadcast('callApi', 1, 'rankInfo', {
weddingId: window['CFG']._weddingId,
activityId: window['CFG']._activityId
})
}
onResponse_rankInfo(data) {
// console.log(data);
if (data.openPrize) {
if (true)
this.showDialog('Prize', data);
else
this.showDialog('Alert', '您与奖品擦肩而过~')
}
} }
onGotAjaxElement() { onGotAjaxElement() {
this.broadcast('initGameStage'); setTimeout(() => {
this.broadcast('initGameStage');
}, 1000);
} }
onGotAjaxElementError(e) { onGotAjaxElementError(e) {
......
...@@ -4,15 +4,42 @@ import { createTexture, EngineConfig, Entity, Texture } from "scilla/src"; ...@@ -4,15 +4,42 @@ import { createTexture, EngineConfig, Entity, Texture } from "scilla/src";
import { alien } from "../navigator/StackNavigator"; import { alien } from "../navigator/StackNavigator";
import { INavigatorViewBase } from "../navigator/VirtualNavigator"; import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { TextureRenderer } from "scilla-components/src"; import { TextureRenderer } from "scilla-components/src";
import { setScale } from "../transformUtils"; import { setScale, setText } from "../transformUtils";
export default class SceneResult extends ScillaComponent implements INavigatorViewBase { export default class SceneResult extends ScillaComponent implements INavigatorViewBase {
onAwake() { onAwake() {
super.onAwake(); super.onAwake();
this.loadAvatar(this.avatar1, '//yun.duiba.com.cn/db_games/1.jpg', 78); this.broadcast('callApi', 1, 'rankInfo', {
this.loadAvatar(this.avatar2, '//yun.duiba.com.cn/db_games/1.jpg', 64); weddingId: window['CFG']._weddingId,
this.loadAvatar(this.avatar3, '//yun.duiba.com.cn/db_games/1.jpg', 64); activityId: window['CFG']._activityId
})
}
onResponse(data) {
//设置我的信息
setText(this.myname, 'honingwon');
setText(this.myrank, data.rank + '');
setText(this.myscore, '123456');
this.loadAvatar(this.myavatar, '//yun.duiba.com.cn/db_games/1.jpg', 78); this.loadAvatar(this.myavatar, '//yun.duiba.com.cn/db_games/1.jpg', 78);
//设置前三名的信息
const [rankinfo1, rankinfo2, rankinfo3, ...last] = data.list;
console.log(rankinfo1, rankinfo2, rankinfo3, last);
if (rankinfo1) {
this.loadAvatar(this.avatar1, rankinfo1.avatar, 78);
setText(this.name1, rankinfo1.nickName);
setText(this.score1, rankinfo1.score);
}
if (rankinfo2) {
this.loadAvatar(this.avatar2, rankinfo2.avatar, 64);
setText(this.name2, rankinfo2.nickName);
setText(this.score2, rankinfo2.score);
}
if (rankinfo3) {
this.loadAvatar(this.avatar3, rankinfo3.avatar, 64);
setText(this.name3, rankinfo3.nickName);
setText(this.score3, rankinfo3.score);
}
} }
onTapCloseButton() { onTapCloseButton() {
......
...@@ -25,6 +25,7 @@ export default class SceneStart extends ScillaComponent implements INavigatorVie ...@@ -25,6 +25,7 @@ export default class SceneStart extends ScillaComponent implements INavigatorVie
} }
initGameStage() { initGameStage() {
console.log('initGameStage')
// // this.updateCountText(); // // this.updateCountText();
// this.bubbling('showToast', '活动还未开始\n敬请期待') // this.bubbling('showToast', '活动还未开始\n敬请期待')
} }
......
...@@ -32,7 +32,7 @@ export const setScale = (val: Entity | ScillaComponent, sacle) => { ...@@ -32,7 +32,7 @@ export const setScale = (val: Entity | ScillaComponent, sacle) => {
} }
export const setText = (entity: Entity, text: string) => { export const setText = (entity: Entity, text: string) => {
entity.getComponent(TextRenderer).text = text; entity.getComponent(TextRenderer).text = text + '';
} }
export const getScale = (val: Entity | ScillaComponent) => { export const getScale = (val: Entity | ScillaComponent) => {
......
...@@ -6934,6 +6934,9 @@ ...@@ -6934,6 +6934,9 @@
val.entity.getComponent(Transform).scale.y = sacle; val.entity.getComponent(Transform).scale.y = sacle;
} }
}; };
var setText$1 = function (entity, text) {
entity.getComponent(TextRenderer).text = text + '';
};
var setY = function (entity, y) { var setY = function (entity, y) {
entity.getComponent(Transform).position.y = y; entity.getComponent(Transform).position.y = y;
}; };
...@@ -7346,6 +7349,7 @@ ...@@ -7346,6 +7349,7 @@
_super.prototype.onAwake.call(this); _super.prototype.onAwake.call(this);
}; };
SceneStart.prototype.initGameStage = function () { SceneStart.prototype.initGameStage = function () {
console.log('initGameStage');
}; };
SceneStart.prototype.onClick_startbtn = function () { SceneStart.prototype.onClick_startbtn = function () {
this.startbtn.getComponent(Button).enabled = false; this.startbtn.getComponent(Button).enabled = false;
...@@ -7522,10 +7526,33 @@ ...@@ -7522,10 +7526,33 @@
} }
SceneResult.prototype.onAwake = function () { SceneResult.prototype.onAwake = function () {
_super.prototype.onAwake.call(this); _super.prototype.onAwake.call(this);
this.loadAvatar(this.avatar1, '//yun.duiba.com.cn/db_games/1.jpg', 78); this.broadcast('callApi', 1, 'rankInfo', {
this.loadAvatar(this.avatar2, '//yun.duiba.com.cn/db_games/1.jpg', 64); weddingId: window['CFG']._weddingId,
this.loadAvatar(this.avatar3, '//yun.duiba.com.cn/db_games/1.jpg', 64); activityId: window['CFG']._activityId
});
};
SceneResult.prototype.onResponse = function (data) {
setText$1(this.myname, 'honingwon');
setText$1(this.myrank, data.rank + '');
setText$1(this.myscore, '123456');
this.loadAvatar(this.myavatar, '//yun.duiba.com.cn/db_games/1.jpg', 78); this.loadAvatar(this.myavatar, '//yun.duiba.com.cn/db_games/1.jpg', 78);
var _a = __read(data.list), rankinfo1 = _a[0], rankinfo2 = _a[1], rankinfo3 = _a[2], last = _a.slice(3);
console.log(rankinfo1, rankinfo2, rankinfo3, last);
if (rankinfo1) {
this.loadAvatar(this.avatar1, rankinfo1.avatar, 78);
setText$1(this.name1, rankinfo1.nickName);
setText$1(this.score1, rankinfo1.score);
}
if (rankinfo2) {
this.loadAvatar(this.avatar2, rankinfo2.avatar, 64);
setText$1(this.name2, rankinfo2.nickName);
setText$1(this.score2, rankinfo2.score);
}
if (rankinfo3) {
this.loadAvatar(this.avatar3, rankinfo3.avatar, 64);
setText$1(this.name3, rankinfo3.nickName);
setText$1(this.score3, rankinfo3.score);
}
}; };
SceneResult.prototype.onTapCloseButton = function () { SceneResult.prototype.onTapCloseButton = function () {
this.bubbling('fuck', 'start'); this.bubbling('fuck', 'start');
...@@ -8464,9 +8491,21 @@ ...@@ -8464,9 +8491,21 @@
this._popup = this.Popup.getComponent(Popup); this._popup = this.Popup.getComponent(Popup);
initEnv(); initEnv();
this.broadcast('callApi', 1, 'ajaxElement', { duibaId: this.hdToolId, activityId: this.actId }); this.broadcast('callApi', 1, 'ajaxElement', { duibaId: this.hdToolId, activityId: this.actId });
this.broadcast('callApi', 1, 'rankInfo', {
weddingId: window['CFG']._weddingId,
activityId: window['CFG']._activityId
});
};
MainController.prototype.onResponse_rankInfo = function (data) {
if (data.openPrize) {
this.showDialog('Prize', data);
}
}; };
MainController.prototype.onGotAjaxElement = function () { MainController.prototype.onGotAjaxElement = function () {
this.broadcast('initGameStage'); var _this = this;
setTimeout(function () {
_this.broadcast('initGameStage');
}, 1000);
}; };
MainController.prototype.onGotAjaxElementError = function (e) { MainController.prototype.onGotAjaxElementError = function (e) {
console.log(e); console.log(e);
......
This diff is collapsed.
{
"success": true,
"code": null,
"desc": null,
"timestamp": 1561377481101,
"data": {
"openPrize": false,
"rank": "3",
"list": [
{
"weiXinUid": "weiXinUid",
"nickName": "nickName1",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 100,
"rank": "1"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName2",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 50,
"rank": "2"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName3",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 20,
"rank": "3"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName4",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 204,
"rank": "4"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName5",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 205,
"rank": "5"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName6",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 206,
"rank": "6"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName_last",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 9999,
"rank": "999"
}
]
}
}
\ No newline at end of file
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