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 - scilla editor v0.0.30
- fps改成63,提升fps # 步骤
- 使用fixedWidth - 使用v0.0.30的create模板hello-scilla
- webServiceUrl - 使用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 - 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": { "root": {
"uuid": "20190301114308", "uuid": "20190301114308",
"components": [ "components": [
{ {
"script": "components/base/Transform" "script": "components/base/Transform"
},
{
"script": "components/other/CameraController"
} }
], ],
"children": [ "children": [
{ {
"uuid": "20190301114245", "uuid": "20190301114245",
"name": "i1", "name": "BallItem",
"components": [ "components": [
{ {
"script": "components/base/Transform", "script": "components/base/Transform",
"properties": {} "properties": {}
}, },
{ {
"script": "./scripts/Icon", "script": "./scripts/scenes/BallItem",
"properties": {} "properties": {
"scoreTxt": "entity|8abfc716-7017-4834-a7fa-5ca6c2ce4b3e"
}
} }
], ],
"children": [ "children": [
{ {
"name": "Image", "name": "pic",
"components": [ "components": [
{ {
"script": "components/base/Transform", "script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": { "properties": {
"texture": "res|5ea53bf0-8a58-420c-8c25-fc1724e4865b" "alpha": 0
} }
}
],
"uuid": "3348f059-ffca-4670-9cbc-d9fdd014a17f"
},
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
}, },
{ {
"script": "components/renderer/TextureRenderer", "script": "components/renderer/TextureRenderer",
"properties": { "properties": {
"texture": "res|c2836212-2459-4c1d-a294-1ed49e197229" "texture": "res|5367ae30-00ee-4296-8779-158f8fbd68f2"
} }
} }
], ],
"uuid": "b083dc1a-32c1-4223-bd92-6a5a08d61761" "uuid": "fb53fa37-a942-4474-901a-582dccd14c93"
}, },
{ {
"name": "Image", "name": "blue",
"components": [ "components": [
{ {
"script": "components/base/Transform", "script": "components/base/Transform",
...@@ -64,14 +55,14 @@ ...@@ -64,14 +55,14 @@
{ {
"script": "components/renderer/TextureRenderer", "script": "components/renderer/TextureRenderer",
"properties": { "properties": {
"texture": "res|c9272a2e-6151-4b87-a700-32ac4a12caee" "texture": "res|5367ae30-00ee-4296-8779-158f8fbd68f2"
} }
} }
], ],
"uuid": "7f878b93-5f00-4087-aa94-522d6b1fdd8d" "uuid": "bd5eee18-b584-4e7b-817f-17924c204a24"
}, },
{ {
"name": "Image", "name": "purple",
"components": [ "components": [
{ {
"script": "components/base/Transform", "script": "components/base/Transform",
...@@ -80,14 +71,14 @@ ...@@ -80,14 +71,14 @@
{ {
"script": "components/renderer/TextureRenderer", "script": "components/renderer/TextureRenderer",
"properties": { "properties": {
"texture": "res|fb22f965-457d-4514-a322-95149ecdee79" "texture": "res|3aad1b7b-89ec-4565-afa2-a16d36d7b721"
} }
} }
], ],
"uuid": "7c640bd9-d699-4fca-9d96-2e75f4f927b1" "uuid": "23ad1a6b-0041-472e-b2b4-b6d615f6d6f9"
}, },
{ {
"name": "Image", "name": "red",
"components": [ "components": [
{ {
"script": "components/base/Transform", "script": "components/base/Transform",
...@@ -96,14 +87,14 @@ ...@@ -96,14 +87,14 @@
{ {
"script": "components/renderer/TextureRenderer", "script": "components/renderer/TextureRenderer",
"properties": { "properties": {
"texture": "res|e143dfc7-324e-4635-a776-2f6c0d1ce845" "texture": "res|e624e863-53d4-41f7-bc95-924579fe8025"
} }
} }
], ],
"uuid": "2aa87abd-5f1a-469e-9461-eb7e12779e04" "uuid": "5adf946c-1307-443a-9c4b-73e1ce864a69"
}, },
{ {
"name": "Image", "name": "green",
"components": [ "components": [
{ {
"script": "components/base/Transform", "script": "components/base/Transform",
...@@ -112,14 +103,14 @@ ...@@ -112,14 +103,14 @@
{ {
"script": "components/renderer/TextureRenderer", "script": "components/renderer/TextureRenderer",
"properties": { "properties": {
"texture": "res|511ce403-5c36-48e6-9b5c-b3bbfd9b210d" "texture": "res|853cc248-89dc-40f1-8f16-48007e6d8ef3"
} }
} }
], ],
"uuid": "58db0986-92aa-4828-9f2c-064174addb21" "uuid": "023cb819-56e2-4ba7-b052-786e0766d255"
}, },
{ {
"name": "Image", "name": "darkBlue",
"components": [ "components": [
{ {
"script": "components/base/Transform", "script": "components/base/Transform",
...@@ -128,43 +119,54 @@ ...@@ -128,43 +119,54 @@
{ {
"script": "components/renderer/TextureRenderer", "script": "components/renderer/TextureRenderer",
"properties": { "properties": {
"texture": "res|04ae0a39-6624-488e-b52d-97f7a03baf8f" "texture": "res|9cc48379-a01c-4cd1-9196-220016eb9797"
} }
} }
], ],
"uuid": "7b51b9ce-7f6e-4fc2-8ddc-bcd3e619e773" "uuid": "8cd279f5-9c19-4179-9b93-fdb0b8a7dcca"
}, },
{ {
"name": "Image", "name": "yellow",
"components": [ "components": [
{ {
"script": "components/base/Transform", "script": "components/base/Transform",
"properties": {} "properties": {
"position": {
"_hashCode": 44907,
"_x": 0,
"_y": 0
}
}
}, },
{ {
"script": "components/renderer/TextureRenderer", "script": "components/renderer/TextureRenderer",
"properties": { "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": [ "components": [
{ {
"script": "components/base/Transform", "script": "components/base/Transform",
"properties": {} "properties": {}
}, },
{ {
"script": "components/renderer/TextureRenderer", "script": "components/renderer/TextRenderer",
"properties": { "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 diff is collapsed.
/**
* 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 ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { engine, Entity } from "scilla/src"; import { dynamic, engine, Entity } from "scilla/src";
import { initEnv } from "./common/BuriedPoint";
import Toast from "./common/Toast"; import Toast from "./common/Toast";
import { initEnv } from "./common/BuriedPoint";
import Popup from "./popup/Popup"; import Popup from "./popup/Popup";
export default class MainController extends ScillaComponent { export default class MainController extends ScillaComponent {
Popup: Entity;//PopupContainer 弹窗容器 Popup: Entity;//PopupContainer 弹窗容器
Toast: Entity;//toast 实体 Toast: Entity;//toast 实体
hdToolId: dynamic;
actId: dynamic;
private _toast: Toast; private _toast: Toast;
private _popup: Popup; private _popup: Popup;
// fuckNavigator(p) {
// console.log('fuckNavigator from MainController', p)
// }
onAwake() { onAwake() {
super.onAwake(); super.onAwake();
...@@ -21,47 +26,42 @@ export default class MainController extends ScillaComponent { ...@@ -21,47 +26,42 @@ export default class MainController extends ScillaComponent {
initEnv(); initEnv();
console.log('游戏刷新了...'); this.broadcast('callApi', 1, 'ajaxElement', { duibaId: this.hdToolId, activityId: this.actId })
// const limit = localStorage.getItem('')
} }
onGotAjaxElement() {
this.broadcast('initGameStage');
// onGotAjaxElement() { }
// setTimeout(() => {
// this.broadcast('initGameStage');
// }, 1000);
// }
// onGotAjaxElementError(e) { onGotAjaxElementError(e) {
// console.log(e); console.log(e);
// // if (typeof e === 'string') { // if (typeof e === 'string') {
// // switch (e) { // switch (e) {
// // case '0100016': //活动未开始 // case '0100016': //活动未开始
// // case '0100014': //活动已结束 // case '0100014': //活动已结束
// // case '0100017': //活动已关闭 // case '0100017': //活动已关闭
// // this.showErrorToast(e); // this.showErrorToast(e);
// // break; // break;
// // default: // default:
// // this.showNetError(); // this.showNetError();
// // } // }
// // } else { // } else {
// // this.showNetError(); // this.showNetError();
// // } // }
// } }
// showErrorToast(e) { showErrorToast(e) {
// // switch (e) { // switch (e) {
// // case '0100016': //活动未开始 // case '0100016': //活动未开始
// // this.showToast('活动未开始,暂时无法参与'); // this.showToast('活动未开始,暂时无法参与');
// // break; // break;
// // case '0100014': //活动已结束 // case '0100014': //活动已结束
// // case '0100017': //活动已关闭 // case '0100017': //活动已关闭
// // this.showToast('活动已结束,无法参与'); // this.showToast('活动已结束,无法参与');
// // break; // break;
// // } // }
// } }
showToast(content, duration?) { showToast(content, duration?) {
this._toast.show({ 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 @@ ...@@ -4,16 +4,16 @@
* 简单的api组件 * 简单的api组件
*/ */
import { utils, } from 'scilla/src' import {utils, } from 'scilla/src'
import ApiComponent from "./ApiComponent"; import ApiComponent from "./ApiComponent";
import { callApi } from "../net/webService"; import {callApi} from "../net/webService";
export default class SampleApi extends ApiComponent { export default class SampleApi extends ApiComponent {
uri: string; uri: string;
ignoreSuccessField = false; ignoreSuccessField = false;
async callApi(name, paramsInput, ...args) { async callApi(name, paramsInput, ...args){
if (this.name == name) { if(this.name == name){
await this.execute(paramsInput, ...args); await this.execute(paramsInput, ...args);
} }
} }
...@@ -23,22 +23,20 @@ export default class SampleApi extends ApiComponent { ...@@ -23,22 +23,20 @@ export default class SampleApi extends ApiComponent {
const params = {}; const params = {};
if (this.params) { if(this.params){
utils.injectProp(params, this.params); utils.injectProp(params, this.params);
} }
if (paramsInput) { if(paramsInput){
utils.injectProp(params, paramsInput); utils.injectProp(params, paramsInput);
} }
const { uri, method } = this; const {uri, method} = this;
try { try {
console.log(`${uri}==>${JSON.stringify(params)}`);
const response = await callApi(uri, params, method, 'json', this.ignoreSuccessField); const response = await callApi(uri, params, method, 'json', this.ignoreSuccessField);
this.onGotResponse(response); this.onGotResponse(response);
console.log(`${uri}<<==${JSON.stringify(response)}`);
return response.data; return response.data;
} catch (e) { } 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"; ...@@ -11,8 +11,7 @@ import Transform from "scilla-components/src/base/Transform";
export default class Toast extends ScillaComponent { export default class Toast extends ScillaComponent {
Label: Entity; Label: Entity;
ypadding = 20; padding = 20;
xpadding = 50;
offsetY = 0; offsetY = 0;
showDuration = 300; showDuration = 300;
hideDuration = 300; hideDuration = 300;
...@@ -51,13 +50,13 @@ export default class Toast extends ScillaComponent { ...@@ -51,13 +50,13 @@ export default class Toast extends ScillaComponent {
show({content, duration = 1000}) { show({content, duration = 1000}) {
this.entity.enabled = true; this.entity.enabled = true;
const {_bgTransform, _labelRenderer, _labelTransform, xpadding,ypadding} = this; const {_bgTransform, _labelRenderer, _labelTransform, padding} = this;
_labelRenderer.text = content; _labelRenderer.text = content;
_labelRenderer.measureBounds(); _labelRenderer.measureBounds();
_bgTransform.width = _labelTransform.width + xpadding * 2; _bgTransform.width = _labelTransform.width + padding * 2;
_bgTransform.height = _labelTransform.height + ypadding * 2; _bgTransform.height = _labelTransform.height + padding * 2;
this._tweenOut.queue[0].props.position.y = this.outPos; 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 @@ ...@@ -5,19 +5,17 @@
*/ */
import DialogContent from "../popup/DialogContent"; import DialogContent from "../popup/DialogContent";
import { Entity } from "scilla/src";
import { setText } from "../entityUtils";
export default class AlertDialogContent extends DialogContent { export default class AlertDialogContent extends DialogContent {
content: Entity;
onAwake() { onAwake() {
super.onAwake(); super.onAwake();
} }
protected onTapCloseButton() {
super.onTapCloseButton();
this.bubbling('fuckNavigator', 'start');
}
setup(data: any = {}) { 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 { ...@@ -20,7 +20,7 @@ export default class RuleDialogContent extends DialogContent {
} }
setup(data) { 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"; ...@@ -2,5 +2,5 @@ import { TextRenderer } from "scilla-components/src";
import { Entity } from "scilla/src"; import { Entity } from "scilla/src";
export const setText = (entity: Entity, text) => { 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 ...@@ -17,19 +17,7 @@ export const getTween = (context, val: Transform | Entity | ScillaComponent, obj
delete obj[key]; 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.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); 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 @@ ...@@ -5,12 +5,8 @@
*/ */
import ScillaComponent from "scilla-components/src/base/ScillaComponent"; import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { ScenePlay, SceneStart } from "../scenes";
import { VirtualNavigator } from "./VirtualNavigator"; 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 { export default class SingleSceneNavigator extends ScillaComponent {
_navigator: VirtualNavigator; _navigator: VirtualNavigator;
...@@ -20,8 +16,6 @@ export default class SingleSceneNavigator extends ScillaComponent { ...@@ -20,8 +16,6 @@ export default class SingleSceneNavigator extends ScillaComponent {
this._navigator = new VirtualNavigator(this.entity); this._navigator = new VirtualNavigator(this.entity);
this._navigator.register('start', 'SceneStart', SceneStart); this._navigator.register('start', 'SceneStart', SceneStart);
this._navigator.register('play', 'ScenePlay', ScenePlay); this._navigator.register('play', 'ScenePlay', ScenePlay);
this._navigator.register('guide', 'SceneGuide', SceneGuide);
this._navigator.register('result', 'SceneResult', SceneResult);
} }
onAwake() { 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 ...@@ -117,6 +117,6 @@ export class VirtualNavigator extends EventEmitter implements INavigatorDelegate
* @param error * @param error
*/ */
onError(error: 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 @@ ...@@ -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 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 { none } from "./PopupEffect";
import { createTween, Entity } from "scilla/src";
import SingleSceneNavigator from "../navigator/SingleSceneNavigator";
export default class Popup extends ScillaComponent { export default class Popup extends ScillaComponent {
blackLayerDuration = 300; blackLayerDuration = 300;
bgRenderer: Entity; private _bgRenderer: RectRenderer;
private _touchInterrupt: TouchInterrupt; private _touchInterrupt: TouchInterrupt;
private _dialogStack = []; private _dialogStack = [];
...@@ -28,11 +28,10 @@ export default class Popup extends ScillaComponent { ...@@ -28,11 +28,10 @@ export default class Popup extends ScillaComponent {
this._touchInterrupt = this.getComponent(TouchInterrupt); this._touchInterrupt = this.getComponent(TouchInterrupt);
this._touchInterrupt.enabled = false; this._touchInterrupt.enabled = false;
// this.bgRenderer.enabled = false; const bgRenderer = this._bgRenderer = this.getComponent(RectRenderer);
bgRenderer.enabled = false;
this._navigator = this.sceneContainer.getComponent(SingleSceneNavigator); this._navigator = this.sceneContainer.getComponent(SingleSceneNavigator)
this.entity.children.forEach(child => child.enabled = false);
} }
fuckNavigator(p) { fuckNavigator(p) {
...@@ -53,18 +52,17 @@ export default class Popup extends ScillaComponent { ...@@ -53,18 +52,17 @@ export default class Popup extends ScillaComponent {
} }
setBgVisible(visible) { setBgVisible(visible) {
this.bgRenderer.enabled = visible; if (visible) {
// if (visible) { this._bgRenderer.enabled = true;
// this._bgRenderer.enabled = true; }
// } this._bgRenderer.alpha = visible ? 0 : 1;
// this._bgRenderer.alpha = visible ? 0 : 1; createTween(this, this._bgRenderer, true)
// createTween(this, this._bgRenderer, true) .to({ alpha: visible ? 1 : 0 }, this.blackLayerDuration)
// .to({ alpha: visible ? 1 : 0 }, this.blackLayerDuration) .call(() => {
// .call(() => { if (!visible) {
// if (!visible) { this._bgRenderer.enabled = false;
// this._bgRenderer.enabled = false; }
// } });
// });
} }
getDialogInStack(name) { getDialogInStack(name) {
...@@ -120,7 +118,7 @@ export default class Popup extends ScillaComponent { ...@@ -120,7 +118,7 @@ export default class Popup extends ScillaComponent {
const effect = content ? content.effectImpl : none; const effect = content ? content.effectImpl : none;
const effectOptions = content ? content.showEffectOptions : null; const effectOptions = content ? content.showEffectOptions : null;
// await effect.show(transform, effectOptions); await effect.show(transform, effectOptions);
} }
async hideDialog(name, action?: string, data?) { async hideDialog(name, action?: string, data?) {
...@@ -145,7 +143,7 @@ export default class Popup extends ScillaComponent { ...@@ -145,7 +143,7 @@ export default class Popup extends ScillaComponent {
const effect = content ? content.effectImpl : none; const effect = content ? content.effectImpl : none;
const effectOptions = content ? content.hideEffectOptions : null; const effectOptions = content ? content.hideEffectOptions : null;
// await effect.hide(transform, effectOptions); await effect.hide(transform, effectOptions);
dialog.enabled = false; dialog.enabled = false;
if (dialogConfig.callback) { 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 { ...@@ -8,6 +8,7 @@ export default class SceneController extends ScillaComponent {
} }
fuck(p) { fuck(p) {
// console.log('fuck',p)
const nav = this.entity.getComponent(SingleSceneNavigator); const nav = this.entity.getComponent(SingleSceneNavigator);
nav.push(p) 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"}
This diff is collapsed.
{"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"}
This diff is collapsed.
{"ver":"1.0.1","uuid":"83555ffb-9b5c-47af-a811-b9315ca88211","subMetas":{},"type":"script"}
This diff is collapsed.
{"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}
This diff is collapsed.
{"ver":"1.0.1","uuid":"ea6e2329-3083-471f-b71a-a9bdbe9f3cb2","subMetas":{},"type":"script"}
This diff is collapsed.
{"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}
This diff is collapsed.
{"ver":"1.0.1","uuid":"1e2f418c-2d41-4d72-8a40-34cb834e99f6","subMetas":{},"type":"script"}
This diff is collapsed.
{"ver":"1.0.1","uuid":"8525cc2b-6dbc-4f0e-9fe1-256a2811c705","subMetas":{},"type":"script"}
This diff is collapsed.
{"ver":"1.0.1","uuid":"e78ad988-e1f0-4505-a1c7-8d40b26790c2","subMetas":{},"type":"script"}
This diff is collapsed.
{"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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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