Commit 884f7178 authored by wildfirecode's avatar wildfirecode

1

parent e13d9f0d
{"currentScene":"assets/prefabs/icon1.pfb"} {"currentScene":"assets/prefabs/i1.pfb"}
\ No newline at end of file \ No newline at end of file
{"name":"i1","root":{"uuid":"20190301114308","components":[{"script":"components/base/Transform"}],"children":[{"uuid":"20190301114245","name":"i1","components":[{"script":"components/base/Transform","properties":{}}],"children":[{"name":"Image","components":[{"script":"components/base/Transform","properties":{}},{"script":"components/renderer/TextureRenderer","properties":{"texture":"res|82c35ef6-869e-4f5e-8f0b-36c899ed6b39"}}],"uuid":"3348f059-ffca-4670-9cbc-d9fdd014a17f"}]}]}} {
\ No newline at end of file "name": "i1",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "i1",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/Icon",
"properties": {}
}
],
"children": [
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|5ea53bf0-8a58-420c-8c25-fc1724e4865b"
}
}
],
"uuid": "3348f059-ffca-4670-9cbc-d9fdd014a17f"
},
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|c2836212-2459-4c1d-a294-1ed49e197229"
}
}
],
"uuid": "b083dc1a-32c1-4223-bd92-6a5a08d61761"
},
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|c9272a2e-6151-4b87-a700-32ac4a12caee"
}
}
],
"uuid": "7f878b93-5f00-4087-aa94-522d6b1fdd8d"
},
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|fb22f965-457d-4514-a322-95149ecdee79"
}
}
],
"uuid": "7c640bd9-d699-4fca-9d96-2e75f4f927b1"
},
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|e143dfc7-324e-4635-a776-2f6c0d1ce845"
}
}
],
"uuid": "2aa87abd-5f1a-469e-9461-eb7e12779e04"
},
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|511ce403-5c36-48e6-9b5c-b3bbfd9b210d"
}
}
],
"uuid": "58db0986-92aa-4828-9f2c-064174addb21"
},
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|04ae0a39-6624-488e-b52d-97f7a03baf8f"
}
}
],
"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"
}
}
],
"uuid": "d05c4a07-1471-43a9-b369-c90a497c2c79"
},
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|c3361b0e-b03a-4fff-a4b3-b20adde85547"
}
}
],
"uuid": "cca2f2c2-6226-4dcc-bfcc-2e6824ee2cd8"
}
]
}
]
}
}
\ No newline at end of file
{
"name": "i2",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "i2",
"components": [
{
"script": "components/base/Transform",
"properties": {}
}
]
}
]
},
"entity-cache": []
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"6ed24859-705a-40ad-abb4-1577dad80d3b","subMetas":{},"type":"prefab"}
{
"name": "i3",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "i3",
"components": [
{
"script": "components/base/Transform",
"properties": {}
}
]
}
]
},
"entity-cache": []
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"d52d8187-3e97-4fbe-96a0-90151e56661d","subMetas":{},"type":"prefab"}
{
"name": "i4",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "i4",
"components": [
{
"script": "components/base/Transform",
"properties": {}
}
]
}
]
},
"entity-cache": []
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"f8b162ac-d9a4-4376-98af-bc4c95c82140","subMetas":{},"type":"prefab"}
{
"name": "i5",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "i5",
"components": [
{
"script": "components/base/Transform",
"properties": {}
}
]
}
]
},
"entity-cache": []
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"2d603fe3-7a29-4b57-9b6c-801817815c86","subMetas":{},"type":"prefab"}
{
"name": "i6",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "i6",
"components": [
{
"script": "components/base/Transform",
"properties": {}
}
]
}
]
},
"entity-cache": []
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"3c2e6d0b-082c-4a03-a61f-a8478a151bd8","subMetas":{},"type":"prefab"}
{
"name": "i7",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "i7",
"components": [
{
"script": "components/base/Transform",
"properties": {}
}
]
}
]
},
"entity-cache": []
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"8f397fb3-800a-49f1-90f5-973a507244fa","subMetas":{},"type":"prefab"}
{
"name": "i8",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "i8",
"components": [
{
"script": "components/base/Transform",
"properties": {}
}
]
}
]
},
"entity-cache": []
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"98db18ff-3a65-4838-9c32-72e329c79efb","subMetas":{},"type":"prefab"}
{
"name": "i9",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "i9",
"components": [
{
"script": "components/base/Transform",
"properties": {}
}
]
}
]
},
"entity-cache": []
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"da62865b-b1e6-410f-8e9a-bfa4f77b7aa5","subMetas":{},"type":"prefab"}
...@@ -415,7 +415,8 @@ ...@@ -415,7 +415,8 @@
"num3": "entity|84900df0-6476-491a-8792-ab6a18568c7d", "num3": "entity|84900df0-6476-491a-8792-ab6a18568c7d",
"box1": "entity|c2fe839a-b7c4-4621-8064-16b16ea1714d", "box1": "entity|c2fe839a-b7c4-4621-8064-16b16ea1714d",
"box2": "entity|4e7a15d9-07c6-44cf-be7b-2393fbcd765f", "box2": "entity|4e7a15d9-07c6-44cf-be7b-2393fbcd765f",
"box3": "entity|a9ecf50b-0bba-4e98-a65e-073ff62f654c" "box3": "entity|a9ecf50b-0bba-4e98-a65e-073ff62f654c",
"iconResource": "res|d6c6eb9d-b2bf-4da7-9017-1fdde2766886"
} }
} }
], ],
...@@ -1290,6 +1291,10 @@ ...@@ -1290,6 +1291,10 @@
}, },
"resource-groups": { "resource-groups": {
"preload": [ "preload": [
{
"uuid": "d6c6eb9d-b2bf-4da7-9017-1fdde2766886",
"url": "prefabs/i1.pfb"
},
{ {
"uuid": "1f737398-ebbb-4a65-9851-0303fd5def02", "uuid": "1f737398-ebbb-4a65-9851-0303fd5def02",
"url": "sheets/play.sht-disperse", "url": "sheets/play.sht-disperse",
......
import ScillaComponent from 'components/base/ScillaComponent'; import ScillaComponent from 'components/base/ScillaComponent';
import { getX, getY, setXY } from './transformUtils';
export default class Icon extends ScillaComponent{ export default class Icon extends ScillaComponent {
onAwake(){ private GRAVITY = .7;
private _vx = 0;
private _vy = 0;
onAwake() {
super.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){ onUpdate(t) {
this._vy += this.GRAVITY;
super.onUpdate(t); 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 { alien } from "../navigator/StackNavigator"; import { Entity, instantiate, resource } from "scilla/src";
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Entity } from "scilla/src";
import { setText } from "../entityUtils"; import { setText } from "../entityUtils";
import { getTween } from "../getTween"; import { getTween } from "../getTween";
import { alien } from "../navigator/StackNavigator";
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { setScale } from "../transformUtils"; import { setScale } from "../transformUtils";
import { Transform } from "scilla-components/src";
export default class ScenePlay extends ScillaComponent implements INavigatorViewBase { export default class ScenePlay extends ScillaComponent implements INavigatorViewBase {
iconResource: resource;
countTxt: Entity; countTxt: Entity;
num1: Entity; num1: Entity;
num2: Entity; num2: Entity;
...@@ -15,15 +15,17 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView ...@@ -15,15 +15,17 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView
box1: Entity; box1: Entity;
box2: Entity; box2: Entity;
box3: Entity; box3: Entity;
private COUNT_DOWN_SEC = 16; private COUNT_DOWN_SEC = 8;
private _startTag = false; private _startTag = false;
private _msPassed = 0; private _msPassed = 0;
private _ballCounter = 0; private _ballCounter = 0;
// private _timeoutTag: boolean;
onAwake() { onAwake() {
super.onAwake(); super.onAwake();
this.showBox1();
this.initText(); this.initText();
this.playCountdown(); this.play321Countdown();
let addCounter = 0; let addCounter = 0;
const add = () => { const add = () => {
...@@ -44,7 +46,9 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView ...@@ -44,7 +46,9 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView
var SHAKE_THRESHOLD = 100; //累积200的速度值出一个球 var SHAKE_THRESHOLD = 100; //累积200的速度值出一个球
var x, y, z, last_x = 0, last_y = 0, last_z = 0; var x, y, z, last_x = 0, last_y = 0, last_z = 0;
var speedCounter = 0; var speedCounter = 0;
var _this = this;
function deviceMotionHandler(eventData) { function deviceMotionHandler(eventData) {
if (!_this._startTag) return;
var acceleration = eventData.accelerationIncludingGravity; var acceleration = eventData.accelerationIncludingGravity;
x = acceleration.x; x = acceleration.x;
...@@ -71,7 +75,7 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView ...@@ -71,7 +75,7 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView
setTimeout(r, ms); setTimeout(r, ms);
}) })
} }
async playCountdown() { async play321Countdown() {
setScale(this.num1, 3); setScale(this.num1, 3);
setScale(this.num2, 3); setScale(this.num2, 3);
setScale(this.num3, 3); setScale(this.num3, 3);
...@@ -88,10 +92,11 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView ...@@ -88,10 +92,11 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView
this.num1.enabled = true; this.num1.enabled = true;
await getTween(this, this.num1, { scalex: 1, scaley: 1 }, 300); await getTween(this, this.num1, { scalex: 1, scaley: 1 }, 300);
await this.wait(600); await this.wait(600);
this.startCountdown(); this.num1.enabled = false;
this.startRealCountdown();
} }
startCountdown() { startRealCountdown() {
this._startTag = true; this._startTag = true;
this._msPassed = 0; this._msPassed = 0;
this._lastTimer = Date.now(); this._lastTimer = Date.now();
...@@ -117,7 +122,8 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView ...@@ -117,7 +122,8 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView
} }
onTimerout() { onTimerout() {
console.log('onTimerout') console.log('onTimerout');
alert(this._ballCounter);
} }
getNumber(num) { getNumber(num) {
...@@ -136,6 +142,32 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView ...@@ -136,6 +142,32 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView
addBall() { addBall() {
this._ballCounter++; this._ballCounter++;
const iocn = instantiate(this.iconResource);
this.entity.addChild(iocn);
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();
}
}
showBox1() {
this.box1.enabled = true;
this.box2.enabled = false;
this.box3.enabled = false;
}
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() { onGameOver() {
......
...@@ -31,7 +31,8 @@ export default class SceneStart extends ScillaComponent implements INavigatorVie ...@@ -31,7 +31,8 @@ export default class SceneStart extends ScillaComponent implements INavigatorVie
onClick_startbtn() { onClick_startbtn() {
this.startbtn.getComponent(Button).enabled = false; this.startbtn.getComponent(Button).enabled = false;
this.sendDojoin(); // this.sendDojoin();
this.bubbling('fuck', 'play');
} }
sendDojoin() { sendDojoin() {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -5,23 +5,23 @@ ...@@ -5,23 +5,23 @@
import {registerDef} from 'scilla' import {registerDef} from 'scilla'
import component0 from 'components/renderer/TextRenderer'; import component0 from 'components/other/CameraController';
registerDef('components/renderer/TextRenderer', component0); registerDef('components/other/CameraController', component0);
import component1 from 'components/base/Transform'; import component1 from 'components/base/Transform';
registerDef('components/base/Transform', component1); registerDef('components/base/Transform', component1);
import component2 from 'components/renderer/HtmlRenderer'; import component2 from 'components/renderer/TextureRenderer';
registerDef('components/renderer/HtmlRenderer', component2); registerDef('components/renderer/TextureRenderer', component2);
import component3 from 'components/other/RelativeLayout'; import component3 from 'components/animation/TouchZoom';
registerDef('components/other/RelativeLayout', component3); registerDef('components/animation/TouchZoom', component3);
import component4 from 'components/ui/ScrollView'; import component4 from 'components/ui/Button';
registerDef('components/ui/ScrollView', component4); registerDef('components/ui/Button', component4);
import component5 from 'components/renderer/RectRenderer'; import component5 from 'components/renderer/TextRenderer';
registerDef('components/renderer/RectRenderer', component5); registerDef('components/renderer/TextRenderer', component5);
import component6 from 'components/other/FullStageSize'; import component6 from 'components/other/FullStageSize';
registerDef('components/other/FullStageSize', component6); registerDef('components/other/FullStageSize', component6);
...@@ -29,26 +29,26 @@ registerDef('components/other/FullStageSize', component6); ...@@ -29,26 +29,26 @@ registerDef('components/other/FullStageSize', component6);
import component7 from 'components/base/TouchInterrupt'; import component7 from 'components/base/TouchInterrupt';
registerDef('components/base/TouchInterrupt', component7); registerDef('components/base/TouchInterrupt', component7);
import component8 from 'components/other/CameraController'; import component8 from 'components/renderer/RectRenderer';
registerDef('components/other/CameraController', component8); registerDef('components/renderer/RectRenderer', component8);
import component9 from 'components/renderer/TextureRenderer'; import component9 from 'components/ui/ScrollView';
registerDef('components/renderer/TextureRenderer', component9); registerDef('components/ui/ScrollView', component9);
import component10 from 'components/animation/TouchZoom'; import component10 from 'components/other/RelativeLayout';
registerDef('components/animation/TouchZoom', component10); registerDef('components/other/RelativeLayout', component10);
import component11 from 'components/ui/Button'; import component11 from 'components/renderer/HtmlRenderer';
registerDef('components/ui/Button', component11); registerDef('components/renderer/HtmlRenderer', component11);
import component12 from '../../assets/scripts/dialogs/RuleDialogContent'; import component12 from '../../assets/scripts/scenes/ScenePlay';
registerDef('./scripts/dialogs/RuleDialogContent', component12); registerDef('./scripts/scenes/ScenePlay', component12);
import component13 from '../../assets/scripts/scenes/ScenePlay'; import component13 from '../../assets/scripts/navigator/SingleSceneNavigator';
registerDef('./scripts/scenes/ScenePlay', component13); registerDef('./scripts/navigator/SingleSceneNavigator', component13);
import component14 from '../../assets/scripts/scenes/SceneGuide'; import component14 from '../../assets/scripts/Icon';
registerDef('./scripts/scenes/SceneGuide', component14); registerDef('./scripts/Icon', component14);
import component15 from '../../assets/scripts/scenes/SceneResult'; import component15 from '../../assets/scripts/scenes/SceneResult';
registerDef('./scripts/scenes/SceneResult', component15); registerDef('./scripts/scenes/SceneResult', component15);
...@@ -59,14 +59,14 @@ registerDef('./scripts/popup/Popup', component16); ...@@ -59,14 +59,14 @@ registerDef('./scripts/popup/Popup', component16);
import component17 from '../../assets/scripts/scenes/SceneStart'; import component17 from '../../assets/scripts/scenes/SceneStart';
registerDef('./scripts/scenes/SceneStart', component17); registerDef('./scripts/scenes/SceneStart', component17);
import component18 from '../../assets/scripts/navigator/SingleSceneNavigator'; import component18 from '../../assets/scripts/api/SamplePollingApi';
registerDef('./scripts/navigator/SingleSceneNavigator', component18); registerDef('./scripts/api/SamplePollingApi', component18);
import component19 from '../../assets/scripts/api/SamplePollingApi'; import component19 from '../../assets/scripts/dialogs/RuleDialogContent';
registerDef('./scripts/api/SamplePollingApi', component19); registerDef('./scripts/dialogs/RuleDialogContent', component19);
import component20 from '../../assets/scripts/scenes/SceneController'; import component20 from '../../assets/scripts/MainController';
registerDef('./scripts/scenes/SceneController', component20); registerDef('./scripts/MainController', component20);
import component21 from '../../assets/scripts/api/SampleApi'; import component21 from '../../assets/scripts/api/SampleApi';
registerDef('./scripts/api/SampleApi', component21); registerDef('./scripts/api/SampleApi', component21);
...@@ -74,8 +74,8 @@ registerDef('./scripts/api/SampleApi', component21); ...@@ -74,8 +74,8 @@ registerDef('./scripts/api/SampleApi', component21);
import component22 from '../../assets/scripts/game/CustomTextRenderer'; import component22 from '../../assets/scripts/game/CustomTextRenderer';
registerDef('./scripts/game/CustomTextRenderer', component22); registerDef('./scripts/game/CustomTextRenderer', component22);
import component23 from '../../assets/scripts/MainController'; import component23 from '../../assets/scripts/scenes/SceneController';
registerDef('./scripts/MainController', component23); registerDef('./scripts/scenes/SceneController', component23);
import component24 from '../../assets/scripts/dialogs/AlertDialogContent'; import component24 from '../../assets/scripts/dialogs/AlertDialogContent';
registerDef('./scripts/dialogs/AlertDialogContent', component24); registerDef('./scripts/dialogs/AlertDialogContent', component24);
...@@ -85,3 +85,6 @@ registerDef('./scripts/dialogs/PrizeDialogContent', component25); ...@@ -85,3 +85,6 @@ registerDef('./scripts/dialogs/PrizeDialogContent', component25);
import component26 from '../../assets/scripts/common/Toast'; import component26 from '../../assets/scripts/common/Toast';
registerDef('./scripts/common/Toast', component26); registerDef('./scripts/common/Toast', component26);
import component27 from '../../assets/scripts/scenes/SceneGuide';
registerDef('./scripts/scenes/SceneGuide', component27);
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