Commit 8671f224 authored by rockyl's avatar rockyl

init

parents
Pipeline #126831 failed with stages
in 5 seconds
node_modules/
debug/
design/origin/
dist/
\ No newline at end of file
{"currentScene":"assets/scenes/main.scene"}
\ No newline at end of file
{"ver":"1.0.1","uuid":"81900259-12e0-44a6-94f4-88bb48d0fe8b","subMetas":{},"isGroup":true}
{"mc":{
"coin":{
"frameRate":24,
"events":[
],
"frames":[
{
"res":"13497B6D",
"x":-45,
"y":-47
},
{
"res":"87CF8D85",
"x":-44,
"y":-47
},
{
"res":"2CDD23F0",
"x":-36,
"y":-47
},
{
"res":"D4BE6F6D",
"x":-23,
"y":-47
},
{
"res":"ECEC9D8A",
"x":-8,
"y":-47
},
{
"res":"4BC78864",
"x":-25,
"y":-47
},
{
"res":"F2156B7D",
"x":-38,
"y":-47
},
{
"res":"61BC53A",
"x":-45,
"y":-47
}
]
}},
"res":{
"61BC53A":{"x":0,"y":0,"w":93,"h":94},
"F2156B7D":{"x":95,"y":96,"w":78,"h":94},
"4BC78864":{"x":190,"y":0,"w":53,"h":94},
"13497B6D":{"x":95,"y":0,"w":93,"h":94},
"D4BE6F6D":{"x":0,"y":192,"w":53,"h":94},
"ECEC9D8A":{"x":55,"y":192,"w":20,"h":94},
"87CF8D85":{"x":0,"y":96,"w":93,"h":94},
"2CDD23F0":{"x":175,"y":96,"w":78,"h":94}
}}
\ No newline at end of file
{"ver":"1.0.1","uuid":"7a81c636-599e-4707-8688-9d13306cb29c","subMetas":{"coin":{"ver":"1.0.1","uuid":"943a42a1-7426-4894-a880-39a4f5dbf7ab","rawTextureUuid":"7a81c636-599e-4707-8688-9d13306cb29c","frame":{"x":95,"y":0,"w":93,"h":94},"type":"animation"}},"type":"animation"}
{"ver":"1.0.1","uuid":"168ed6dc-c204-4903-b2b6-4d0590248668","subMetas":{"coin":{"ver":"1.0.1","uuid":"65ca9349-7bdd-41c7-a98c-35a2a643e18e","rawTextureUuid":"168ed6dc-c204-4903-b2b6-4d0590248668","type":"texture"}},"type":"texture","imagePath":"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/anims/coin.png"}
This diff is collapsed.
{"ver":"1.0.1","uuid":"ec1d28d1-aeea-4e43-9d07-b597f7364e7a","subMetas":{"blue":{"ver":"1.0.1","uuid":"f4d7b2a7-e8b8-406f-bda8-6ed3bd77c34c","rawTextureUuid":"ec1d28d1-aeea-4e43-9d07-b597f7364e7a","frame":{"x":1777,"y":1099,"w":97,"h":154},"type":"animation"},"red":{"ver":"1.0.1","uuid":"53f788bd-4d09-4376-91e4-f81cf07421f3","rawTextureUuid":"ec1d28d1-aeea-4e43-9d07-b597f7364e7a","frame":{"x":1578,"y":941,"w":97,"h":157},"type":"animation"}},"type":"animation"}
{"ver":"1.0.1","uuid":"77174112-cf30-4ca1-8802-3fd0ccd7d2df","subMetas":{"miner":{"ver":"1.0.1","uuid":"0e8277c4-9b4f-410b-b799-9f60127ac2ab","rawTextureUuid":"77174112-cf30-4ca1-8802-3fd0ccd7d2df","type":"texture"}},"type":"texture","imagePath":"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/anims/miner.png"}
{"mc":{
"stone-effect":{
"frameRate":24,
"events":[
],
"frames":[
{
"res":"D8639186",
"x":-8,
"y":-8
},
{
"res":"6967EB1E",
"x":-9,
"y":-25
},
{
"res":"2033343B",
"x":-19,
"y":-45
},
{
"res":"F4F73900",
"x":-29,
"y":-53
},
{
"res":"DC223A5F",
"x":-35,
"y":-54
},
{
"res":"88880345",
"x":-37,
"y":-48
},
{
"res":"DA97FA47",
"x":-44,
"y":-54
},
{
"res":"C6A85FFB",
"x":-48,
"y":-50
},
{
"res":"2144DF1C",
"x":-121,
"y":-157
}
]
}},
"res":{
"88880345":{"x":106,"y":59,"w":94,"h":47},
"2033343B":{"x":203,"y":0,"w":45,"h":40},
"2144DF1C":{"x":250,"y":0,"w":1,"h":1},
"DA97FA47":{"x":106,"y":0,"w":95,"h":57},
"F4F73900":{"x":81,"y":108,"w":67,"h":48},
"DC223A5F":{"x":0,"y":61,"w":79,"h":51},
"D8639186":{"x":227,"y":42,"w":16,"h":17},
"C6A85FFB":{"x":0,"y":0,"w":104,"h":59},
"6967EB1E":{"x":203,"y":42,"w":22,"h":26}
}}
\ No newline at end of file
{"ver":"1.0.1","uuid":"73f0cb03-42cf-4f21-bc6c-ac949e0e6d90","subMetas":{"stone-effect":{"ver":"1.0.1","uuid":"0a04e5f9-c4af-44f7-abb8-f48570174492","rawTextureUuid":"73f0cb03-42cf-4f21-bc6c-ac949e0e6d90","frame":{"x":227,"y":42,"w":16,"h":17},"type":"animation"}},"type":"animation"}
{"ver":"1.0.1","uuid":"7adf4036-c0b4-41c0-833e-fa45312ac5f3","subMetas":{"stone-effect":{"ver":"1.0.1","uuid":"3f847433-7d24-4f41-b952-6ce032e53e6f","rawTextureUuid":"7adf4036-c0b4-41c0-833e-fa45312ac5f3","type":"texture"}},"type":"texture","imagePath":"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/anims/stone-effect.png"}
{"ver":"1.0.1","uuid":"63d93bf8-dde1-4eca-bc6f-5d5fa86e5f23","subMetas":{},"isGroup":true}
{
"name": "coin",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "coin",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/FrameAnimationRenderer",
"properties": {
"frameAnimation": "res|943a42a1-7426-4894-a880-39a4f5dbf7ab",
"autoPlay": true
}
}
]
}
]
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"ac43106a-4ddf-4a44-8f3c-eb5d0b107c74","subMetas":{},"type":"prefab"}
{
"name": "item-hang",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "item-hang",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|0af7c70e-2e83-4ae8-aaa0-78a6f0feb02f",
"anchor": {
"y": 0.35,
"_type_": "scilla/support/Vector2D"
}
}
}
],
"children": []
}
]
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"75327890-4087-485f-8594-6f1c26bd43e8","subMetas":{},"type":"prefab"}
{
"name": "item",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "item",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|0af7c70e-2e83-4ae8-aaa0-78a6f0feb02f",
"anchor": {
"y": 0.35,
"_type_": "scilla/support/Vector2D"
}
}
},
{
"script": "./scripts/game/Item",
"properties": {
"creditsEntity": "entity|b2a12ec2-fd60-4a8a-8bd0-8d426eab0e96",
"Label": "entity|1e9d8ad9-356a-4479-b4de-5cfcb3c0e3b9"
}
}
],
"children": [
{
"name": "Credits",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": 0,
"y": -40
}
}
},
{
"script": "./scripts/common/FloatMissing",
"properties": {}
}
],
"uuid": "b2a12ec2-fd60-4a8a-8bd0-8d426eab0e96",
"children": [
{
"name": "icon",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": -20,
"y": 0,
"_type_": "scilla/support/Vector2D"
}
}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|e9bcb67a-0626-4849-aaf5-33d1728c145e"
}
}
],
"uuid": "7c71c78a-ba6a-451a-a448-d7c62d14145c"
},
{
"name": "Label",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"fillColor": "rgba(255, 255, 0, 1)",
"textStyle": {
"fontSize": 24
},
"text": "0",
"textAlign": "center",
"anchor": {
"x": 0,
"_type_": "scilla/support/Vector2D"
}
}
}
],
"uuid": "1e9d8ad9-356a-4479-b4de-5cfcb3c0e3b9"
}
]
}
]
}
]
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"67e32bdb-f410-42f5-8a9e-4d06c056eaa4","subMetas":{},"type":"prefab"}
{
"name": "miner",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "miner",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/game/Miner",
"properties": {
"Hole": "entity|8f23c3a7-a168-4ae4-9d41-32daffb70d45",
"Body": "entity|10e4ba7c-5ef4-4493-856b-92ee1996171c",
"Effect": "entity|da765ba6-9a03-4237-b981-7fb619209a1e",
"Miner": "entity|1b4744e5-55af-4a44-a433-3dbec058d8c4",
"Items": "entity|ebb58804-f432-4612-bb35-b7214f0ea790",
"itemHangPrefab": "res|75327890-4087-485f-8594-6f1c26bd43e8",
"animations": "res|ec1d28d1-aeea-4e43-9d07-b597f7364e7a",
"holeRes": "res|933c5bc7-aa8e-43ff-9910-10b67ff910e9"
}
}
],
"children": [
{
"name": "Hole",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/game/Hole",
"properties": {
"Bg": "entity|6045c0b6-4dde-4735-9e5a-447b69e259a6",
"Bottom": "entity|4b66fbf8-cec7-400d-b2ca-29c51ebea4f0",
"BgImage": "entity|6ba5995d-8a37-4753-ac6c-67e4b251e373"
}
}
],
"uuid": "8f23c3a7-a168-4ae4-9d41-32daffb70d45",
"children": [
{
"name": "HoleBg",
"components": [
{
"script": "components/base/Transform",
"properties": {
"width": 169,
"height": 45,
"position": {
"_hashCode": 22353,
"_x": 0,
"_y": 0
}
}
},
{
"script": "components/renderer/RectRenderer",
"properties": {
"anchor": {
"y": 0,
"_type_": "scilla/support/Vector2D"
},
"isMask": true,
"maskVisible": false
}
}
],
"uuid": "6045c0b6-4dde-4735-9e5a-447b69e259a6",
"children": [
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|933c5bc7-aa8e-43ff-9910-10b67ff910e9",
"anchor": {
"y": 0,
"_type_": "scilla/support/Vector2D"
}
}
}
],
"uuid": "6ba5995d-8a37-4753-ac6c-67e4b251e373"
}
]
},
{
"name": "HoleBottom",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"y": 50,
"_type_": "scilla/support/Vector2D"
}
}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|e0953ca5-665b-400d-9eec-7c6d8887c15a"
}
}
],
"uuid": "4b66fbf8-cec7-400d-b2ca-29c51ebea4f0"
}
]
},
{
"name": "Miner",
"components": [
{
"script": "components/base/Transform",
"properties": {}
}
],
"uuid": "1b4744e5-55af-4a44-a433-3dbec058d8c4",
"children": [
{
"name": "Effect",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/FrameAnimationRenderer",
"properties": {
"frameAnimation": "res|0a04e5f9-c4af-44f7-abb8-f48570174492",
"autoPlay": false
}
}
],
"uuid": "da765ba6-9a03-4237-b981-7fb619209a1e"
},
{
"name": "Body",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/FrameAnimationRenderer",
"properties": {
"frameAnimation": "res|fa38740c-fcf1-4e9b-a80f-0d48b77968e8",
"autoPlay": false,
"onComplete": [
{
"entity": "entity|20190301114245",
"component": 1,
"method": "onAnimationComplete"
}
],
"onLoopComplete": [
{
"entity": "entity|20190301114245",
"component": 1,
"method": "onAnimationLoopComplete"
}
],
"anchor": {
"x": 1,
"_type_": "scilla/support/Vector2D"
}
}
}
],
"uuid": "10e4ba7c-5ef4-4493-856b-92ee1996171c"
},
{
"name": "Items",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": -20,
"y": -60,
"_type_": "scilla/support/Vector2D"
}
}
}
],
"uuid": "ebb58804-f432-4612-bb35-b7214f0ea790"
}
]
}
]
}
]
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"efa8a4db-c1c1-4ac0-959a-90043fbd8974","subMetas":{},"type":"prefab"}
{
"name": "times-card",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "times-card",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/game/TimesCard",
"properties": {
"Label": "entity|89f4d9a0-04f7-4663-b05e-9bbdafaa5967",
"Light": "entity|939c54ad-9379-480c-87dc-0f2a1c3cbd52"
}
}
],
"children": [
{
"name": "Light",
"components": [
{
"script": "components/base/Transform",
"properties": {
"scale": {
"x": 0.7,
"y": 0.7,
"_type_": "scilla/support/Vector2D"
}
}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|c73ad06f-6ddb-4677-959f-00c6886a4dc5"
}
}
],
"uuid": "939c54ad-9379-480c-87dc-0f2a1c3cbd52"
},
{
"name": "Card",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|6532dcec-e4a5-4630-90a4-5b8518a856fc"
}
}
],
"uuid": "899cc817-919e-48e2-a9e9-c222bd81c59a"
},
{
"name": "Label",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": 0,
"y": 25,
"_type_": "scilla/support/Vector2D"
}
}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"text": "X1",
"fillColor": "rgba(255, 255, 255, 1)",
"textStyle": {
"fontSize": 35
}
}
}
],
"uuid": "89f4d9a0-04f7-4663-b05e-9bbdafaa5967"
}
]
}
]
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"1bbb5b66-33ea-4035-a6fe-3ec5af37ad23","subMetas":{},"type":"prefab"}
{
"name": "two-lines-button",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "two-lines-button",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|e9d7f891-46a6-4038-a89a-6bf12e014b40"
}
},
{
"script": "./scripts/common/TwoLinesButton",
"properties": {
"bgRes": "res|e9d7f891-46a6-4038-a89a-6bf12e014b40",
"bgDisabledRes": "res|fa182a61-d334-4c3e-ad93-b0f168ca3307",
"label0Entity": "entity|4032f2b5-44da-4c5f-a77d-aac1a1d9280f",
"label1Entity": "entity|dce477d1-a18f-4d38-8ebc-8f428e54ab76"
}
},
{
"script": "components/animation/Wave",
"properties": {
"autoPlay": false
}
},
{
"script": "./scripts/common/BounceButtonController",
"properties": {
"button": "entity|20190301114245"
}
}
],
"children": [
{
"name": "Label0",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": 0,
"y": -15
}
}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"text": "开始挖矿",
"fillColor": "rgba(204, 51, 0, 1)",
"textStyle": {
"fontSize": 38,
"fontWeight": "bold"
}
}
}
],
"uuid": "4032f2b5-44da-4c5f-a77d-aac1a1d9280f"
},
{
"name": "Label1",
"components": [
{
"script": "components/base/Transform",
"properties": {
"position": {
"x": 0,
"y": 20
}
}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"fillColor": "rgba(204, 51, 0, 1)",
"text": "100积分/次",
"textStyle": {
"fontSize": 22
}
}
}
],
"uuid": "dce477d1-a18f-4d38-8ebc-8f428e54ab76"
}
]
}
]
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"14e4c41e-456b-4c30-a692-30da59907d61","subMetas":{},"type":"prefab"}
{"ver":"1.0.1","uuid":"78c18f8f-b241-42e3-b7e2-81c41117a8d6","subMetas":{},"isGroup":true}
This diff is collapsed.
{"ver":"1.0.1","uuid":"1f50815f-bf2f-4cf6-8432-f56f3aa834ef","subMetas":{},"type":"scene"}
{"ver":"1.0.1","uuid":"f529f015-2952-4026-be7e-ff8d7367444e","subMetas":{},"isGroup":true}
/**
* Created by rockyl on 2019-04-18.
*
* 抖动
*/
import ScillaComponent from "components/base/ScillaComponent";
import {createTween} from "scilla";
export default class Animation extends ScillaComponent {
onCreate() {
super.onCreate();
}
onAwake() {
super.onAwake();
createTween(this, this.transform, true, {fields: ['x', 'y']})
.to({
position: {x: 100, y: 100},
scale: {x: 2, y: 3},
rotation: 270
}, 1000)
}
onUpdate(t) {
super.onUpdate(t);
}
onSleep() {
super.onSleep();
}
onDestroy() {
super.onDestroy();
}
}
{"ver":"1.0.1","uuid":"5f2419c1-237c-4901-92ce-4079420063dc","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-09.
*
* 主控制器
*/
import ScillaComponent from "components/base/ScillaComponent";
import {dynamic, engine, Entity} from "scilla";
import Toast from "./common/Toast";
import Popup from "./popup/Popup";
import {initEnv} from "./common/BuriedPoint";
import {isWeiXin} from "./game/utils";
export default class MainController extends ScillaComponent {
Popup: Entity;
Toast: Entity;
opActivityId: dynamic;
private _toast: Toast;
private _popup: Popup;
onAwake() {
super.onAwake();
engine.dataCenter.set('CFG', window['CFG']);
this._toast = this.Toast.getComponent(Toast);
this._popup = this.Popup.getComponent(Popup);
initEnv();
this.broadcast('callApi', 1, 'activityBaseInfo', {opActivityId: this.opActivityId})
}
onGotActivityBaseInfo() {
this.broadcast('initGameStage');
}
onActivityBaseInfoError(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();
}
}
showErrorToast(e) {
switch (e) {
case '0100016': //活动未开始
this.showToast('活动未开始,暂时无法参与');
break;
case '0100014': //活动已结束
case '0100017': //活动已关闭
this.showToast('活动已结束,无法参与');
break;
}
}
showToast(content, duration?) {
this._toast.show({
content,
duration,
})
}
showDialog(name, data?, callback?) {
this._popup.showDialog(name, data, callback);
}
hideDialog(name, action?: string, data?) {
this._popup.hideDialog(name, action, data);
}
hideAllDialog() {
this._popup.hideAll();
}
alert(data?, callback?) {
this.showDialog('Alert', data, callback);
}
showLoginAlert() {
const callUpRegistH5Code = engine.dataCenter.get('CFG', 'callUpRegistH5Code');
const callUpLoginFunc = window['requirelogin'];
this.alert({
title: `啊哦,你还未登录`,
content: `登录后即可参与活动`,
button: (callUpLoginFunc || callUpRegistH5Code) ? '立即登录' : null,
}, (action) => {
if (action === 'confirm') {
if(isWeiXin()){
if(callUpRegistH5Code){
location.href = callUpRegistH5Code;
}else{
console.log('没有登录方案');
}
}else{
if(callUpLoginFunc){
callUpLoginFunc();
}else{
console.log('没有登录方案');
}
}
}
});
}
showCreditsAlert() {
const unitName = engine.dataCenter.get('CFG', 'unitName');
const earnCreditsUrl = engine.dataCenter.get('CFG', 'earnCreditsUrl');
this.alert({
title: `啊哦,当前${unitName}不足`,
content: `快去领取更多${unitName}吧`,
button: earnCreditsUrl ? '去做任务' : null,
}, (action) => {
if (action === 'confirm') {
location.href = earnCreditsUrl;
}
});
}
showNetError(action?) {
this.showDialog('Alert', {title: '网络异常', content: '请检查网络后重试!', button: '重新加载', showCloseButton: false}, () => {
if (typeof action === 'function') {
action();
} else {
action = action || 'refresh';
switch (action) {
case 'back':
history.back();
break;
case 'refresh':
location.reload();
break;
}
}
})
}
}
{"ver":"1.0.1","uuid":"77a9f9eb-77c4-4b5a-88ca-22e717d807f3","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-04-09.
*/
import {createTween, ease, Entity} from "scilla";
export async function playAnimation(config, context){
for(let partName in config){
let partConfig = config[partName];
let part:Entity = context[partName];
for(let componentName in partConfig){
let component = part.getComponentByName(componentName);
let {params, duration, ease: easeName} = partConfig[componentName];
createTween(context, component)
.to(params, duration, ease[easeName]);
}
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"1ae03578-651e-4285-aae5-d41098d478b2","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"4e924060-72b7-4ff8-86da-0362ec826a89","subMetas":{},"isGroup":true}
/**
* Created by rockyl on 2018-12-16.
*
* Api接口组件基类
*/
import {engine, ScillaEvent} from "scilla";
import ScillaComponent from "components/base/ScillaComponent";
export enum RequestMethod{
GET = 'GET',
POST = 'POST',
PUT = 'PUT',
DELETE = 'DELETE',
}
export default class ApiComponent extends ScillaComponent {
name: string;
method: RequestMethod = RequestMethod.POST;
params: any;
onResponse: ScillaEvent = new ScillaEvent();
onError: ScillaEvent = new ScillaEvent();
onFinish: ScillaEvent = new ScillaEvent();
autoCall: boolean = false;
private _args;
onAwake() {
super.onAwake();
if(this.autoCall){
this.execute();
}
}
protected async execute(paramsInput?, ...args) {
this._args = args;
}
onGotResponse(response: any) {
if(this.name){
engine.dataCenter.set('API', this.name, response.data);
}
if(this._args && this._args.length > 0){
this.onResponse.invoke(response.data, ...this._args);
}else{
this.onResponse.invoke(response.data);
}
this.onCallFinish();
}
onGotError(e) {
if(this._args && this._args.length > 0){
this.onError.invoke(e, ...this._args);
}else{
this.onError.invoke(e);
}
this.onCallFinish();
}
onCallFinish(){
if(this._args && this._args.length > 0){
this.onFinish.invoke(...this._args);
}else{
this.onFinish.invoke();
}
}
}
{"ver":"1.0.1","uuid":"ac217ee2-c5ac-489c-9c9b-3b2f1b50a22d","subMetas":{},"type":"script"}
/**
* Created by hwj on 2018/12/1.
*
* 简单的api组件
*/
import {utils, } from 'scilla'
import ApiComponent from "./ApiComponent";
import {callApi} from "../net/webService";
export default class SampleApi extends ApiComponent {
uri: string;
ignoreSuccessField = false;
async callApi(name, paramsInput, ...args){
if(this.name == name){
await this.execute(paramsInput, ...args);
}
}
protected async execute(paramsInput?, ...args) {
await super.execute(paramsInput, ...args);
const params = {};
if(this.params){
utils.injectProp(params, this.params);
}
if(paramsInput){
utils.injectProp(params, paramsInput);
}
const {uri, method} = this;
try {
const response = await callApi(uri, params, method, 'json', this.ignoreSuccessField);
this.onGotResponse(response);
return response.data;
} catch (e) {
this.onGotError(e);
}
}
}
{"ver":"1.0.1","uuid":"35c9db7c-1baa-4ddb-a098-24d04642f6d6","subMetas":{},"type":"script"}
/**
* Created by hwj on 2018/12/1.
*
* 简单的api组件
*/
import {raw, utils,} from 'scilla'
import ApiComponent from "./ApiComponent";
import { polling} from "../net/webService";
export default class SamplePollingApi extends ApiComponent {
successField: string;
successValues: raw;
uri: string;
maxTimes = 5;
delay = 500;
private _abortFlag = false;
async callApi(name, paramsInput, ...args) {
if (this.name == name) {
await this.execute(paramsInput, ...args);
}
}
abortCallApi(name){
if (this.name == name) {
this._abort();
}
}
protected async execute(paramsInput?, ...args) {
await super.execute(paramsInput, ...args);
this._abortFlag = false;
const params = {};
if (this.params) {
utils.injectProp(params, this.params);
}
if (paramsInput) {
utils.injectProp(params, paramsInput);
}
const {uri, method} = this;
try {
const response = await polling(this.successFunc, uri, params, this.maxTimes, this.delay, this.abortFunc, method);
this.onGotResponse(response);
return response.data;
} catch (e) {
this.onGotError(e);
}
}
protected abortFunc=()=>{
return this._abortFlag;
}
protected _abort(){
this._abortFlag = true;
}
successFunc=(response)=> {
const {successField, successValues} = this;
let v = successField ? response.data[successField] : response.data;
return successValues ? successValues.indexOf(v) >= 0 : false;
}
}
{"ver":"1.0.1","uuid":"548fab96-299d-4363-8adc-ed14345ce2a0","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"c4cc21d9-db56-46b6-b317-edae64d94ecb","subMetas":{},"isGroup":true}
/**
* Created by rockyl on 2018-12-26.
*
* 埋点按钮
*/
import InteractComponent from "components/base/InteractComponent";
import {callApi} from "../net/webService";
import {engine} from "scilla";
export default class BuriedPoint extends InteractComponent {
dpm: string;
dcm: string;
private _buriedPointName: string;
private _exposured: boolean;
onAwake() {
super.onAwake();
if (this.dpm && this.dcm && !this._exposured) {
this.setConfig(this.dpm, this.dcm, true);
}
}
onTouchTap(e) {
super.onTouchTap(e);
if (this._buriedPointName) {
logClick(this._buriedPointName);
}
}
setConfig(dpm, dcm, needLogExposure = false) {
this._buriedPointName = 'buried-point-' + Date.now() + Math.floor(Math.random() * 999999);
addBuriedPointConfig(
this._buriedPointName,
{dpm, dcm}
);
if (needLogExposure) {
logExposure(this._buriedPointName);
this._exposured = true;
}
}
}
let _buriedPoints: any = {};
let env: any;
export function initEnv() {
const cfg = engine.dataCenter.get('CFG');
env = {
app_id: cfg.appId,
oaid: cfg.opActivityId,
page_id: 3,
comp_id: 4,
}
}
export function addBuriedPoints(buriedPoints) {
for (let name in buriedPoints) {
_buriedPoints[name] = buriedPoints[name];
}
}
export function addBuriedPointConfig(name, config) {
const {dpm, dcm} = config;
_buriedPoints[name] = new BuriedPointData(dpm, dcm);
}
export function addBuriedPointConfigs(configs) {
for (let name in configs) {
addBuriedPointConfig(name, configs[name]);
}
}
export function logExposure(name) {
return log(name, 'exposure');
}
export function logClick(name) {
return log(name, 'click');
}
function log(name, type) {
if (DEBUG) {
//return;
}
let logPoint = _buriedPoints[name];
let appId = engine.dataCenter.get('CFG', 'appId');
let {dpm, dcm} = logPoint;
return callApi( //todo 埋点
type == 'exposure' ? '//embedlog.duiba.com.cn/exposure/standard' : '/log/click',
{
dpm, dcm, appId
},
'get', type == 'exposure' ? 'jsonp' : 'json'
).catch(e => {
//console.log(e);
});
}
function fillData(src) {
let result = src;
for (let key in env) {
result = result.replace(key, env[key]);
}
return result;
}
class BuriedPointData {
dpm: string;
dcm: string;
constructor(dpm, dcm) {
this.dpm = fillData(dpm);
this.dcm = fillData(dcm);
}
}
{"ver":"1.0.1","uuid":"cd8dc475-b08f-42c5-95f6-40cbbcf891c1","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-14.
*
* 倒计时
*/
import ScillaComponent from "components/base/ScillaComponent";
import {resource, ScillaEvent, Sheet} from "scilla";
import TextureRenderer from "components/renderer/TextureRenderer";
function getTextureNameSample(second){
return `${second}.png`;
}
export default class CountDown extends ScillaComponent {
numberSheet: resource;
seconds: number;
onComplete: ScillaEvent = new ScillaEvent();
interval = 1000;
hideWhenStop = true;
$getTextureName: (second: number)=>string;
private _textureRenderer: TextureRenderer;
private _timer;
private _remainSeconds;
constructor(){
super();
this.$getTextureName = getTextureNameSample;
}
onAwake() {
super.onAwake();
this._textureRenderer = this.getComponent(TextureRenderer);
}
play(){
if(this.seconds > 0){
this.entity.enabled = true;
this._remainSeconds = this.seconds;
this.stop();
this.onTimer();
this._timer = setInterval(this.onTimer, this.interval);
}
}
stop(){
if(this._timer){
clearInterval(this._timer);
this._timer = null;
if(this.hideWhenStop){
this.entity.enabled = false;
}
}
}
private onTimer=()=>{
if(this._remainSeconds <= 0){
this.onComplete.invoke();
this.stop();
return;
}
let sheet = this.numberSheet;
this._textureRenderer.texture = sheet.getTexture(this.$getTextureName(this._remainSeconds));
this._remainSeconds--;
}
}
{"ver":"1.0.1","uuid":"b491b5a5-5322-4f05-bcd0-30710e31d386","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-16.
*
* 点等待
*/
import ScillaComponent from "components/base/ScillaComponent";
import {color} from "scilla";
import GraphicRenderer from "components/renderer/GraphicRenderer";
export default class DotWaiting extends ScillaComponent {
activeColor: color;
inativeColor: color;
interval = 300;
private _index;
private _startTime;
private _reset;
private _dots: GraphicRenderer[] = [];
onAwake() {
super.onAwake();
this._reset = true;
this._dots.splice(0);
for(let child of this.entity.children){
this._dots.push(child.getComponent(GraphicRenderer));
}
}
onUpdate(t) {
super.onUpdate(t);
if(this._reset){
this._reset = false;
this._startTime = t;
}
let index = Math.floor((t - this._startTime) / this.interval) % this._dots.length;
if(this._index !== index){
for (let i = 0, li = this._dots.length; i < li; i++) {
const dot = this._dots[i];
dot.fillColor = index === i ? this.activeColor : this.inativeColor;
}
}
}
}
{"ver":"1.0.1","uuid":"c8059e2b-543f-4482-9a45-ac0074393cba","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-08.
*
* 浮动上升渐隐
*/
import ScillaComponent from "components/base/ScillaComponent";
import {createTween, ease, Tween, Vector2D} from "scilla";
import {killTweens} from "scilla/src/support/Tween";
export default class FloatMissing extends ScillaComponent {
wait = 500;
delay = 0;
endPos: Vector2D = new Vector2D(0, -100);
private _tween: Tween;
private _tweenResolve: Function;
onAwake() {
super.onAwake();
if(!this._tween){
this.init();
this._tween = createTween(this, this.transform, false, {
autoPlay: false,
initFields: ['position', 'alpha', 'scale'],
onComplete: this.onTweenComplete
})
.wait(this.delay)
.to({scale: {x: 1, y: 1}}, 500, ease.backOut)
.wait(this.wait)
.to({alpha: 0, position: this.endPos.toObj()}, 300);
}
}
init() {
this.transform.alpha = 1;
this.transform.scale.setXY(0, 0)
}
play() {
return new Promise(resolve => {
this._tweenResolve = resolve;
this._tween.play(true, 0, false);
})
}
stop() {
killTweens(this.transform);
}
private onTweenComplete = () => {
if (this._tweenResolve) {
this._tweenResolve();
this._tweenResolve = null;
}
}
}
{"ver":"1.0.1","uuid":"42b053b6-a66f-417d-94a2-7bfa17086579","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-16.
*
* 飞行序列
*/
import ScillaComponent from "components/base/ScillaComponent";
import {createTween, ease, Entity, instantiate, resource, ScillaEvent, Vector2D} from "scilla";
import Transform from "components/base/Transform";
export default class FlySequence extends ScillaComponent {
ToEntity: Entity;
itemPrefab: resource;
count = 10;
fromPos = new Vector2D();
toPos = new Vector2D();
toScale = new Vector2D(0.3, 0.3);
duration = 3000;
delay = 500;
itemInterval = 100;
hideWhenComplete = true;
offset = 1;
onComplete: ScillaEvent = new ScillaEvent();
private _items: Transform[] = [];
private _itemDuration;
private _counting;
private _timerDelay;
private _timer;
onAwake() {
super.onAwake();
if (this._items.length === 0) {
this._itemDuration = this.duration - this.count * this.itemInterval - this.delay;
for (let i = 0; i < this.count; i++) {
let itemEntity = instantiate(this.itemPrefab);
itemEntity.enabled = false;
this.entity.addChild(itemEntity);
let transform = itemEntity.getComponent(Transform);
this._items.push(transform);
}
}
}
onUpdate(t) {
super.onUpdate(t);
}
play() {
this.stop();
if (this.ToEntity) {
this.toPos = this.transform.globalPositionToLocal(this.ToEntity.getComponent(Transform).globalPosition);
}
let first = this._items[0];
first.entity.enabled = true;
first.position.copyFrom(this.fromPos);
first.scale.setXY(1, 1);
this._counting = 1;
this._timerDelay = setTimeout(this.onDelay, this.delay);
}
stop(hidden = true) {
if (this._timer) {
clearInterval(this._timer);
this._timer = null;
}
if (this._timerDelay) {
clearTimeout(this._timerDelay);
this._timerDelay = null;
}
if (hidden) {
for (let item of this._items) {
item.entity.enabled = false;
}
}
}
private onDelay = () => {
this._timer = setInterval(() => {
if (this._counting > this.count - 1) {
this.stop(false);
this._flyItem(this._items[0], this.onEnd);
return;
}
this._playItem(this._counting);
this._counting++;
}, this.itemInterval)
}
private onEnd = () => {
this.onComplete.invoke();
}
private _playItem(index) {
let item = this._items[index];
item.entity.enabled = true;
item.position.copyFrom(this.fromPos);
item.scale.setXY(0, 0);
this._flyItem(item);
}
private _flyItem(item, callback?) {
const itemDuration = this._itemDuration;
createTween(this, item.scale, false)
.to({x: 1, y: 1}, itemDuration * 0.1)
.wait(itemDuration * 0.4)
.to(this.toScale.toObj(), itemDuration * 0.5);
createTween(this, item.position)
.to({x: this.toPos.x}, itemDuration);
let easeFuncCreator = Math.random() > 0.5 ? ease.getPowOut : ease.getPowIn;
let easeFunc = easeFuncCreator(Math.random() + this.offset);
createTween(this, item.position)
.to({y: this.toPos.y}, itemDuration, easeFunc)
.call(() => {
if (this.hideWhenComplete) {
item.entity.enabled = false;
}
callback && callback();
});
}
}
{"ver":"1.0.1","uuid":"ad0bee45-adbd-4088-a49d-9e6828bb0a41","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-08.
*
* 文本轮播
*/
import ScillaComponent from "components/base/ScillaComponent";
import {createTween, ease, Entity} from "scilla";
import Transform from "components/base/Transform";
import TextRenderer from "components/renderer/TextRenderer";
export enum DIR {
UP,
DOWN,
}
export default class LabelCarousel extends ScillaComponent {
entity0: Entity;
entity1: Entity;
offset = 40;
interval = 1000;
scrollDuration = 500;
dir: DIR = DIR.UP;
getTextFunc: Function;
autoPlay = false;
_playing = false;
private _index = 0;
private _labels = [];
private _timer;
onAwake() {
super.onAwake();
const {_labels, entity0, entity1, offset, dir} = this;
const entities = [entity0, entity1];
for (let entity of entities) {
let transform = entity.getComponent(Transform);
let textRenderer = entity.getComponent(TextRenderer);
transform.position.y = offset * (dir === DIR.UP ? -1 : 1);
transform.alpha = 0;
_labels.push({
transform,
textRenderer
});
}
if(this.autoPlay){
this.play();
}
}
play() {
this.playNext();
this.stop();
this._timer = setInterval(() => {
this.playNext();
}, this.interval);
this._playing = true;
}
stop() {
if(this._timer){
clearInterval(this._timer);
this._timer = null;
}
this._playing = false;
}
private updateText(textRenderer){
let text = this.getTextFunc ? this.getTextFunc() : null;
if(text){
textRenderer.text = text;
}
}
playNext() {
const {_labels, _index, scrollDuration, offset, dir} = this;
let nextLabel = _labels[_index % 2];
const sign = dir === DIR.UP ? -1 : 1;
this.updateText(nextLabel.textRenderer);
createTween(this, nextLabel.transform, true)
.set({position: {y: offset * sign * -1}})
.to({position: {y: 0}, alpha: 1}, scrollDuration, ease.cubicOut);
if (_index > 0) {
let lastLabel = _labels[(_index + 1) % 2];
createTween(this, lastLabel.transform, true)
.to({position: {y: offset * sign}, alpha: 0}, scrollDuration, ease.cubicOut);
}
this._index++;
}
}
{"ver":"1.0.1","uuid":"e61b7fe1-59ff-4cf8-8e3c-d2d0a63b4df9","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-15.
*
* 跑数字
*/
import ScillaComponent from "components/base/ScillaComponent";
import TextRenderer from "components/renderer/TextRenderer";
import {createTween, ScillaEvent} from "scilla";
function renderSimple(v) {
return Math.floor(v).toString();
}
export default class RunNumber extends ScillaComponent {
duration = 3000;
onComplete = new ScillaEvent();
private _textRenderer: TextRenderer;
private _t;
$renderFunc: (v: number) => string = renderSimple;
onAwake() {
super.onAwake();
this._textRenderer = this.getComponent(TextRenderer);
}
play(to, from?) {
if(!this._textRenderer){
return Promise.resolve();
}
from = from === undefined ? parseFloat(this._textRenderer.text) : from;
return new Promise(resolve => {
createTween(this, this, true)
.set({t: from})
.to({t: to}, this.duration)
.call(()=>{
resolve();
this.onComplete.invoke();
});
})
}
get t() {
return this._t;
}
set t(v) {
this._t = v;
this._textRenderer.text = this.$renderFunc(v);
}
}
{"ver":"1.0.1","uuid":"34eb1693-96bd-4b71-9ca6-2de9274f60fc","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-01-02.
*
* Toast
*/
import {Entity, createTween, Tween, ease, engine,} from "scilla";
import ScillaComponent from "components/base/ScillaComponent";
import TextRenderer from "components/renderer/TextRenderer";
import Transform from "components/base/Transform";
export default class Toast extends ScillaComponent {
Label: Entity;
padding = 20;
offsetY = 0;
showDuration = 300;
hideDuration = 300;
private _bgTransform: Transform;
private _labelRenderer: TextRenderer;
private _labelTransform: Transform;
private _tweenIn: Tween;
private _tweenOut: Tween;
private _timerDuration;
onAwake() {
super.onAwake();
if (!this._bgTransform) {
const {offsetY, hideDuration, showDuration, transform} = this;
this._bgTransform = this.getComponent(Transform);
this._labelRenderer = this.Label.getComponent(TextRenderer);
this._labelTransform = this.Label.getComponent(Transform);
this._tweenIn = createTween(this, transform, false, {autoPlay: false})
.to({position: {x: 0, y: offsetY}}, showDuration, ease.cubicOut);
this._tweenOut = createTween(this, transform, false, {autoPlay: false})
.to({position: {y: 0}}, hideDuration, ease.cubicIn)
.call(this.onHidden);
this.transform.position.y = this.outPos;
}
}
private get outPos(){
return engine.renderContext.stageCenter.y + this._bgTransform.height;
}
show({content, duration = 1000}) {
this.entity.enabled = true;
const {_bgTransform, _labelRenderer, _labelTransform, padding} = this;
_labelRenderer.text = content;
_labelRenderer.measureBounds();
_bgTransform.width = _labelTransform.width + padding * 2;
_bgTransform.height = _labelTransform.height + padding * 2;
this._tweenOut.queue[0].props.position.y = this.outPos;
this._tweenIn.play(true);
if (this._timerDuration) {
clearTimeout(this._timerDuration);
this._timerDuration = null;
}
this._timerDuration = setTimeout(() => {
this.hide();
}, duration);
}
hide() {
this._tweenOut.play(true);
}
private onHidden() {
this.entity.enabled = false;
}
}
{"ver":"1.0.1","uuid":"4deea944-f0f1-4802-b298-61c8826432e4","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-10.
*
* 波动画控制器
*/
import InteractComponent from "components/base/InteractComponent";
import Wave from "components/animation/Wave";
export default class WaveController extends InteractComponent {
/**
* 可交互时是否播放
*/
playWhenInteractable = true;
/**
* 不可交互时是否停止
*/
stopWhenUninteractable = true;
/**
* 按下时是否停止
*/
stopWhenTouchBegin = true;
/**
* 松开时是否停止
*/
playWhenTouchEnd = true;
private _wave: Wave;
touchBeginFlag = false;
onAwake() {
super.onAwake();
this._wave = this.getComponent(Wave);
}
onTouchBegin(e) {
super.onTouchBegin(e);
this.touchBeginFlag = true;
if(this.stopWhenTouchBegin){
if(this._wave) this._wave.stop(true);
}
}
onGlobalTouchEnd(e) {
if(this.touchBeginFlag){
this.touchBeginFlag = false;
if(this.playWhenTouchEnd){
if(this._wave) this._wave.play();
}
}
}
onInteractableChanged(interactable) {
super.onInteractableChanged(interactable);
if(interactable && this.playWhenInteractable){
if(this._wave) this._wave.play();
}
if(!interactable && this.stopWhenUninteractable){
if(this._wave) this._wave.stop();
}
}
}
{"ver":"1.0.1","uuid":"511ecf71-7d16-422b-9513-8f945ee1027e","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-15.
*/
export const configs = {
};
{"ver":"1.0.1","uuid":"19636d71-e3df-4c54-a0f1-34fc2782697b","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"a3fcf7cd-7450-4bd2-a98a-953050e254d9","subMetas":{},"isGroup":true}
/**
* Created by rockyl on 2019-04-10.
*
* 警告对话框内容
*/
import DialogContent from "../popup/DialogContent";
import {Entity} from "scilla";
import TextRenderer from "components/renderer/TextRenderer";
import Transform from "components/base/Transform";
export default class AlertDialogContent extends DialogContent {
Title: Entity;
Content: Entity;
ConfirmButton: Entity;
private _confirmButtonLabel: TextRenderer;
private _titleLabel: TextRenderer;
private _contentLabel: TextRenderer;
private _contentTransform: Transform;
onAwake() {
super.onAwake();
this._titleLabel = this.Title.getComponent(TextRenderer);
this._contentLabel = this.Content.getComponent(TextRenderer);
this._contentTransform = this.Content.getComponent(Transform);
if (this.ConfirmButton) {
this._confirmButtonLabel = this.ConfirmButton.getChildrenByName('Label')[0].getComponent(TextRenderer);
}
}
setup(data: any = {}) {
const {title = 'Alert', content = '', button = 'Confirm', showCloseButton = true} = data;
this._titleLabel.text = title;
this._contentLabel.text = content;
this._closeButton.entity.enabled = showCloseButton;
if (button) {
this._confirmButtonLabel.text = button;
}
this._contentTransform.position.y = button ? -30 : 40;
this.ConfirmButton.enabled = !!button;
}
onClickConfirmButton() {
this.hide('confirm')
}
}
{"ver":"1.0.1","uuid":"f92bbd9c-d6e2-4b0a-be50-30d4972521f2","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-15.
*
* PK挑战书
*/
import DialogContent from "../popup/DialogContent";
import {dynamic, Entity} from "scilla";
import TextRenderer from "components/renderer/TextRenderer";
import {renderRunCredits} from "../game/utils";
import TwoLinesButton from "../game/TwoLinesButton";
export default class PKChallenge extends DialogContent {
Content: Entity;
ButtonPK: Entity;
activityBaseInfo: dynamic;
private _buttonPK: TwoLinesButton;
onAwake() {
super.onAwake();
this._buttonPK = this.ButtonPK.getComponent(TwoLinesButton);
}
setup(data) {
super.setup(data);
const {pkExpend, machineNickname} = this.activityBaseInfo;
this._buttonPK.label1 = renderRunCredits(pkExpend) + '/次';
this.Content.getComponent(TextRenderer).text = `我是${machineNickname}`;
}
onClickConfirm() {
this.hide('accept')
}
}
{"ver":"1.0.1","uuid":"f68dd866-0ca5-4809-b91f-de05a9d683ca","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-04-10.
*
* 警告对话框内容
*/
import DialogContent from "../popup/DialogContent";
import {dynamic, Entity, resource} from "scilla";
import TextRenderer from "components/renderer/TextRenderer";
export default class PKMatching extends DialogContent {
Title: Entity;
SelfName: Entity;
OtherName: Entity;
AvatarOther: Entity;
AvatarWaiting: Entity;
CloseButton: Entity;
userNickname: dynamic;
otherName: dynamic;
private _titleRenderer: TextRenderer;
private _selfNameRenderer: TextRenderer;
private _otherNameRenderer: TextRenderer;
private _timer;
onAwake() {
super.onAwake();
this._titleRenderer = this.Title.getComponent(TextRenderer);
this._selfNameRenderer = this.SelfName.getComponent(TextRenderer);
this._otherNameRenderer = this.OtherName.getComponent(TextRenderer);
}
setup(data: any) {
const {channel} = data;
this._titleRenderer.text = '正在匹配对手…';
this._selfNameRenderer.text = this.userNickname;
this._otherNameRenderer.text = this.otherName;
this.AvatarOther.enabled = false;
this.AvatarWaiting.enabled = true;
this.CloseButton.enabled = true;
this.stop();
if(channel === 1){
this.onMatched();
}else{
this._timer = setTimeout(this.onMatched, Math.random() * 2000 + 2000);
}
}
stop() {
if (this._timer) {
clearTimeout(this._timer);
this._timer = null;
}
}
protected onTapCloseButton() {
super.onTapCloseButton();
this.stop();
}
private onMatched = () => {
this._titleRenderer.text = '匹配成功';
this.AvatarOther.enabled = true;
this.AvatarWaiting.enabled = false;
this.CloseButton.enabled = false;
setTimeout(this.hide, 1000, 'success');
}
}
{"ver":"1.0.1","uuid":"aeadb7b3-cab8-4ae0-b003-52ed2097c3d1","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"3da3b8d4-9870-4b99-984f-364c93608d1d","subMetas":{},"isGroup":true}
/**
* Created by rockyl on 2019-05-20.
*
* PK结果动画弹窗
*/
import {Entity, utils,} from "scilla";
import DialogContent from "../popup/DialogContent";
import AnimLayer from "./pkresult/AnimLayer";
import ResultLayer from "./pkresult/ResultLayer";
export default class PKResult extends DialogContent {
AnimLayer: Entity;
ResultLayer: Entity;
private _animLayer: AnimLayer;
private _resultLayer: ResultLayer;
onAwake() {
super.onAwake();
this._animLayer = this.AnimLayer.getComponent(AnimLayer);
this._resultLayer = this.ResultLayer.getComponent(ResultLayer);
}
onUpdate(t) {
super.onUpdate(t);
}
async setup(data) {
super.setup(data);
this.AnimLayer.enabled = true;
this.ResultLayer.enabled = false;
await this._animLayer.play(data);
await utils.waitPromise(500);
this.ResultLayer.enabled = true;
this._resultLayer.play(data);
}
onBottomButtonTap(action){
this._resultLayer.hide();
this.hide(action);
}
}
{"ver":"1.0.1","uuid":"14719161-5d31-4e48-a7b8-6109977d8441","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-04-10.
*
* 规则对话框内容
*/
import DialogContent from "../popup/DialogContent";
import {dynamic, Entity} from "scilla";
import HtmlRenderer from "components/renderer/HtmlRenderer";
export default class RuleDialogContent extends DialogContent {
Content: Entity;
ruleContent: dynamic;
private _contentRenderer: HtmlRenderer;
onAwake() {
super.onAwake();
this._contentRenderer = this.Content.getComponent(HtmlRenderer);
this._contentRenderer.htmlText = this.ruleContent;
const config = window['configJson'];
this._contentRenderer.color = config.dialog_text_color;
}
}
{"ver":"1.0.1","uuid":"f45130ad-d500-4ced-af9b-ac87ec009a19","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-15.
*
* 单人挖矿结果
*/
import {createTween, dynamic, Entity, utils} from "scilla";
import DialogContent from "../popup/DialogContent";
import RunNumber from "../common/RunNumber";
import Transform from "components/base/Transform";
import FlySequence from "../common/FlySequence";
import globalEvent from "globalEvent";
import TimesCard from "../game/TimesCard";
import {renderRunCredits} from "../game/utils";
export default class SingleResult extends DialogContent {
Wrapper: Entity;
ColorTape: Entity;
Credits: Entity;
TimesCard: Entity;
Light: Entity;
Coins: Entity;
singleDigData: dynamic;
private _runCredits: RunNumber;
private _timesCard: TimesCard;
private _wrapperTransform: Transform;
private _colorTapeTransform: Transform;
private _lightTransform: Transform;
private _flySequence: FlySequence;
onAwake() {
super.onAwake();
this._timesCard = this.TimesCard.getComponent(TimesCard);
this._colorTapeTransform = this.ColorTape.getComponent(Transform);
this._wrapperTransform = this.Wrapper.getComponent(Transform);
this._lightTransform = this.Light.getComponent(Transform);
this._flySequence = this.Coins.getComponent(FlySequence);
this._runCredits = this.Credits.getComponent(RunNumber);
this._runCredits.$renderFunc = renderRunCredits;
}
onUpdate(t) {
super.onUpdate(t);
}
async setup(data) {
super.setup(data);
this.Wrapper.enabled = true;
this.Light.enabled = false;
createTween(this, this._wrapperTransform)
.set({scale: {x: 0.8, y: 0.8}, alpha: 1})
.to({scale: {x: 1.0, y: 1.0}}, 2000);
createTween(this, this._colorTapeTransform)
.set({scale: {x: 0, y: 0}, alpha: 1})
.wait(100)
.to({scale: {x: 0.8, y: 0.8}}, 800)
.to({scale: {x: 1.1, y: 1.1}, alpha: 0}, 1200);
await this.playCredits();
this.playLight();
}
async playCredits(){
const {receiveCredits, finalCredits, multipleCard} = this.singleDigData;
const showTimesCard = multipleCard > 0;
this.TimesCard.enabled = false;
await this._runCredits.play(receiveCredits, 0);
await utils.waitPromise(500);
if (showTimesCard) {
this.TimesCard.enabled = true;
await this._timesCard.playShow(multipleCard);
createTween(this, this._wrapperTransform)
.to({scale: {x: 1.2, y: 1.2}}, 2000);
await this._runCredits.play(finalCredits, receiveCredits);
}
}
private playLight() {
createTween(this, this._wrapperTransform)
.to({alpha: 0}, 500)
.call(()=>{
this.Wrapper.enabled = false;
});
this.Light.enabled = true;
this._lightTransform.alpha = 0;
createTween(this, this._lightTransform)
.set({scale: {x: 0, y: 0}})
.to({alpha: 1, scale: {x: 1, y: 1}}, 300)
.call(()=>{
this.playCoins();
})
.to({alpha: 0, scale: {x: 0, y: 0}}, 300)
.call(()=>{
this.Light.enabled = false;
})
}
private playCoins() {
this.bubbling('setBgVisible', false);
this._flySequence.play();
globalEvent.emit('runCredits');
}
onFlyCoinEnd(){
this.hide('complete');
}
}
{"ver":"1.0.1","uuid":"d3f88761-453c-4bd6-9af5-608c6debf166","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-20.
*
* 动画层
*/
import ScillaComponent from "components/base/ScillaComponent";
import {createTween, dynamic, ease, Entity} from "scilla";
import PKResultAnimSide from "../../game/PKResultAnimSide";
import Transform from "components/base/Transform";
export default class AnimLayer extends ScillaComponent {
LeftSide: Entity;
RightSide: Entity;
Line: Entity;
userNickname: dynamic;
pkData: dynamic;
private _leftSide: PKResultAnimSide;
private _rightSide: PKResultAnimSide;
private _lineTransform: Transform;
onAwake() {
super.onAwake();
this._leftSide = this.LeftSide.getComponent(PKResultAnimSide);
this._rightSide = this.RightSide.getComponent(PKResultAnimSide);
this._lineTransform = this.Line.getComponent(Transform);
}
onUpdate(t) {
super.onUpdate(t);
}
async play(data) {
createTween(this, this._lineTransform)
.set({scale: {x: 0, y: 0}, alpha: 0}, true)
.wait(200)
.to({scale: {x: 1, y: 1}, alpha: 1}, 500, ease.backOut);
await Promise.all([this._leftSide.play({
nickname: this.userNickname,
receiveCredits: this.pkData.userReceiveCredits,
finalCredits: this.pkData.userFinalCredits,
multipleCard: this.pkData.userMultipleCard,
}),
this._rightSide.play({
nickname: this.pkData.machineNickname,
receiveCredits: this.pkData.machineReceiveCredits,
finalCredits: this.pkData.machineFinalCredits,
multipleCard: this.pkData.machineMultipleCard,
}),]);
}
}
{"ver":"1.0.1","uuid":"623082f2-a2fc-4003-9265-ae241da467a8","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-20.
*
* 结果层
*/
import ScillaComponent from "components/base/ScillaComponent";
import {createTween, dynamic, ease, Entity} from "scilla";
import PKResultSide from "../../game/PKResultSide";
import Transform from "components/base/Transform";
import RelativeLayout from "components/other/RelativeLayout";
export default class ResultLayer extends ScillaComponent {
LeftSide: Entity;
RightSide: Entity;
Line: Entity;
BottomBar: Entity;
userNickname: dynamic;
pkData: dynamic;
private _leftSide: PKResultSide;
private _rightSide: PKResultSide;
private _lineTransform: Transform;
private _bottomBarLayout: RelativeLayout;
private _bottomBarHeight;
onAwake() {
super.onAwake();
this._leftSide = this.LeftSide.getComponent(PKResultSide);
this._rightSide = this.RightSide.getComponent(PKResultSide);
this._lineTransform = this.Line.getComponent(Transform);
this._bottomBarLayout = this.BottomBar.getComponent(RelativeLayout);
this._bottomBarHeight = this.BottomBar.getComponent(Transform).height;
this.hide();
}
onUpdate(t) {
super.onUpdate(t);
}
async play(data) {
const {userFinalCredits, machineFinalCredits, machineNickname, resultState} = this.pkData;
createTween(this, this._lineTransform)
.set({scale: {x: 0, y: 0}, alpha: 0}, true)
.wait(200)
.to({scale: {x: 1, y: 1}, alpha: 1}, 500, ease.backOut);
await Promise.all([this._leftSide.play({
nickname: this.userNickname,
finalCredits: userFinalCredits,
otherFinalCredits: machineFinalCredits,
resultState
}),
this._rightSide.play({
nickname: machineNickname,
finalCredits: machineFinalCredits,
otherFinalCredits: userFinalCredits,
resultState
}),]).then(
()=>{
createTween(this, this._bottomBarLayout)
.to({bottom: 0}, 500, ease.cubicOut);
}
);
}
hide(){
this._bottomBarLayout.bottom = -this._bottomBarHeight;
}
}
{"ver":"1.0.1","uuid":"da78325c-afbd-47d5-b3f6-2a627fc81544","subMetas":{},"type":"script"}
{"ver":"1.0.1","uuid":"e6a72a1b-31bd-444b-bef6-ea7462b827c5","subMetas":{},"isGroup":true}
/**
* Created by rockyl on 2019-05-10.
*
* api处理过程
*/
import ScillaComponent from "components/base/ScillaComponent";
import GameStage from "./GameStage";
export default class ApiProcess extends ScillaComponent {
private _gameStage: GameStage;
onAwake() {
super.onAwake();
this._gameStage = this.entity.getComponent(GameStage);
}
onSingleDigSuccess(response) {
console.log(response);
this._gameStage.readyDig(1, 0);
this.getOrderStatus(response)
}
onPkDigSuccess(response, channel) {
console.log(response);
this._gameStage.readyDig(2, channel);
this.getOrderStatus(response)
}
private getOrderStatus(response){
const {actOrderNum, operationType,} = response;
this.broadcast('callApi', 1, 'getOrderStatus', {actOrderNum, operationType,})
}
onDigError(e) {
console.log(e);
if(typeof e === 'string'){
switch(e){
case '0100000':
this.bubbling('showLoginAlert');
this._gameStage.resetBottomButton();
break;
case '0201150':
this.bubbling('showCreditsAlert');
this._gameStage.resetBottomButton();
break;
case '0100016': //活动未开始
case '0100014': //活动已结束
case '0100017': //活动已关闭
this.bubbling('showErrorToast', e);
break;
default:
this.bubbling('showNetError');//, this._gameStage.restoreDig.bind(this._gameStage, e));
}
}else{
this.bubbling('showNetError');
}
}
onOrderStatusResponse(response) {
console.log('onOrderStatusResponse', response);
this._gameStage.changeOrderStatus(response);
}
onOrderStatusError(e) {
console.log('onOrderStatusError', e);
this._gameStage.changeOrderStatus(1);
}
}
{"ver":"1.0.1","uuid":"be5a5336-ec52-4fa2-bb02-22c4b73439b2","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-09.
*
* 底部按钮控制器
*/
import ScillaComponent from "components/base/ScillaComponent";
import {dynamic, Entity} from "scilla";
import TwoLinesButton from "../game/TwoLinesButton";
import Wave from "components/animation/Wave";
import WaveController from "../common/WaveController";
import {renderRunCredits} from "./utils";
import CustomButton from "./CustomButton";
function getWaveAlgorithm(){
return function bounce(t){
const s = 1 + Math.abs(Math.sin(t)) * 0.1;
return {
sx: s,
sy: s,
}
}
}
export default class BottomButtonController extends ScillaComponent {
activityBaseInfo: dynamic;
buttonPKEntity: Entity;
buttonDigEntity: Entity;
buttonDigSLEntity: Entity;
private _buttonPK: TwoLinesButton;
private _buttonDig: TwoLinesButton;
private _buttonSLDig: CustomButton;
private _buttons = [];
private _counting = 0;
onAwake() {
super.onAwake();
this._buttonSLDig = this.buttonDigSLEntity.getComponent(CustomButton);
this._buttonPK = this.buttonPKEntity.getComponent(TwoLinesButton);
const wavePK = this.buttonPKEntity.getComponent(Wave);
const wcPK = this.buttonPKEntity.getComponent(WaveController);
wavePK.waveAlgorithm = getWaveAlgorithm();
this._buttonDig = this.buttonDigEntity.getComponent(TwoLinesButton);
const waveDig = this.buttonDigEntity.getComponent(Wave);
const wcDig = this.buttonDigEntity.getComponent(WaveController);
waveDig.waveAlgorithm = getWaveAlgorithm();
this.switchState(false);
this._buttons.push({
button: this._buttonPK,
wave: wavePK,
wc: wcPK,
}, {
button: this._buttonDig,
wave: waveDig,
wc: wcDig,
});
setInterval(()=>{
const {button, wave, wc} = this._buttons[(this._counting++) % this._buttons.length];
if(button.interactable && !wc.touchBeginFlag){
wave.play();
}
}, 600);
this.updateButtonLabel();
this.disableAll();
}
initGameStage(){
const {pkExpend, miningExpend} = this.activityBaseInfo;
this.updateButtonLabel(pkExpend, miningExpend);
this.switchState(false);
}
private updateButtonLabel(pkExpend = 0, miningExpend = 0){
this._buttonPK.label1 = renderRunCredits(pkExpend) + '/次';
this._buttonDig.label1 = renderRunCredits(miningExpend) + '/次';
}
enableAll(){
for(let {button, wc} of this._buttons){
button.interactable = true;
wc.touchBeginFlag = false;
}
}
disableAll(){
for(let {button, wc} of this._buttons){
button.interactable = false;
wc.touchBeginFlag = false;
}
}
enablePkDigButton(){
this._buttonSLDig.interactable = true;
}
disablePkDigButton(){
this._buttonSLDig.interactable = false;
}
switchState(isPK){
this.buttonPKEntity.enabled = !isPK;
this.buttonDigEntity.enabled = !isPK;
this.buttonDigSLEntity.enabled = isPK;
if(isPK){
this.enablePkDigButton();
}
}
}
{"ver":"1.0.1","uuid":"a007b015-23b8-469d-9cbb-4580e1e2f56a","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-09.
*
* 积分栏
*/
import ScillaComponent from "components/base/ScillaComponent";
import TextRenderer from "components/renderer/TextRenderer";
import {dynamic, Entity,} from "scilla";
import RunNumber from "../common/RunNumber";
import globalEvent from "globalEvent";
import RectRenderer from "components/renderer/RectRenderer";
export default class CreditsBar extends ScillaComponent {
CreditsUnitName: Entity;
LabelCreditsCurrent: Entity;
Line: Entity;
Label: Entity;
LabelCreditsTotal: Entity;
showCredits: dynamic;
activityBaseInfo: dynamic;
unitName: dynamic;
runDuration = 2000;
private _bgRenderer: RectRenderer;
private _creditsUnitName: TextRenderer;
private _labelCreditsCurrent: TextRenderer;
private _labelCreditsTotal: TextRenderer;
private _runCreditsTotal: RunNumber;
private _runCreditsCurrent: RunNumber;
onAwake() {
super.onAwake();
globalEvent.on('runCredits', this.runCredits, this);
this._bgRenderer = this.getComponent(RectRenderer);
this._creditsUnitName = this.CreditsUnitName.getComponent(TextRenderer);
this._labelCreditsCurrent = this.LabelCreditsCurrent.getComponent(TextRenderer);
this._labelCreditsTotal = this.LabelCreditsTotal.getComponent(TextRenderer);
this._runCreditsCurrent = this.LabelCreditsCurrent.getComponent(RunNumber);
this._runCreditsTotal = this.LabelCreditsTotal.getComponent(RunNumber);
this._creditsUnitName.text = this.unitName;
if(this.showCredits !== 1){
this.LabelCreditsCurrent.enabled = false;
this.Line.enabled = false;
this.Label.enabled = false;
}
this._bgRenderer.width = this.showCredits === 1 ? 480 : 320;
}
initGameStage(){
const {curCredits, heapCredits} = this.activityBaseInfo;
if(this.showCredits === 1){
this._labelCreditsCurrent.text = curCredits.toString();
}
this._labelCreditsTotal.text = heapCredits.toString();
}
runCredits(duration?){
const {curCredits, heapCredits} = this.activityBaseInfo;
if(this.showCredits === 1){
this._runCreditsCurrent.duration = duration || this.runDuration;
this._runCreditsCurrent.play(curCredits);
}
this._runCreditsTotal.duration = duration || this.runDuration;
this._runCreditsTotal.play(heapCredits);
}
}
{"ver":"1.0.1","uuid":"462522fe-e68c-4c0b-b784-267109cdcd6d","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-22.
*
* 自定义按钮
*/
import Button from "components/ui/Button";
export default class CustomButton extends Button {
upLabelColorKey:string;
disabledLabelColorKey:string;
onAwake() {
super.onAwake();
const config = window['configJson'];
if(this.upLabelColorKey){
this.upLabelColor = config[this.upLabelColorKey];
}
if(this.disabledLabelColorKey){
this.disabledLabelColor = config[this.disabledLabelColorKey];
}
}
}
{"ver":"1.0.1","uuid":"d74bdb4d-5af2-43c6-ac4b-299e4d2db9a8","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-23.
*
* 自定义文本渲染器
*/
import TextRenderer from "components/renderer/TextRenderer";
export default class CustomTextRenderer extends TextRenderer {
fillColorKey: string;
onAwake() {
super.onAwake();
const config = window['configJson'];
if(this.fillColorKey){
this.fillColor = config[this.fillColorKey];
}
}
}
{"ver":"1.0.1","uuid":"edf9fcf2-169b-46e9-88c5-a7b1e043c312","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-07.
*
* 游戏舞台
*/
import ScillaComponent from "components/base/ScillaComponent";
import {Entity, instantiate, Texture, resource, dynamic, engine} from "scilla";
import Miner from "./Miner";
import BottomButtonController from "./BottomButtonController";
import CountDown from "../common/CountDown";
import ItemLayer from "./ItemLayer";
import globalEvent from "globalEvent";
const minerConfigs = [
{res: 'blue', dir: 1, walk: true},
{res: 'red', dir: -1, walk: false},
];
export default class GameStage extends ScillaComponent {
MinerLayer: Entity;
ItemLayer: Entity;
Bottom: Entity;
CountDown: Entity;
isLogin: dynamic;
holeRes: Texture;
minerPrefab: resource;
activityBaseInfo: dynamic;
singleDigData: dynamic;
pkDigData: dynamic;
private _bottomButtonController: BottomButtonController;
private _miners: Miner[] = [];
private _countdown: CountDown;
private _itemLayer: ItemLayer;
private _orderStatus;
private _digFinishedCount;
private _minerCount;
onAwake() {
super.onAwake();
this._bottomButtonController = this.Bottom.getComponent(BottomButtonController);
this._countdown = this.CountDown.getComponent(CountDown);
this._itemLayer = this.ItemLayer.getComponent(ItemLayer);
for (let config of minerConfigs) {
let minerEntity = instantiate(this.minerPrefab);
this.MinerLayer.addChild(minerEntity);
let miner: Miner = minerEntity.getComponent(Miner);
miner.prepare(this._itemLayer.digDelegate, this.holeRes.height - 40, config.res);
this._miners.push(miner);
minerEntity.enabled = false;
}
}
initGameStage() {
this.reset();
if (this.activityBaseInfo.machineNickname) {
this.bubbling('showDialog', 'PKChallenge', null, this.onPKChallengeClose)
}
}
private reset() {
for (let miner of this._miners) {
miner.entity.enabled = false;
miner.reset();
}
this._itemLayer.prepareItems();
this.resetBottomButton();
const selfMiner: Miner = this._miners[0];
selfMiner.entity.enabled = true;
selfMiner.standSide(1);
selfMiner.playWalk();
}
resetBottomButton() {
this._bottomButtonController.switchState(false);
this._bottomButtonController.enableAll();
}
private loginAlert() {
if (!this.isLogin) {
this.bubbling('showLoginAlert');
}
return this.isLogin;
}
private creditsAlert() {
/*let {miningExpend, pkExpend, curCredits} = engine.dataCenter.get('API', 'activityBaseInfo');
if (miningExpend > curCredits || pkExpend > curCredits) {
this.bubbling('showCreditsAlert');
return false;
}*/
return true;
}
onTapDig() {
if (!this.loginAlert() || !this.creditsAlert()) {
return;
}
this._bottomButtonController.disableAll();
this._orderStatus = 0;
this._digFinishedCount = 0;
this._minerCount = 1;
const opActivityId = engine.dataCenter.get('CFG', 'opActivityId');
this.broadcast('callApi', 1, 'singleDigData', {opActivityId})
}
onTapPK(channel = 0) {
if (!this.loginAlert() || !this.creditsAlert()) {
return;
}
this._bottomButtonController.disableAll();
this._orderStatus = 0;
this._digFinishedCount = 0;
this._minerCount = 2;
const opActivityId = engine.dataCenter.get('CFG', 'opActivityId');
this.broadcast('callApi', 1, 'pkDigData', {opActivityId}, channel)
}
changeOrderStatus(v) {
this._orderStatus = v;
this.checkDigEnd();
}
readyDig(minerCount, channel) {
if (minerCount === 1) {
this.startDig(minerCount);
} else {
//this.onDigEnd();
if(channel === 1){
this.pkDigData.machineNickname = this.activityBaseInfo.machineNickname;
}
this.bubbling('hideAllDialog');
this.bubbling('showDialog', 'PKMatching', {channel}, this.matchResult);
}
this.activityBaseInfo.curCredits -= minerCount === 1 ? this.activityBaseInfo.miningExpend : this.activityBaseInfo.pkExpend;
globalEvent.emit('runCredits', 500);
this._itemLayer.stopCreditsAnimation();
}
startDig(minerCount) {
const {_miners, _countdown} = this;
_countdown.stop();
const selfMiner: Miner = _miners[0];
selfMiner.playDig();
if (minerCount === 1) {
} else {
this._bottomButtonController.disablePkDigButton();
const otherMiner: Miner = _miners[1];
otherMiner.avoidToDig(selfMiner.transform.position);
}
}
private matchResult = (action) => {
if (action === 'close') {
this._bottomButtonController.enableAll();
this.broadcast('abortCallApi', 1, 'getOrderStatus');
} else {
this.startPKDig();
}
}
startPKDig() {
this._bottomButtonController.switchState(true);
this._countdown.play();
for (let i = 0, li = minerConfigs.length; i < li; i++) {
const config = minerConfigs[i];
const miner = this._miners[i];
miner.entity.enabled = true;
miner.standSide(config.dir);
miner.playWalk();
}
}
restoreDig(e) {
this.reset();
}
checkDigEnd() {
if (this._orderStatus !== 0 && this._digFinishedCount === this._minerCount) {
switch (this._orderStatus) {
case 2:
this.onDigEnd();
break;
case 1:
case 3:
this.bubbling('showNetError');
break;
}
}
}
digEnd() {
this._digFinishedCount++;
this.checkDigEnd();
}
private onDigEnd() {
switch (this._minerCount) {
case 1:
this.activityBaseInfo.curCredits += this.singleDigData.finalCredits;
this.activityBaseInfo.heapCredits += this.singleDigData.finalCredits;
this.bubbling('hideAllDialog');
this.bubbling('showDialog', 'SingleResult', null, this.onSingleResultComplete);
break;
case 2:
const {userFinalCredits, machineFinalCredits} = this.pkDigData;
const resultState = userFinalCredits === machineFinalCredits ? 0 : (userFinalCredits > machineFinalCredits ? -1 : 1);
this.pkDigData.resultState = resultState;
let gotCredits = userFinalCredits;
if (resultState < 0) {
gotCredits += machineFinalCredits;
} else if (resultState > 0) {
gotCredits = 0;
}
this.activityBaseInfo.curCredits += gotCredits;
this.activityBaseInfo.heapCredits += gotCredits;
this.bubbling('hideAllDialog');
this.bubbling('showDialog', 'PKResult', null, this.onPKResult);
break;
}
}
private onPKResult = (action) => {
this.reset();
if (action === 'retry') {
this.onTapPK();
}
}
private onSingleResultComplete = () => {
this.reset();
}
private onPKChallengeClose = (action) => {
if(action === 'accept'){
this.onTapPK(1);
}
}
}
{"ver":"1.0.1","uuid":"32b6e077-b050-4fef-b311-f20eed2b138e","subMetas":{},"type":"script"}
/**
* Created by rockyl on 2019-05-10.
*
* 洞
*/
import ScillaComponent from "components/base/ScillaComponent";
import {Entity} from "scilla";
import Transform from "components/base/Transform";
export default class Hole extends ScillaComponent {
Bg: Entity;
Bottom: Entity;
heightOffset = 50;
bottomOffset = 50;
private bgMask: Transform;
private bottomTransform: Transform;
onAwake() {
super.onAwake();
this.bgMask = this.Bg.getComponent(Transform);
this.bottomTransform = this.Bottom.getComponent(Transform);
}
show(){
this.entity.enabled = true;
this.setDeep(0);
}
hide(){
this.entity.enabled = false;
}
setDeep(v){
this.bgMask.height = v + this.heightOffset;
this.bottomTransform.position.y = v + this.bottomOffset;
}
}
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.
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