Commit 4390c20f authored by wildfirecode's avatar wildfirecode

1

parent 6f9b43fa
No preview for this file type
{"currentScene":"assets/scenes/main.scene"}
\ No newline at end of file
# shuijf
## manifest.json
- fps改成63,提升fps
- 使用fixedWidth
- webServiceUrl
# 环境
- scilla editor v0.0.30
# 步骤
- 使用v0.0.30的create模板hello-scilla
- 使用scilla editor 打开
- preview上的虫子按钮编译
- 运行成功
# livereload
- index.html 增加
```js
<script>
document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] +
':35729/livereload.js?snipver=1"></' + 'script>')
</script>
```
- sudo npm install -g livereload
- livereload ./debug
# mock
- npm run mock
# 配置
- "scaleMode": "fixedWidth",
- "webServiceUrl": "http://localhost:4001"
- dataCenterConfig
## loading.gif
# 流程
- main controller
- webservice,SampleApi,SamplePollingApi
- toast
- net和data
- scene&popup
##
\ No newline at end of file
# 日报
- 5.28 跑新的demo,运行成功
- 5.28
# 换皮
- 换皮可能会超级麻烦
# 可以优化的点
- 分离单个UI配置文件,方便复制
- editor内即时刷新组件属性
- http://localhost:52751/ port能固定不
- 改了图要退出editor才会刷新
- 筛选图的方法
# 优先级
1.增加编译的快捷键
2.方便换皮
# todo
- 排行榜
\ No newline at end of file
No preview for this file type
{"ver":"1.0.1","uuid":"6b4347e6-fc1a-47aa-94b1-0a88302437bd","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"e22b4566-ecdf-47e4-9620-36f1964733b7","subMetas":{},"isGroup":true}
{
"name": "i1",
"name": "BallItem",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
},
{
"script": "components/other/CameraController"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "i1",
"name": "BallItem",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/Icon",
"properties": {}
"script": "./scripts/scenes/BallItem",
"properties": {
"scoreTxt": "entity|8abfc716-7017-4834-a7fa-5ca6c2ce4b3e"
}
}
],
"children": [
{
"name": "Image",
"name": "pic",
"components": [
{
"script": "components/base/Transform",
"properties": {}
"properties": {
"alpha": 0
}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|5ea53bf0-8a58-420c-8c25-fc1724e4865b"
"texture": "res|5367ae30-00ee-4296-8779-158f8fbd68f2"
}
}
],
"uuid": "3348f059-ffca-4670-9cbc-d9fdd014a17f"
"uuid": "fb53fa37-a942-4474-901a-582dccd14c93"
},
{
"name": "Image",
"name": "blue",
"components": [
{
"script": "components/base/Transform",
......@@ -48,14 +55,14 @@
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|c2836212-2459-4c1d-a294-1ed49e197229"
"texture": "res|5367ae30-00ee-4296-8779-158f8fbd68f2"
}
}
],
"uuid": "b083dc1a-32c1-4223-bd92-6a5a08d61761"
"uuid": "bd5eee18-b584-4e7b-817f-17924c204a24"
},
{
"name": "Image",
"name": "purple",
"components": [
{
"script": "components/base/Transform",
......@@ -64,14 +71,14 @@
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|c9272a2e-6151-4b87-a700-32ac4a12caee"
"texture": "res|3aad1b7b-89ec-4565-afa2-a16d36d7b721"
}
}
],
"uuid": "7f878b93-5f00-4087-aa94-522d6b1fdd8d"
"uuid": "23ad1a6b-0041-472e-b2b4-b6d615f6d6f9"
},
{
"name": "Image",
"name": "red",
"components": [
{
"script": "components/base/Transform",
......@@ -80,14 +87,14 @@
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|fb22f965-457d-4514-a322-95149ecdee79"
"texture": "res|e624e863-53d4-41f7-bc95-924579fe8025"
}
}
],
"uuid": "7c640bd9-d699-4fca-9d96-2e75f4f927b1"
"uuid": "5adf946c-1307-443a-9c4b-73e1ce864a69"
},
{
"name": "Image",
"name": "green",
"components": [
{
"script": "components/base/Transform",
......@@ -96,14 +103,14 @@
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|e143dfc7-324e-4635-a776-2f6c0d1ce845"
"texture": "res|853cc248-89dc-40f1-8f16-48007e6d8ef3"
}
}
],
"uuid": "2aa87abd-5f1a-469e-9461-eb7e12779e04"
"uuid": "023cb819-56e2-4ba7-b052-786e0766d255"
},
{
"name": "Image",
"name": "darkBlue",
"components": [
{
"script": "components/base/Transform",
......@@ -112,59 +119,54 @@
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|511ce403-5c36-48e6-9b5c-b3bbfd9b210d"
"texture": "res|9cc48379-a01c-4cd1-9196-220016eb9797"
}
}
],
"uuid": "58db0986-92aa-4828-9f2c-064174addb21"
"uuid": "8cd279f5-9c19-4179-9b93-fdb0b8a7dcca"
},
{
"name": "Image",
"name": "yellow",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|04ae0a39-6624-488e-b52d-97f7a03baf8f"
"position": {
"_hashCode": 44907,
"_x": 0,
"_y": 0
}
}
],
"uuid": "7b51b9ce-7f6e-4fc2-8ddc-bcd3e619e773"
},
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|12e9e984-20c2-4930-aae7-296cee113462"
"texture": "res|24c66e95-12ff-4bea-b4be-aa8554eea39f"
}
}
],
"uuid": "d05c4a07-1471-43a9-b369-c90a497c2c79"
"uuid": "47a489b3-037f-4f2d-87bb-58e1b962afb0",
"disabled": false
},
{
"name": "Image",
"name": "txt",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"script": "components/renderer/TextRenderer",
"properties": {
"texture": "res|c3361b0e-b03a-4fff-a4b3-b20adde85547"
"text": "1111",
"fillColor": "rgba(255, 255, 255, 1)",
"textStyle": {
"fontSize": 100
}
}
}
],
"uuid": "cca2f2c2-6226-4dcc-bfcc-2e6824ee2cd8"
"uuid": "8abfc716-7017-4834-a7fa-5ca6c2ce4b3e"
}
]
}
......
{"ver":"1.0.1","uuid":"d6c6eb9d-b2bf-4da7-9017-1fdde2766886","subMetas":{},"type":"prefab"}
{"ver":"1.0.1","uuid":"1de471d9-75ca-4549-aca9-ff3cca9aac08","subMetas":{},"type":"prefab"}
{
"name": "BlueRocket",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
},
{
"script": "components/other/CameraController"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "BlueRocket",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/scenes/RocketItem",
"properties": {
"type": "blue",
"text": "entity|b15d2107-ed6f-4784-a704-7852968d9baa"
}
}
],
"children": [
{
"name": "pic",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|b08e8d70-e3cd-48b4-81b5-61196aafdc7b"
}
}
],
"uuid": "8880bafc-d2cd-4e48-bd4d-4b0db91e23c8"
},
{
"name": "Label",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": 46,
"y": 0
}
}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"text": "+1",
"fillColor": "rgba(102, 202, 235, 1)",
"textStyle": {
"fontSize": 35,
"fontWeight": "bold"
}
}
}
],
"uuid": "b15d2107-ed6f-4784-a704-7852968d9baa"
}
]
}
]
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"681aaec9-4063-4399-b56f-2a88de1a902e","subMetas":{},"type":"prefab"}
{"ver":"1.0.1","uuid":"b5185698-ef74-4855-95b9-813e187f6ee7","subMetas":{},"type":"prefab"}
{
"name": "PurepleFire",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
},
{
"script": "components/other/CameraController"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "PurepleFire",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/scenes/RocketItem",
"properties": {
"text": "entity|f5c662d6-44c8-4cb3-9871-47f9b1174a29",
"type": "purple"
}
}
],
"children": [
{
"name": "pic",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|18af58d7-34ef-469b-a769-dec15fb0e908"
}
}
],
"uuid": "18ac6b51-b4ef-4144-94f1-d9ff09bad4d2"
},
{
"name": "Label",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": 58,
"y": 0
}
}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"text": "20%",
"fillColor": "rgba(179, 66, 228, 1)",
"textStyle": {
"fontSize": 35,
"fontStyle": "normal",
"fontWeight": "bold",
"fontVariant": "normal"
}
}
}
],
"uuid": "f5c662d6-44c8-4cb3-9871-47f9b1174a29"
}
]
}
]
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"2be6a616-f50b-402e-b10f-8aacca0b3a9f","subMetas":{},"type":"prefab"}
{
"name": "RedFire",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
},
{
"script": "components/other/CameraController"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "RedFire",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/scenes/RocketItem",
"properties": {
"type": "red",
"text": "entity|8146b5f9-8c56-4edb-9dbb-93bd44951fcd"
}
}
],
"children": [
{
"name": "pic",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|86bf904f-c870-44c5-b2e1-16e511c63eff"
}
}
],
"uuid": "35827ccd-03af-42fd-868b-5ba42f8ee992"
},
{
"name": "Label",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": 64,
"y": 0
}
}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"text": "30%",
"fillColor": "rgba(242, 106, 57, 1)",
"textStyle": {
"fontSize": 35,
"fontWeight": "bold"
}
}
}
],
"uuid": "8146b5f9-8c56-4edb-9dbb-93bd44951fcd"
}
]
}
]
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"8a61e34c-bdba-4dbe-813a-68c562e7ecbd","subMetas":{},"type":"prefab"}
{
"name": "YellowFire",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
},
{
"script": "components/other/CameraController"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "YellowFire",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/scenes/RocketItem",
"properties": {
"type": "yellow",
"text": "entity|cb2bcda7-70e8-494e-a23a-ad65ee024e79"
}
}
],
"children": [
{
"name": "pic",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|12a92a67-b5b7-472c-8c4c-95d8eefa1c82"
}
}
],
"uuid": "76605a9b-9864-4e67-be3a-a223039f4aa5"
},
{
"name": "Label",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": 58,
"y": 0
}
}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"text": "10%",
"fillColor": "rgba(255, 234, 0, 1)",
"textStyle": {
"fontSize": 35
}
}
}
],
"uuid": "cb2bcda7-70e8-494e-a23a-ad65ee024e79"
}
]
}
]
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"51834a6b-5880-41df-81d9-beaef804a919","subMetas":{},"type":"prefab"}
{
"name": "bullet",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
},
{
"script": "components/other/CameraController"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "bullet",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/scenes/BulletItem",
"properties": {},
"disabled": false
}
],
"children": [
{
"name": "pic",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|a0310a43-fc21-44d6-b32b-a8406fe10e03"
}
}
],
"uuid": "bd27ee5e-6f76-49cb-8e10-5ae807e0d000"
}
]
}
]
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"df59e078-e7b7-4fbb-a1aa-8b291284c39f","subMetas":{},"type":"prefab"}
{
"name": "rankItem",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
},
{
"script": "components/other/CameraController"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "rankItem",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/scenes/result/RankItem",
"properties": {
"avatar": "entity|922f8140-959a-4d58-ad74-fbaa0f0ba3e4",
"rank": "entity|ec0185d3-ce9d-4929-b8bd-a44531efe131",
"score": "entity|723b6f9f-ed88-4e03-ae63-9b5efc3990c6",
"name": "entity|6cee4655-01a5-49ea-b21b-bc269f9a7572"
}
}
],
"children": [
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|71e44311-e161-4503-8f98-61e49083fbc4"
}
}
],
"uuid": "f80351a3-2f07-4797-884a-ffc68372547c",
"disabled": true
},
{
"name": "bg",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": 0,
"y": 24.392156862745097
}
}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|1c417086-3713-4fc1-94fa-2f29f3a34f09"
}
}
],
"uuid": "f7797dd2-ce00-4226-9568-22702807f1b8"
},
{
"name": "score",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": 269.4117647058823,
"y": -4.705882352941177
}
}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"text": "100颗",
"fillColor": "rgba(255, 247, 224, 1)",
"textStyle": {
"fontSize": 20
}
}
}
],
"uuid": "723b6f9f-ed88-4e03-ae63-9b5efc3990c6"
},
{
"name": "name",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": -125.88235294117649,
"y": -4.705882352941177
}
}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"text": "隔壁老王",
"fillColor": "rgba(255, 247, 224, 1)",
"textStyle": {
"fontSize": 20
}
}
}
],
"uuid": "6cee4655-01a5-49ea-b21b-bc269f9a7572"
},
{
"name": "rank",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": -283.5294117647059,
"y": -5.882352941176471
}
}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"text": "44",
"fillColor": "rgba(255, 247, 224, 1)",
"textStyle": {
"fontSize": 20
}
}
}
],
"uuid": "ec0185d3-ce9d-4929-b8bd-a44531efe131"
},
{
"name": "imgWrap",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": -229.41176470588235,
"y": -5.882352941176471,
"_type_": "scilla/support/Vector2D"
}
}
},
{
"script": "components/renderer/RectRenderer",
"properties": {
"width": 40,
"height": 40,
"cornerRadius": 20,
"useCacheMode": false,
"maskVisible": false,
"isMask": true
}
}
],
"uuid": "f2de6959-6413-4218-9694-9f4f0a374f41",
"children": [
{
"name": "avatar",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": 0,
"y": 0,
"_type_": "scilla/support/Vector2D"
}
}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|8ad59445-0ff2-4382-bb1c-9f7a07845e48"
}
}
],
"uuid": "922f8140-959a-4d58-ad74-fbaa0f0ba3e4"
}
]
}
]
}
]
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* Created by rockyl on 2019-01-03.
*
* 砖块动画单体
*/
import {Entity,} from "scilla";
import TextRenderer from 'components/renderer/TextRenderer'
import Wave from 'components/animation/Wave'
import ScillaComponent from 'components/base/ScillaComponent';
export default class HelloScilla extends ScillaComponent {
name: string = 'scilla';
logo: Entity;
label: Entity;
private labelRenderer: TextRenderer;
private logoAnimation: Wave;
onAwake() {
super.onAwake();
console.log('fuck11')
this.labelRenderer = this.label.getComponent(TextRenderer);
this.logoAnimation = this.logo.getComponent(Wave);
}
tapMe(){
this.labelRenderer.text = 'Hello ' + this.name;
this.logoAnimation.play();
}
}
import ScillaComponent from 'components/base/ScillaComponent';
import { getX, getY, setXY } from './transformUtils';
export default class Icon extends ScillaComponent {
private GRAVITY = .7;
private _vx = 0;
private _vy = 0;
onAwake() {
super.onAwake();
const children = this.entity.children;
const index = Math.floor(children.length * Math.random());
children.forEach((v, i) => v.enabled = index == i);
const baseY = -100;
const offsetX = 150;
const offsetY = -100;
const randomXoffset = Math.random() * offsetX * 2 - offsetX;
const randomYoffset = Math.random() * offsetY;
setXY(this.entity, randomXoffset, baseY + randomYoffset);
//初始vy小于0
this._vy = (-Math.random() * 3 - 10) * 2;
this._vx = (Math.random() * 5 + 5) * (Math.random() > 0.5 ? 1 : -1) * 1;
}
onUpdate(t) {
this._vy += this.GRAVITY;
super.onUpdate(t);
const x = getX(this) + this._vx;
const y = getY(this) + this._vy;
setXY(this, x, y)
}
}
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { engine, Entity } from "scilla/src";
import { initEnv } from "./common/BuriedPoint";
import { dynamic, engine, Entity } from "scilla/src";
import Toast from "./common/Toast";
import { initEnv } from "./common/BuriedPoint";
import Popup from "./popup/Popup";
export default class MainController extends ScillaComponent {
Popup: Entity;//PopupContainer 弹窗容器
Toast: Entity;//toast 实体
hdToolId: dynamic;
actId: dynamic;
private _toast: Toast;
private _popup: Popup;
// fuckNavigator(p) {
// console.log('fuckNavigator from MainController', p)
// }
onAwake() {
super.onAwake();
......@@ -21,47 +26,42 @@ export default class MainController extends ScillaComponent {
initEnv();
console.log('游戏刷新了...');
// const limit = localStorage.getItem('')
this.broadcast('callApi', 1, 'ajaxElement', { duibaId: this.hdToolId, activityId: this.actId })
}
onGotAjaxElement() {
this.broadcast('initGameStage');
}
onGotAjaxElementError(e) {
console.log(e);
// onGotAjaxElement() {
// setTimeout(() => {
// this.broadcast('initGameStage');
// }, 1000);
// if (typeof e === 'string') {
// switch (e) {
// case '0100016': //活动未开始
// case '0100014': //活动已结束
// case '0100017': //活动已关闭
// this.showErrorToast(e);
// break;
// default:
// this.showNetError();
// }
// onGotAjaxElementError(e) {
// console.log(e);
// // if (typeof e === 'string') {
// // switch (e) {
// // case '0100016': //活动未开始
// // case '0100014': //活动已结束
// // case '0100017': //活动已关闭
// // this.showErrorToast(e);
// // break;
// // default:
// // this.showNetError();
// // }
// // } else {
// // this.showNetError();
// // }
// } else {
// this.showNetError();
// }
}
// showErrorToast(e) {
// // switch (e) {
// // case '0100016': //活动未开始
// // this.showToast('活动未开始,暂时无法参与');
// // break;
// // case '0100014': //活动已结束
// // case '0100017': //活动已关闭
// // this.showToast('活动已结束,无法参与');
// // break;
// // }
showErrorToast(e) {
// switch (e) {
// case '0100016': //活动未开始
// this.showToast('活动未开始,暂时无法参与');
// break;
// case '0100014': //活动已结束
// case '0100017': //活动已关闭
// this.showToast('活动已结束,无法参与');
// break;
// }
}
showToast(content, duration?) {
this._toast.show({
......
{"ver":"1.0.1","uuid":"6264e54e-3a4e-4bb8-baed-91b9a0c6b85d","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"3bc8690b-e80e-4239-849d-41d99f249f5d","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"9abb2447-83bb-49e0-8912-39814676b8a4","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"9d563731-a25f-423f-bab9-e77c10fa8b53","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"de65cf24-dfc0-4728-8ef5-83c97dca9b15","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"976a2dda-db9b-4ca8-b781-51c98b2a6e4a","subMetas":{},"type":"script"}
......@@ -4,16 +4,16 @@
* 简单的api组件
*/
import { utils, } from 'scilla/src'
import {utils, } from 'scilla/src'
import ApiComponent from "./ApiComponent";
import { callApi } from "../net/webService";
import {callApi} from "../net/webService";
export default class SampleApi extends ApiComponent {
uri: string;
ignoreSuccessField = false;
async callApi(name, paramsInput, ...args) {
if (this.name == name) {
async callApi(name, paramsInput, ...args){
if(this.name == name){
await this.execute(paramsInput, ...args);
}
}
......@@ -23,22 +23,20 @@ export default class SampleApi extends ApiComponent {
const params = {};
if (this.params) {
if(this.params){
utils.injectProp(params, this.params);
}
if (paramsInput) {
if(paramsInput){
utils.injectProp(params, paramsInput);
}
const { uri, method } = this;
const {uri, method} = this;
try {
console.log(`${uri}==>${JSON.stringify(params)}`);
const response = await callApi(uri, params, method, 'json', this.ignoreSuccessField);
this.onGotResponse(response);
console.log(`${uri}<<==${JSON.stringify(response)}`);
return response.data;
} catch (e) {
......
{"ver":"1.0.1","uuid":"02450709-0578-4315-82d3-b6676111fc8f","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"2a07e71a-fedb-4bfe-9ea2-771be76404ee","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"92de3cc4-8222-4f87-baca-5d84079f4537","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"a0ccb513-37cc-4bae-920d-334b30dfea62","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"d5df52ff-573f-4fae-a1eb-69fe4062e1ce","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"9f08d900-47ca-4705-941d-5d62c7522867","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"621fdc18-2185-4d12-b199-0d650c2cca94","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"5a56d291-4baf-492f-9528-2c579e7f8c56","subMetas":{},"type":"script"}
......@@ -11,8 +11,7 @@ import Transform from "scilla-components/src/base/Transform";
export default class Toast extends ScillaComponent {
Label: Entity;
ypadding = 20;
xpadding = 50;
padding = 20;
offsetY = 0;
showDuration = 300;
hideDuration = 300;
......@@ -51,13 +50,13 @@ export default class Toast extends ScillaComponent {
show({content, duration = 1000}) {
this.entity.enabled = true;
const {_bgTransform, _labelRenderer, _labelTransform, xpadding,ypadding} = this;
const {_bgTransform, _labelRenderer, _labelTransform, padding} = this;
_labelRenderer.text = content;
_labelRenderer.measureBounds();
_bgTransform.width = _labelTransform.width + xpadding * 2;
_bgTransform.height = _labelTransform.height + ypadding * 2;
_bgTransform.width = _labelTransform.width + padding * 2;
_bgTransform.height = _labelTransform.height + padding * 2;
this._tweenOut.queue[0].props.position.y = this.outPos;
......
{"ver":"1.0.1","uuid":"e67c7e07-1a4a-44eb-a56e-74fba7534c1a","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"ffe40fb1-962f-4b21-9833-c66d31de4b4c","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"cf6a3b27-3203-4229-9d0b-6e0c9132b754","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"997b374c-347d-466a-af4f-50f115d294cd","subMetas":{},"isGroup":true}
......@@ -5,19 +5,17 @@
*/
import DialogContent from "../popup/DialogContent";
import { Entity } from "scilla/src";
import { setText } from "../entityUtils";
export default class AlertDialogContent extends DialogContent {
content: Entity;
onAwake() {
super.onAwake();
}
protected onTapCloseButton() {
super.onTapCloseButton();
this.bubbling('fuckNavigator', 'start');
}
setup(data: any = {}) {
setText(this.content, data);
}
onClickConfirmButton() {
this.hide('confirm')
}
}
{"ver":"1.0.1","uuid":"222398f9-001b-4213-b2d0-0484f49da18f","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"be102305-c06e-4717-9148-a59fccddef73","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"27a4ad71-7fcb-4509-9b6e-d2eb4624a07c","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"b7be6577-399f-47f2-ac0e-b07e03f336e8","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-04-10.
*
* 警告对话框内容
*/
import { TextureRenderer } from "scilla-components/src";
import { AssetsManager, createTexture, EngineConfig, Entity, Texture, dynamic } from "scilla/src";
import DialogContent from "../popup/DialogContent";
import { setScale, setText } from "../transformUtils";
import { getRecordURL } from "./ScoreDialogContent";
export default class PrizeDialogContent extends DialogContent {
pic: Entity;
name: Entity;
title: Entity;
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;
}
onClick_usebtn() {
// window.location.href=this.getOrderStatus.lottery.link
window.location.href = getRecordURL();
}
onAwake() {
super.onAwake();
}
async setup(data: any = {}) {
setText(this.name, data.prizeName);
setText(this.title, this.getTypeStr(data.prizeType))
const texRender = this.pic.getComponent(TextureRenderer);
const texture = await this.loadTexture(data.prizeImage);
texRender.texture = texture;
if (texture.bounds.width > texture.bounds.height) {
const maxwidth = 250;
setScale(this.pic, maxwidth / texture.bounds.width)
} else {
const maxheight = 250;
setScale(this.pic, maxheight / texture.bounds.height)
}
}
private getTypeStr(type: number) {
if (type == 1) {
return `获得一等奖`
}
if (type == 2) {
return `获得二等奖`
}
if (type == 3) {
return `获得三等奖`
}
if (type == 4) {
return `获得四等奖`
}
}
}
......@@ -20,7 +20,7 @@ export default class RuleDialogContent extends DialogContent {
}
setup(data) {
this._contentRenderer.htmlText = window['ruleContent'];
this._contentRenderer.htmlText = this.ajaxElement.rule;
}
}
{"ver":"1.0.1","uuid":"20e51d98-2b67-455d-b86f-b238d80fef2c","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"f4ad775b-3c0d-4d15-8f28-4fc7ed078dea","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-04-10.
*
* 警告对话框内容
*/
import { Entity } from "scilla/src";
import { setText } from "../entityUtils";
import DialogContent from "../popup/DialogContent";
export default class ScoreDialogContent extends DialogContent {
content: Entity;
rankbtn: Entity;
onAwake() {
super.onAwake();
}
setup(data: any = {}) {
setText(this.content, `恭喜你共摇出${data}颗糖果`)
}
protected onTapCloseButton() {
super.onTapCloseButton();
this.bubbling('fuckNavigator', 'start');
}
onclick_ranbtn() {
this.hide();
// this.broadcast('callApi', 1, 'rankInfo', {
// weddingId: window['CFG'].weddingId,
// activityId: window['CFG'].activityId
// })
this.bubbling('fuckNavigator', 'start');
window.location.href = getRankURL();
}
// onResponse_rank1() {
// console.log('score dialog content,onResponse_rank')
// this.bubbling('fuckNavigator', 'result');
// }
}
export const getRankURL = () => {
return `/customActivity/sjf/activity/recordIndex?weddingId=${window['CFG'].weddingId}&activityId=${window['CFG'].activityId}&brickType=7`
}
export const getURL = () => {
//`/customActivity/sjf/mainIndex?weddingId=2
return `/customActivity/sjf/mainIndex?weddingId=${window['CFG'].weddingId}`;
}
export const getRecordURL = () => {
return `/customActivity/sjf/activity/recordIndex?weddingId=${window['CFG'].weddingId}&activityId=${window['CFG'].activityId}&brickType=6`;
}
......@@ -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
{"ver":"1.0.1","uuid":"f4a580ec-d00d-4bb0-8cb1-cc955f990e22","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"23d10a11-6459-4e3b-b73e-a00e1967ad0a","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"c59f7148-9a03-47ab-a146-693028d37bee","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"62c77f0e-0d2a-45ba-95d8-8f6bd922a8a0","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"f852cfa3-ccbf-4989-a807-65368a72b129","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"74c1fe4d-621a-4908-aaf7-0934901d3c1e","subMetas":{},"type":"script"}
......@@ -17,19 +17,7 @@ export const getTween = (context, val: Transform | Entity | ScillaComponent, obj
delete obj[key];
}
}
const scaleObj = {};
for (const key in obj) {
if (key == 'scalex') {
scaleObj['x'] = obj[key];
delete obj[key];
}
if (key == 'scaley') {
scaleObj['y'] = obj[key];
delete obj[key];
}
}
createTween(context, target.position, true).to(postionObj, duration, ease);
createTween(context, target.scale, true).to(scaleObj, duration, ease);
createTween(context, target, true).to(obj, duration, ease).call(r);
});
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"4d662288-5dcb-4f4f-af88-0b1233d96770","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"6819e675-030f-4df9-8f49-d662a434d7cf","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"ead52dd1-f4cf-4869-b471-0f820c005d69","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"c0c3cf56-be33-4264-8613-5f2e8f8ebb33","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"23c9a081-bf70-4728-adfc-b95143c2bd18","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"636ee90d-508d-4b65-9605-f7352d0b2466","subMetas":{},"type":"script"}
......@@ -5,12 +5,8 @@
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { ScenePlay, SceneStart } from "../scenes";
import { VirtualNavigator } from "./VirtualNavigator";
import SceneStart from "../scenes/SceneStart";
import ScenePlay from "../scenes/ScenePlay";
import SceneGuide from "../scenes/SceneGuide";
import SceneResult from "../scenes/SceneResult";
import { Button } from "scilla-components/src";
export default class SingleSceneNavigator extends ScillaComponent {
_navigator: VirtualNavigator;
......@@ -20,8 +16,6 @@ export default class SingleSceneNavigator extends ScillaComponent {
this._navigator = new VirtualNavigator(this.entity);
this._navigator.register('start', 'SceneStart', SceneStart);
this._navigator.register('play', 'ScenePlay', ScenePlay);
this._navigator.register('guide', 'SceneGuide', SceneGuide);
this._navigator.register('result', 'SceneResult', SceneResult);
}
onAwake() {
......
{"ver":"1.0.1","uuid":"1baca7a6-0db8-4109-8b3c-a13459a83ff5","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"4b5a29f1-88af-47d5-8949-cfc2c1f8f861","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"60f88e76-e1dc-43a4-a74b-75f71a2f6eef","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"c787ec07-0e47-4ac2-8f55-d4195acbcddc","subMetas":{},"type":"script"}
......@@ -117,6 +117,6 @@ export class VirtualNavigator extends EventEmitter implements INavigatorDelegate
* @param error
*/
onError(error: Error) {
console.log(error)
}
}
{"ver":"1.0.1","uuid":"4ae843bd-25a7-4979-a39d-59486f4cbc55","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"cca81914-b73a-42e1-8c20-273329a24220","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"af630d2e-acd0-4369-bc02-032a640853da","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"3c970fd0-fe5d-4bdd-aeaa-f291dd26462c","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"9c37b4b7-6565-4d46-ad28-7ad17dbcf7dc","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"d6c61478-e547-4ab5-8c4c-c0b40f34596a","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"aa006aad-50a3-49b2-ae49-6b031b154793","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"412d270b-6e82-4b42-baf9-7fbc976c79e7","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"0657cdf0-0b97-4286-ae87-8f356140e662","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"82058157-b884-4040-b0cd-4dc5289098e0","subMetas":{},"type":"script"}
......@@ -3,19 +3,19 @@
* 弹层
*/
import TouchInterrupt from "components/base/TouchInterrupt";
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import Transform from "scilla-components/src/base/Transform";
import RectRenderer from "scilla-components/src/renderer/RectRenderer";
import { Entity } from "scilla/src";
import SingleSceneNavigator from "../navigator/SingleSceneNavigator";
import DialogContent from "./DialogContent";
import RectRenderer from "scilla-components/src/renderer/RectRenderer";
import TouchInterrupt from "scilla-components/src/base/TouchInterrupt";
import Transform from "scilla-components/src/base/Transform";
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { none } from "./PopupEffect";
import { createTween, Entity } from "scilla/src";
import SingleSceneNavigator from "../navigator/SingleSceneNavigator";
export default class Popup extends ScillaComponent {
blackLayerDuration = 300;
bgRenderer: Entity;
private _bgRenderer: RectRenderer;
private _touchInterrupt: TouchInterrupt;
private _dialogStack = [];
......@@ -28,11 +28,10 @@ export default class Popup extends ScillaComponent {
this._touchInterrupt = this.getComponent(TouchInterrupt);
this._touchInterrupt.enabled = false;
// this.bgRenderer.enabled = false;
this._navigator = this.sceneContainer.getComponent(SingleSceneNavigator);
const bgRenderer = this._bgRenderer = this.getComponent(RectRenderer);
bgRenderer.enabled = false;
this.entity.children.forEach(child => child.enabled = false);
this._navigator = this.sceneContainer.getComponent(SingleSceneNavigator)
}
fuckNavigator(p) {
......@@ -53,18 +52,17 @@ export default class Popup extends ScillaComponent {
}
setBgVisible(visible) {
this.bgRenderer.enabled = visible;
// if (visible) {
// this._bgRenderer.enabled = true;
// }
// this._bgRenderer.alpha = visible ? 0 : 1;
// createTween(this, this._bgRenderer, true)
// .to({ alpha: visible ? 1 : 0 }, this.blackLayerDuration)
// .call(() => {
// if (!visible) {
// this._bgRenderer.enabled = false;
// }
// });
if (visible) {
this._bgRenderer.enabled = true;
}
this._bgRenderer.alpha = visible ? 0 : 1;
createTween(this, this._bgRenderer, true)
.to({ alpha: visible ? 1 : 0 }, this.blackLayerDuration)
.call(() => {
if (!visible) {
this._bgRenderer.enabled = false;
}
});
}
getDialogInStack(name) {
......@@ -120,7 +118,7 @@ export default class Popup extends ScillaComponent {
const effect = content ? content.effectImpl : none;
const effectOptions = content ? content.showEffectOptions : null;
// await effect.show(transform, effectOptions);
await effect.show(transform, effectOptions);
}
async hideDialog(name, action?: string, data?) {
......@@ -145,7 +143,7 @@ export default class Popup extends ScillaComponent {
const effect = content ? content.effectImpl : none;
const effectOptions = content ? content.hideEffectOptions : null;
// await effect.hide(transform, effectOptions);
await effect.hide(transform, effectOptions);
dialog.enabled = false;
if (dialogConfig.callback) {
......
{"ver":"1.0.1","uuid":"b6b6a4f7-1aa0-4aa8-a325-1184927abd90","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"794b113e-ee7a-46d8-b9cc-6755fc76f839","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"03597fde-0a6d-4c4f-b0f6-d1079ddb777d","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"d1ea2c31-d3f6-4c18-99bc-1d8390553501","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"9b5487b8-a2a7-44ea-a370-ab8e3ea7ba93","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"45d473b1-a874-47aa-8c1a-9323b6720a82","subMetas":{},"isGroup":true}
import { TextRenderer } from 'scilla-components/src';
import { Entity } from 'scilla/src';
import Body from './Body';
import { calNextColor } from './scenePlay/colors';
export default class BallItem extends Body {
private _storedScore;
private _currentScore = 0;
scoreTxt: Entity;
isBig = true;
size: BallSizeType;
colorIndex: number;
nextColorIndex: number;
ID: number;
parentID: number;
constructor() {
super();
this.gravity = 0.225;
this.rotationSpeed = 0.5;
}
onAwake() {
super.onAwake();
}
reduceScore(score: number) {
let result = 0;
if (this._currentScore <= score)
result = this._currentScore;
else
result = score;
this._currentScore -= score;
if (this._currentScore < 0)
this._currentScore = 0;
this.updateScoreTxt();
return result;
}
resetScore(score) {
this._currentScore = score;
this._storedScore = score;
this.updateScoreTxt();
this.nextColorIndex = calNextColor(this.colorIndex);
}
updateScoreTxt() {
const tr = this.scoreTxt.getComponent(TextRenderer);
tr.text = this._currentScore.toString();
}
childNames = [BallType.yellow, BallType.green, BallType.blue, BallType.darkBlue, BallType.purple, BallType.red];
color: BallType;
updateColor(color: BallType) {
this.color = color;
this.childNames.forEach(name => {
const child = this.entity.getChildrenByName(name)[0];
if (name != color)
child.enabled = false;
});
const child = this.entity.getChildrenByName(color)[0];
child.enabled = true;
}
get currentScore() { return this._currentScore }
get storedScore() { return this._storedScore }
}
export enum BallSizeType {
min = 0,
size1 = 1,
size2 = 2,
max = 3,
}
export enum BallType {
blue = 'blue',
purple = 'purple',
red = 'red',
green = 'green',
darkBlue = 'darkBlue',
yellow = 'yellow',
}
export const BallSizeTypeList = [74, 126, 165, 227];
\ No newline at end of file
{"ver":"1.0.1","uuid":"bd9a9589-4961-44b9-ae8c-263297eb9a35","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"99d3002b-6f74-412d-8af0-b144d58bb054","subMetas":{},"type":"script"}
import ScillaComponent from 'components/base/ScillaComponent';
import { Transform } from 'scilla-components/src';
export default class Body extends ScillaComponent {
bounceY = 1;
bounceX = 1;
velocityY = 0;
velocityX = 0;
rotationSpeed = 0.5;
gravity = 0;
private _counter = 0;
onUpdate() {
this._counter++;
const { entity } = this;
this.velocityY += this.gravity;
entity.getComponent(Transform).position.y += this.velocityY;
entity.getComponent(Transform).position.x += this.velocityX;
// console.log(entity.getComponent(Transform).position.y)
entity.getComponent(Transform).rotation = this._counter * .7 * this.rotationSpeed;
}
reset() {
const { entity } = this;
this.velocityY = 0;
this.velocityX = 0;
entity.getComponent(Transform).rotation = 0;
this._counter = 0;
}
revertY() {
this.velocityY *= -1 * this.bounceY;
}
revertX() {
this.velocityX *= -1 * this.bounceX;
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"7846da82-f6e3-4ab7-aadb-064d4b3672b5","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"216f7c25-499f-4bee-9ead-5cdf94411265","subMetas":{},"type":"script"}
import Body from './Body';
import { Transform } from 'scilla-components/src';
export default class BulletItem extends Body {
constructor() {
super();
this.gravity = 0;
this.velocityY = -20;
this.rotationSpeed= 0;
}
onUpdate() {
const { entity } = this;
entity.getComponent(Transform).position.y += this.velocityY;
entity.getComponent(Transform).position.x += this.velocityX;
}
reset() {}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"3321fa44-dadf-4d67-8e26-04ba5fb8bac7","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"9b500f7e-7d23-46bd-8d3f-b3b076ebee5c","subMetas":{},"type":"script"}
import Body from './Body';
import { Entity } from 'scilla/src';
import { DropType } from './scenePlay/DropType';
export default class RocketItem extends Body {
type: DropType;
text: Entity;
constructor() {
super();
this.gravity = .5;
this.bounceY = 0.4;
this.rotationSpeed = 0;
}
onAwake() {
super.onAwake();
this.text.enabled = false;
}
reset() {
super.reset();
this.rotationSpeed = 0;
}
getCarFire() {
if (this.type == DropType.red) return 30;
if (this.type == DropType.yellow) return 10;
if (this.type == DropType.purple) return 20;
return 0;
}
getCarBullet() {
if (this.type == DropType.blue) return 1;
return 0;
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"3a09e137-303f-434e-a26e-6f19216e962f","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"0325040d-e190-4b38-834d-362abc071117","subMetas":{},"type":"script"}
......@@ -8,6 +8,7 @@ export default class SceneController extends ScillaComponent {
}
fuck(p) {
// console.log('fuck',p)
const nav = this.entity.getComponent(SingleSceneNavigator);
nav.push(p)
}
......
{"ver":"1.0.1","uuid":"fd411e04-be60-45d3-aabb-40a76cf4ad25","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"bc96d141-6270-4cc8-8638-9c05cbaaa271","subMetas":{},"type":"script"}
import { alien } from "../navigator/StackNavigator";
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Button, InteractComponent } from "scilla-components/src";
export default class SceneGuide extends InteractComponent implements INavigatorViewBase {
onAwake() {
super.onAwake();
}
onGlobalTouchBegin(e) {
super.onGlobalTouchBegin(e);
this.onNextScene();
return false;
}
onNextScene() {
this.bubbling('fuck', 'play');
}
// _timer
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
{"ver":"1.0.1","uuid":"9b858404-d4f3-49a0-a174-6947fc5e52ec","subMetas":{},"type":"script"}
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { Entity, instantiate, resource, dynamic } from "scilla/src";
import { setText } from "../entityUtils";
import { getTween } from "../getTween";
import { RectRenderer } from "scilla-components/src";
import InteractComponent from "scilla-components/src/base/InteractComponent";
import Transform from "scilla-components/src/base/Transform";
import { Entity } from "scilla/src";
import { alien } from "../navigator/StackNavigator";
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { setScale } from "../transformUtils";
export default class ScenePlay extends ScillaComponent implements INavigatorViewBase {
doJoin: dynamic;
iconResource: resource;
countTxt: Entity;
num1: Entity;
num2: Entity;
num3: Entity;
box1: Entity;
box2: Entity;
box3: Entity;
private COUNT_DOWN_SEC = window['COUNT_DOWN_SEC'];
private _startTag = false;
private _msPassed = 0;
private _ballCounter = 0;
// private _timeoutTag: boolean;
onAwake() {
super.onAwake();
import { getScale, getX, getY, setText, setX } from "../transformUtils";
import BallItem from "./BallItem";
import BallManager from "./scenePlay/BallManager";
import CarBulletAni from "./scenePlay/CarBulletAni";
import CarShootAni from "./scenePlay/CarShootAni";
import DropManager from "./scenePlay/DropManager";
import ngameSubmit from "./scenePlay/ngameSubmit";
this.showBox1();
this.initText();
this.play321Countdown();
let addCounter = 0;
const add = () => {
addCounter++;
this.addBall();
}
setInterval(() => {
console.log('上一秒摇晃的能量是', addCounter);
addCounter = 0;
}, 1000);
//运动事件监听
if (window['DeviceMotionEvent']) {
window.addEventListener('devicemotion', deviceMotionHandler, false);
}
var SHAKE_THRESHOLD = 50; //累积200的速度值出一个球
var x, y, z, last_x = 0, last_y = 0, last_z = 0;
var speedCounter = 0;
var _this = this;
function deviceMotionHandler(eventData) {
if (!_this._startTag) return;
var acceleration = eventData.accelerationIncludingGravity;
x = acceleration.x;
y = acceleration.y;
z = acceleration.z;
var speed = Math.abs(x + y + z - last_x - last_y - last_z) * 1;
//快的时候差不多速度几十
//静止的时候是0
speedCounter += speed;
if (speedCounter >= SHAKE_THRESHOLD) {
speedCounter = 0;
add();
}
last_x = x;
last_y = y;
last_z = z;
}
this._startTag = false;
}
async wait(ms) {
return new Promise((r) => {
setTimeout(r, ms);
})
}
async play321Countdown() {
setScale(this.num1, 3);
setScale(this.num2, 3);
setScale(this.num3, 3);
this.num1.enabled = false;
this.num2.enabled = false;
this.num3.enabled = true;
await getTween(this, this.num3, { scalex: 1, scaley: 1 }, 300);
await this.wait(600);
this.num3.enabled = false;
this.num2.enabled = true;
await getTween(this, this.num2, { scalex: 1, scaley: 1 }, 300);
await this.wait(600);
this.num2.enabled = false;
this.num1.enabled = true;
await getTween(this, this.num1, { scalex: 1, scaley: 1 }, 300);
await this.wait(600);
this.num1.enabled = false;
this.startRealCountdown();
}
startRealCountdown() {
this._startTag = true;
this._msPassed = 0;
this._lastTimer = Date.now();
this._ballCounter = 0;
}
private _lastTimer: number;
onUpdate() {
if (!this._startTag) return;
this._msPassed += (Date.now() - this._lastTimer);
const left = this.COUNT_DOWN_SEC * 1000 - this._msPassed;
// console.log(left)
const mPassed = Math.floor(left / 1000);
let msPassed = left % 1000;
msPassed = Math.floor(msPassed / 10);
this.updateText(mPassed, msPassed);
this._lastTimer = Date.now();
if (left <= 0) {
this.updateText(0, 0);
this._startTag = false;
this.onTimerout();
export default class ScenePlay extends InteractComponent implements INavigatorViewBase {
scoreTxt: Entity;
bulletNumTxt: Entity;
strengthNumTxt: Entity;
car: Entity;
carInner: Entity;
bottomline: Entity;
score = 0;
private _carBullet: number;
private _carFire: number;
private _pause = false;
_carShootAni: CarShootAni;
_bulletManager: CarBulletAni;
_ballManager: BallManager;
_dropManager: DropManager;
private _ngameSubmitApi: ngameSubmit;
updateScoreTxt() {
setText(this.bulletNumTxt, `${this._carBullet}`);
setText(this.strengthNumTxt, `${this._carFire}%`);
setText(this.scoreTxt, `${this.score}`);
}
onGlobalTouchBegin(e): any {
this._lastTouchMoveX = -1;
return super.onGlobalTouchBegin(e);
}
onTimerout() {
console.log('onTimerout');
this.broadcast('callApi', 1, 'activitySubmit', {
weddingId: window['CFG'].weddingId,
activityId: window['CFG'].activityId,
orderId: this.doJoin.orderId,
score: this._ballCounter
});
_lastTouchMoveX = -1;
onGlobalTouchMove(e: { x, y }) {
if (this._lastTouchMoveX == -1) {
this._lastTouchMoveX = e.x;
}
let targetX = getX(this.car) + e.x - this._lastTouchMoveX;
if (targetX < -375)
targetX = -375;
if (targetX > 375)
targetX = 375;
setX(this.car, targetX);
this._lastTouchMoveX = e.x;
return super.onGlobalTouchMove(e);
}
onRespone_activitySubmit() {
this.bubbling('showDialog', 'Score', this._ballCounter);
onUpdate() {
if (this._pause) return;
this.checkBallCollideGroud();
this.checkDropsCollideGroud();
this.checkBulletCollideBall();
this.checkCarCollideBall();
this.checkCarColliedeDrops();
this._ballManager.onBallDestroyedCheckBallIDs(this._carBullet, this._carFire);
}
checkCarColliedeDrops() {
for (let i = 0; i < this._dropManager.dropList.length; i++) {
const drop = this._dropManager.dropList[i];
const pic = drop.entity.getChildrenByName('pic')[0];
const r = pic.getComponent(Transform).height / 2;
const x0 = Math.abs(getX(drop) - getX(this.car));
const y0 = Math.abs(getY(drop) - getY(this.car));
const { width, height } = this.car.getComponent(RectRenderer);
const x1 = r + width / 2;
const y1 = r + height / 2;
if (x0 < x1 && y0 < y1) {
this._dropManager.removeDrop(drop);
this._carFire += drop.getCarFire();
this._carBullet += drop.getCarBullet();
this.updateScoreTxt();
this._bulletManager.updateLines(this._carBullet);
i--;
}
}
}
checkCarCollideBall() {
const { ballList } = this._ballManager;
for (let i = 0; i < ballList.length; i++) {
const ball = ballList[i];
const pic = ball.entity.getChildrenByName(ball.color)[0];
const r = pic.getComponent(Transform).height / 2;
const x0 = Math.abs(getX(ball) - getX(this.car));
const y0 = Math.abs(getY(ball) - getY(this.car));
const ballScale = getScale(ball);
const { width, height } = this.car.getComponent(RectRenderer);
const x1 = r * ballScale.x + width / 2;
const y1 = r * ballScale.x + height / 2;
if (x0 < x1 && y0 < y1) {
this.$onGameOver();
}
}
}
onError_activitySubmit(error) {
this.bubbling('showDialog', 'Alert', '网络异常,请稍后再试~');
checkBulletCollideBall() {
const { ballList } = this._ballManager;
for (let i = 0; i < this._bulletManager.bullets.length; i++) {
const bullet = this._bulletManager.bullets[i];
const { width: bulletWidth, height: bulletHeight } = bullet.entity.getComponent(Transform);
for (let j = 0; j < ballList.length; j++) {
const ball = ballList[j];
const x0 = Math.abs(getX(ball.entity) - getX(bullet.entity));
const y0 = Math.abs(getY(ball.entity) - getY(bullet.entity));
const ballScale = getScale(ball);
const { height: ballH } = ball.entity.getChildrenByName(ball.color)[0].getComponent(Transform);
const x1 = bulletWidth / 2 + ballH / 2 * ballScale.x;
const y1 = bulletHeight / 2 + ballH / 2 * ballScale.x;
if (x0 < x1 && y0 < y1) { //子弹和球碰撞了,不再便利其他球
this._bulletManager.removeBullet(bullet);
this._bulletManager.bullets.splice(i, 1);
i--;
const resultScore = ball.reduceScore(this.getBulletStren());
if (ball.currentScore == 0) { //破裂
this.checkBallSplit(ball);
}
this.score += resultScore;
// console.log(this.getBulletStren(), resultScore);
this.updateScoreTxt();
break;
}
}
}
}
getBulletStren() { return Math.floor(this._carFire / 100); }
getNumber(num) {
if (num < 10)
return `0${num}`
return `${num}`
checkBallSplit(ball: BallItem) {
this._ballManager.checkBallSplit(ball,this._carBullet,this._carFire);
}
updateText(a, b) {
setText(this.countTxt, `${this.getNumber(a)}.${this.getNumber(b)}s`)
checkBallCollideGroud() {
const { ballList } = this._ballManager;
for (let i = 0; i < ballList.length; i++) {
const ball = ballList[i];
const { position } = ball.getComponent(Transform);
const pic = ball.entity.getChildrenByName(ball.color)[0];
const { height } = pic.getComponent(Transform);
const r = height / 2 * getScale(ball).x;//刚体的半径 213
if (position.y + r > getY(this.bottomline)) {
position.y = getY(this.bottomline) - r;
ball.revertY();
ball.velocityY = -17.54;
}
initText() {
setText(this.countTxt, `${this.getNumber(this.COUNT_DOWN_SEC)}.00s`)
if (position.x + r > 375) {
position.x = 375 - r;
ball.revertX();
}
addBall() {
this._ballCounter++;
const iocn = instantiate(this.iconResource);
this.entity.addChild(iocn);
if (position.x - r < -375) {
position.x = -375 + r;
ball.revertX();
}
}
}
if (this._ballCounter > 100 / (16 / this.COUNT_DOWN_SEC)) {
this.showBox3();
} else if (this._ballCounter > 50 / (16 / this.COUNT_DOWN_SEC)) {
this.showBox2();
} else {
this.showBox1();
checkDropsCollideGroud() {
const { dropList } = this._dropManager;
for (let i = 0; i < dropList.length; i++) {
const drop = dropList[i];
const { position } = drop.getComponent(Transform);
const pic = drop.entity.getChildrenByName('pic')[0];
const { height } = pic.getComponent(Transform);
const r = height / 2;//刚体的半径
if (position.y + r > getY(this.bottomline)) {
position.y = getY(this.bottomline) - r;
drop.revertY();
}
if (position.x + r > 375) {
position.x = 375 - r;
drop.revertX();
}
showBox1() {
this.box1.enabled = true;
this.box2.enabled = false;
this.box3.enabled = false;
if (position.x - r < -375) {
position.x = -375 + r;
drop.revertX();
}
showBox2() {
this.box1.enabled = false;
this.box2.enabled = true;
this.box3.enabled = false;
}
showBox3() {
this.box1.enabled = false;
this.box2.enabled = false;
this.box3.enabled = true;
}
// onGameOver() {
// this.bubbling('fuck', 'result');
// }
onAwake() {
super.onAwake();
if (!this._carShootAni) {
this._carShootAni = this.carInner.getComponent(CarShootAni);
this._bulletManager = this.car.getComponent(CarBulletAni);
this._ngameSubmitApi = this.getComponent(ngameSubmit);
this._ballManager = this.getComponent(BallManager);
this._dropManager = this.getComponent(DropManager);
}
this.score = 0;
this._carBullet = 0;
this._carFire = 100;
this._bulletManager.updateLines(this._carBullet);
this.updateScoreTxt();
this._pause = false;
this._carShootAni.enabled = true;
// console.log('sceneplay onAwake');
// this._timer = setInterval(() => {
// this._ballManager.addBall(this._carBullet, this._carFire)
// }, 5 * 1000);
}
// _timer
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
$onGameOver() {
// clearInterval(this._timer);
this._pause = true;
this._ngameSubmitApi.ngameSubmit(this.score);
this._carShootAni.enabled = false;
this.broadcast('onGameOver');
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
this.broadcast('_onDidLeave');
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
......
{"ver":"1.0.1","uuid":"848eeea5-4afe-4725-bb21-7d1d01a309ef","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"4c940094-0966-44b4-9875-0c7deb522cb5","subMetas":{},"type":"script"}
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
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";
import { setScale, setText } from "../transformUtils";
export default class SceneResult extends ScillaComponent implements INavigatorViewBase {
onAwake() {
super.onAwake();
// console.log(this.rankInfo);
this.onResponse(this.rankInfo);
}
rankInfo: dynamic;
onResponse(data) {
//设置我的信息
setText(this.myname, data.nickName);
if (data.rank > 500)
setText(this.myrank, '未上榜');
else
setText(this.myrank, data.rank + '');
setText(this.myscore, data.score);
this.loadAvatar(this.myavatar, data.avatar, 78);
//设置前三名的信息
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);
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() {
this.bubbling('fuck', 'start');
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
async loadAvatar(avatar: Entity, url: string, width: number) {
const texRender = avatar.getComponent(TextureRenderer);
const texture = await this.loadTexture(url);
texRender.texture = texture;
setScale(avatar, width / texture.bounds.width);
}
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;
}
avatar1: Entity;
myavatar: Entity;
avatar2: Entity;
avatar3: Entity;
name2: Entity;
name1: Entity;
name3: Entity;
myname: Entity;
myscore: Entity;
score2: Entity;
score1: Entity;
score3: Entity;
myrank: Entity;
}
{"ver":"1.0.1","uuid":"83555ffb-9b5c-47af-a811-b9315ca88211","subMetas":{},"type":"script"}
......@@ -2,192 +2,76 @@
* Created by rockyl on 2019-04-09.
*/
import { Button } from "scilla-components/src";
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { setText, setRotation, getRotation } from "../transformUtils";
import { getRankURL, getRecordURL, getURL } from "../dialogs/ScoreDialogContent";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
ajaxElement: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
// getNgameStartStatus: dynamic;
countTxt: Entity;
startbtn: Entity;
rankbtn: Entity;
rulebtn: Entity;
box: Entity;
musiconbtn: Entity;
musicoffbtn: Entity;
onclick_music() {
this.musicoffbtn.enabled = !this.musicoffbtn.enabled;
this.musiconbtn.enabled = !this.musiconbtn.enabled;
if (this.musiconbtn.enabled) {
document.getElementById('bgmusic')['play']();
} else {
document.getElementById('bgmusic')['pause']();
}
}
private INTERVAL = 3000;
private STREN = 3;
private FREQ = 5;
private SHAK_TIMERS = 10;
private _shakeTimes = -1;
private _counter = -1;
private _lastTime = -1;
onUpdate() {
if (Date.now() - this._lastTime > this.INTERVAL) {
this._lastTime = Date.now();
setRotation(this.box, this.STREN);
this._shakeTimes = this.SHAK_TIMERS;
this._counter = 0;
}
if (this._shakeTimes > 0) {
if (this._counter <= 0) {
this._shakeTimes--;
setRotation(this.box, -getRotation(this.box))
if (this._shakeTimes <= 0) {
setRotation(this.box, 0);
}
this._counter = this.FREQ;
} else {
this._counter--;
}
}
}
updateCountFromNet(limit: number) {
if (limit < 0)
limit = 0;
setText(this.countTxt, `剩余次数:${limit}`);
console.log('updateCountFromNet', `剩余次数:${limit}`)
}
onErrorLimitFree(data) {
console.log('onErrorLimitFree', data);
if (data == '400005')
setText(this.countTxt, `剩余次数:${window['CFG'].freeLimit}`);
else
setText(this.countTxt, `剩余次数:0`);
}
updateCountTxtFromDojoin() {
let limit = 0;
if (this.doJoin) {
limit = this.doJoin.freeLimit;
}
if (limit < 0)
limit = 0;
setText(this.countTxt, `剩余次数:${limit}`);
console.log('updateCountTxtFromDojoin', `剩余次数:${limit}`)
}
onAwake() {
super.onAwake();
this.broadcast('callApi', 1, 'rankInfo2', {
weddingId: window['CFG'].weddingId,
activityId: window['CFG'].activityId
});
this.broadcast('callApi', 1, 'limitTimes', {
weddingId: window['CFG'].weddingId,
activityId: window['CFG'].activityId
});
this._shakeTimes = 0;
this._counter = 0;
this._lastTime = -1;
setRotation(this.box, 0);
this.setCountText('');
// SingleSceneNavigator
console.log('fuck start scene')
}
onResponse_rankInfo2(data) {
if (data.openPrize && data.score > 0) {//开奖了,都是线下奖品
console.log('开奖了....');
console.log('prizelist', JSON.stringify(window['CFG'].activity.prizeList));
let prize;
window['CFG'].activity.prizeList.forEach(p => {
if (p.prizeType == data.prizeType)
prize = p;
});
if (prize)
console.log('中奖了', JSON.stringify(prize))
else
console.log('没有中奖')
if (!window.localStorage.getItem(this.getKey())) {
if (prize) //中奖了
this.bubbling('showDialog', 'Prize', prize);
else
this.bubbling('showDialog', 'Alert', '您与奖品擦肩而过~');
} else {
console.log('已经弹窗过了', this.getKey())
}
window.localStorage.setItem(this.getKey(), '1')
}
}
getKey() {
return 'prizeShowed-' + window['CFG'].weixinUid + '-' + window['CFG'].weddingId + '-' + window['CFG'].activityId
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
console.log('initGameStage')
this.updateCountText();
}
onClick_startbtn() {
this.startbtn.getComponent(Button).enabled = false;
this.sendDojoin();
updateCountText() {
const { element } = this.ajaxElement;
let text = ''
if (element.freeLimit > 0) {
text = `今日剩余免费次数:${element.freeLimit}次`;
} else {
text = `${element.needCredits}${window['CFG'].unitName}/次`
}
sendDojoin() {
// if (window['getDuibaToken']) {
// window['getDuibaToken']((tokenObj: any) => {
// this.dojoinFunc(tokenObj.token);
// }, (key: string, messageObj: any) => {
// // this.onError(net);
// });
// } else {
this.dojoinFunc();
// }
this.setCountText(text);
}
dojoinFunc(token?) {
onClick_startbtn() {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].activityId,
weddingId: window['CFG'].weddingId,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
// globalEvent.emit('popup', { name: 'RulePanel', params: {} }, this.onAlertClose);
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
this.startbtn.getComponent(Button).enabled = true;
this.updateCountTxtFromDojoin();
setTimeout(() => {
this.bubbling('fuck', 'guide');
}, 50);
this.broadcast('callApi', 1, 'getNgameStartStatus', {
orderId: this.doJoin
});
}
onGotDojoinError(error) {
this.startbtn.getComponent(Button).enabled = true;
if (error === '400005') {
this.bubbling('showToast', '活动还未开始\n敬请期待~');
} else if (error === '400006') {
this.bubbling('showToast', '活动已结束\n下次早点来哦~');
} else if (error === '400002') {
this.bubbling('showDialog', 'Alert', '您已经没有抽奖机会了');
onGotDojoinError() {
console.log('onGotDojoinError')
}
else {
this.bubbling('showDialog', 'Alert', '网络异常,请稍后再试~');
onGot_getNgameStartStatus() {
// console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
console.log('onGotDojoinError', error);
onGotError_getNgameStartStatus() {
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
......@@ -196,22 +80,7 @@ export default class SceneStart extends ScillaComponent implements INavigatorVie
}
onClick_rankbtn() {
window.location.href = getRankURL();
}
onClick_backbtn() {
// console.log('onClick_backbtn');
window.location.href = getURL()
}
onResponse_rank() {
this.bubbling('fuck', 'result');
this.rankbtn.getComponent(Button).enabled = true;
}
onClick_recordbtn() {
// alert('onClick_recordbtn')
window.location.href = getRecordURL();
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
......
{"ver":"1.0.1","uuid":"a6fb727e-d71c-484f-b3eb-480b3a5f3e42","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"9b17ef27-60b5-46b4-b9d2-735a2861e5f6","subMetas":{},"type":"script"}
export const removeFromList = (item, list: any[]) => {
const index = list.indexOf(item);
if (index != -1) {
list.splice(index, 1);
}
return item;
}
export const pickFromList = (list: any[]) => {
const index = Math.floor(Math.random() * list.length);
return list[index]
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"82324ada-6ea3-480d-ad2d-229339fd7df4","subMetas":{},"type":"script"}
export const gravityY= .5;
\ No newline at end of file
{"ver":"1.0.1","uuid":"49d89b23-4cb4-4536-9f9e-c83130909711","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-04-09.
*/
export {default as SceneStart} from "./SceneStart";
export {default as ScenePlay} from "./ScenePlay";
{"ver":"1.0.1","uuid":"f5c11db4-1b48-4d86-8433-e4afda5d9a8d","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"8de41bf2-0b03-42d7-bbb9-8d01f3cad181","subMetas":{},"isGroup":true}
import { setText } from 'assets/scripts/entityUtils';
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) {
// 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;
}
}
{"ver":"1.0.1","uuid":"ea6e2329-3083-471f-b71a-a9bdbe9f3cb2","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-01-03.
*
* 砖块动画单体
*/
import ScillaComponent from 'components/base/ScillaComponent';
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 {
item: resource;
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 => {
this.content.removeChild(item);
})
}
const itemHeight = 73;
const totalHeight = itemHeight * data.length;
this._list = [];
this._bg.height = 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);
});
}
}
{"ver":"1.0.1","uuid":"8960d977-3ca8-482b-b15a-9dac7438d253","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"78241f13-a5ce-4eb9-8455-97ff2004f0e2","subMetas":{},"isGroup":true}
import { getTween } from 'assets/scripts/getTween';
import { getX, getY, setScale, setXY } from 'assets/scripts/transformUtils';
import ScillaComponent from 'components/base/ScillaComponent';
import { Transform } from 'scilla-components/src';
import { Entity, instantiate, resource } from 'scilla/src';
import BallItem, { BallSizeType, BallSizeTypeList } from '../BallItem';
import { removeFromList } from '../_';
import { getBallScore, getBallScoreRange } from './ballScore';
import { randomColorIndex } from './colors';
import { getNextScore } from './getNextScore';
const getN = (carBullet) => {
if (carBullet <= 20) return 1;
if (carBullet <= 60) return 2;
if (carBullet <= 100) return 3
if (carBullet <= 130) return 4;
if (Math.random() < 0.3) return 6;
return 7;
}
export default class BallManager extends ScillaComponent {
private _idCounter = 1;
/** 所有父亲球的id */
private _ballIDs: number[] = [];
private checkAddBall(carBullet, carFire) {
if (this._ballIDs.length < getN(carBullet)) {
this.addBall(carBullet, carFire)
}
}
onBallDestroyedCheckBallIDs(carBullet, carFire) {
for (let i = 0; i < this._ballIDs.length; i++) {
const id = this._ballIDs[i];
const ballIsNotDestroy = this.ballList.some(ball => ball.ID == id);
if (this.ballList.every(ball => ball.parentID != id) && !ballIsNotDestroy) {
this._ballIDs.splice(i, 1);
i--;
}
}
this.checkAddBall(carBullet, carFire);
}
addBall(carBullet, carFire) {
let size = Math.floor(Math.random() * 4); //随机size,0-3
let colorIndex = randomColorIndex(size); //根据size随机颜色
let scorerange = getBallScoreRange(carBullet, carFire);
scorerange = scorerange.map(val => Math.ceil(val * (window['ballscore-p'] || 1)));
const score = getBallScore(scorerange, colorIndex);// [1, 100];
let dir = Math.random() > 0.5 ? -1 : 1;
// this.createBigBall(20, dir, colorIndex, size);
this.createBigBall(score, dir, colorIndex, size);
}
onGameOver() {
this.disableBalls();
}
disableBalls() {
this.ballList.forEach(item => item.enabled = false);
}
_onDidLeave() {
//删除所有的球
this.ballList.forEach(
ball => {
ball.enabled = false;
this.entity.removeChild(ball.entity);
this._freeBallList.push(ball);
}
);
this.ballList = [];
this._ballIDs = [];
this._idCounter = 1;
}
checkBallSplit(ball: BallItem,bullet,fire) {
//移除ball
ball.enabled = false;
removeFromList(ball, this.ballList);
this.entity.removeChild(ball.entity);
this._freeBallList.push(ball);
// console.log('this.ballList', this.ballList.length, 'this._freeBallList', this._freeBallList.length);
if (ball.size > BallSizeType.min) {//开始分裂
const nextSizeType = ball.size - 1;
const nextScore = getNextScore(ball.storedScore);
const nextColorIndex = ball.nextColorIndex;
const ball1 = this.createSplitedBall(ball, nextSizeType, nextScore, nextColorIndex);
const ball2 = this.createSplitedBall(ball, nextSizeType, nextScore, nextColorIndex);
ball1.velocityX = -5;
ball2.velocityX = 5;
} else {//掉落
this.broadcast('createDrop', 1, ball,bullet,fire)
}
}
BallItemPrefab: resource;
topline: Entity;
ballList: BallItem[] = [];
private _freeBallList: BallItem[] = [];
createSplitedBall(parentBall: BallItem, size, score, nextColorIndex) {
const ball = this.getBall();
ball.reset();
ball.resetScore(score);
ball.size = size;
// console.log(size)
ball.updateColor(ball.childNames[nextColorIndex]);
setScale(ball, BallSizeTypeList[size] / BallSizeTypeList[BallSizeTypeList.length - 1]);
setXY(ball, getX(parentBall), getY(parentBall));
this.ballList.push(ball);
this.entity.addChild(ball.entity);
ball.enabled = true;
ball.velocityY = -5;
ball.parentID = parentBall.ID == -1 ? parentBall.parentID : parentBall.ID; //parentBall.ID = -1 表示是父球,不是祖宗求。否则是祖宗求
ball.ID = -1;
return ball;
}
private async createBigBall(score, dir, colorIndex, size: BallSizeType) {
const ball = this.getBall();
ball.reset();
ball.resetScore(score);
ball.updateColor(ball.childNames[colorIndex])
setScale(ball, 1);
ball.enabled = false;
this.ballList.push(ball);
this.entity.addChild(ball.entity);
ball.size = size;
ball.parentID = -1;
ball.ID = ++this._idCounter;
this._ballIDs.push(this._idCounter);
setScale(ball, BallSizeTypeList[size] / BallSizeTypeList[BallSizeTypeList.length - 1]);
if (dir == 1) {
setXY(ball.entity, -375, getY(this.topline));
await getTween(this, ball.getComponent(Transform), { x: -375 + 200 }, 700);
ball.velocityX = 5;
}
else {
setXY(ball.entity, 375, getY(this.topline));
await getTween(this, ball.getComponent(Transform), { x: 375 - 200 }, 700);
ball.velocityX = -5;
}
ball.enabled = true;
}
getBall() {
let ball: BallItem;
if (this._freeBallList.length > 0) {
ball = this._freeBallList.pop();
} else {
ball = this.createBall();
}
return ball;
}
createBall() {
const ball = instantiate(this.BallItemPrefab);
const body = ball.getComponent(BallItem);
return body;
}
}
{"ver":"1.0.1","uuid":"1e2f418c-2d41-4d72-8a40-34cb834e99f6","subMetas":{},"type":"script"}
import { getTween } from 'assets/scripts/getTween';
import { getX, getY, setXY } from 'assets/scripts/transformUtils';
import ScillaComponent from 'components/base/ScillaComponent';
import { Transform } from 'scilla-components/src';
import { Entity, instantiate, resource } from 'scilla/src';
import Body from '../Body';
const getLines = (X) => {
if (X <= 20) return 1
if (X <= 40) return 2
if (X <= 60) return 3
if (X <= 80) return 4
if (X <= 100) return 5
if (X <= 120) return 6
if (X <= 140) return 7
return 7
}
export default class CarBulletAni extends ScillaComponent {
BulletItemPrefab: resource;
scenePlay: Entity;
private _interval = 10;
//等级1 2 3 4
private _lines = 1;
private _offsetList: number[][] = [];
bullets: Body[] = [];
private _freeBullets: Body[];
private _pause = false;
onGameOver() {
this._pause = true;
this.disableBullets();
}
disableBullets() {
this.bullets.forEach(item => item.enabled = false);
}
_onDidLeave() {
this.bullets.forEach(bullet => {
this.scenePlay.removeChild(bullet.entity);
bullet.enabled = false;
this._freeBullets.push(bullet);
});
this.bullets = [];
}
onAwake() {
super.onAwake();
if (!this._freeBullets) {
this._freeBullets = [];
this._offsetList.push([0]);
this._offsetList.push([-9, 9]);
this._offsetList.push([-18, 0, 18]);
this._offsetList.push([-27, -9, 9, 27]);
this._offsetList.push([-36, -18, 0, 18, 36]);
this._offsetList.push([-45, -27, -9, 9, 27, 45]);
this._offsetList.push([-54, -36, -18, 0, 18, 36, 54]);
}
this._pause = false;
this._interval = 10;
}
updateLines(carbullet) {
if (carbullet >= 20)
this._interval = 3;
else
this._interval = 10 - (carbullet / 20) * 7;
this._lines = getLines(carbullet);
}
_counter = 0;
onUpdate(t) {
super.onUpdate(t);
if (this._pause) return;
this._counter++;
if (this._counter >= this._interval) {
this._counter = 0;
this.createBullet();
}
this.checkRemoveBullets();
}
removeBullet(bullet: Body) {
this.scenePlay.removeChild(bullet.entity);
bullet.enabled = false;
this._freeBullets.push(bullet);
}
checkRemoveBullets() {
for (let i = 0; i < this.bullets.length; i++) {
const bullet = this.bullets[i];
const y = getY(bullet)
if (y < -1624 / 2) { //子弹失效
this.removeBullet(bullet);
this.bullets.splice(i, 1);
i--;
}
}
}
createBullet() {
const tweens = [];
const list: Body[] = [];
const offsets = this._offsetList[this._lines - 1];
for (let i = 0; i < this._lines; i++) {
let bullet: Body;
let item: Entity;
if (this._freeBullets.length > 0) {
bullet = this._freeBullets.pop();
item = bullet.entity;
} else {
item = instantiate(this.BulletItemPrefab);
bullet = item.getComponent(Body);
}
bullet.enabled = false;
list.push(bullet);
const targetX = getX(this.entity);
const targetY = getY(this.entity) - 80;
setXY(item, targetX, targetY);
const tween = getTween(this, item.getComponent(Transform), { y: targetY - 50, x: targetX + offsets[i] }, 100);
tweens.push(tween);
}
Promise.all(tweens).then(() => {
list.forEach(bullet => {
if (this._pause) { //暂停了之后再结束的tween
this.bullets.push(bullet);
} else {
bullet.enabled = true;
this.bullets.push(bullet);
}
});
});
list.forEach(bullet => {
this.scenePlay.addChild(bullet.entity);
});
}
}
{"ver":"1.0.1","uuid":"8525cc2b-6dbc-4f0e-9fe1-256a2811c705","subMetas":{},"type":"script"}
import ScillaComponent from 'components/base/ScillaComponent';
import { Entity } from 'scilla/src';
import { getY, setY } from 'assets/scripts/transformUtils';
export default class CarShootAni extends ScillaComponent {
body: Entity;
smoke: Entity;
_bodyY: number;
onAwake() {
super.onAwake();
this._bodyY = getY(this.body);
}
_counter = 0;
onUpdate(t) {
super.onUpdate(t);
this._counter++;
if (this._counter > 1) {
this._counter = 0;
const bodyY = getY(this.body);
const targetY = bodyY == this._bodyY ? this._bodyY - 3 : this._bodyY;
setY(this.body, targetY);
this.smoke.enabled = !this.smoke.enabled;
}
}
}
{"ver":"1.0.1","uuid":"e78ad988-e1f0-4505-a1c7-8d40b26790c2","subMetas":{},"type":"script"}
import { getTween } from 'assets/scripts/getTween';
import { getX, getY, setAlpha, setXY } from 'assets/scripts/transformUtils';
import ScillaComponent from 'components/base/ScillaComponent';
import { instantiate, resource } from 'scilla/src';
import Body from '../Body';
import RocketItem from '../RocketItem';
import { removeFromList } from '../_';
import { DropType } from './DropType';
import { initEnv } from 'assets/scripts/common/BuriedPoint';
import { getProp, dropsCls } from './drops';
import getPropItem from './getPropItem';
export default class DropManager extends ScillaComponent {
RedFirePrefab: resource;
BlueRocketPrefab: resource;
YellowRocketPrefab: resource;
PurpleRocketPrefab: resource;
onGameOver() {
this.disableBalls();
}
disableBalls() {
this._dropList.forEach(item => item.enabled = false);
}
_onDidLeave() {
//删除所有的球
this._dropList.forEach(
drop => {
drop.enabled = false;
this.entity.removeChild(drop.entity);
const frees = this._freeDic[drop.type];
frees.push(drop);
}
);
this._dropList = [];
}
async removeDrop(drop: RocketItem) {
drop.enabled = false;
drop.text.enabled = true;
removeFromList(drop, this._dropList);
const frees = this._freeDic[drop.type];
const y = getY(drop);
await getTween(this, drop, { y: y - 200, alpha: 0 }, 1000);
frees.push(drop);
this.entity.removeChild(drop.entity);
setAlpha(drop, 1);
}
createDrop(ball: Body, carbullet, fire) {
const dropinfo = getProp(carbullet);
const dropsData: DropType[] = getPropItem(dropsCls, dropinfo.p, dropinfo.n);
const [d1, d2, d3] = dropsData;
let n = dropsData.length;
// console.log(dropsData)
const p = 30;
let dir = 1;
if (getX(ball) > 0)
dir = -1;
const x = getX(ball), y = getY(ball);
const baseVx = dir * 1;
if (n == 3) {
const item1 = this.createDropItem(d1, ball, x, y, baseVx - dir);
const item2 = this.createDropItem(d2, ball, x + dir * p, y - p, baseVx);
const item3 = this.createDropItem(d3, ball, x + dir * p * 2, y - p * 2, baseVx + dir);
} else if (n == 2) {
const item1 = this.createDropItem(d1, ball, x, y, baseVx);
const item2 = this.createDropItem(d2, ball, x + dir * p, y - p, baseVx + dir);
} else {
const item1 = this.createDropItem(d1, ball, x, y, baseVx);
}
}
getPrefab(dropType: DropType) {
if (dropType == DropType.blue) return this.BlueRocketPrefab;
if (dropType == DropType.purple) return this.PurpleRocketPrefab;
if (dropType == DropType.red) return this.RedFirePrefab;
if (dropType == DropType.yellow) return this.YellowRocketPrefab;
}
private createDropItem(dropType: DropType, ball: Body, x: number, y: number, vx) {
let item: Body;
item = this.getFireItem(this.getPrefab(dropType), dropType);
setXY(item, getX(ball), getY(ball));
item.velocityY = -Math.abs(vx) * 3 * 2;
item.velocityX = vx * 3;
return item;
}
getFireItem(res: resource, type: DropType) {
const frees = this._freeDic[type];
let body: RocketItem;
if (frees.length > 0) {
body = frees.pop();
body.enabled = true;
body.reset();
} else {
const item = instantiate(res);
body = item.getComponent(RocketItem);
}
this.entity.addChild(body.entity);
this._dropList.push(body);
return body;
}
private _dropList: RocketItem[] = [];
get dropList() { return this._dropList }
private _freeDic: { [key: string]: RocketItem[]; } = {
'red': [], 'blue': [], 'purple': [], 'yellow': []
};
oncreate() {
super.onCreate();
}
onAwake() {
super.onAwake();
}
onUpdate(t) {
super.onUpdate(t);
}
}
{"ver":"1.0.1","uuid":"7dbbaba5-b07a-4e4e-a598-dc1de3aca547","subMetas":{},"type":"script"}
export enum DropType {
red = 'red', blue = 'blue', yellow = 'yellow', purple = 'purple'
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"312e234b-e6c4-43ce-9e98-18d74fecf509","subMetas":{},"type":"script"}
import getPropItem from './getPropItem'
//6种颜色
export const getBallScore = ([a, b], colorIndex) => {
let n = Math.abs(b - a) + 1;
n = Math.floor(n / 6);
const m = [];
// m.push([a, a + n - 1]);
// m.push([a + n, a + n + n - 1]);
for (let i = 0; i < 5; i++) {
m.push([a + n * i, a + n * i + n - 1]);
}
m.push([a + n * 4 + n, b])
const [a0, b0] = m[colorIndex]; //1-10
let result = Math.ceil(Math.random() * (b0 - a0 + 1)) + a0
return result;
}
export const getBallScoreRange = (carBullet: number, carFire: number): any => {
if (carBullet <= 20)
return [0.01 * carFire, 0.2 * carFire]
if (carBullet > 20 && carBullet <= 40)
return [0.2 * carFire, 0.6 * carFire]
if (carBullet > 40 && carBullet <= 60) {
const list = [
[0.2 * carFire, 0.6 * carFire],
[0.6 * carFire, 0.8 * carFire],
[0.8 * carFire, 1.5 * carFire],
]
return getPropItem(list, [3, 5, 2])[0];
}
if (carBullet > 60 && carBullet <= 80) {
const list = [
[0.6 * carFire, 0.8 * carFire],
[0.8 * carFire, 1.5 * carFire],
[1.5 * carFire, 2.2 * carFire],
]
return getPropItem(list, [2, 5, 2])[0];
}
if (carBullet > 80 && carBullet <= 100) {
const list = [
[1.5 * carFire, 2.2 * carFire],
[2.2 * carFire, 3.2 * carFire],
[3.2 * carFire, 4.2 * carFire],
]
return getPropItem(list, [1, 5, 4])[0];
}
if (carBullet > 100 && carBullet <= 120) {
const list = [
[2.2 * carFire, 3.2 * carFire],
[3.2 * carFire, 4.2 * carFire],
[4.2 * carFire, 5.2 * carFire],
]
return getPropItem(list, [1, 4, 5])[0];
}
// if (carBullet > 120 && carBullet <= 140) {
const list = [
[2.2 * carFire, 3.2 * carFire],
[3.2 * carFire, 4.2 * carFire],
[4.2 * carFire, 5.2 * carFire],
]
return getPropItem(list, [1, 3, 6])[0];
// }
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"1c8d19ed-6a8e-412b-afe9-12d0adb782f6","subMetas":{},"type":"script"}
export const colorsMcOrder = [6, 5, 2, 3, 4, 1];
export const calNextColor = (colorIndex: number) => {
return colorIndex >= 1 ? colorIndex - 1 : 0;
}
export const randomColorIndex = (sizeType) => {
let colorIndex;
if (sizeType == 0) {
colorIndex = Math.floor(Math.random() * colorsMcOrder.length);//0-5
}
if (sizeType == 1) { //1-5
colorIndex = Math.floor(Math.random() * (colorsMcOrder.length - 1)) + 1;//0-4 + 1
}
if (sizeType == 2) { //2-5
colorIndex = Math.floor(Math.random() * (colorsMcOrder.length - 2)) + 2;//0-3 + 2
}
if (sizeType == 3) {//3-5
colorIndex = Math.floor(Math.random() * (colorsMcOrder.length - 3)) + 3;//0-2 + 3
}
return colorIndex;
}
export const getChangeColor = (score, initscore, initColorIndex) => {
//红5,紫4,深蓝3,蓝2,绿1,黄0
//生成颜色分数段,总100分
//黄 0 ,黄的不变色
const per = score / initscore;
//绿 1,1/2的时候变黄
if (initColorIndex == 1) {
if (per < 1 / 2) return initColorIndex - 1
}
//蓝 2,1/3的时候变黄 2/3变绿
if (initColorIndex == 2) {
if (per < 1 / 3) return initColorIndex - 2;
if (per < 2 / 3) return initColorIndex - 1;
}
//深蓝 3,1/4的时候变黄,2/4绿,3/4蓝
if (initColorIndex == 3) {
if (per < 1 / 4) return initColorIndex - 3;
if (per < 2 / 4) return initColorIndex - 2;
if (per < 3 / 4) return initColorIndex - 1;
}
//紫 4,1/5黄,2/5绿,3/5蓝 4/5 深蓝
if (initColorIndex == 4) {
if (per < 1 / 5) return initColorIndex - 4;
if (per < 2 / 5) return initColorIndex - 3;
if (per < 3 / 5) return initColorIndex - 2;
if (per < 4 / 5) return initColorIndex - 1;
}
//红 5,1/6黄,2/6绿,3/6蓝 4/6 深蓝 5/6 紫
if (initColorIndex == 5) {
if (per < 1 / 6) return initColorIndex - 5;
if (per < 2 / 6) return initColorIndex - 4;
if (per < 3 / 6) return initColorIndex - 3;
if (per < 4 / 6) return initColorIndex - 2;
if (per < 5 / 6) return initColorIndex - 1;
}
return initColorIndex;
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"ba6dbec4-8ffd-468d-847a-4167765a2fb1","subMetas":{},"type":"script"}
import { DropType } from "./DropType";
//////////////////////// 1 30% 20% 10%
export const dropsCls = [DropType.blue, DropType.red, DropType.purple, DropType.yellow];
export const dropsData = [{ bullet: 1 }, { fire: 30 }, { fire: 20 }, { fire: 10 }];
export const getIndex = (cls) => dropsCls.indexOf(cls);
export const getProp = (X: number) => {
if (X <= 30) {
return {
n: 3,
p: window['drop-p-30'] || [40, 0, 15, 50]
}
}
if (X > 30 && X < 70) {
return {
n: 2,
p: window['drop-p-30-70'] || [40, 5, 15, 50]
}
}
if (X >= 70) {
return {
n: 1,
p: window['drop-p-70'] || [40, 5, 15, 50]
}
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"2648271f-74ba-485c-96c8-24cd46fac8dc","subMetas":{},"type":"script"}
export const getNextScore = (initscore) => {
const p = Math.random() * 0.4 + 0.8;
return Math.ceil(initscore / 2 * p);
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"95f1b2a0-ed9b-4bf8-90ab-d7493d59ab55","subMetas":{},"type":"script"}
const fill = (item, n) => {
const result = [];
for (let i = 0; i < n; i++) {
result.push(item);
}
return result;
}
export default (items: any[], props: number[], n = 1) => {
let pool = [];
for (let i = 0; i < items.length; i++) {
const item = items[i];
pool = pool.concat(fill(item, props[i]));
}
const result = [];
for (let i = 0; i < n; i++) {
const index = Math.floor(Math.random() * pool.length);
const resultItem = pool[index];
result.push(resultItem);
}
return result;
}
{"ver":"1.0.1","uuid":"3d17f17a-997b-4947-8e59-3755cbf3fa63","subMetas":{},"type":"script"}
import ScillaComponent from 'components/base/ScillaComponent';
import { createSgin } from 'assets/scripts/net/webService';
import { dynamic } from 'scilla/src';
export default class ngameSubmit extends ScillaComponent {
onAwake() {
super.onAwake();
}
onUpdate(t) {
super.onUpdate(t);
}
doJoin: dynamic;
getNgameStartStatus: dynamic;
ngameSubmit(score: number) {
// console.log('createSgin', this.doJoin, score, '[]', this.getNgameStartStatus.submitToken);
const sign = createSgin(this.doJoin, score, '[]', this.getNgameStartStatus.submitToken);
const param: any = {
orderId: this.doJoin,
score: score,
gameData: '[]',
sgin: sign,
dynamicData: '[]'
};
this.broadcast('callApi', 1, 'ngameSubmit', param);
}
onResponse_ngameSubmit() {
this.bubbling('showDialog', 'GameOver');
}
onError_ngameSubmit() {
}
}
{"ver":"1.0.1","uuid":"c7ed7528-bfa7-40c2-a502-e01500fd21dd","subMetas":{},"type":"script"}
......@@ -5,12 +5,6 @@ import { Entity } from 'scilla/src';
export const setX = (entity: Entity, x) => {
entity.getComponent(Transform).position.x = x;
}
export const setRotation = (entity: Entity, x) => {
entity.getComponent(Transform).rotation=x;
}
export const getRotation = (entity: Entity) => {
return entity.getComponent(Transform).rotation
}
export const setAlpha = (val: Entity | ScillaComponent, alpha: number) => {
if (val instanceof Entity) {
......@@ -20,19 +14,19 @@ export const setAlpha = (val: Entity | ScillaComponent, alpha: number) => {
}
}
export const setScale = (val: Entity | ScillaComponent, sacle) => {
export const setScale = (val: Entity | ScillaComponent, x) => {
if (val instanceof Entity) {
val.getComponent(Transform).scale.x = sacle;
val.getComponent(Transform).scale.y = sacle;
val.getComponent(Transform).scale.x = x;
val.getComponent(Transform).scale.y = x;
}
else if (val instanceof ScillaComponent) {
val.entity.getComponent(Transform).scale.x = sacle;
val.entity.getComponent(Transform).scale.y = sacle;
val.entity.getComponent(Transform).scale.x = x;
val.entity.getComponent(Transform).scale.y = x;
}
}
export const setText = (entity: Entity, text: string) => {
entity.getComponent(TextRenderer).text = text + '';
entity.getComponent(TextRenderer).text = text;
}
export const getScale = (val: Entity | ScillaComponent) => {
......
{"ver":"1.0.1","uuid":"b838249c-6046-4347-bfc0-30dce9ba1a3f","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"aa5e844e-2bb0-435d-8907-f36cdf20759d","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"08c7c305-540f-4203-a98e-037454900419","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"43846f4b-0b30-4c45-af4b-044641d7ed34","subMetas":{},"isGroup":true}
No preview for this file type
{"ver":"1.0.1","uuid":"c63ea6c6-ef23-41ea-9d25-c9d0f3eff4cf","subMetas":{"Bitmap-4-1.png":{"ver":"1.0.1","uuid":"e0c66afc-0f95-4297-863b-936233a3516c","rawTextureUuid":"c63ea6c6-ef23-41ea-9d25-c9d0f3eff4cf","type":"texture"},"得分-拷贝.png":{"ver":"1.0.1","uuid":"092efb80-3308-4fa5-9285-adf878b4a837","rawTextureUuid":"c63ea6c6-ef23-41ea-9d25-c9d0f3eff4cf","type":"texture"},"按钮2-拷贝.png":{"ver":"1.0.1","uuid":"87c90a55-bd86-4b54-ac46-edecc0ffbe86","rawTextureUuid":"c63ea6c6-ef23-41ea-9d25-c9d0f3eff4cf","type":"texture"},"再来一次.png":{"ver":"1.0.1","uuid":"38b04759-5a77-4963-846a-525e11f2500e","rawTextureUuid":"c63ea6c6-ef23-41ea-9d25-c9d0f3eff4cf","type":"texture"},"得分.png":{"ver":"1.0.1","uuid":"5dfe8571-8cfc-4258-b985-44862098f0cc","rawTextureUuid":"c63ea6c6-ef23-41ea-9d25-c9d0f3eff4cf","type":"texture"}},"type":"sheet"}
{"ver":"1.0.1","uuid":"1f737398-ebbb-4a65-9851-0303fd5def02","subMetas":{"1.png":{"ver":"1.0.1","uuid":"4f3816da-553e-40e1-8568-cc1bf669783d","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"2.png":{"ver":"1.0.1","uuid":"ae3c021b-fbbf-43d3-ad6d-dc4b7bf2a7c9","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"3.png":{"ver":"1.0.1","uuid":"207eb774-d33a-4309-b420-667bea6c6cf6","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"盒子.png":{"ver":"1.0.1","uuid":"56bcd2e4-f0a1-4228-a528-c95f18b1092b","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"盒子2.png":{"ver":"1.0.1","uuid":"1740da0d-b247-46bd-a062-39940b88d549","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"盒子3.png":{"ver":"1.0.1","uuid":"710ca0e4-99bc-4b77-800a-f2d71b9cb69f","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"装饰.png":{"ver":"1.0.1","uuid":"f4ea00e4-af9e-4761-876f-eb1c5101b4f2","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"icon1.png":{"ver":"1.0.1","uuid":"5ea53bf0-8a58-420c-8c25-fc1724e4865b","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"icon2.png":{"ver":"1.0.1","uuid":"c2836212-2459-4c1d-a294-1ed49e197229","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"icon3.png":{"ver":"1.0.1","uuid":"c9272a2e-6151-4b87-a700-32ac4a12caee","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"icon4.png":{"ver":"1.0.1","uuid":"fb22f965-457d-4514-a322-95149ecdee79","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"icon5.png":{"ver":"1.0.1","uuid":"e143dfc7-324e-4635-a776-2f6c0d1ce845","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"icon6.png":{"ver":"1.0.1","uuid":"511ce403-5c36-48e6-9b5c-b3bbfd9b210d","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"icon7.png":{"ver":"1.0.1","uuid":"04ae0a39-6624-488e-b52d-97f7a03baf8f","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"icon8.png":{"ver":"1.0.1","uuid":"12e9e984-20c2-4930-aae7-296cee113462","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"},"icon9.png":{"ver":"1.0.1","uuid":"c3361b0e-b03a-4fff-a4b3-b20adde85547","rawTextureUuid":"1f737398-ebbb-4a65-9851-0303fd5def02","type":"texture"}},"type":"sheet"}
{"ver":"1.0.1","uuid":"707b0618-36e7-4fee-a68b-12157b07f102","subMetas":{"1-1-1.png":{"ver":"1.0.1","uuid":"b00c51e6-497c-43d9-82f7-404a75d20be4","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"red20.png":{"ver":"1.0.1","uuid":"86bf904f-c870-44c5-b2e1-16e511c63eff","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"发弹雾气-1.png":{"ver":"1.0.1","uuid":"6985d3f7-d1cc-432d-b6bb-d3775718f823","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"大炮板子-1.png":{"ver":"1.0.1","uuid":"d58b17d5-52a7-4464-93d6-314396fb2cf2","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"大炮的头-1.png":{"ver":"1.0.1","uuid":"38e8a63e-37e3-4e11-a641-384bbf0223bb","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"子弹-1.png":{"ver":"1.0.1","uuid":"a0310a43-fc21-44d6-b32b-a8406fe10e03","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"淡蓝-1.png":{"ver":"1.0.1","uuid":"5367ae30-00ee-4296-8779-158f8fbd68f2","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"淡蓝火箭-1.png":{"ver":"1.0.1","uuid":"b08e8d70-e3cd-48b4-81b5-61196aafdc7b","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"火-1.png":{"ver":"1.0.1","uuid":"86a1d006-76e2-4101-b4ba-60fbf96d25a6","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"火箭-1.png":{"ver":"1.0.1","uuid":"42d4b3ff-b9a9-4688-8d02-10d9e9c0dcf6","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"紫-1.png":{"ver":"1.0.1","uuid":"3aad1b7b-89ec-4565-afa2-a16d36d7b721","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"红-1.png":{"ver":"1.0.1","uuid":"e624e863-53d4-41f7-bc95-924579fe8025","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"绿-1.png":{"ver":"1.0.1","uuid":"853cc248-89dc-40f1-8f16-48007e6d8ef3","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"蓝-1.png":{"ver":"1.0.1","uuid":"9cc48379-a01c-4cd1-9196-220016eb9797","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"黄-1.png":{"ver":"1.0.1","uuid":"24c66e95-12ff-4bea-b4be-aa8554eea39f","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"火yellow-1.png":{"ver":"1.0.1","uuid":"12a92a67-b5b7-472c-8c4c-95d8eefa1c82","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"},"火purple-1.png":{"ver":"1.0.1","uuid":"18af58d7-34ef-469b-a769-dec15fb0e908","rawTextureUuid":"707b0618-36e7-4fee-a68b-12157b07f102","type":"texture"}},"type":"sheet"}
{"ver":"1.0.1","uuid":"7812ab8d-1490-4d67-9d7d-b5d104e36814","subMetas":{"prizebg.png":{"ver":"1.0.1","uuid":"1d4d0649-9ea1-4171-b301-54f1d90aabf5","rawTextureUuid":"7812ab8d-1490-4d67-9d7d-b5d104e36814","type":"texture"},"usebtn.png":{"ver":"1.0.1","uuid":"8b0f2eee-8cb0-4499-ab58-49e7f2caee18","rawTextureUuid":"7812ab8d-1490-4d67-9d7d-b5d104e36814","type":"texture"}},"type":"sheet"}
{"ver":"1.0.1","uuid":"1fbceff5-d327-43eb-ab17-4cd54cb440a5","subMetas":{"1.png":{"ver":"1.0.1","uuid":"598c0eb5-ea0e-41dc-adcb-d808fe0ac95f","rawTextureUuid":"1fbceff5-d327-43eb-ab17-4cd54cb440a5","type":"texture"},"2.png":{"ver":"1.0.1","uuid":"cf2931eb-bd7a-4ef6-8b71-9b67dc633306","rawTextureUuid":"1fbceff5-d327-43eb-ab17-4cd54cb440a5","type":"texture"},"3.png":{"ver":"1.0.1","uuid":"d6139441-67ce-4290-94b4-43971b310753","rawTextureUuid":"1fbceff5-d327-43eb-ab17-4cd54cb440a5","type":"texture"},"返回首页.png":{"ver":"1.0.1","uuid":"96f7f590-a82a-422f-803d-6e4e454b6dc5","rawTextureUuid":"1fbceff5-d327-43eb-ab17-4cd54cb440a5","type":"texture"},"rankbg.png":{"ver":"1.0.1","uuid":"1c417086-3713-4fc1-94fa-2f29f3a34f09","rawTextureUuid":"1fbceff5-d327-43eb-ab17-4cd54cb440a5","type":"texture"}},"type":"sheet"}
{"ver":"1.0.1","uuid":"57b12603-85b6-4aa9-9fa6-072674a8d674","subMetas":{"closeBtn-1.png":{"ver":"1.0.1","uuid":"987a5caa-e372-4c76-a853-c8adea9e6686","rawTextureUuid":"57b12603-85b6-4aa9-9fa6-072674a8d674","type":"texture"},"游戏说明-1.png":{"ver":"1.0.1","uuid":"48aa7079-65a9-45dd-9449-e765b6996674","rawTextureUuid":"57b12603-85b6-4aa9-9fa6-072674a8d674","type":"texture"}},"type":"sheet"}
{"ver":"1.0.1","uuid":"5a26b406-3b16-4d29-a47a-e968294aa431","subMetas":{"closeBtn-1.png":{"ver":"1.0.1","uuid":"f6580694-d87b-487c-840e-8f4c990a43a7","rawTextureUuid":"5a26b406-3b16-4d29-a47a-e968294aa431","type":"texture"},"游戏说明-1.png":{"ver":"1.0.1","uuid":"3a144581-2403-4ce9-845b-7470fc1d5bef","rawTextureUuid":"5a26b406-3b16-4d29-a47a-e968294aa431","type":"texture"}},"type":"sheet"}
{"ver":"1.0.1","uuid":"30d8c878-4721-452c-be69-5a7ff3b8c384","subMetas":{},"isGroup":true}
{"ver":"1.0.1","uuid":"6e959768-d04d-4a1b-a28d-649d0ee9c769","subMetas":{"弹窗-完成.png":{"ver":"1.0.1","uuid":"19642cc5-45c3-41ce-9086-5389a295e3ef","rawTextureUuid":"6e959768-d04d-4a1b-a28d-649d0ee9c769","type":"texture"},"按钮.png":{"ver":"1.0.1","uuid":"5d3225cc-1a94-471c-a8db-d24cb44a62c7","rawTextureUuid":"6e959768-d04d-4a1b-a28d-649d0ee9c769","type":"texture"}},"type":"sheet"}
{"ver":"1.0.1","uuid":"ed0e6061-7014-492f-b95f-88794de7d5cc","subMetas":{"rulebtn.png":{"ver":"1.0.1","uuid":"d092293f-6a84-45eb-a7c2-7735b747c2af","rawTextureUuid":"ed0e6061-7014-492f-b95f-88794de7d5cc","type":"texture"},"recordbtn.png":{"ver":"1.0.1","uuid":"7c2aa27c-5cf6-46d0-8509-d9b68052de09","rawTextureUuid":"ed0e6061-7014-492f-b95f-88794de7d5cc","type":"texture"},"startbtn.png":{"ver":"1.0.1","uuid":"65d0864b-a3b8-438b-aa87-673311473c7f","rawTextureUuid":"ed0e6061-7014-492f-b95f-88794de7d5cc","type":"texture"},"rankbtn.png":{"ver":"1.0.1","uuid":"66066ff4-4536-4398-84ad-8cf91c2d8333","rawTextureUuid":"ed0e6061-7014-492f-b95f-88794de7d5cc","type":"texture"},"盒子.png":{"ver":"1.0.1","uuid":"072e5812-0898-4d90-a077-3a0c073df00f","rawTextureUuid":"ed0e6061-7014-492f-b95f-88794de7d5cc","type":"texture"},"装饰.png":{"ver":"1.0.1","uuid":"add607e6-e22c-4e67-9a24-3b147abce03d","rawTextureUuid":"ed0e6061-7014-492f-b95f-88794de7d5cc","type":"texture"},"backbtn.png":{"ver":"1.0.1","uuid":"cc98cc7a-27db-4dc6-824a-c76eca549c6c","rawTextureUuid":"ed0e6061-7014-492f-b95f-88794de7d5cc","type":"texture"},"musicoff.png":{"ver":"1.0.1","uuid":"224ff589-99e7-4a92-b688-703822bae78b","rawTextureUuid":"ed0e6061-7014-492f-b95f-88794de7d5cc","type":"texture"},"musicon.png":{"ver":"1.0.1","uuid":"458c9c03-4163-42af-bbcc-5c6d7ef33f6b","rawTextureUuid":"ed0e6061-7014-492f-b95f-88794de7d5cc","type":"texture"}},"type":"sheet"}
{"ver":"1.0.1","uuid":"9158c461-d76d-42b6-8a4f-4151d551fbf2","subMetas":{"按钮-2.png":{"ver":"1.0.1","uuid":"b70eba5c-be0d-453c-bd43-f426e82e47e1","rawTextureUuid":"9158c461-d76d-42b6-8a4f-4151d551fbf2","type":"texture"},"规则-1.png":{"ver":"1.0.1","uuid":"ac6fde8f-26e8-4172-8bf1-352351779b90","rawTextureUuid":"9158c461-d76d-42b6-8a4f-4151d551fbf2","type":"texture"},"排行榜.png":{"ver":"1.0.1","uuid":"8e1830a4-ae13-4ded-b75c-38f396ef0549","rawTextureUuid":"9158c461-d76d-42b6-8a4f-4151d551fbf2","type":"texture"}},"type":"sheet"}
{"ver":"1.0.1","uuid":"58f8ca0c-13b5-4c47-84a9-2bcb3e25c568","subMetas":{"alertbg":{"ver":"1.0.1","uuid":"49fa9d5a-fa33-40e4-b2e1-b00006ee0b2c","rawTextureUuid":"58f8ca0c-13b5-4c47-84a9-2bcb3e25c568","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/shuijf/assets/singles/alertbg.png"}
assets/singles/bg.jpg

103 KB | W: | H:

assets/singles/bg.jpg

40.7 KB | W: | H:

assets/singles/bg.jpg
assets/singles/bg.jpg
assets/singles/bg.jpg
assets/singles/bg.jpg
  • 2-up
  • Swipe
  • Onion skin
{"ver":"1.0.1","uuid":"b89a1d88-1f8f-4c9d-bd76-4682de69d62f","subMetas":{"bg":{"ver":"1.0.1","uuid":"3e8e7daf-380f-4524-998d-6bc955b88298","rawTextureUuid":"b89a1d88-1f8f-4c9d-bd76-4682de69d62f","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/shuijf/assets/singles/bg.jpg"}
{"ver":"1.0.1","uuid":"65ad1c9d-457e-437c-a678-1f52ebb98381","subMetas":{"bg":{"ver":"1.0.1","uuid":"719a4bf8-e2f0-4822-81a6-6870eba0ab37","rawTextureUuid":"65ad1c9d-457e-437c-a678-1f52ebb98381","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/new-kickball/assets/singles/bg.jpg"}
{"ver":"1.0.1","uuid":"8e27acb0-5de3-4923-a0d6-74c8f97ecf03","subMetas":{"bg_play":{"ver":"1.0.1","uuid":"21efcb53-689b-482d-bcff-91176ecbad9e","rawTextureUuid":"8e27acb0-5de3-4923-a0d6-74c8f97ecf03","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/new-kickball/assets/singles/bg_play.jpg"}
{"ver":"1.0.1","uuid":"c4d9cb82-8eed-4444-9638-bec8180db868","subMetas":{"button-red":{"ver":"1.0.1","uuid":"856e2ee2-68ef-4c4d-bc52-369867b98982","rawTextureUuid":"c4d9cb82-8eed-4444-9638-bec8180db868","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/new-kickball/assets/singles/button-red.png"}
{"ver":"1.0.1","uuid":"ba68c8dd-1e6a-42fc-83b4-a8ca01bd40d2","subMetas":{"cankao":{"ver":"1.0.1","uuid":"f14081bd-8f55-4ce4-a175-849f9512daea","rawTextureUuid":"ba68c8dd-1e6a-42fc-83b4-a8ca01bd40d2","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/shuijf/assets/singles/cankao.jpg"}
{"ver":"1.0.1","uuid":"fbb05192-e4f2-4706-a177-91b2c71f24f9","subMetas":{"close":{"ver":"1.0.1","uuid":"834f5b58-e063-4e9d-a211-343354ad84d7","rawTextureUuid":"fbb05192-e4f2-4706-a177-91b2c71f24f9","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/new-kickball/assets/singles/close.png"}
{"ver":"1.0.1","uuid":"d3c3140f-3210-426b-8a0b-c1811f33044f","subMetas":{"closebtn":{"ver":"1.0.1","uuid":"d47189aa-f9fb-4ed8-b4cf-4f1631fe0c33","rawTextureUuid":"d3c3140f-3210-426b-8a0b-c1811f33044f","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/shuijf/assets/singles/closebtn.png"}
{"ver":"1.0.1","uuid":"d6163686-6056-40e1-8d5a-5e4248636a27","subMetas":{"dialog-bg":{"ver":"1.0.1","uuid":"44e18ac2-22fc-416f-b831-7d5b405e6260","rawTextureUuid":"d6163686-6056-40e1-8d5a-5e4248636a27","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/new-kickball/assets/singles/dialog-bg.png"}
assets/singles/logo.png

1.85 KB | W: | H:

assets/singles/logo.png

34.8 KB | W: | H:

assets/singles/logo.png
assets/singles/logo.png
assets/singles/logo.png
assets/singles/logo.png
  • 2-up
  • Swipe
  • Onion skin
{"ver":"1.0.1","uuid":"3a78d5ce-8939-4fb9-8aad-23e5f8a179b4","subMetas":{"playbg":{"ver":"1.0.1","uuid":"bf3dc05b-5ca3-4db9-a246-e6e0913ee177","rawTextureUuid":"3a78d5ce-8939-4fb9-8aad-23e5f8a179b4","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/shuijf2/assets/singles/playbg.jpg"}
{"ver":"1.0.1","uuid":"8b7f9aab-a69b-4bff-99b7-f3710d565403","subMetas":{"ran_cankao":{"ver":"1.0.1","uuid":"d747a595-961c-4084-b44c-e8bcbd984319","rawTextureUuid":"8b7f9aab-a69b-4bff-99b7-f3710d565403","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/shuijf2/assets/singles/ran_cankao.png"}
{"ver":"1.0.1","uuid":"6c90daea-7dde-4b18-823a-e4f8141b7b41","subMetas":{"rankbg":{"ver":"1.0.1","uuid":"e792599d-4776-478c-b0d7-5c667ea9f1f0","rawTextureUuid":"6c90daea-7dde-4b18-823a-e4f8141b7b41","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/shuijf2/assets/singles/rankbg.jpg"}
{"ver":"1.0.1","uuid":"71e44311-e161-4503-8f98-61e49083fbc4","subMetas":{"rankitem_cankao":{"ver":"1.0.1","uuid":"10bcaeb9-a710-4d08-ba2d-3ab8aa407bb1","rawTextureUuid":"71e44311-e161-4503-8f98-61e49083fbc4","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/shuijf2/assets/singles/rankitem_cankao.jpg"}
{"ver":"1.0.1","uuid":"f851b613-f1a9-48b0-83f1-be7fdc46a671","subMetas":{"test":{"ver":"1.0.1","uuid":"6eb9850d-5a36-4792-b544-a40cf2ed00d2","rawTextureUuid":"f851b613-f1a9-48b0-83f1-be7fdc46a671","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/shuijf/assets/singles/test.png"}
{"ver":"1.0.1","uuid":"20070530-0eaf-4e77-af40-bee6392b5e52","subMetas":{"按钮":{"ver":"1.0.1","uuid":"0ef49c1b-4077-4285-840e-6639ef4c5f69","rawTextureUuid":"20070530-0eaf-4e77-af40-bee6392b5e52","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/shuijf/assets/singles/按钮.png"}
{"ver":"1.0.1","uuid":"0425c878-060e-4072-ad30-c17ed1a0b441","subMetas":{"游戏引导":{"ver":"1.0.1","uuid":"8ea937db-76f8-4147-b7e7-e22d6ab29d44","rawTextureUuid":"0425c878-060e-4072-ad30-c17ed1a0b441","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/shuijf2/assets/singles/游戏引导.jpg"}
<meta name="viewport"
content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="true" />
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<div id="loading"> <img src="//yun.duiba.com.cn/db_games/loading.gif" /> </div>
<div id="gameContainer" style="width: 100%;height: 100%;overflow: hidden;"></div>
<script src="//yun.duiba.com.cn/db_games/zepto.min.js"></script>
<script src="//yun.duiba.com.cn/db_games/security.js"></script>
<script src="//yun.duiba.com.cn/db_games/1561967214/bundle.js"></script>
<script> setTimeout(function () {
var loadingEl = document.getElementById('loading'); function onProcess(p) { if (p >= 1) { loadingEl.style.display = 'none'; } }
var options = { resPath: "//yun.duiba.com.cn/db_games/1561967214/" }; window['shuijf'].startup(document.getElementById('gameContainer'), options, onProcess);
}, 100);
window['COUNT_DOWN_SEC'] = 10;
window.ruleContent = '';
window.ruleContent += '1.点击开始游戏,在3-2-1后进行10秒倒计时,摇晃手机将礼盒中的糖果摇出,以10秒内摇出的糖果数量为游戏成绩,成绩可在排行榜进行查看;<br>';
window.ruleContent += '2.游戏成绩排名越高,获奖几率越大;<br>';
window.ruleContent += '3.排行结束后,可进入游戏查看是否中奖,以及本游戏的最终排名情况,且排行结束后的成绩不再进入排行榜;<br>';
window.ruleContent += '4.领奖须知:实物奖品请于获奖当日在宴会现场工作人员处领取奖品,否则视为放弃领奖;<br>'
window.ruleContent += '5.点击【我的奖品】可查看获奖情况;<br>'
window.ruleContent += '6.在本次活动期间,如用户存在任何违反法律、法规、水井坊活动规则的行为,包括但不限于作弊得奖等行为,水井坊有权取消用户的中奖资格,有权撤销违规交易;<br>'
window.ruleContent += '7.在法律规定的范围内,水井坊对本次活动拥有最终解释权。'
</script>
<style>
html,
body,
p {
padding: 0;
margin: 0;
border: 0;
}
html,
body {
height: 100%;
background-color: #282C34;
}
#loading {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
display: -webkit-flex;
justify-content: center;
-webkit-justify-content: center;
align-items: center;
-webkit-align-items: center;
}
#floatLayer::-webkit-scrollbar {
display: none
}
</style>
<audio id="bgmusic" src="//video.duiba.com.cn/ts_video/V1905/m1.mp3" autoplay preload loop></audio>
<!-- 当使用方法1时必须加载 JS-SDK 的 JS 文件, 方法2不需要加载这个 JS -->
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
function autoPlayAudio() {
var ua = navigator.userAgent.toLowerCase(); console.log(ua);
if (ua.match(/MicroMessenger/i)) {
console.log('MicroMessenger');
wx.config({
debug: false,
appId: '',
timestamp: 1,
nonceStr: '',
signature: '',
jsApiList: []
});
wx.ready(function () {
console.log('ready');
document.getElementById('bgmusic').play();
});
} else {
window.onload = function () {
document.getElementById('bgmusic').play();
}
document.addEventListener("click", function () {
document.getElementById('bgmusic').play();
})
}
}
autoPlayAudio(); // 推荐使用方法1
</script>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>shuijf2</title>
<title>new-kickball</title>
<meta name="viewport"
content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
......@@ -11,7 +11,6 @@
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<audio id="bgmusic" src="//video.duiba.com.cn/ts_video/V1905/m1.mp3" autoplay preload loop></audio>
<style>
html,
body,
......@@ -57,9 +56,8 @@
<script src="./security.js"></script>
<script src="debug/bundle.js"></script>
<script>
window['COUNT_DOWN_SEC'] = 2;
var CFG = { "startTime": 1561523400000, "endTime": 1561554000000, "weddingId": 1, "freeLimit": 1234, "weixinUid": "", "activityId": "3", "nickname": "", "activity": { "activityType": 4, "brickId": 5, "drawStatus": 0, "id": 3, "joinLimit": 100, "prizeList": [{ "activityId": 3, "id": 5, "prizeCount": 5, "prizeImage": "//yun.duiba.com.cn/db_games/3.jpg", "prizeName": "喜糖摇摇乐奖品1", "prizeRemain": 0, "prizeType": 1, "weddingId": 1 }, { "activityId": 3, "id": 6, "prizeCount": 5, "prizeImage": "//yun.duiba.com.cn/upload/uP99F1462438316972.png", "prizeName": "喜糖摇摇乐奖品2", "prizeRemain": 1, "prizeType": 2, "weddingId": 1 }], "rankEndTime": 1561550400000, "weddingId": 1 } };
window['ballscore-p']=0.1;
var CFG = { "actId": "3335069", "oaId": "3335069", "unitName": "积分", "btnUnitName": "积分", "doJoin": "/hdtool/doJoin?dpm=1.3.1.0&activityId=3335069", "quireOrder": "/hdtool/getOrderStatus", "styleConfig": "/hdtool/getHdtoolConfig", "getElement": "/hdtool/ajaxElement", "getPrizeDetail": "/hdtool/prizeDetail", "ajaxThroughInfo": "/hdtool/ajaxThroughInfo", "throughSubmit": "/hdtool/throughSubmit", "gameGetOrder": "/hdtool/getOrderInfo", "gameSubmit": "/hdtool/gameSubmit", "doSubmit": "/hdtool/submit", "adslotId": "", "consumerId": "1", "isNotLoginUser": false, "uid": "1", "hdType": "duiba", "hdToolId": "42363", "appType": "credits", "subType": "custom", "directSendCoupon": "false", "ajaxAction": "", "recommendQueue": "/recommend/getRecommend", "recommendSkin": "/recommend/getRecommendSkin", "isShowDetail": true, "preview": false, "from": "", "login": "//activity.m.duiba.com.cn/hdtool/login?dpm=1.3.3.0", "flowRedirectUrl": "", "flowRedirectTuiaUrl": "", "isOpenRecommend": false, "getCreditsLink": "http://baidu.com?uid=1&dbnewopen", "appId": "1", "recordUrl": "//activity.m.duiba.com.cn/crecord/record?dbnewopen&dpm=1.3.2.0", "shareDesc": "分享分享文案文案", "entranceDesc": "测试领奖,也可到我的奖品领奖,24小时内有效哦", "isSHowMeat": true, "needCouponModal": true, "needRecommendModal": true, "asyncFiles": [], "shareAndroidLinkActivity": "http://www.duiba.com.cn", "shareIosLinkActivity": "http://www.iqiyi.com", "appName": "custom", "needShare": true, "shareTitle": "", "shareSubTitle": "", "sharePicUrl": "", "shareLink": "", "shareAndroidDeeplink": "", "shareIOSDeeplink": "" };
function requirelogin() {
console.log('requirelogin');
......@@ -75,7 +73,7 @@
}
var options = {};//window['inputOptions'] ||
window['shuijf'].startup(document.getElementById('gameContainer'), options, onProcess);
window['new-kickball'].startup(document.getElementById('gameContainer'), options, onProcess);
}, 100);
</script>
<script>
......
{
"name": "shuijf",
"name": "new-kickball",
"engineConfig": {
"fps": 63,
"designWidth": 750,
"designHeight": 1624,
"designHeight": 1334,
"scaleMode": "fixedWidth",
"modifyCanvasSize": false,
"resPath": ""
......@@ -16,8 +16,7 @@
"entryScene": "main"
},
"webServiceUrl-": "http://10.10.93.204:7555 http://localhost:3010",
"webServiceUrl1": "http://localhost:4001",
"webServiceUrl": ""
"webServiceUrl": "http://localhost:4001"
},
"dataCenterConfig": {
"dataCenterRoot": [
......
{
"success": true,
"code": null,
"desc": null,
"timestamp": 1561363232162,
"data": 1000
}
\ No newline at end of file
{
"success": true,
"code": null,
"desc": null,
"timestamp": 1561445946866,
"data": {
"orderId": 123,
"prizeId": null,
"title": null,
"freeLimit":7,
"prizeType": 1,
"orderStatus": 1,
"imgurl": null,
"link": null
}
}
\ No newline at end of file
{
"success": false,
"code": "400001",
"desc": null,
"timestamp": 1561625108247,
"data": 123
}
\ No newline at end of file
{
"success": true,
"code": null,
"desc": null,
"timestamp": 1561625108247,
"data": {
"openPrize": true,
"weiXinUid": "weiXinUid",
"nickName": "nickName",
"avatar": "nickName",
"score": 1,
"rank": "未上榜",
"prizeType": 1,
"list": []
}
}
\ No newline at end of file
......@@ -64,7 +64,7 @@
"id": 15585
}
],
"rule": "adsfasdf",
"rule": "xxxxxxxxxxxxxxxxxyyy<p><span style='color: rgb(51, 51, 51);'>yyyyyyyyyy活动规则活动规则活动规则活动规则活动规则活动规则活动规则活动规则活动规则</span></p><p>hello</p><p>hello</p><p>hello</p><p>hello</p><p>hello</p><p>hello</p><p>hello</p><p>hello</p><p>hello</p><p>hello</p><p>hello</p><p>hello endyyyyyyy</p>",
"type": "hdtool",
"element": {
"isCreditsTypeOpen": false,
......
{
"success": true,
"code": "2",
"desc": "OK",
"timestamp": 1548915321930,
"data": 123456
}
\ No newline at end of file
{"success":true,"code":"0000000000","desc":"OK","timestamp":1548915321930,"data":123456}
{
"code": "1C000000001",
"data": {
"creditsInfo": {
"activityId": 21194,
"score": 31,
"recordStatus": 1,
"developerBizId": "3013273",
"prizeId": 1
},
"lottery": {
"imgUrl": "//yun.duiba.com.cn/babi/img/q7yx1sus73.gif",
"imgUrl1": "//yun.duiba.com.cn/developer/img/activityTool/slotMachine/alipay.png",
"itemId": 20348,
"appHidden": true,
"link": "//activity.m.duibatest.com.cn/activity/takePrizeNew?recordId=3395303&dbnewopen",
"id": 9,
"title": "虚拟商品",
"type": "v",
"isDownloadUrl": true
},
"element": {
"isCreditsTypeOpen": false,
"myCreditsLong": 4993862,
"freeLimit": 2,
"success": true,
"myCredits": "4993862",
"needCredits": "200",
"freeEmpty": false,
"needCreditsLong": 200,
"status": 5
}
},
"success": true,
"desc": "OK",
"timestamp": 1550543212313
}
\ No newline at end of file
{"success":true,"code":"0000000000","desc":"OK","timestamp":1548923950498,"data":{"element":{"success":false,"isCreditsTypeOpen":false,"needCredits":"100","myCredits":"999999630434","myCreditsLong":999999630434,"needCreditsLong":100,"freeLimit":-1,"status":1,"freeEmpty":true},"lottery":{"id":null,"type":"thanks","imgUrl":null,"link":null,"title":null,"itemId":null,"appItemId":null,"bonus":null,"bonusMin":null,"bonusMax":null,"needAccount":null,"appLucky":null,"tip":null,"useBtnText":null,"validate":null,"couponCode":null,"couponKey":null,"stInfoDpmImg":null,"stInfoDpmClose":null,"stInfoDpmGoUse":null,"showUse":null,"openUrl":null,"iosDownloadUrl":null,"androidDownloadUrl":null,"isDownloadUrl":null,"confirm":null,"phaseNumber":null,"happyCode":null,"appHidden":true,"zybangJson":null},"exposure":null,"creditsInfo":{"activityId":82567,"prizeId":4,"orderNum":null,"developerBizId":"3029576","score":null,"recordStatus":1,"errorMsg":null},"againTag":null}}
{
"success": true,
"code": "0",
"desc": "OK",
"code": "xC000000001",
"desc": "12313213",
"timestamp": 1550570639368,
"data": {
"orderId": "12345",
"orderId": "883006813674240289",
"submitToken": "d895deb9118f4b938d0b70a3dd2ace19",
"credits": "999999491765",
"unitName": "金币",
......
{
"name": "shuijf",
"name": "new-kickball",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"livereload": "livereload . -ee jpg,png,html",
"livereload": "livereload . -ee scene,jpg,png,html",
"mock": "game-cli m -p 4001 -f './mock'",
"server": "game-cli serve -p 3001",
"dev": "game-cli dev"
......@@ -12,7 +12,7 @@
"build": {
"build-process": "scilla",
"release-path": "./dist",
"remote-path": "activity/shuijf",
"remote-path": "activity/new-kickball",
"version": ""
},
"dependencies": {
......
......@@ -2,7 +2,7 @@
* Created by rockyl on 2018-12-12.
*/
import {EventEmitter} from 'scilla'
import {EventEmitter} from 'scilla/src'
const eventEmitter = new EventEmitter();
......
......@@ -4,7 +4,7 @@
import {
utils,
} from 'scilla'
} from 'scilla/src'
const options: any = {};
......
......@@ -3,94 +3,103 @@
* DO NOT MODIFY THIS FILE
*/
import {registerDef} from 'scilla'
import {engine} from 'scilla'
import component0 from 'components/renderer/RectRenderer';
registerDef('components/renderer/RectRenderer', component0);
import component0 from 'components/other/CameraController';
engine.registerDef('components/other/CameraController', component0);
import component1 from 'components/base/Transform';
registerDef('components/base/Transform', component1);
engine.registerDef('components/base/Transform', component1);
import component2 from 'components/renderer/HtmlRenderer';
registerDef('components/renderer/HtmlRenderer', component2);
import component2 from 'components/renderer/TextureRenderer';
engine.registerDef('components/renderer/TextureRenderer', component2);
import component3 from 'components/base/TouchInterrupt';
registerDef('components/base/TouchInterrupt', component3);
import component3 from 'components/renderer/TextRenderer';
engine.registerDef('components/renderer/TextRenderer', component3);
import component4 from 'components/other/RelativeLayout';
registerDef('components/other/RelativeLayout', component4);
import component4 from 'components/animation/TouchZoom';
engine.registerDef('components/animation/TouchZoom', component4);
import component5 from 'components/ui/ScrollView';
registerDef('components/ui/ScrollView', component5);
import component5 from 'components/ui/Button';
engine.registerDef('components/ui/Button', component5);
import component6 from 'components/other/FullStageSize';
registerDef('components/other/FullStageSize', component6);
engine.registerDef('components/other/FullStageSize', component6);
import component7 from 'components/other/CameraController';
registerDef('components/other/CameraController', component7);
import component7 from 'components/other/RelativeLayout';
engine.registerDef('components/other/RelativeLayout', component7);
import component8 from 'components/renderer/TextureRenderer';
registerDef('components/renderer/TextureRenderer', component8);
import component8 from 'components/renderer/RectRenderer';
engine.registerDef('components/renderer/RectRenderer', component8);
import component9 from 'components/animation/TouchZoom';
registerDef('components/animation/TouchZoom', component9);
import component9 from 'components/base/TouchInterrupt';
engine.registerDef('components/base/TouchInterrupt', component9);
import component10 from 'components/ui/Button';
registerDef('components/ui/Button', component10);
import component10 from 'components/ui/ScrollView';
engine.registerDef('components/ui/ScrollView', component10);
import component11 from 'components/renderer/TextRenderer';
registerDef('components/renderer/TextRenderer', component11);
import component11 from 'components/renderer/HtmlRenderer';
engine.registerDef('components/renderer/HtmlRenderer', component11);
import component12 from '../../assets/scripts/dialogs/RuleDialogContent';
registerDef('./scripts/dialogs/RuleDialogContent', component12);
import component12 from '../../assets/scripts/api/SamplePollingApi';
engine.registerDef('./scripts/api/SamplePollingApi', component12);
import component13 from '../../assets/scripts/scenes/ScenePlay';
registerDef('./scripts/scenes/ScenePlay', component13);
engine.registerDef('./scripts/scenes/ScenePlay', component13);
import component14 from '../../assets/scripts/scenes/SceneResult';
registerDef('./scripts/scenes/SceneResult', component14);
import component14 from '../../assets/scripts/scenes/scenePlay/ngameSubmit';
engine.registerDef('./scripts/scenes/scenePlay/ngameSubmit', component14);
import component15 from '../../assets/scripts/scenes/SceneStart';
registerDef('./scripts/scenes/SceneStart', component15);
import component15 from '../../assets/scripts/scenes/scenePlay/BallManager';
engine.registerDef('./scripts/scenes/scenePlay/BallManager', component15);
import component16 from '../../assets/scripts/navigator/SingleSceneNavigator';
registerDef('./scripts/navigator/SingleSceneNavigator', component16);
import component16 from '../../assets/scripts/scenes/SceneController';
engine.registerDef('./scripts/scenes/SceneController', component16);
import component17 from '../../assets/scripts/scenes/result/RankList';
registerDef('./scripts/scenes/result/RankList', component17);
import component17 from '../../assets/scripts/scenes/SceneStart';
engine.registerDef('./scripts/scenes/SceneStart', component17);
import component18 from '../../assets/scripts/scenes/SceneController';
registerDef('./scripts/scenes/SceneController', component18);
import component18 from '../../assets/scripts/MainController';
engine.registerDef('./scripts/MainController', component18);
import component19 from '../../assets/scripts/popup/Popup';
registerDef('./scripts/popup/Popup', component19);
import component19 from '../../assets/scripts/scenes/scenePlay/CarBulletAni';
engine.registerDef('./scripts/scenes/scenePlay/CarBulletAni', component19);
import component20 from '../../assets/scripts/api/SampleApi';
registerDef('./scripts/api/SampleApi', component20);
import component20 from '../../assets/scripts/scenes/scenePlay/CarShootAni';
engine.registerDef('./scripts/scenes/scenePlay/CarShootAni', component20);
import component21 from '../../assets/scripts/scenes/SceneGuide';
registerDef('./scripts/scenes/SceneGuide', component21);
import component21 from '../../assets/scripts/popup/Popup';
engine.registerDef('./scripts/popup/Popup', component21);
import component22 from '../../assets/scripts/game/CustomTextRenderer';
registerDef('./scripts/game/CustomTextRenderer', component22);
import component22 from '../../assets/scripts/api/SampleApi';
engine.registerDef('./scripts/api/SampleApi', component22);
import component23 from '../../assets/scripts/MainController';
registerDef('./scripts/MainController', component23);
import component23 from '../../assets/scripts/dialogs/AlertDialogContent';
engine.registerDef('./scripts/dialogs/AlertDialogContent', component23);
import component24 from '../../assets/scripts/dialogs/AlertDialogContent';
registerDef('./scripts/dialogs/AlertDialogContent', component24);
import component24 from '../../assets/scripts/dialogs/RuleDialogContent';
engine.registerDef('./scripts/dialogs/RuleDialogContent', component24);
import component25 from '../../assets/scripts/dialogs/PrizeDialogContent';
registerDef('./scripts/dialogs/PrizeDialogContent', component25);
import component25 from '../../assets/scripts/scenes/BulletItem';
engine.registerDef('./scripts/scenes/BulletItem', component25);
import component26 from '../../assets/scripts/dialogs/ScoreDialogContent';
registerDef('./scripts/dialogs/ScoreDialogContent', component26);
import component26 from '../../assets/scripts/game/CustomTextRenderer';
engine.registerDef('./scripts/game/CustomTextRenderer', component26);
import component27 from '../../assets/scripts/common/Toast';
registerDef('./scripts/common/Toast', component27);
import component27 from '../../assets/scripts/navigator/SingleSceneNavigator';
engine.registerDef('./scripts/navigator/SingleSceneNavigator', component27);
import component28 from '../../assets/scripts/Icon';
registerDef('./scripts/Icon', component28);
import component28 from '../../assets/scripts/dialogs/GameOverPanel';
engine.registerDef('./scripts/dialogs/GameOverPanel', component28);
import component29 from '../../assets/scripts/scenes/result/RankItem';
registerDef('./scripts/scenes/result/RankItem', component29);
import component29 from '../../assets/scripts/common/Toast';
engine.registerDef('./scripts/common/Toast', component29);
import component30 from '../../assets/scripts/scenes/BallItem';
engine.registerDef('./scripts/scenes/BallItem', component30);
import component31 from '../../assets/scripts/scenes/RocketItem';
engine.registerDef('./scripts/scenes/RocketItem', component31);
import component32 from '../../assets/scripts/scenes/scenePlay/DropManager';
engine.registerDef('./scripts/scenes/scenePlay/DropManager', component32);
......@@ -4,8 +4,8 @@
* 游戏入口
*/
import {modifyEngineConfig} from 'scilla'
import ScillaLauncher from 'launcher'
import {modifyEngineConfig} from 'scilla/src'
import ScillaLauncher from 'scilla-launcher/src'
import './generated/MustCompile'
let launcher: ScillaLauncher;
......
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