Commit fc1dba2d authored by wildfirecode's avatar wildfirecode

1

parent 349310b0
......@@ -127,7 +127,7 @@
"doJoin": "dynamic|API|doJoin",
"getNgameStartStatus": "dynamic|API|getNgameStartStatus",
"getOrderStatus": "dynamic|API|getOrderStatus",
"rankbtn": "entity|5f3ed06e-c47a-491e-a3a1-9ac0e700a302"
"rankbtn": "entity|34f68eec-739c-478c-a527-6aa12c197850"
},
"disabled": false
},
......@@ -200,6 +200,20 @@
],
"name": "getOrderStatus"
}
},
{
"script": "./scripts/api/SamplePollingApi",
"properties": {
"uri": "/customActivity/sjf/activity/rankInfo",
"name": "rankInfo",
"onResponse": [
{
"entity": "entity|41f0a20e-9d0a-445b-8ffc-d8a0b04ab02c",
"component": 1,
"method": "onResponse_rank"
}
]
}
}
],
"uuid": "41f0a20e-9d0a-445b-8ffc-d8a0b04ab02c",
......@@ -339,7 +353,9 @@
"position": {
"_hashCode": 2827,
"_x": 0,
"_y": 245.1060606060605
"_y": 245.1060606060605,
"x": 0,
"y": 216.21717171717162
}
}
},
......@@ -412,14 +428,15 @@
"disabledRes": "res|66066ff4-4536-4398-84ad-8cf91c2d8333",
"upRes": "res|66066ff4-4536-4398-84ad-8cf91c2d8333",
"downRes": "res|66066ff4-4536-4398-84ad-8cf91c2d8333"
}
},
"disabled": false
}
],
"children": [],
"uuid": "34f68eec-739c-478c-a527-6aa12c197850"
}
],
"disabled": true
"disabled": false
},
{
"name": "ScenePlay",
......@@ -709,7 +726,8 @@
"score3": "entity|1a35431a-c2ab-494e-baa9-8b4e1f1e7c16",
"myname": "entity|61fc871c-9f18-499e-abb5-2dfe8b381223",
"myscore": "entity|d30c7a2a-e95a-42e4-a288-ebe7022e1f3e",
"myrank": "entity|3ed68a8c-bbcc-4a85-a9da-5f44eff0d08e"
"myrank": "entity|3ed68a8c-bbcc-4a85-a9da-5f44eff0d08e",
"rankInfo": "dynamic|API|rankInfo"
},
"disabled": false
},
......@@ -1279,7 +1297,7 @@
"script": "components/base/Transform",
"properties": {
"width": 692,
"height": 511,
"height": 521,
"position": {
"x": -1.8181818181819318,
"y": -149.09090909090912
......@@ -1290,9 +1308,10 @@
"script": "components/renderer/RectRenderer",
"properties": {
"fillColor": "rgba(255, 255, 255, 0.7)",
"cornerRadius": 20
"cornerRadius": 20,
"alpha": 0
},
"disabled": true
"disabled": false
},
{
"script": "components/ui/ScrollView",
......@@ -1306,7 +1325,8 @@
"script": "./scripts/scenes/result/RankList",
"properties": {
"content": "entity|f66d93c5-5fee-4c7b-b29c-8af633cae769",
"item": "res|681aaec9-4063-4399-b56f-2a88de1a902e"
"item": "res|681aaec9-4063-4399-b56f-2a88de1a902e",
"rankInfo": "dynamic|API|rankInfo"
}
}
],
......@@ -1355,7 +1375,8 @@
"height": 100,
"cornerRadius": 20,
"alpha": 0
}
},
"disabled": false
},
{
"script": "components/other/RelativeLayout",
......
......@@ -15,7 +15,7 @@ export default class ScoreDialogContent extends DialogContent {
}
setup(data: any = {}) {
setText(this.content, `恭喜你共摇出${data}喜糖`)
setText(this.content, `恭喜你共摇出${data}糖果`)
}
protected onTapCloseButton() {
......
......@@ -2,5 +2,5 @@ import { TextRenderer } from "scilla-components/src";
import { Entity } from "scilla/src";
export const setText = (entity: Entity, text) => {
entity.getComponent(TextRenderer).text = text;
entity.getComponent(TextRenderer).text = text + '';
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView
box1: Entity;
box2: Entity;
box3: Entity;
private COUNT_DOWN_SEC = 4;
private COUNT_DOWN_SEC = 10;
private _startTag = false;
private _msPassed = 0;
private _ballCounter = 0;
......@@ -43,7 +43,7 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView
window.addEventListener('devicemotion', deviceMotionHandler, false);
}
var SHAKE_THRESHOLD = 100; //累积200的速度值出一个球
var SHAKE_THRESHOLD = 50; //累积200的速度值出一个球
var x, y, z, last_x = 0, last_y = 0, last_z = 0;
var speedCounter = 0;
var _this = this;
......
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { createTexture, EngineConfig, Entity, Texture } from "scilla/src";
import { createTexture, EngineConfig, Entity, Texture, dynamic } from "scilla/src";
import { alien } from "../navigator/StackNavigator";
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { TextureRenderer } from "scilla-components/src";
......@@ -9,22 +9,21 @@ import { setScale, setText } from "../transformUtils";
export default class SceneResult extends ScillaComponent implements INavigatorViewBase {
onAwake() {
super.onAwake();
this.broadcast('callApi', 1, 'rankInfo', {
weddingId: window['CFG']._weddingId,
activityId: window['CFG']._activityId
})
// console.log(this.rankInfo);
this.onResponse(this.rankInfo);
}
rankInfo: dynamic;
onResponse(data) {
//设置我的信息
setText(this.myname, 'honingwon');
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);
//设置前三名的信息
const [rankinfo1, rankinfo2, rankinfo3, ...last] = data.list;
console.log(rankinfo1, rankinfo2, rankinfo3, last);
const [rankinfo1, rankinfo2, rankinfo3] = data.list;
// console.log(rankinfo1, rankinfo2, rankinfo3, last);
if (rankinfo1) {
this.loadAvatar(this.avatar1, rankinfo1.avatar, 78);
setText(this.name1, rankinfo1.nickName);
......
......@@ -26,14 +26,11 @@ export default class SceneStart extends ScillaComponent implements INavigatorVie
initGameStage() {
console.log('initGameStage')
// // this.updateCountText();
// this.bubbling('showToast', '活动还未开始\n敬请期待')
}
onClick_startbtn() {
this.startbtn.getComponent(Button).enabled = false;
this.sendDojoin();
// this.bubbling('fuck', 'play');
}
sendDojoin() {
......@@ -116,9 +113,16 @@ export default class SceneStart extends ScillaComponent implements INavigatorVie
}
onClick_rankbtn() {
// alert('onClick_rankbtn');
this.rankbtn.getComponent(Button).enabled = false;
this.broadcast('callApi', 1, 'rankInfo', {
weddingId: window['CFG']._weddingId,
activityId: window['CFG']._activityId
})
}
onResponse_rank() {
this.bubbling('fuck', 'result');
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
this.rankbtn.getComponent(Button).enabled = true;
}
onClick_recordbtn() {
......
import ScillaComponent from 'components/base/ScillaComponent';
import { Entity, EngineConfig, Texture, createTexture } from 'scilla/src';
import { setText } from 'assets/scripts/entityUtils';
import { TextureRenderer } from 'scilla-components/src';
import { setScale } from 'assets/scripts/transformUtils';
import ScillaComponent from 'components/base/ScillaComponent';
import { TextureRenderer } from 'scilla-components/src';
import { createTexture, EngineConfig, Entity, Texture } from 'scilla/src';
export default class RankItem extends ScillaComponent {
score: Entity;
rank: Entity;
name: Entity;
avatar: Entity;
onAwake() {
super.onAwake();
}
async setdata(data) {
//yun.duiba.com.cn/db_games/1.jpg
setText(this.rank, data + '');
const texRender = this.avatar.getComponent(TextureRenderer);
const texture = await this.loadTexture('//yun.duiba.com.cn/db_games/1.jpg');
texRender.texture = texture;
setScale(this.avatar,40/texture.bounds.width)
}
onUpdate(t) {
super.onUpdate(t);
}
private loadImage = (url: string): Promise<HTMLImageElement> => {
return new Promise<HTMLImageElement>((resolve, reject) => {
let img = new Image();
if (EngineConfig.imgCrossOrigin) {
img.setAttribute('crossOrigin', 'anonymous');
}
img.onload = function (e) {
resolve(img);
};
img.onerror = function (e) {
reject(e);
};
img.src = url;
});
}
private loadTexture = async (url: string): Promise<Texture> => {
const img = await this.loadImage(url);
const texture = createTexture(img);
return texture;
}
score: Entity;
rank: Entity;
name: Entity;
avatar: Entity;
onAwake() {
super.onAwake();
}
async setdata(data) {
// console.log(data);
setText(this.score, data.score + '');
setText(this.rank, data.rank);
setText(this.name, data.nickName);
const texRender = this.avatar.getComponent(TextureRenderer);
const texture = await this.loadTexture(data.avatar);
texRender.texture = texture;
setScale(this.avatar, 40 / texture.bounds.width)
}
onUpdate(t) {
super.onUpdate(t);
}
private loadImage = (url: string): Promise<HTMLImageElement> => {
return new Promise<HTMLImageElement>((resolve, reject) => {
let img = new Image();
if (EngineConfig.imgCrossOrigin) {
img.setAttribute('crossOrigin', 'anonymous');
}
img.onload = function (e) {
resolve(img);
};
img.onerror = function (e) {
reject(e);
};
img.src = url;
});
}
private loadTexture = async (url: string): Promise<Texture> => {
const img = await this.loadImage(url);
const texture = createTexture(img);
return texture;
}
}
/**
* Created by rockyl on 2019-01-03.
*
* 砖块动画单体
*/
* Created by rockyl on 2019-01-03.
*
* 砖块动画单体
*/
import ScillaComponent from 'components/base/ScillaComponent';
import { Entity, resource, instantiate, EngineConfig, Texture, createTexture } from 'scilla/src';
import { RectRenderer, Transform } from 'scilla-components/src';
import { Entity, resource, instantiate, dynamic } from 'scilla/src';
import RankItem from './RankItem';
export default class RankList extends ScillaComponent {
......@@ -14,8 +14,16 @@ export default class RankList extends ScillaComponent {
content: Entity;
private _list: Entity[];
private _bg: RectRenderer;
rankInfo: dynamic;
onAwake() {
super.onAwake();
// console.log('RankList onAwake')
this.updateRankList(this.rankInfo);
}
updateRankList(rankInfo) {
const [, , , ...data] = rankInfo.list;
this._bg = this.content.getComponent(RectRenderer);
if (this._list) {
this._list.forEach(item => {
......@@ -23,20 +31,18 @@ export default class RankList extends ScillaComponent {
})
}
const itemHeight = 73;
const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const totalHeight = itemHeight * data.length;
this._list = [];
this._bg.height = totalHeight;
// console.log(totalHeight);
data.forEach((item, index) => {
const rank = instantiate(this.item);
rank.getComponent(RankItem).setdata(item);
this.content.addChild(rank);
// rank.getComponent(Transform).position.y = index * itemHeight;
rank.getComponent(Transform).position.y = index * itemHeight - totalHeight / 2 + itemHeight / 2 + 10;
this._list.push(rank);
});
}
}
assets/sheets/start.sht/startbtn.png

22.3 KB | W: | H:

assets/sheets/start.sht/startbtn.png

18.4 KB | W: | H:

assets/sheets/start.sht/startbtn.png
assets/sheets/start.sht/startbtn.png
assets/sheets/start.sht/startbtn.png
assets/sheets/start.sht/startbtn.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -6885,7 +6885,7 @@
}(ScillaComponent));
var setText = function (entity, text) {
entity.getComponent(TextRenderer).text = text;
entity.getComponent(TextRenderer).text = text + '';
};
var getTween = function (context, val, obj, duration, ease$$1) {
......@@ -6970,7 +6970,7 @@
__extends(ScenePlay, _super);
function ScenePlay() {
var _this_1 = _super !== null && _super.apply(this, arguments) || this;
_this_1.COUNT_DOWN_SEC = 4;
_this_1.COUNT_DOWN_SEC = 10;
_this_1._startTag = false;
_this_1._msPassed = 0;
_this_1._ballCounter = 0;
......@@ -6994,7 +6994,7 @@
if (window['DeviceMotionEvent']) {
window.addEventListener('devicemotion', deviceMotionHandler, false);
}
var SHAKE_THRESHOLD = 100;
var SHAKE_THRESHOLD = 50;
var x, y, z, last_x = 0, last_y = 0, last_z = 0;
var speedCounter = 0;
var _this = this;
......@@ -7412,7 +7412,15 @@
this.bubbling('showDialog', 'Rule');
};
SceneStart.prototype.onClick_rankbtn = function () {
this.rankbtn.getComponent(Button).enabled = false;
this.broadcast('callApi', 1, 'rankInfo', {
weddingId: window['CFG']._weddingId,
activityId: window['CFG']._activityId
});
};
SceneStart.prototype.onResponse_rank = function () {
this.bubbling('fuck', 'result');
this.rankbtn.getComponent(Button).enabled = true;
};
SceneStart.prototype.onClick_recordbtn = function () {
alert('onClick_recordbtn');
......@@ -7526,18 +7534,14 @@
}
SceneResult.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
this.broadcast('callApi', 1, 'rankInfo', {
weddingId: window['CFG']._weddingId,
activityId: window['CFG']._activityId
});
this.onResponse(this.rankInfo);
};
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);
var _a = __read(data.list), rankinfo1 = _a[0], rankinfo2 = _a[1], rankinfo3 = _a[2], last = _a.slice(3);
console.log(rankinfo1, rankinfo2, rankinfo3, last);
var _a = __read(data.list, 3), rankinfo1 = _a[0], rankinfo2 = _a[1], rankinfo3 = _a[2];
if (rankinfo1) {
this.loadAvatar(this.avatar1, rankinfo1.avatar, 78);
setText$1(this.name1, rankinfo1.nickName);
......@@ -7698,9 +7702,11 @@
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
setText(this.rank, data + '');
setText(this.score, data.score + '');
setText(this.rank, data.rank);
setText(this.name, data.nickName);
texRender = this.avatar.getComponent(TextureRenderer);
return [4, this.loadTexture('//yun.duiba.com.cn/db_games/1.jpg')];
return [4, this.loadTexture(data.avatar)];
case 1:
texture = _a.sent();
texRender.texture = texture;
......@@ -7995,8 +8001,12 @@
return _super !== null && _super.apply(this, arguments) || this;
}
RankList.prototype.onAwake = function () {
var _this = this;
_super.prototype.onAwake.call(this);
this.updateRankList(this.rankInfo);
};
RankList.prototype.updateRankList = function (rankInfo) {
var _this = this;
var _a = __read(rankInfo.list), data = _a.slice(3);
this._bg = this.content.getComponent(RectRenderer);
if (this._list) {
this._list.forEach(function (item) {
......@@ -8004,7 +8014,6 @@
});
}
var itemHeight = 73;
var data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var totalHeight = itemHeight * data.length;
this._list = [];
this._bg.height = totalHeight;
......@@ -8726,7 +8735,7 @@
};
ScoreDialogContent.prototype.setup = function (data) {
if (data === void 0) { data = {}; }
setText(this.content, "\u606D\u559C\u4F60\u5171\u6447\u51FA" + data + "\u9897\u559C\u7CD6");
setText(this.content, "\u606D\u559C\u4F60\u5171\u6447\u51FA" + data + "\u9897\u7CD6\u679C");
};
ScoreDialogContent.prototype.onTapCloseButton = function () {
_super.prototype.onTapCloseButton.call(this);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -49,6 +49,48 @@
"score": 206,
"rank": "6"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName6",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 206,
"rank": "6"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName6",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 206,
"rank": "6"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName6",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 206,
"rank": "6"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName6",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 206,
"rank": "6"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName6",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 206,
"rank": "6"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName6",
"avatar": "//yun.duiba.com.cn/db_games/1.jpg",
"score": 206,
"rank": "6"
},
{
"weiXinUid": "weiXinUid",
"nickName": "nickName_last",
......
......@@ -4,7 +4,7 @@
"main": "index.js",
"license": "MIT",
"scripts": {
"livereload": "livereload . -ee scene,jpg,png,html",
"livereload": "livereload . -ee jpg,png,html",
"mock": "game-cli m -p 4001 -f './mock'",
"server": "game-cli serve -p 3001",
"dev": "game-cli dev"
......
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