Commit 0e614c99 authored by rockyl's avatar rockyl

onAwake更新为onCreate

parent 7cea778d
...@@ -42,8 +42,7 @@ ...@@ -42,8 +42,7 @@
"script": "./scripts/game/Hole", "script": "./scripts/game/Hole",
"properties": { "properties": {
"Bg": "entity|6045c0b6-4dde-4735-9e5a-447b69e259a6", "Bg": "entity|6045c0b6-4dde-4735-9e5a-447b69e259a6",
"Bottom": "entity|4b66fbf8-cec7-400d-b2ca-29c51ebea4f0", "Bottom": "entity|4b66fbf8-cec7-400d-b2ca-29c51ebea4f0"
"BgImage": "entity|6ba5995d-8a37-4753-ac6c-67e4b251e373"
} }
} }
], ],
...@@ -160,7 +159,7 @@ ...@@ -160,7 +159,7 @@
{ {
"script": "components/renderer/FrameAnimationRenderer", "script": "components/renderer/FrameAnimationRenderer",
"properties": { "properties": {
"frameAnimation": "res|fa38740c-fcf1-4e9b-a80f-0d48b77968e8", "frameAnimation": "res|f4d7b2a7-e8b8-406f-bda8-6ed3bd77c34c",
"autoPlay": false, "autoPlay": false,
"onComplete": [ "onComplete": [
{ {
......
...@@ -19,8 +19,8 @@ export default class MainController extends ScillaComponent { ...@@ -19,8 +19,8 @@ export default class MainController extends ScillaComponent {
private _toast: Toast; private _toast: Toast;
private _popup: Popup; private _popup: Popup;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
engine.dataCenter.set('CFG', window['CFG']); engine.dataCenter.set('CFG', window['CFG']);
......
...@@ -27,8 +27,8 @@ export default class ApiComponent extends ScillaComponent { ...@@ -27,8 +27,8 @@ export default class ApiComponent extends ScillaComponent {
private _args; private _args;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
if(this.autoCall){ if(this.autoCall){
this.execute(); this.execute();
......
...@@ -14,8 +14,8 @@ export default class BuriedPoint extends InteractComponent { ...@@ -14,8 +14,8 @@ export default class BuriedPoint extends InteractComponent {
private _buriedPointName: string; private _buriedPointName: string;
private _exposured: boolean; private _exposured: boolean;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
if (this.dpm && this.dcm && !this._exposured) { if (this.dpm && this.dcm && !this._exposured) {
this.setConfig(this.dpm, this.dcm, true); this.setConfig(this.dpm, this.dcm, true);
......
...@@ -31,8 +31,8 @@ export default class CountDown extends ScillaComponent { ...@@ -31,8 +31,8 @@ export default class CountDown extends ScillaComponent {
this.$getTextureName = getTextureNameSample; this.$getTextureName = getTextureNameSample;
} }
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._textureRenderer = this.getComponent(TextureRenderer); this._textureRenderer = this.getComponent(TextureRenderer);
} }
......
...@@ -18,8 +18,8 @@ export default class DotWaiting extends ScillaComponent { ...@@ -18,8 +18,8 @@ export default class DotWaiting extends ScillaComponent {
private _reset; private _reset;
private _dots: GraphicRenderer[] = []; private _dots: GraphicRenderer[] = [];
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._reset = true; this._reset = true;
......
...@@ -16,21 +16,19 @@ export default class FloatMissing extends ScillaComponent { ...@@ -16,21 +16,19 @@ export default class FloatMissing extends ScillaComponent {
private _tween: Tween; private _tween: Tween;
private _tweenResolve: Function; private _tweenResolve: Function;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
if(!this._tween){ this.init();
this.init(); this._tween = createTween(this, this.transform, false, {
this._tween = createTween(this, this.transform, false, { autoPlay: false,
autoPlay: false, initFields: ['position', 'alpha', 'scale'],
initFields: ['position', 'alpha', 'scale'], onComplete: this.onTweenComplete
onComplete: this.onTweenComplete })
}) .wait(this.delay)
.wait(this.delay) .to({scale: {x: 1, y: 1}}, 500, ease.backOut)
.to({scale: {x: 1, y: 1}}, 500, ease.backOut) .wait(this.wait)
.wait(this.wait) .to({alpha: 0, position: this.endPos.toObj()}, 300);
.to({alpha: 0, position: this.endPos.toObj()}, 300);
}
} }
init() { init() {
......
...@@ -30,20 +30,18 @@ export default class FlySequence extends ScillaComponent { ...@@ -30,20 +30,18 @@ export default class FlySequence extends ScillaComponent {
private _timerDelay; private _timerDelay;
private _timer; private _timer;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
if (this._items.length === 0) { this._itemDuration = this.duration - this.count * this.itemInterval - this.delay;
this._itemDuration = this.duration - this.count * this.itemInterval - this.delay;
for (let i = 0; i < this.count; i++) { for (let i = 0; i < this.count; i++) {
let itemEntity = instantiate(this.itemPrefab); let itemEntity = instantiate(this.itemPrefab);
itemEntity.enabled = false; itemEntity.enabled = false;
this.entity.addChild(itemEntity); this.entity.addChild(itemEntity);
let transform = itemEntity.getComponent(Transform); let transform = itemEntity.getComponent(Transform);
this._items.push(transform); this._items.push(transform);
}
} }
} }
......
...@@ -30,8 +30,8 @@ export default class LabelCarousel extends ScillaComponent { ...@@ -30,8 +30,8 @@ export default class LabelCarousel extends ScillaComponent {
private _labels = []; private _labels = [];
private _timer; private _timer;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
const {_labels, entity0, entity1, offset, dir} = this; const {_labels, entity0, entity1, offset, dir} = this;
const entities = [entity0, entity1]; const entities = [entity0, entity1];
......
...@@ -21,8 +21,8 @@ export default class RunNumber extends ScillaComponent { ...@@ -21,8 +21,8 @@ export default class RunNumber extends ScillaComponent {
$renderFunc: (v: number) => string = renderSimple; $renderFunc: (v: number) => string = renderSimple;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._textRenderer = this.getComponent(TextRenderer); this._textRenderer = this.getComponent(TextRenderer);
} }
......
...@@ -23,24 +23,22 @@ export default class Toast extends ScillaComponent { ...@@ -23,24 +23,22 @@ export default class Toast extends ScillaComponent {
private _tweenOut: Tween; private _tweenOut: Tween;
private _timerDuration; private _timerDuration;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
if (!this._bgTransform) { const {offsetY, hideDuration, showDuration, transform} = this;
const {offsetY, hideDuration, showDuration, transform} = this;
this._bgTransform = this.getComponent(Transform); this._bgTransform = this.getComponent(Transform);
this._labelRenderer = this.Label.getComponent(TextRenderer); this._labelRenderer = this.Label.getComponent(TextRenderer);
this._labelTransform = this.Label.getComponent(Transform); this._labelTransform = this.Label.getComponent(Transform);
this._tweenIn = createTween(this, transform, false, {autoPlay: false}) this._tweenIn = createTween(this, transform, false, {autoPlay: false})
.to({position: {x: 0, y: offsetY}}, showDuration, ease.cubicOut); .to({position: {x: 0, y: offsetY}}, showDuration, ease.cubicOut);
this._tweenOut = createTween(this, transform, false, {autoPlay: false}) this._tweenOut = createTween(this, transform, false, {autoPlay: false})
.to({position: {y: 0}}, hideDuration, ease.cubicIn) .to({position: {y: 0}}, hideDuration, ease.cubicIn)
.call(this.onHidden); .call(this.onHidden);
this.transform.position.y = this.outPos; this.transform.position.y = this.outPos;
}
} }
private get outPos(){ private get outPos(){
......
...@@ -29,8 +29,8 @@ export default class WaveController extends InteractComponent { ...@@ -29,8 +29,8 @@ export default class WaveController extends InteractComponent {
touchBeginFlag = false; touchBeginFlag = false;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._wave = this.getComponent(Wave); this._wave = this.getComponent(Wave);
} }
......
...@@ -19,8 +19,8 @@ export default class AlertDialogContent extends DialogContent { ...@@ -19,8 +19,8 @@ export default class AlertDialogContent extends DialogContent {
private _contentLabel: TextRenderer; private _contentLabel: TextRenderer;
private _contentTransform: Transform; private _contentTransform: Transform;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._titleLabel = this.Title.getComponent(TextRenderer); this._titleLabel = this.Title.getComponent(TextRenderer);
this._contentLabel = this.Content.getComponent(TextRenderer); this._contentLabel = this.Content.getComponent(TextRenderer);
......
...@@ -17,8 +17,8 @@ export default class PKChallenge extends DialogContent { ...@@ -17,8 +17,8 @@ export default class PKChallenge extends DialogContent {
private _buttonPK: TwoLinesButton; private _buttonPK: TwoLinesButton;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._buttonPK = this.ButtonPK.getComponent(TwoLinesButton); this._buttonPK = this.ButtonPK.getComponent(TwoLinesButton);
} }
......
...@@ -25,8 +25,8 @@ export default class PKMatching extends DialogContent { ...@@ -25,8 +25,8 @@ export default class PKMatching extends DialogContent {
private _otherNameRenderer: TextRenderer; private _otherNameRenderer: TextRenderer;
private _timer; private _timer;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._titleRenderer = this.Title.getComponent(TextRenderer); this._titleRenderer = this.Title.getComponent(TextRenderer);
this._selfNameRenderer = this.SelfName.getComponent(TextRenderer); this._selfNameRenderer = this.SelfName.getComponent(TextRenderer);
......
...@@ -17,8 +17,8 @@ export default class PKResult extends DialogContent { ...@@ -17,8 +17,8 @@ export default class PKResult extends DialogContent {
private _animLayer: AnimLayer; private _animLayer: AnimLayer;
private _resultLayer: ResultLayer; private _resultLayer: ResultLayer;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._animLayer = this.AnimLayer.getComponent(AnimLayer); this._animLayer = this.AnimLayer.getComponent(AnimLayer);
this._resultLayer = this.ResultLayer.getComponent(ResultLayer); this._resultLayer = this.ResultLayer.getComponent(ResultLayer);
......
...@@ -14,8 +14,8 @@ export default class RuleDialogContent extends DialogContent { ...@@ -14,8 +14,8 @@ export default class RuleDialogContent extends DialogContent {
private _contentRenderer: HtmlRenderer; private _contentRenderer: HtmlRenderer;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._contentRenderer = this.Content.getComponent(HtmlRenderer); this._contentRenderer = this.Content.getComponent(HtmlRenderer);
this._contentRenderer.htmlText = this.ruleContent; this._contentRenderer.htmlText = this.ruleContent;
......
...@@ -29,8 +29,8 @@ export default class SingleResult extends DialogContent { ...@@ -29,8 +29,8 @@ export default class SingleResult extends DialogContent {
private _lightTransform: Transform; private _lightTransform: Transform;
private _flySequence: FlySequence; private _flySequence: FlySequence;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._timesCard = this.TimesCard.getComponent(TimesCard); this._timesCard = this.TimesCard.getComponent(TimesCard);
......
...@@ -21,8 +21,8 @@ export default class AnimLayer extends ScillaComponent { ...@@ -21,8 +21,8 @@ export default class AnimLayer extends ScillaComponent {
private _rightSide: PKResultAnimSide; private _rightSide: PKResultAnimSide;
private _lineTransform: Transform; private _lineTransform: Transform;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._leftSide = this.LeftSide.getComponent(PKResultAnimSide); this._leftSide = this.LeftSide.getComponent(PKResultAnimSide);
this._rightSide = this.RightSide.getComponent(PKResultAnimSide); this._rightSide = this.RightSide.getComponent(PKResultAnimSide);
......
...@@ -25,8 +25,8 @@ export default class ResultLayer extends ScillaComponent { ...@@ -25,8 +25,8 @@ export default class ResultLayer extends ScillaComponent {
private _bottomBarLayout: RelativeLayout; private _bottomBarLayout: RelativeLayout;
private _bottomBarHeight; private _bottomBarHeight;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._leftSide = this.LeftSide.getComponent(PKResultSide); this._leftSide = this.LeftSide.getComponent(PKResultSide);
this._rightSide = this.RightSide.getComponent(PKResultSide); this._rightSide = this.RightSide.getComponent(PKResultSide);
......
...@@ -10,8 +10,8 @@ import GameStage from "./GameStage"; ...@@ -10,8 +10,8 @@ import GameStage from "./GameStage";
export default class ApiProcess extends ScillaComponent { export default class ApiProcess extends ScillaComponent {
private _gameStage: GameStage; private _gameStage: GameStage;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._gameStage = this.entity.getComponent(GameStage); this._gameStage = this.entity.getComponent(GameStage);
} }
......
...@@ -36,8 +36,8 @@ export default class BottomButtonController extends ScillaComponent { ...@@ -36,8 +36,8 @@ export default class BottomButtonController extends ScillaComponent {
private _buttons = []; private _buttons = [];
private _counting = 0; private _counting = 0;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._buttonSLDig = this.buttonDigSLEntity.getComponent(CustomButton); this._buttonSLDig = this.buttonDigSLEntity.getComponent(CustomButton);
......
...@@ -30,8 +30,8 @@ export default class CreditsBar extends ScillaComponent { ...@@ -30,8 +30,8 @@ export default class CreditsBar extends ScillaComponent {
private _runCreditsTotal: RunNumber; private _runCreditsTotal: RunNumber;
private _runCreditsCurrent: RunNumber; private _runCreditsCurrent: RunNumber;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
globalEvent.on('runCredits', this.runCredits, this); globalEvent.on('runCredits', this.runCredits, this);
......
...@@ -10,8 +10,8 @@ export default class CustomButton extends Button { ...@@ -10,8 +10,8 @@ export default class CustomButton extends Button {
upLabelColorKey:string; upLabelColorKey:string;
disabledLabelColorKey:string; disabledLabelColorKey:string;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
const config = window['configJson']; const config = window['configJson'];
if(this.upLabelColorKey){ if(this.upLabelColorKey){
......
...@@ -9,8 +9,8 @@ import TextRenderer from "components/renderer/TextRenderer"; ...@@ -9,8 +9,8 @@ import TextRenderer from "components/renderer/TextRenderer";
export default class CustomTextRenderer extends TextRenderer { export default class CustomTextRenderer extends TextRenderer {
fillColorKey: string; fillColorKey: string;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
const config = window['configJson']; const config = window['configJson'];
if(this.fillColorKey){ if(this.fillColorKey){
......
...@@ -39,8 +39,8 @@ export default class GameStage extends ScillaComponent { ...@@ -39,8 +39,8 @@ export default class GameStage extends ScillaComponent {
private _digFinishedCount; private _digFinishedCount;
private _minerCount; private _minerCount;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._bottomButtonController = this.Bottom.getComponent(BottomButtonController); this._bottomButtonController = this.Bottom.getComponent(BottomButtonController);
this._countdown = this.CountDown.getComponent(CountDown); this._countdown = this.CountDown.getComponent(CountDown);
......
...@@ -17,8 +17,8 @@ export default class Hole extends ScillaComponent { ...@@ -17,8 +17,8 @@ export default class Hole extends ScillaComponent {
private bgMask: Transform; private bgMask: Transform;
private bottomTransform: Transform; private bottomTransform: Transform;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this.bgMask = this.Bg.getComponent(Transform); this.bgMask = this.Bg.getComponent(Transform);
this.bottomTransform = this.Bottom.getComponent(Transform); this.bottomTransform = this.Bottom.getComponent(Transform);
......
...@@ -18,8 +18,8 @@ export default class Item extends ScillaComponent { ...@@ -18,8 +18,8 @@ export default class Item extends ScillaComponent {
private _label: TextRenderer; private _label: TextRenderer;
private _playing = false; private _playing = false;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._floatMissing = this.creditsEntity.getComponent(FloatMissing); this._floatMissing = this.creditsEntity.getComponent(FloatMissing);
this._label = this.Label.getComponent(TextRenderer); this._label = this.Label.getComponent(TextRenderer);
......
...@@ -29,8 +29,8 @@ export default class ItemLayer extends ScillaComponent { ...@@ -29,8 +29,8 @@ export default class ItemLayer extends ScillaComponent {
private _excludeItemQueue = []; private _excludeItemQueue = [];
private _timerCreditsAnimation; private _timerCreditsAnimation;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._playCreditsCount = Math.floor(this.itemCount / 3); this._playCreditsCount = Math.floor(this.itemCount / 3);
this._itemGap = { this._itemGap = {
......
...@@ -67,18 +67,16 @@ export default class Miner extends ScillaComponent { ...@@ -67,18 +67,16 @@ export default class Miner extends ScillaComponent {
this._minerTransform.position.y = 0; this._minerTransform.position.y = 0;
} }
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
if (!this._minerTransform) { this._minerTransform = this.Miner.getComponent(Transform);
this._minerTransform = this.Miner.getComponent(Transform); this._bodyAnim = this.Body.getComponent(FrameAnimationRenderer);
this._bodyAnim = this.Body.getComponent(FrameAnimationRenderer);
this._effectAnim = this.Effect.getComponent(FrameAnimationRenderer); this._effectAnim = this.Effect.getComponent(FrameAnimationRenderer);
this._hole = this.Hole.getComponent(Hole); this._hole = this.Hole.getComponent(Hole);
this._hole.hide(); this._hole.hide();
}
} }
onUpdate(t) { onUpdate(t) {
......
...@@ -16,8 +16,8 @@ export default class NoticeBar extends ScillaComponent { ...@@ -16,8 +16,8 @@ export default class NoticeBar extends ScillaComponent {
private _pool:string[] = []; private _pool:string[] = [];
private _bgRenderer: RectRenderer; private _bgRenderer: RectRenderer;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._bgRenderer = this.getComponent(RectRenderer); this._bgRenderer = this.getComponent(RectRenderer);
this._bgRenderer.enabled = false; this._bgRenderer.enabled = false;
......
...@@ -26,20 +26,18 @@ export default class PKResultAnimSide extends ScillaComponent { ...@@ -26,20 +26,18 @@ export default class PKResultAnimSide extends ScillaComponent {
private _pos; private _pos;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
if (!this._labelName) { this._labelName = this.LabelName.getComponent(TextRenderer);
this._labelName = this.LabelName.getComponent(TextRenderer); this._labelCredits = this.LabelCredits.getComponent(TextRenderer);
this._labelCredits = this.LabelCredits.getComponent(TextRenderer); this._labelCreditsTransform = this.LabelCredits.getComponent(Transform);
this._labelCreditsTransform = this.LabelCredits.getComponent(Transform); this._labelRunCredits = this.LabelCredits.getComponent(RunNumber);
this._labelRunCredits = this.LabelCredits.getComponent(RunNumber); this._timesCard = this.TimesCard.getComponent(TimesCard);
this._timesCard = this.TimesCard.getComponent(TimesCard);
this._labelRunCredits.$renderFunc = renderRunCredits; this._labelRunCredits.$renderFunc = renderRunCredits;
this._pos = this.transform.position.x; this._pos = this.transform.position.x;
}
} }
async play(data) { async play(data) {
......
...@@ -36,22 +36,20 @@ export default class PKResultSide extends ScillaComponent { ...@@ -36,22 +36,20 @@ export default class PKResultSide extends ScillaComponent {
private _pos; private _pos;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
if (!this._labelName) { this._labelName = this.LabelName.getComponent(TextRenderer);
this._labelName = this.LabelName.getComponent(TextRenderer); this._labelCredits = this.LabelCredits.getComponent(TextRenderer);
this._labelCredits = this.LabelCredits.getComponent(TextRenderer); this._labelCreditsTransform = this.LabelCredits.getComponent(Transform);
this._labelCreditsTransform = this.LabelCredits.getComponent(Transform); this._resultTagRenderer = this.ResultTag.getComponent(TextureRenderer);
this._resultTagRenderer = this.ResultTag.getComponent(TextureRenderer); this._bodyRenderer = this.Body.getComponent(TextureRenderer);
this._bodyRenderer = this.Body.getComponent(TextureRenderer); this._resultTagZoom = this.ResultTag.getComponent(Zoom);
this._resultTagZoom = this.ResultTag.getComponent(Zoom); this._labelRunCredits = this.LabelCredits.getComponent(RunNumber);
this._labelRunCredits = this.LabelCredits.getComponent(RunNumber);
this._labelRunCredits.$renderFunc = renderRunCredits; this._labelRunCredits.$renderFunc = renderRunCredits;
this._pos = this.transform.position.x; this._pos = this.transform.position.x;
}
} }
onUpdate(t) { onUpdate(t) {
......
...@@ -13,8 +13,8 @@ export default class TimesCard extends ScillaComponent { ...@@ -13,8 +13,8 @@ export default class TimesCard extends ScillaComponent {
private _labelRenderer: TextRenderer; private _labelRenderer: TextRenderer;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._labelRenderer = this.Label.getComponent(TextRenderer); this._labelRenderer = this.Label.getComponent(TextRenderer);
} }
......
...@@ -23,13 +23,11 @@ export default class TwoLinesButton extends CustomButton { ...@@ -23,13 +23,11 @@ export default class TwoLinesButton extends CustomButton {
protected label0TextRenderer: TextRenderer; protected label0TextRenderer: TextRenderer;
protected label1TextRenderer: TextRenderer; protected label1TextRenderer: TextRenderer;
onAwake() { onCreate() {
if(!this.label0TextRenderer){ this.label0TextRenderer = this.label0Entity.getComponent(TextRenderer);
this.label0TextRenderer = this.label0Entity.getComponent(TextRenderer); this.label1TextRenderer = this.label1Entity.getComponent(TextRenderer);
this.label1TextRenderer = this.label1Entity.getComponent(TextRenderer);
}
super.onAwake(); super.onCreate();
} }
onUpdate(t) { onUpdate(t) {
......
...@@ -17,10 +17,6 @@ export default class SingleSceneNavigator extends ScillaComponent { ...@@ -17,10 +17,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);
}
onAwake() {
super.onAwake();
this.push('start'); this.push('start');
} }
......
...@@ -30,15 +30,13 @@ export default class DialogContent extends ScillaComponent { ...@@ -30,15 +30,13 @@ export default class DialogContent extends ScillaComponent {
} }
} }
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
if (!this._closeButton) { const buttons = this.entity.getChildrenByName('CloseButton');
const buttons = this.entity.getChildrenByName('CloseButton'); if (buttons.length > 0) {
if (buttons.length > 0) { this._closeButton = buttons[0].getComponent(CustomButton);
this._closeButton = buttons[0].getComponent(CustomButton); this._closeButton.onClick.addListener(this.onTapCloseButton, this);
this._closeButton.onClick.addListener(this.onTapCloseButton, this);
}
} }
} }
......
...@@ -19,8 +19,8 @@ export default class Popup extends ScillaComponent { ...@@ -19,8 +19,8 @@ export default class Popup extends ScillaComponent {
private _touchInterrupt: TouchInterrupt; private _touchInterrupt: TouchInterrupt;
private _dialogStack = []; private _dialogStack = [];
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
this._touchInterrupt = this.getComponent(TouchInterrupt); this._touchInterrupt = this.getComponent(TouchInterrupt);
this._touchInterrupt.enabled = false; this._touchInterrupt.enabled = false;
......
...@@ -43,8 +43,8 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView ...@@ -43,8 +43,8 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView
_level: number = 3; _level: number = 3;
_img: any; _img: any;
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
//this._puzzle = this.Puzzle.getComponent(Puzzle); //this._puzzle = this.Puzzle.getComponent(Puzzle);
} }
......
...@@ -38,8 +38,8 @@ export default class SceneStart extends ScillaComponent implements INavigatorVie ...@@ -38,8 +38,8 @@ export default class SceneStart extends ScillaComponent implements INavigatorVie
PrizeButton: Entity; PrizeButton: Entity;
StartButton: Entity;*/ StartButton: Entity;*/
onAwake() { onCreate() {
super.onAwake(); super.onCreate();
} }
......
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { engine } from "scilla";
import Toast from "./common/Toast";
import Popup from "./popup/Popup";
import { initEnv } from "./common/BuriedPoint";
import { isWeiXin } from "./game/utils";
var MainController = (function (_super) {
tslib_1.__extends(MainController, _super);
function MainController() {
return _super !== null && _super.apply(this, arguments) || this;
}
MainController.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
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 });
};
MainController.prototype.onGotActivityBaseInfo = function () {
this.broadcast('initGameStage');
};
MainController.prototype.onActivityBaseInfoError = function (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();
}
};
MainController.prototype.showErrorToast = function (e) {
switch (e) {
case '0100016':
this.showToast('活动未开始,暂时无法参与');
break;
case '0100014':
case '0100017':
this.showToast('活动已结束,无法参与');
break;
}
};
MainController.prototype.showToast = function (content, duration) {
this._toast.show({
content: content,
duration: duration,
});
};
MainController.prototype.showDialog = function (name, data, callback) {
this._popup.showDialog(name, data, callback);
};
MainController.prototype.hideDialog = function (name, action, data) {
this._popup.hideDialog(name, action, data);
};
MainController.prototype.hideAllDialog = function () {
this._popup.hideAll();
};
MainController.prototype.alert = function (data, callback, callbackDelay) {
if (callbackDelay === void 0) { callbackDelay = 500; }
this.showDialog('Alert', data, function (action, data) {
setTimeout(function () {
callback(action, data);
}, callbackDelay);
});
};
MainController.prototype.showLoginAlert = function () {
var callUpRegistH5Code = engine.dataCenter.get('CFG', 'callUpRegistH5Code');
var requirelogin = window['requirelogin'];
var inWeiXin = isWeiXin();
this.alert({
title: "\u554A\u54E6\uFF0C\u4F60\u8FD8\u672A\u767B\u5F55",
content: "\u767B\u5F55\u540E\u5373\u53EF\u53C2\u4E0E\u6D3B\u52A8",
button: (inWeiXin ? (callUpRegistH5Code || requirelogin) : requirelogin) ? '立即登录' : null,
}, function (action) {
if (action === 'confirm') {
if (inWeiXin) {
if (callUpRegistH5Code) {
location.href = callUpRegistH5Code;
}
else if (requirelogin) {
requirelogin();
}
else {
console.log('没有登录方案');
}
}
else {
if (requirelogin) {
requirelogin();
}
else {
console.log('没有登录方案');
}
}
}
});
};
MainController.prototype.showCreditsAlert = function () {
var unitName = engine.dataCenter.get('CFG', 'unitName');
var earnCreditsUrl = engine.dataCenter.get('CFG', 'earnCreditsUrl');
this.alert({
title: "\u554A\u54E6\uFF0C\u5F53\u524D" + unitName + "\u4E0D\u8DB3",
content: "\u5FEB\u53BB\u9886\u53D6\u66F4\u591A" + unitName + "\u5427",
button: earnCreditsUrl ? '去做任务' : null,
}, function (action) {
if (action === 'confirm') {
location.href = earnCreditsUrl;
}
});
};
MainController.prototype.showNetError = function (action) {
this.showDialog('Alert', { title: '网络异常', content: '请检查网络后重试!', button: '重新加载', showCloseButton: false }, function () {
if (typeof action === 'function') {
action();
}
else {
action = action || 'refresh';
switch (action) {
case 'back':
history.back();
break;
case 'refresh':
location.reload();
break;
}
}
});
};
return MainController;
}(ScillaComponent));
export default MainController;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { createTween, ease } from "scilla";
export function playAnimation(config, context) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var partName, partConfig, part, componentName, component, _a, params, duration, easeName;
return tslib_1.__generator(this, function (_b) {
for (partName in config) {
partConfig = config[partName];
part = context[partName];
for (componentName in partConfig) {
component = part.getComponentByName(componentName);
_a = partConfig[componentName], params = _a.params, duration = _a.duration, easeName = _a.ease;
createTween(context, component)
.to(params, duration, ease[easeName]);
}
}
return [2];
});
});
}
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { engine, ScillaEvent } from "scilla";
import ScillaComponent from "components/base/ScillaComponent";
export var RequestMethod;
(function (RequestMethod) {
RequestMethod["GET"] = "GET";
RequestMethod["POST"] = "POST";
RequestMethod["PUT"] = "PUT";
RequestMethod["DELETE"] = "DELETE";
})(RequestMethod || (RequestMethod = {}));
var ApiComponent = (function (_super) {
tslib_1.__extends(ApiComponent, _super);
function ApiComponent() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.method = RequestMethod.POST;
_this.onResponse = new ScillaEvent();
_this.onError = new ScillaEvent();
_this.onFinish = new ScillaEvent();
_this.autoCall = false;
return _this;
}
ApiComponent.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
if (this.autoCall) {
this.execute();
}
};
ApiComponent.prototype.execute = function (paramsInput) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
this._args = args;
return [2];
});
});
};
ApiComponent.prototype.onGotResponse = function (response) {
var _a;
if (this.name) {
engine.dataCenter.set('API', this.name, response.data);
}
if (this._args && this._args.length > 0) {
(_a = this.onResponse).invoke.apply(_a, tslib_1.__spread([response.data], this._args));
}
else {
this.onResponse.invoke(response.data);
}
this.onCallFinish();
};
ApiComponent.prototype.onGotError = function (e) {
var _a;
if (this._args && this._args.length > 0) {
(_a = this.onError).invoke.apply(_a, tslib_1.__spread([e], this._args));
}
else {
this.onError.invoke(e);
}
this.onCallFinish();
};
ApiComponent.prototype.onCallFinish = function () {
var _a;
if (this._args && this._args.length > 0) {
(_a = this.onFinish).invoke.apply(_a, tslib_1.__spread(this._args));
}
else {
this.onFinish.invoke();
}
};
return ApiComponent;
}(ScillaComponent));
export default ApiComponent;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { utils, } from 'scilla';
import ApiComponent from "./ApiComponent";
import { callApi } from "../net/webService";
var SampleApi = (function (_super) {
tslib_1.__extends(SampleApi, _super);
function SampleApi() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.ignoreSuccessField = false;
return _this;
}
SampleApi.prototype.callApi = function (name, paramsInput) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!(this.name == name)) return [3, 2];
return [4, this.execute.apply(this, tslib_1.__spread([paramsInput], args))];
case 1:
_a.sent();
_a.label = 2;
case 2: return [2];
}
});
});
};
SampleApi.prototype.execute = function (paramsInput) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return tslib_1.__awaiter(this, void 0, void 0, function () {
var params, _a, uri, method, response, e_1;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0: return [4, _super.prototype.execute.apply(this, tslib_1.__spread([paramsInput], args))];
case 1:
_b.sent();
params = {};
if (this.params) {
utils.injectProp(params, this.params);
}
if (paramsInput) {
utils.injectProp(params, paramsInput);
}
_a = this, uri = _a.uri, method = _a.method;
_b.label = 2;
case 2:
_b.trys.push([2, 4, , 5]);
return [4, callApi(uri, params, method, 'json', this.ignoreSuccessField)];
case 3:
response = _b.sent();
this.onGotResponse(response);
return [2, response.data];
case 4:
e_1 = _b.sent();
this.onGotError(e_1);
return [3, 5];
case 5: return [2];
}
});
});
};
return SampleApi;
}(ApiComponent));
export default SampleApi;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { utils, } from 'scilla';
import ApiComponent from "./ApiComponent";
import { polling } from "../net/webService";
var SamplePollingApi = (function (_super) {
tslib_1.__extends(SamplePollingApi, _super);
function SamplePollingApi() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.maxTimes = 5;
_this.delay = 500;
_this._abortFlag = false;
_this.abortFunc = function () {
return _this._abortFlag;
};
_this.successFunc = function (response) {
var _a = _this, successField = _a.successField, successValues = _a.successValues;
var v = successField ? response.data[successField] : response.data;
return successValues ? successValues.indexOf(v) >= 0 : false;
};
return _this;
}
SamplePollingApi.prototype.callApi = function (name, paramsInput) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!(this.name == name)) return [3, 2];
return [4, this.execute.apply(this, tslib_1.__spread([paramsInput], args))];
case 1:
_a.sent();
_a.label = 2;
case 2: return [2];
}
});
});
};
SamplePollingApi.prototype.abortCallApi = function (name) {
if (this.name == name) {
this._abort();
}
};
SamplePollingApi.prototype.execute = function (paramsInput) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return tslib_1.__awaiter(this, void 0, void 0, function () {
var params, _a, uri, method, response, e_1;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0: return [4, _super.prototype.execute.apply(this, tslib_1.__spread([paramsInput], args))];
case 1:
_b.sent();
this._abortFlag = false;
params = {};
if (this.params) {
utils.injectProp(params, this.params);
}
if (paramsInput) {
utils.injectProp(params, paramsInput);
}
_a = this, uri = _a.uri, method = _a.method;
_b.label = 2;
case 2:
_b.trys.push([2, 4, , 5]);
return [4, polling(this.successFunc, uri, params, this.maxTimes, this.delay, this.abortFunc, method)];
case 3:
response = _b.sent();
this.onGotResponse(response);
return [2, response.data];
case 4:
e_1 = _b.sent();
this.onGotError(e_1);
return [3, 5];
case 5: return [2];
}
});
});
};
SamplePollingApi.prototype._abort = function () {
this._abortFlag = true;
};
return SamplePollingApi;
}(ApiComponent));
export default SamplePollingApi;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import InteractComponent from "components/base/InteractComponent";
import { callApi } from "../net/webService";
import { engine } from "scilla";
var BuriedPoint = (function (_super) {
tslib_1.__extends(BuriedPoint, _super);
function BuriedPoint() {
return _super !== null && _super.apply(this, arguments) || this;
}
BuriedPoint.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
if (this.dpm && this.dcm && !this._exposured) {
this.setConfig(this.dpm, this.dcm, true);
}
};
BuriedPoint.prototype.onTouchTap = function (e) {
_super.prototype.onTouchTap.call(this, e);
if (this._buriedPointName) {
logClick(this._buriedPointName);
}
};
BuriedPoint.prototype.setConfig = function (dpm, dcm, needLogExposure) {
if (needLogExposure === void 0) { needLogExposure = false; }
this._buriedPointName = 'buried-point-' + Date.now() + Math.floor(Math.random() * 999999);
addBuriedPointConfig(this._buriedPointName, { dpm: dpm, dcm: dcm });
if (needLogExposure) {
logExposure(this._buriedPointName);
this._exposured = true;
}
};
return BuriedPoint;
}(InteractComponent));
export default BuriedPoint;
var _buriedPoints = {};
var env;
export function initEnv() {
var cfg = engine.dataCenter.get('CFG');
env = {
app_id: cfg.appId,
oaid: cfg.opActivityId,
page_id: 3,
comp_id: 4,
};
}
export function addBuriedPoints(buriedPoints) {
for (var name in buriedPoints) {
_buriedPoints[name] = buriedPoints[name];
}
}
export function addBuriedPointConfig(name, config) {
var dpm = config.dpm, dcm = config.dcm;
_buriedPoints[name] = new BuriedPointData(dpm, dcm);
}
export function addBuriedPointConfigs(configs) {
for (var 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) {
}
var logPoint = _buriedPoints[name];
var appId = engine.dataCenter.get('CFG', 'appId');
var dpm = logPoint.dpm, dcm = logPoint.dcm;
return callApi(type == 'exposure' ? '//embedlog.duiba.com.cn/exposure/standard' : '/log/click', {
dpm: dpm, dcm: dcm, appId: appId
}, 'get', type == 'exposure' ? 'jsonp' : 'json').catch(function (e) {
});
}
function fillData(src) {
var result = src;
for (var key in env) {
result = result.replace(key, env[key]);
}
return result;
}
var BuriedPointData = (function () {
function BuriedPointData(dpm, dcm) {
this.dpm = fillData(dpm);
this.dcm = fillData(dcm);
}
return BuriedPointData;
}());
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { ScillaEvent } from "scilla";
import TextureRenderer from "components/renderer/TextureRenderer";
function getTextureNameSample(second) {
return second + ".png";
}
var CountDown = (function (_super) {
tslib_1.__extends(CountDown, _super);
function CountDown() {
var _this = _super.call(this) || this;
_this.onComplete = new ScillaEvent();
_this.interval = 1000;
_this.hideWhenStop = true;
_this.onTimer = function () {
if (_this._remainSeconds <= 0) {
_this.onComplete.invoke();
_this.stop();
return;
}
var sheet = _this.numberSheet;
_this._textureRenderer.texture = sheet.getTexture(_this.$getTextureName(_this._remainSeconds));
_this._remainSeconds--;
};
_this.$getTextureName = getTextureNameSample;
return _this;
}
CountDown.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._textureRenderer = this.getComponent(TextureRenderer);
};
CountDown.prototype.play = function () {
if (this.seconds > 0) {
this.entity.enabled = true;
this._remainSeconds = this.seconds;
this.stop();
this.onTimer();
this._timer = setInterval(this.onTimer, this.interval);
}
};
CountDown.prototype.stop = function () {
if (this._timer) {
clearInterval(this._timer);
this._timer = null;
if (this.hideWhenStop) {
this.entity.enabled = false;
}
}
};
return CountDown;
}(ScillaComponent));
export default CountDown;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import GraphicRenderer from "components/renderer/GraphicRenderer";
var DotWaiting = (function (_super) {
tslib_1.__extends(DotWaiting, _super);
function DotWaiting() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.interval = 300;
_this._dots = [];
return _this;
}
DotWaiting.prototype.onCreate = function () {
var e_1, _a;
_super.prototype.onCreate.call(this);
this._reset = true;
this._dots.splice(0);
try {
for (var _b = tslib_1.__values(this.entity.children), _c = _b.next(); !_c.done; _c = _b.next()) {
var child = _c.value;
this._dots.push(child.getComponent(GraphicRenderer));
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
};
DotWaiting.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
if (this._reset) {
this._reset = false;
this._startTime = t;
}
var index = Math.floor((t - this._startTime) / this.interval) % this._dots.length;
if (this._index !== index) {
for (var i = 0, li = this._dots.length; i < li; i++) {
var dot = this._dots[i];
dot.fillColor = index === i ? this.activeColor : this.inativeColor;
}
}
};
return DotWaiting;
}(ScillaComponent));
export default DotWaiting;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { createTween, ease, Vector2D } from "scilla";
import { killTweens } from "scilla/src/support/Tween";
var FloatMissing = (function (_super) {
tslib_1.__extends(FloatMissing, _super);
function FloatMissing() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.wait = 500;
_this.delay = 0;
_this.endPos = new Vector2D(0, -100);
_this.onTweenComplete = function () {
if (_this._tweenResolve) {
_this._tweenResolve();
_this._tweenResolve = null;
}
};
return _this;
}
FloatMissing.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
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);
};
FloatMissing.prototype.init = function () {
this.transform.alpha = 1;
this.transform.scale.setXY(0, 0);
};
FloatMissing.prototype.play = function () {
var _this = this;
return new Promise(function (resolve) {
_this._tweenResolve = resolve;
_this._tween.play(true, 0, false);
});
};
FloatMissing.prototype.stop = function () {
killTweens(this.transform);
};
return FloatMissing;
}(ScillaComponent));
export default FloatMissing;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { createTween, ease, instantiate, ScillaEvent, Vector2D } from "scilla";
import Transform from "components/base/Transform";
var FlySequence = (function (_super) {
tslib_1.__extends(FlySequence, _super);
function FlySequence() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.count = 10;
_this.fromPos = new Vector2D();
_this.toPos = new Vector2D();
_this.toScale = new Vector2D(0.3, 0.3);
_this.duration = 3000;
_this.delay = 500;
_this.itemInterval = 100;
_this.hideWhenComplete = true;
_this.offset = 1;
_this.onComplete = new ScillaEvent();
_this._items = [];
_this.onDelay = function () {
_this._timer = setInterval(function () {
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);
};
_this.onEnd = function () {
_this.onComplete.invoke();
};
return _this;
}
FlySequence.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._itemDuration = this.duration - this.count * this.itemInterval - this.delay;
for (var i = 0; i < this.count; i++) {
var itemEntity = instantiate(this.itemPrefab);
itemEntity.enabled = false;
this.entity.addChild(itemEntity);
var transform = itemEntity.getComponent(Transform);
this._items.push(transform);
}
};
FlySequence.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
};
FlySequence.prototype.play = function () {
this.stop();
if (this.ToEntity) {
this.toPos = this.transform.globalPositionToLocal(this.ToEntity.getComponent(Transform).globalPosition);
}
var 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);
};
FlySequence.prototype.stop = function (hidden) {
var e_1, _a;
if (hidden === void 0) { hidden = true; }
if (this._timer) {
clearInterval(this._timer);
this._timer = null;
}
if (this._timerDelay) {
clearTimeout(this._timerDelay);
this._timerDelay = null;
}
if (hidden) {
try {
for (var _b = tslib_1.__values(this._items), _c = _b.next(); !_c.done; _c = _b.next()) {
var item = _c.value;
item.entity.enabled = false;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
}
};
FlySequence.prototype._playItem = function (index) {
var item = this._items[index];
item.entity.enabled = true;
item.position.copyFrom(this.fromPos);
item.scale.setXY(0, 0);
this._flyItem(item);
};
FlySequence.prototype._flyItem = function (item, callback) {
var _this = this;
var 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);
var easeFuncCreator = Math.random() > 0.5 ? ease.getPowOut : ease.getPowIn;
var easeFunc = easeFuncCreator(Math.random() + this.offset);
createTween(this, item.position)
.to({ y: this.toPos.y }, itemDuration, easeFunc)
.call(function () {
if (_this.hideWhenComplete) {
item.entity.enabled = false;
}
callback && callback();
});
};
return FlySequence;
}(ScillaComponent));
export default FlySequence;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { createTween, ease } from "scilla";
import Transform from "components/base/Transform";
import TextRenderer from "components/renderer/TextRenderer";
export var DIR;
(function (DIR) {
DIR[DIR["UP"] = 0] = "UP";
DIR[DIR["DOWN"] = 1] = "DOWN";
})(DIR || (DIR = {}));
var LabelCarousel = (function (_super) {
tslib_1.__extends(LabelCarousel, _super);
function LabelCarousel() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.offset = 40;
_this.interval = 1000;
_this.scrollDuration = 500;
_this.dir = DIR.UP;
_this.autoPlay = false;
_this._playing = false;
_this._index = 0;
_this._labels = [];
return _this;
}
LabelCarousel.prototype.onCreate = function () {
var e_1, _a;
_super.prototype.onCreate.call(this);
var _b = this, _labels = _b._labels, entity0 = _b.entity0, entity1 = _b.entity1, offset = _b.offset, dir = _b.dir;
var entities = [entity0, entity1];
try {
for (var entities_1 = tslib_1.__values(entities), entities_1_1 = entities_1.next(); !entities_1_1.done; entities_1_1 = entities_1.next()) {
var entity = entities_1_1.value;
var transform = entity.getComponent(Transform);
var textRenderer = entity.getComponent(TextRenderer);
transform.position.y = offset * (dir === DIR.UP ? -1 : 1);
transform.alpha = 0;
_labels.push({
transform: transform,
textRenderer: textRenderer
});
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (entities_1_1 && !entities_1_1.done && (_a = entities_1.return)) _a.call(entities_1);
}
finally { if (e_1) throw e_1.error; }
}
if (this.autoPlay) {
this.play();
}
};
LabelCarousel.prototype.play = function () {
var _this = this;
this.playNext();
this.stop();
this._timer = setInterval(function () {
_this.playNext();
}, this.interval);
this._playing = true;
};
LabelCarousel.prototype.stop = function () {
if (this._timer) {
clearInterval(this._timer);
this._timer = null;
}
this._playing = false;
};
LabelCarousel.prototype.updateText = function (textRenderer) {
var text = this.getTextFunc ? this.getTextFunc() : null;
if (text) {
textRenderer.text = text;
}
};
LabelCarousel.prototype.playNext = function () {
var _a = this, _labels = _a._labels, _index = _a._index, scrollDuration = _a.scrollDuration, offset = _a.offset, dir = _a.dir;
var nextLabel = _labels[_index % 2];
var 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) {
var lastLabel = _labels[(_index + 1) % 2];
createTween(this, lastLabel.transform, true)
.to({ position: { y: offset * sign }, alpha: 0 }, scrollDuration, ease.cubicOut);
}
this._index++;
};
return LabelCarousel;
}(ScillaComponent));
export default LabelCarousel;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
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();
}
var RunNumber = (function (_super) {
tslib_1.__extends(RunNumber, _super);
function RunNumber() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.duration = 3000;
_this.onComplete = new ScillaEvent();
_this.$renderFunc = renderSimple;
return _this;
}
RunNumber.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._textRenderer = this.getComponent(TextRenderer);
};
RunNumber.prototype.play = function (to, from) {
var _this = this;
if (!this._textRenderer) {
return Promise.resolve();
}
from = from === undefined ? parseFloat(this._textRenderer.text) : from;
return new Promise(function (resolve) {
createTween(_this, _this, true)
.set({ t: from })
.to({ t: to }, _this.duration)
.call(function () {
resolve();
_this.onComplete.invoke();
});
});
};
Object.defineProperty(RunNumber.prototype, "t", {
get: function () {
return this._t;
},
set: function (v) {
this._t = v;
this._textRenderer.text = this.$renderFunc(v);
},
enumerable: true,
configurable: true
});
return RunNumber;
}(ScillaComponent));
export default RunNumber;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { createTween, ease, engine, } from "scilla";
import ScillaComponent from "components/base/ScillaComponent";
import TextRenderer from "components/renderer/TextRenderer";
import Transform from "components/base/Transform";
var Toast = (function (_super) {
tslib_1.__extends(Toast, _super);
function Toast() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.padding = 20;
_this.offsetY = 0;
_this.showDuration = 300;
_this.hideDuration = 300;
return _this;
}
Toast.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
var _a = this, offsetY = _a.offsetY, hideDuration = _a.hideDuration, showDuration = _a.showDuration, transform = _a.transform;
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;
};
Object.defineProperty(Toast.prototype, "outPos", {
get: function () {
return engine.renderContext.stageCenter.y + this._bgTransform.height;
},
enumerable: true,
configurable: true
});
Toast.prototype.show = function (_a) {
var _this = this;
var content = _a.content, _b = _a.duration, duration = _b === void 0 ? 1000 : _b;
this.entity.enabled = true;
var _c = this, _bgTransform = _c._bgTransform, _labelRenderer = _c._labelRenderer, _labelTransform = _c._labelTransform, padding = _c.padding;
_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(function () {
_this.hide();
}, duration);
};
Toast.prototype.hide = function () {
this._tweenOut.play(true);
};
Toast.prototype.onHidden = function () {
this.entity.enabled = false;
};
return Toast;
}(ScillaComponent));
export default Toast;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import InteractComponent from "components/base/InteractComponent";
import Wave from "components/animation/Wave";
var WaveController = (function (_super) {
tslib_1.__extends(WaveController, _super);
function WaveController() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.playWhenInteractable = true;
_this.stopWhenUninteractable = true;
_this.stopWhenTouchBegin = true;
_this.playWhenTouchEnd = true;
_this.touchBeginFlag = false;
return _this;
}
WaveController.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._wave = this.getComponent(Wave);
};
WaveController.prototype.onTouchBegin = function (e) {
_super.prototype.onTouchBegin.call(this, e);
this.touchBeginFlag = true;
if (this.stopWhenTouchBegin) {
if (this._wave)
this._wave.stop(true);
}
};
WaveController.prototype.onGlobalTouchEnd = function (e) {
if (this.touchBeginFlag) {
this.touchBeginFlag = false;
if (this.playWhenTouchEnd) {
if (this._wave)
this._wave.play();
}
}
};
WaveController.prototype.onInteractableChanged = function (interactable) {
_super.prototype.onInteractableChanged.call(this, interactable);
if (interactable && this.playWhenInteractable) {
if (this._wave)
this._wave.play();
}
if (!interactable && this.stopWhenUninteractable) {
if (this._wave)
this._wave.stop();
}
};
return WaveController;
}(InteractComponent));
export default WaveController;
//# sourceMappingURL=module.js.map
\ No newline at end of file
export var configs = {};
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import DialogContent from "../popup/DialogContent";
import TextRenderer from "components/renderer/TextRenderer";
import Transform from "components/base/Transform";
var AlertDialogContent = (function (_super) {
tslib_1.__extends(AlertDialogContent, _super);
function AlertDialogContent() {
return _super !== null && _super.apply(this, arguments) || this;
}
AlertDialogContent.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
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);
}
};
AlertDialogContent.prototype.setup = function (data) {
if (data === void 0) { data = {}; }
var _a = data.title, title = _a === void 0 ? 'Alert' : _a, _b = data.content, content = _b === void 0 ? '' : _b, _c = data.button, button = _c === void 0 ? 'Confirm' : _c, _d = data.showCloseButton, showCloseButton = _d === void 0 ? true : _d;
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;
};
AlertDialogContent.prototype.onClickConfirmButton = function () {
this.hide('confirm');
};
return AlertDialogContent;
}(DialogContent));
export default AlertDialogContent;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import DialogContent from "../popup/DialogContent";
import TextRenderer from "components/renderer/TextRenderer";
import { renderRunCredits } from "../game/utils";
import TwoLinesButton from "../game/TwoLinesButton";
var PKChallenge = (function (_super) {
tslib_1.__extends(PKChallenge, _super);
function PKChallenge() {
return _super !== null && _super.apply(this, arguments) || this;
}
PKChallenge.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._buttonPK = this.ButtonPK.getComponent(TwoLinesButton);
};
PKChallenge.prototype.setup = function (data) {
_super.prototype.setup.call(this, data);
var _a = this.activityBaseInfo, pkExpend = _a.pkExpend, machineNickname = _a.machineNickname;
this._buttonPK.label1 = renderRunCredits(pkExpend) + '/次';
this.Content.getComponent(TextRenderer).text = "\u6211\u662F" + machineNickname;
};
PKChallenge.prototype.onClickConfirm = function () {
this.hide('accept');
};
return PKChallenge;
}(DialogContent));
export default PKChallenge;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import DialogContent from "../popup/DialogContent";
import TextRenderer from "components/renderer/TextRenderer";
import { stringFixed } from "../game/utils";
var PKMatching = (function (_super) {
tslib_1.__extends(PKMatching, _super);
function PKMatching() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.onMatched = function () {
_this._titleRenderer.text = '匹配成功';
_this.AvatarOther.enabled = true;
_this.AvatarWaiting.enabled = false;
setTimeout(_this.hide, 1000, 'success');
};
return _this;
}
PKMatching.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._titleRenderer = this.Title.getComponent(TextRenderer);
this._selfNameRenderer = this.SelfName.getComponent(TextRenderer);
this._otherNameRenderer = this.OtherName.getComponent(TextRenderer);
};
PKMatching.prototype.setup = function (data) {
var channel = data.channel;
this._titleRenderer.text = '正在匹配对手…';
this._selfNameRenderer.text = stringFixed(this.userNickname);
this._otherNameRenderer.text = stringFixed(this.otherName);
this.AvatarOther.enabled = false;
this.AvatarWaiting.enabled = true;
this.CloseButton.enabled = false;
this.stop();
if (channel === 1) {
this.onMatched();
}
else {
this._timer = setTimeout(this.onMatched, Math.random() * 2000 + 2000);
}
};
PKMatching.prototype.stop = function () {
if (this._timer) {
clearTimeout(this._timer);
this._timer = null;
}
};
PKMatching.prototype.onTapCloseButton = function () {
_super.prototype.onTapCloseButton.call(this);
this.stop();
};
return PKMatching;
}(DialogContent));
export default PKMatching;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { utils, } from "scilla";
import DialogContent from "../popup/DialogContent";
import AnimLayer from "./pkresult/AnimLayer";
import ResultLayer from "./pkresult/ResultLayer";
import globalEvent from "globalEvent";
var PKResult = (function (_super) {
tslib_1.__extends(PKResult, _super);
function PKResult() {
return _super !== null && _super.apply(this, arguments) || this;
}
PKResult.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._animLayer = this.AnimLayer.getComponent(AnimLayer);
this._resultLayer = this.ResultLayer.getComponent(ResultLayer);
};
PKResult.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
};
PKResult.prototype.setup = function (data) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
_super.prototype.setup.call(this, data);
this.AnimLayer.enabled = true;
this.ResultLayer.enabled = false;
return [4, this._animLayer.play(data)];
case 1:
_a.sent();
return [4, utils.waitPromise(500)];
case 2:
_a.sent();
this.ResultLayer.enabled = true;
return [4, this._resultLayer.play(data)];
case 3:
_a.sent();
globalEvent.emit('runCredits');
return [2];
}
});
});
};
PKResult.prototype.onBottomButtonTap = function (action) {
this._resultLayer.hide();
this.hide(action);
};
return PKResult;
}(DialogContent));
export default PKResult;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import DialogContent from "../popup/DialogContent";
import HtmlRenderer from "components/renderer/HtmlRenderer";
var RuleDialogContent = (function (_super) {
tslib_1.__extends(RuleDialogContent, _super);
function RuleDialogContent() {
return _super !== null && _super.apply(this, arguments) || this;
}
RuleDialogContent.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._contentRenderer = this.Content.getComponent(HtmlRenderer);
this._contentRenderer.htmlText = this.ruleContent;
var config = window['configJson'];
this._contentRenderer.color = config.dialog_text_color;
};
return RuleDialogContent;
}(DialogContent));
export default RuleDialogContent;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { createTween, 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";
var SingleResult = (function (_super) {
tslib_1.__extends(SingleResult, _super);
function SingleResult() {
return _super !== null && _super.apply(this, arguments) || this;
}
SingleResult.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
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;
};
SingleResult.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
};
SingleResult.prototype.setup = function (data) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
_super.prototype.setup.call(this, 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);
return [4, this.playCredits()];
case 1:
_a.sent();
this.playLight();
return [2];
}
});
});
};
SingleResult.prototype.playCredits = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, receiveCredits, finalCredits, multipleCard, showTimesCard;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = this.singleDigData, receiveCredits = _a.receiveCredits, finalCredits = _a.finalCredits, multipleCard = _a.multipleCard;
showTimesCard = multipleCard > 0;
this.TimesCard.enabled = false;
return [4, this._runCredits.play(receiveCredits, 0)];
case 1:
_b.sent();
return [4, utils.waitPromise(500)];
case 2:
_b.sent();
if (!showTimesCard) return [3, 5];
this.TimesCard.enabled = true;
return [4, this._timesCard.playShow(multipleCard)];
case 3:
_b.sent();
createTween(this, this._wrapperTransform)
.to({ scale: { x: 1.2, y: 1.2 } }, 2000);
return [4, this._runCredits.play(finalCredits, receiveCredits)];
case 4:
_b.sent();
_b.label = 5;
case 5: return [2];
}
});
});
};
SingleResult.prototype.playLight = function () {
var _this = this;
createTween(this, this._wrapperTransform)
.to({ alpha: 0 }, 500)
.call(function () {
_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(function () {
_this.playCoins();
})
.to({ alpha: 0, scale: { x: 0, y: 0 } }, 300)
.call(function () {
_this.Light.enabled = false;
});
};
SingleResult.prototype.playCoins = function () {
this.bubbling('setBgVisible', false);
this._flySequence.play();
globalEvent.emit('runCredits');
};
SingleResult.prototype.onFlyCoinEnd = function () {
this.hide('complete');
};
return SingleResult;
}(DialogContent));
export default SingleResult;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { createTween, ease } from "scilla";
import PKResultAnimSide from "../../game/PKResultAnimSide";
import Transform from "components/base/Transform";
var AnimLayer = (function (_super) {
tslib_1.__extends(AnimLayer, _super);
function AnimLayer() {
return _super !== null && _super.apply(this, arguments) || this;
}
AnimLayer.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._leftSide = this.LeftSide.getComponent(PKResultAnimSide);
this._rightSide = this.RightSide.getComponent(PKResultAnimSide);
this._lineTransform = this.Line.getComponent(Transform);
};
AnimLayer.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
};
AnimLayer.prototype.play = function (data) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
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);
return [4, 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,
}),])];
case 1:
_a.sent();
return [2];
}
});
});
};
return AnimLayer;
}(ScillaComponent));
export default AnimLayer;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { createTween, ease } from "scilla";
import PKResultSide from "../../game/PKResultSide";
import Transform from "components/base/Transform";
import RelativeLayout from "components/other/RelativeLayout";
var ResultLayer = (function (_super) {
tslib_1.__extends(ResultLayer, _super);
function ResultLayer() {
return _super !== null && _super.apply(this, arguments) || this;
}
ResultLayer.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
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();
};
ResultLayer.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
};
ResultLayer.prototype.play = function (data) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, userFinalCredits, machineFinalCredits, machineNickname, resultState;
var _this = this;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = this.pkData, userFinalCredits = _a.userFinalCredits, machineFinalCredits = _a.machineFinalCredits, machineNickname = _a.machineNickname, resultState = _a.resultState;
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);
return [4, Promise.all([this._leftSide.play({
nickname: this.userNickname,
finalCredits: userFinalCredits,
otherFinalCredits: machineFinalCredits,
resultState: resultState
}),
this._rightSide.play({
nickname: machineNickname,
finalCredits: machineFinalCredits,
otherFinalCredits: userFinalCredits,
resultState: resultState
}),]).then(function () {
createTween(_this, _this._bottomBarLayout)
.to({ bottom: 0 }, 500, ease.cubicOut);
})];
case 1:
_b.sent();
return [2];
}
});
});
};
ResultLayer.prototype.hide = function () {
this._bottomBarLayout.bottom = -this._bottomBarHeight;
};
return ResultLayer;
}(ScillaComponent));
export default ResultLayer;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import GameStage from "./GameStage";
var ApiProcess = (function (_super) {
tslib_1.__extends(ApiProcess, _super);
function ApiProcess() {
return _super !== null && _super.apply(this, arguments) || this;
}
ApiProcess.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._gameStage = this.entity.getComponent(GameStage);
};
ApiProcess.prototype.onSingleDigSuccess = function (response) {
console.log(response);
this._gameStage.readyDig(1, 0);
this.getOrderStatus(response);
};
ApiProcess.prototype.onPkDigSuccess = function (response, channel) {
console.log(response);
this._gameStage.readyDig(2, channel);
this.getOrderStatus(response);
};
ApiProcess.prototype.getOrderStatus = function (response) {
var actOrderNum = response.actOrderNum, operationType = response.operationType;
this.broadcast('callApi', 1, 'getOrderStatus', { actOrderNum: actOrderNum, operationType: operationType, });
};
ApiProcess.prototype.onDigError = function (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');
}
}
else {
this.bubbling('showNetError');
}
};
ApiProcess.prototype.onOrderStatusResponse = function (response) {
console.log('onOrderStatusResponse', response);
this._gameStage.changeOrderStatus(response);
};
ApiProcess.prototype.onOrderStatusError = function (e) {
console.log('onOrderStatusError', e);
this._gameStage.changeOrderStatus(1);
};
return ApiProcess;
}(ScillaComponent));
export default ApiProcess;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
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) {
var s = 1 + Math.abs(Math.sin(t)) * 0.1;
return {
sx: s,
sy: s,
};
};
}
var BottomButtonController = (function (_super) {
tslib_1.__extends(BottomButtonController, _super);
function BottomButtonController() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._buttons = [];
_this._counting = 0;
return _this;
}
BottomButtonController.prototype.onCreate = function () {
var _this = this;
_super.prototype.onCreate.call(this);
this._buttonSLDig = this.buttonDigSLEntity.getComponent(CustomButton);
this._buttonPK = this.buttonPKEntity.getComponent(TwoLinesButton);
var wavePK = this.buttonPKEntity.getComponent(Wave);
var wcPK = this.buttonPKEntity.getComponent(WaveController);
wavePK.waveAlgorithm = getWaveAlgorithm();
this._buttonDig = this.buttonDigEntity.getComponent(TwoLinesButton);
var waveDig = this.buttonDigEntity.getComponent(Wave);
var 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(function () {
var _a = _this._buttons[(_this._counting++) % _this._buttons.length], button = _a.button, wave = _a.wave, wc = _a.wc;
if (button.interactable && !wc.touchBeginFlag) {
wave.play();
}
}, 600);
this.updateButtonLabel();
this.disableAll();
};
BottomButtonController.prototype.initGameStage = function () {
var _a = this.activityBaseInfo, pkExpend = _a.pkExpend, miningExpend = _a.miningExpend;
this.updateButtonLabel(pkExpend, miningExpend);
this.switchState(false);
};
BottomButtonController.prototype.updateButtonLabel = function (pkExpend, miningExpend) {
if (pkExpend === void 0) { pkExpend = 0; }
if (miningExpend === void 0) { miningExpend = 0; }
this._buttonPK.label1 = renderRunCredits(pkExpend) + '/次';
this._buttonDig.label1 = renderRunCredits(miningExpend) + '/次';
};
BottomButtonController.prototype.enableAll = function () {
var e_1, _a;
try {
for (var _b = tslib_1.__values(this._buttons), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = _c.value, button = _d.button, wc = _d.wc;
button.interactable = true;
wc.touchBeginFlag = false;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
};
BottomButtonController.prototype.disableAll = function () {
var e_2, _a;
try {
for (var _b = tslib_1.__values(this._buttons), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = _c.value, button = _d.button, wc = _d.wc;
button.interactable = false;
wc.touchBeginFlag = false;
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
};
BottomButtonController.prototype.enablePkDigButton = function () {
this._buttonSLDig.interactable = true;
};
BottomButtonController.prototype.disablePkDigButton = function () {
this._buttonSLDig.interactable = false;
};
BottomButtonController.prototype.switchState = function (isPK) {
this.buttonPKEntity.enabled = !isPK;
this.buttonDigEntity.enabled = !isPK;
this.buttonDigSLEntity.enabled = isPK;
if (isPK) {
this.enablePkDigButton();
}
};
return BottomButtonController;
}(ScillaComponent));
export default BottomButtonController;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import TextRenderer from "components/renderer/TextRenderer";
import RunNumber from "../common/RunNumber";
import globalEvent from "globalEvent";
import RectRenderer from "components/renderer/RectRenderer";
var CreditsBar = (function (_super) {
tslib_1.__extends(CreditsBar, _super);
function CreditsBar() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.runDuration = 2000;
return _this;
}
CreditsBar.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
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;
};
CreditsBar.prototype.initGameStage = function () {
var _a = this.activityBaseInfo, curCredits = _a.curCredits, heapCredits = _a.heapCredits;
if (this.showCredits === 1) {
this._labelCreditsCurrent.text = curCredits.toString();
}
this._labelCreditsTotal.text = heapCredits.toString();
};
CreditsBar.prototype.runCredits = function (duration) {
var _a = this.activityBaseInfo, curCredits = _a.curCredits, heapCredits = _a.heapCredits;
if (this.showCredits === 1) {
this._runCreditsCurrent.duration = duration || this.runDuration;
this._runCreditsCurrent.play(curCredits);
}
this._runCreditsTotal.duration = duration || this.runDuration;
this._runCreditsTotal.play(heapCredits);
};
return CreditsBar;
}(ScillaComponent));
export default CreditsBar;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import Button from "components/ui/Button";
var CustomButton = (function (_super) {
tslib_1.__extends(CustomButton, _super);
function CustomButton() {
return _super !== null && _super.apply(this, arguments) || this;
}
CustomButton.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
var config = window['configJson'];
if (this.upLabelColorKey) {
this.upLabelColor = config[this.upLabelColorKey];
}
if (this.disabledLabelColorKey) {
this.disabledLabelColor = config[this.disabledLabelColorKey];
}
};
return CustomButton;
}(Button));
export default CustomButton;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import TextRenderer from "components/renderer/TextRenderer";
var CustomTextRenderer = (function (_super) {
tslib_1.__extends(CustomTextRenderer, _super);
function CustomTextRenderer() {
return _super !== null && _super.apply(this, arguments) || this;
}
CustomTextRenderer.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
var config = window['configJson'];
if (this.fillColorKey) {
this.fillColor = config[this.fillColorKey];
}
};
return CustomTextRenderer;
}(TextRenderer));
export default CustomTextRenderer;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { instantiate, engine } from "scilla";
import Miner from "./Miner";
import BottomButtonController from "./BottomButtonController";
import CountDown from "../common/CountDown";
import ItemLayer from "./ItemLayer";
import globalEvent from "globalEvent";
var minerConfigs = [
{ res: 'blue', dir: 1, walk: true },
{ res: 'red', dir: -1, walk: false },
];
var GameStage = (function (_super) {
tslib_1.__extends(GameStage, _super);
function GameStage() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._miners = [];
_this.matchResult = function (action) {
if (action === 'close') {
_this._bottomButtonController.enableAll();
_this.broadcast('abortCallApi', 1, 'getOrderStatus');
}
else {
_this.startPKDig();
}
};
_this.onPKResult = function (action) {
_this.reset();
if (action === 'retry') {
_this.onTapPK();
}
};
_this.onSingleResultComplete = function () {
_this.reset();
};
_this.onPKChallengeClose = function (action) {
if (action === 'accept') {
_this.onTapPK(1);
}
};
return _this;
}
GameStage.prototype.onCreate = function () {
var e_1, _a;
_super.prototype.onCreate.call(this);
this._bottomButtonController = this.Bottom.getComponent(BottomButtonController);
this._countdown = this.CountDown.getComponent(CountDown);
this._itemLayer = this.ItemLayer.getComponent(ItemLayer);
try {
for (var minerConfigs_1 = tslib_1.__values(minerConfigs), minerConfigs_1_1 = minerConfigs_1.next(); !minerConfigs_1_1.done; minerConfigs_1_1 = minerConfigs_1.next()) {
var config = minerConfigs_1_1.value;
var minerEntity = instantiate(this.minerPrefab);
this.MinerLayer.addChild(minerEntity);
var miner = minerEntity.getComponent(Miner);
miner.prepare(this._itemLayer.digDelegate, this.holeRes.height - 40, config.res);
this._miners.push(miner);
minerEntity.enabled = false;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (minerConfigs_1_1 && !minerConfigs_1_1.done && (_a = minerConfigs_1.return)) _a.call(minerConfigs_1);
}
finally { if (e_1) throw e_1.error; }
}
};
GameStage.prototype.initGameStage = function () {
this.reset();
if (this.activityBaseInfo.machineNickname) {
this.bubbling('showDialog', 'PKChallenge', null, this.onPKChallengeClose);
}
};
GameStage.prototype.reset = function () {
var e_2, _a;
try {
for (var _b = tslib_1.__values(this._miners), _c = _b.next(); !_c.done; _c = _b.next()) {
var miner = _c.value;
miner.entity.enabled = false;
miner.reset();
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
this._itemLayer.prepareItems();
this.resetBottomButton();
var selfMiner = this._miners[0];
selfMiner.entity.enabled = true;
selfMiner.standSide(1);
selfMiner.playWalk();
};
GameStage.prototype.resetBottomButton = function () {
this._bottomButtonController.switchState(false);
this._bottomButtonController.enableAll();
};
GameStage.prototype.loginAlert = function () {
if (!this.isLogin) {
this.bubbling('showLoginAlert');
}
return this.isLogin;
};
GameStage.prototype.creditsAlert = function () {
return true;
};
GameStage.prototype.onTapDig = function () {
if (!this.loginAlert() || !this.creditsAlert()) {
return;
}
this._bottomButtonController.disableAll();
this._orderStatus = 0;
this._digFinishedCount = 0;
this._minerCount = 1;
var opActivityId = engine.dataCenter.get('CFG', 'opActivityId');
this.broadcast('callApi', 1, 'singleDigData', { opActivityId: opActivityId });
};
GameStage.prototype.onTapPK = function (channel) {
if (channel === void 0) { channel = 0; }
if (!this.loginAlert() || !this.creditsAlert()) {
return;
}
this._bottomButtonController.disableAll();
this._orderStatus = 0;
this._digFinishedCount = 0;
this._minerCount = 2;
var opActivityId = engine.dataCenter.get('CFG', 'opActivityId');
this.broadcast('callApi', 1, 'pkDigData', { opActivityId: opActivityId }, channel);
};
GameStage.prototype.changeOrderStatus = function (v) {
this._orderStatus = v;
this.checkDigEnd();
};
GameStage.prototype.readyDig = function (minerCount, channel) {
if (minerCount === 1) {
this.startDig(minerCount);
}
else {
if (channel === 1) {
this.pkDigData.machineNickname = this.activityBaseInfo.machineNickname;
}
this.bubbling('hideAllDialog');
this.bubbling('showDialog', 'PKMatching', { channel: channel }, this.matchResult);
}
this.activityBaseInfo.curCredits -= minerCount === 1 ? this.activityBaseInfo.miningExpend : this.activityBaseInfo.pkExpend;
globalEvent.emit('runCredits', 500);
this._itemLayer.stopCreditsAnimation();
};
GameStage.prototype.startDig = function (minerCount) {
var _a = this, _miners = _a._miners, _countdown = _a._countdown;
_countdown.stop();
var selfMiner = _miners[0];
selfMiner.playDig();
if (minerCount === 1) {
}
else {
this._bottomButtonController.disablePkDigButton();
var otherMiner = _miners[1];
otherMiner.avoidToDig(selfMiner.transform.position);
}
};
GameStage.prototype.startPKDig = function () {
this._bottomButtonController.switchState(true);
this._countdown.play();
for (var i = 0, li = minerConfigs.length; i < li; i++) {
var config = minerConfigs[i];
var miner = this._miners[i];
miner.entity.enabled = true;
miner.standSide(config.dir);
miner.playWalk();
}
};
GameStage.prototype.restoreDig = function (e) {
this.reset();
};
GameStage.prototype.checkDigEnd = function () {
if (this._orderStatus !== 0 && this._digFinishedCount === this._minerCount) {
switch (this._orderStatus) {
case 2:
case 4:
this.onDigEnd();
break;
case 1:
case 3:
this.bubbling('showNetError');
break;
}
}
};
GameStage.prototype.digEnd = function () {
this._digFinishedCount++;
this.checkDigEnd();
};
GameStage.prototype.onDigEnd = function () {
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:
var _a = this.pkDigData, userFinalCredits = _a.userFinalCredits, machineFinalCredits = _a.machineFinalCredits;
var resultState = userFinalCredits === machineFinalCredits ? 0 : (userFinalCredits > machineFinalCredits ? -1 : 1);
this.pkDigData.resultState = resultState;
var 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;
}
};
return GameStage;
}(ScillaComponent));
export default GameStage;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import Transform from "components/base/Transform";
var Hole = (function (_super) {
tslib_1.__extends(Hole, _super);
function Hole() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.heightOffset = 50;
_this.bottomOffset = 50;
return _this;
}
Hole.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this.bgMask = this.Bg.getComponent(Transform);
this.bottomTransform = this.Bottom.getComponent(Transform);
};
Hole.prototype.show = function () {
this.entity.enabled = true;
this.setDeep(0);
};
Hole.prototype.hide = function () {
this.entity.enabled = false;
};
Hole.prototype.setDeep = function (v) {
this.bgMask.height = v + this.heightOffset;
this.bottomTransform.position.y = v + this.bottomOffset;
};
return Hole;
}(ScillaComponent));
export default Hole;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import FloatMissing from "../common/FloatMissing";
import TextRenderer from "components/renderer/TextRenderer";
var Item = (function (_super) {
tslib_1.__extends(Item, _super);
function Item() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.exclude = false;
_this._playing = false;
return _this;
}
Item.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._floatMissing = this.creditsEntity.getComponent(FloatMissing);
this._label = this.Label.getComponent(TextRenderer);
};
Item.prototype.reset = function (pos) {
this.transform.position.copyFrom(pos);
this.entity.enabled = true;
this.exclude = false;
this._playing = false;
};
Item.prototype.playCredits = function (cost) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
this._label.text = cost.toString();
this.creditsEntity.enabled = true;
this._floatMissing.delay = Math.random() * 500;
this._playing = true;
return [4, this._floatMissing.play()];
case 1:
_a.sent();
this._playing = false;
return [2];
}
});
});
};
Item.prototype.stopCredits = function () {
this.creditsEntity.enabled = false;
};
Object.defineProperty(Item.prototype, "playing", {
get: function () {
return this._playing;
},
enumerable: true,
configurable: true
});
Item.prototype.hit = function (x, y, hitWidth, hitHeight) {
var _a = this.transform.position, px = _a.x, py = _a.y;
return x > px - hitWidth / 2 && x < px + hitWidth / 2 && py && y > py - hitHeight / 2 && y < py + hitHeight / 2;
};
return Item;
}(ScillaComponent));
export default Item;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { instantiate, math, Size } from "scilla";
import Item from "./Item";
import Transform from "components/base/Transform";
var ItemLayer = (function (_super) {
tslib_1.__extends(ItemLayer, _super);
function ItemLayer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.itemCount = 13;
_this.itemPosPadding = 50;
_this.itemPosRange = new Size(750, 500);
_this.itemCellPadding = 20;
_this.itemPosOffsetY = 50;
_this.playCreditsCount = 4;
_this._items = [];
_this._excludeItemQueue = [];
_this.playACredits = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var _a, _excludeItemQueue, _items, targetItem, index, cost;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
if (!(this._freePlayCreditsCount > 0)) return [3, 2];
_a = this, _excludeItemQueue = _a._excludeItemQueue, _items = _a._items;
targetItem = void 0, index = void 0;
while (true) {
index = Math.floor(Math.random() * _items.length);
if (_excludeItemQueue.indexOf(index) < 0) {
targetItem = _items[index];
if (!targetItem.playing) {
break;
}
}
}
this._freePlayCreditsCount--;
_excludeItemQueue.push(index);
if (_excludeItemQueue.length > this._playCreditsCount * 2) {
_excludeItemQueue.shift();
}
cost = math.makeRandomInt(this.activityBaseInfo.miningExpend * 2, 1);
return [4, targetItem.playCredits(cost)];
case 1:
_b.sent();
this._freePlayCreditsCount++;
_b.label = 2;
case 2: return [2];
}
});
}); };
_this.digDelegate = function (x, y) {
var e_1, _a;
var items = [];
var hitWidth = _this.holeRes.width + _this.itemRes.width - 40;
try {
for (var _b = tslib_1.__values(_this._items), _c = _b.next(); !_c.done; _c = _b.next()) {
var item = _c.value;
if (!item.exclude && item.hit(x, y, hitWidth, 5)) {
items.push(item);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return items;
};
return _this;
}
ItemLayer.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._playCreditsCount = Math.floor(this.itemCount / 3);
this._itemGap = {
x: (this.itemPosRange.width - this.itemPosPadding * 2) / 3,
y: (this.itemPosRange.height - this.itemCellPadding * 2) / 3,
};
this._itemPosOffset = {
x: -this.itemPosRange.width / 2,
y: this.itemPosOffsetY,
};
for (var i = 0; i < this.itemCount; i++) {
var itemEntity = instantiate(this.itemPrefab);
this.entity.addChild(itemEntity);
itemEntity.enabled = false;
this._items.push(itemEntity.getComponent(Item));
}
};
ItemLayer.prototype.prepareItems = function () {
this._freePlayCreditsCount = this.playCreditsCount;
this._excludeItemQueue.splice(0);
var _a = this, _itemGap = _a._itemGap, _itemPosOffset = _a._itemPosOffset, itemPosPadding = _a.itemPosPadding, itemCellPadding = _a.itemCellPadding, itemPosRange = _a.itemPosRange;
var i, j;
for (i = 0; i < 4; i++) {
this.addItem(i, {
x: i * _itemGap.x + _itemPosOffset.x + itemPosPadding,
y: _itemPosOffset.y + Math.random() * itemPosRange.height + itemPosPadding,
});
}
for (j = 0; j < this.itemCount - 4; j++) {
var gx = j % 3;
var gy = Math.floor(j / 3);
this.addItem(i + j, {
x: gx * _itemGap.x + _itemPosOffset.x + itemPosPadding + Math.random() * (_itemGap.x - itemCellPadding * 2) + itemCellPadding,
y: gy * _itemGap.y + _itemPosOffset.y + itemPosPadding + Math.random() * (_itemGap.y - itemCellPadding * 2) + itemCellPadding,
});
}
this.entity.children.sort(function (a, b) {
return a.getComponent(Transform).position.y - b.getComponent(Transform).position.y;
});
this.stopCreditsAnimation();
this.playCreditsAnimation();
};
ItemLayer.prototype.addItem = function (i, pos) {
var item = this._items[i];
item.reset(pos);
};
ItemLayer.prototype.playCreditsAnimation = function () {
this._timerCreditsAnimation = setInterval(this.playACredits, 200);
};
ItemLayer.prototype.stopCreditsAnimation = function () {
var e_2, _a;
if (this._timerCreditsAnimation) {
clearInterval(this._timerCreditsAnimation);
this._timerCreditsAnimation = null;
}
try {
for (var _b = tslib_1.__values(this._items), _c = _b.next(); !_c.done; _c = _b.next()) {
var item = _c.value;
item.stopCredits();
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
};
return ItemLayer;
}(ScillaComponent));
export default ItemLayer;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import FrameAnimationRenderer from "components/renderer/FrameAnimationRenderer";
import { createTween, ease, instantiate, Vector2D } from "scilla";
import Hole from "./Hole";
import Transform from "components/base/Transform";
var speed = new Vector2D(2.5, 2.5);
var walkRange = 750 / 2 - 50;
var STATUS;
(function (STATUS) {
STATUS[STATUS["IDLE"] = 0] = "IDLE";
STATUS[STATUS["WALK"] = 1] = "WALK";
STATUS[STATUS["DIG"] = 2] = "DIG";
STATUS[STATUS["DIG_IDLE"] = 3] = "DIG_IDLE";
})(STATUS || (STATUS = {}));
var Miner = (function (_super) {
tslib_1.__extends(Miner, _super);
function Miner() {
var _this = _super.call(this) || this;
_this.itemGap = new Vector2D(5, -1);
_this.smallItemScale = new Vector2D(0.3, 0.3);
_this._velocity = new Vector2D();
_this._diggingHole = false;
_this._itemCount = 0;
_this._status = STATUS.IDLE;
return _this;
}
Miner.prototype.prepare = function (digDelegate, maxDepth, resName) {
this._digDelegate = digDelegate;
this._maxDepth = maxDepth;
this._bodyAnim.frameAnimation = this.animations[resName];
};
Miner.prototype.reset = function () {
var e_1, _a;
try {
for (var _b = tslib_1.__values(this.Items.children), _c = _b.next(); !_c.done; _c = _b.next()) {
var item = _c.value;
item.enabled = false;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
this._itemCount = 0;
this._avoidPosition = null;
this._hole.hide();
this._minerTransform.position.y = 0;
};
Miner.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._minerTransform = this.Miner.getComponent(Transform);
this._bodyAnim = this.Body.getComponent(FrameAnimationRenderer);
this._effectAnim = this.Effect.getComponent(FrameAnimationRenderer);
this._hole = this.Hole.getComponent(Hole);
this._hole.hide();
};
Miner.prototype.onUpdate = function (t) {
var e_2, _a;
_super.prototype.onUpdate.call(this, t);
var _b = this, minerPosition = _b._minerTransform.position, position = _b.transform.position, _velocity = _b._velocity;
switch (this._status) {
case STATUS.IDLE:
break;
case STATUS.WALK:
position.x += _velocity.x;
if (Math.abs(position.x) > walkRange) {
_velocity.x = -_velocity.x;
this.dir = _velocity.x >= 0 ? 1 : -1;
}
if (this._avoidPosition && Math.abs(position.x - this._avoidPosition.x) > this.holeRes.width) {
this.playDig();
}
break;
case STATUS.DIG:
if (this._diggingHole) {
minerPosition.y += _velocity.y;
this._hole.setDeep(minerPosition.y - 25);
var items = this._digDelegate(position.x, minerPosition.y - 50);
if (items.length > 0) {
this.playDigIdle();
}
try {
for (var items_1 = tslib_1.__values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
var item = items_1_1.value;
this.playAddItem(item);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
}
finally { if (e_2) throw e_2.error; }
}
if (minerPosition.y > this._maxDepth) {
this.playIdle();
this.bubbling('digEnd');
}
}
break;
case STATUS.DIG_IDLE:
break;
}
};
Object.defineProperty(Miner.prototype, "dir", {
get: function () {
return this._minerTransform.scale.x;
},
set: function (v) {
this._minerTransform.scale.x = v;
},
enumerable: true,
configurable: true
});
Miner.prototype.standSide = function (dir) {
this.transform.position.x = walkRange * -dir;
this.dir = dir;
};
Miner.prototype.playIdle = function () {
this._status = STATUS.IDLE;
this._bodyAnim.play('idle', -1);
};
Miner.prototype.playWalk = function () {
this._status = STATUS.WALK;
this._diggingHole = false;
this._bodyAnim.play('walk', -1);
this._velocity.x = speed.x;
this.dir = 1;
};
Miner.prototype.playDig = function () {
this._bodyAnim.play('beginDig', 1);
this._status = STATUS.DIG;
this._velocity.setXY(0, speed.y);
};
Miner.prototype.playDigIdle = function () {
this._bodyAnim.play('idle', -1);
this._status = STATUS.DIG_IDLE;
this._velocity.y = 0;
};
Miner.prototype.playAddItem = function (item) {
var e_3, _a;
var _this = this;
var target;
try {
for (var _b = tslib_1.__values(this.Items.children), _c = _b.next(); !_c.done; _c = _b.next()) {
var item_1 = _c.value;
if (!item_1.enabled) {
target = item_1;
target.enabled = true;
break;
}
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
if (!target) {
target = instantiate(this.itemHangPrefab);
this.Items.addChild(target);
}
item.exclude = true;
item.entity.enabled = false;
var pos = item.getComponent(Transform).globalPosition;
var targetTransform = target.getComponent(Transform);
var localPos = this.Items.getComponent(Transform).globalPositionToLocal(pos);
targetTransform.position.copyFrom(localPos);
targetTransform.scale.setXY(1, 1);
var position = { x: this._itemCount * this.itemGap.x, y: this._itemCount * this.itemGap.y };
this._itemCount++;
createTween(this, targetTransform, false, { fields: ['x', 'y'] })
.to({ position: position, scale: this.smallItemScale.toObj() }, 500, ease.cubicInOut)
.call(function () {
_this.playDig();
});
};
Miner.prototype.onAnimationComplete = function (label) {
switch (label) {
case 'beginDig':
this._bodyAnim.play('dig', -1);
this._effectAnim.play(0, 1);
this._hole.show();
this._diggingHole = true;
break;
}
};
Miner.prototype.onAnimationLoopComplete = function (label) {
switch (label) {
case 'dig':
this._effectAnim.play(0, 1);
break;
}
};
Miner.prototype.avoidToDig = function (position) {
var _this = this;
setTimeout(function () {
_this._avoidPosition = position;
}, Math.random() * 500 + 500);
};
return Miner;
}(ScillaComponent));
export default Miner;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import LabelCarousel from '../common/LabelCarousel';
import RectRenderer from "components/renderer/RectRenderer";
var NoticeBar = (function (_super) {
tslib_1.__extends(NoticeBar, _super);
function NoticeBar() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._pool = [];
_this.getTextFunc = function () {
if (_this._pool.length < 5) {
_this.initGameStage();
}
if (_this._pool.length > 0) {
if (_this._pool.length > 0) {
_this._bgRenderer.enabled = true;
}
return _this._pool.shift();
}
};
return _this;
}
NoticeBar.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._bgRenderer = this.getComponent(RectRenderer);
this._bgRenderer.enabled = false;
this._labelCarousel = this.getComponent(LabelCarousel);
this._labelCarousel.getTextFunc = this.getTextFunc;
};
NoticeBar.prototype.initGameStage = function () {
this.broadcast('callApi', 1, 'noticeContent', { opActivityId: this.opActivityId });
};
NoticeBar.prototype.onGotNoticeContent = function (response) {
this._pool = this._pool.concat(response);
if (!this._labelCarousel._playing) {
this._labelCarousel.play();
}
};
return NoticeBar;
}(ScillaComponent));
export default NoticeBar;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { createTween, ease, engine } from "scilla";
import Transform from "components/base/Transform";
import TextRenderer from "components/renderer/TextRenderer";
import TimesCard from "./TimesCard";
import RunNumber from "../common/RunNumber";
import { renderRunCredits, stringFixed } from "./utils";
var PKResultAnimSide = (function (_super) {
tslib_1.__extends(PKResultAnimSide, _super);
function PKResultAnimSide() {
return _super !== null && _super.apply(this, arguments) || this;
}
PKResultAnimSide.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._labelName = this.LabelName.getComponent(TextRenderer);
this._labelCredits = this.LabelCredits.getComponent(TextRenderer);
this._labelCreditsTransform = this.LabelCredits.getComponent(Transform);
this._labelRunCredits = this.LabelCredits.getComponent(RunNumber);
this._timesCard = this.TimesCard.getComponent(TimesCard);
this._labelRunCredits.$renderFunc = renderRunCredits;
this._pos = this.transform.position.x;
};
PKResultAnimSide.prototype.play = function (data) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var nickname, receiveCredits, finalCredits, multipleCard, showTimesCard, toScale1, toScale2, stageWidth;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
nickname = data.nickname, receiveCredits = data.receiveCredits, finalCredits = data.finalCredits, multipleCard = data.multipleCard;
showTimesCard = multipleCard > 0;
this._labelName.text = stringFixed(nickname);
this._labelCredits.text = '';
this.TimesCard.enabled = false;
this._labelCreditsTransform.scale.setXY(0.6, 0.6);
toScale1 = {
x: 1, y: 1,
};
toScale2 = {
x: 1.4, y: 1.4,
};
stageWidth = engine.renderContext.stageSize.width;
return [4, createTween(this, this.transform.position)
.set({ x: stageWidth * this.side }, true)
.to({ x: this._pos }, 500, ease.backOut)
.getPromise()];
case 1:
_a.sent();
createTween(this, this._labelCreditsTransform)
.to({ scale: showTimesCard ? toScale1 : toScale2 }, 1000);
return [4, this._labelRunCredits.play(receiveCredits, 0)];
case 2:
_a.sent();
if (!showTimesCard) return [3, 5];
return [4, this._timesCard.playShow(multipleCard)];
case 3:
_a.sent();
createTween(this, this._labelCreditsTransform)
.to({ scale: toScale2 }, 1000);
return [4, this._labelRunCredits.play(finalCredits, receiveCredits)];
case 4:
_a.sent();
_a.label = 5;
case 5: return [2];
}
});
});
};
return PKResultAnimSide;
}(ScillaComponent));
export default PKResultAnimSide;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { createTween, ease, engine } from "scilla";
import Transform from "components/base/Transform";
import TextRenderer from "components/renderer/TextRenderer";
import RunNumber from "../common/RunNumber";
import { renderRunCredits, stringFixed } from "./utils";
import Zoom from "components/animation/Zoom";
import TextureRenderer from "components/renderer/TextureRenderer";
var PKResultSide = (function (_super) {
tslib_1.__extends(PKResultSide, _super);
function PKResultSide() {
return _super !== null && _super.apply(this, arguments) || this;
}
PKResultSide.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._labelName = this.LabelName.getComponent(TextRenderer);
this._labelCredits = this.LabelCredits.getComponent(TextRenderer);
this._labelCreditsTransform = this.LabelCredits.getComponent(Transform);
this._resultTagRenderer = this.ResultTag.getComponent(TextureRenderer);
this._bodyRenderer = this.Body.getComponent(TextureRenderer);
this._resultTagZoom = this.ResultTag.getComponent(Zoom);
this._labelRunCredits = this.LabelCredits.getComponent(RunNumber);
this._labelRunCredits.$renderFunc = renderRunCredits;
this._pos = this.transform.position.x;
};
PKResultSide.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
};
PKResultSide.prototype.play = function (data) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var nickname, finalCredits, otherFinalCredits, resultState, win, stageWidth, toValue_1;
var _this = this;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
nickname = data.nickname, finalCredits = data.finalCredits, otherFinalCredits = data.otherFinalCredits, resultState = data.resultState;
this._labelName.text = stringFixed(nickname);
this._labelCredits.text = renderRunCredits(finalCredits);
win = resultState === this.side;
this._bodyRenderer.texture = resultState === 0 || win ? this.winBodyRes : this.loseBodyRes;
this.ResultTag.enabled = false;
this.Stars.enabled = false;
stageWidth = engine.renderContext.stageSize.width;
return [4, createTween(this, this.transform.position)
.set({ x: stageWidth * this.side }, true)
.to({ x: this._pos }, 300, ease.cubicOut)
.getPromise()];
case 1:
_a.sent();
this._labelCreditsTransform.scale.setXY(1, 1);
this._resultTagRenderer.texture = resultState === 0 ? this.equalTagRes : (win ? this.winTagRes : this.loseTagRes);
setTimeout(function () {
_this.ResultTag.enabled = true;
if (win) {
_this.Stars.enabled = true;
}
}, 300);
if (!(resultState === 0)) return [3, 2];
return [3, 4];
case 2:
toValue_1 = win ? finalCredits + otherFinalCredits : 0;
return [4, createTween(this, this._labelCreditsTransform)
.wait(1000)
.call(function () {
_this._labelRunCredits.play(toValue_1);
})
.to({ scale: win ? { x: 1.4, y: 1.4 } : { x: 0.6, y: 0.6 } }, 1000)
.getPromise()];
case 3:
_a.sent();
_a.label = 4;
case 4: return [2];
}
});
});
};
return PKResultSide;
}(ScillaComponent));
export default PKResultSide;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { createTween, ease } from "scilla";
import TextRenderer from "components/renderer/TextRenderer";
var TimesCard = (function (_super) {
tslib_1.__extends(TimesCard, _super);
function TimesCard() {
return _super !== null && _super.apply(this, arguments) || this;
}
TimesCard.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._labelRenderer = this.Label.getComponent(TextRenderer);
};
TimesCard.prototype.setTimes = function (v) {
this._labelRenderer.text = 'X' + v;
};
TimesCard.prototype.playShow = function (v) {
var _this = this;
if (v !== undefined) {
this.setTimes(v);
}
this.entity.enabled = true;
return new Promise(function (resolve) {
createTween(_this, _this.transform, true)
.set({ scale: { x: 2, y: 2 }, alpha: 0 }, true)
.to({ scale: { x: 1, y: 1 }, alpha: 1 }, 500, ease.backOut)
.wait(500)
.to({ alpha: 0 }, 500)
.call(resolve);
});
};
return TimesCard;
}(ScillaComponent));
export default TimesCard;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { decorators } from "scilla";
import TextRenderer from "components/renderer/TextRenderer";
import CustomButton from "./CustomButton";
var dirtyFieldDetector = decorators.dirtyFieldDetector;
var TwoLinesButton = (function (_super) {
tslib_1.__extends(TwoLinesButton, _super);
function TwoLinesButton() {
return _super !== null && _super.apply(this, arguments) || this;
}
TwoLinesButton.prototype.onCreate = function () {
this.label0TextRenderer = this.label0Entity.getComponent(TextRenderer);
this.label1TextRenderer = this.label1Entity.getComponent(TextRenderer);
_super.prototype.onCreate.call(this);
};
TwoLinesButton.prototype.onUpdate = function (t) {
if (this['dirty']) {
this.label0TextRenderer.text = this.label0;
this.label1TextRenderer.text = this.label1;
}
_super.prototype.onUpdate.call(this, t);
};
TwoLinesButton.prototype.changeTexture = function (status) {
_super.prototype.changeTexture.call(this, status);
if (this.label0TextRenderer) {
this.label0TextRenderer.fillColor = this.interactable ? this.upLabelColor : this.disabledLabelColor;
this.label1TextRenderer.fillColor = this.interactable ? this.upLabelColor : this.disabledLabelColor;
}
};
tslib_1.__decorate([
dirtyFieldDetector
], TwoLinesButton.prototype, "label0", void 0);
tslib_1.__decorate([
dirtyFieldDetector
], TwoLinesButton.prototype, "label1", void 0);
return TwoLinesButton;
}(CustomButton));
export default TwoLinesButton;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import { engine } from "scilla";
export function renderRunCredits(v) {
var unitName = engine.dataCenter.get('CFG', 'unitName');
return Math.floor(v) + unitName;
}
export function htmlSimplify(html) {
var content = html
.replace(/<\/\w+><\w+>/ig, '\n')
.replace(/<\w+>/ig, '\n')
.replace(/<\/\w+>/ig, '\n')
.replace(/<\w+\/>/ig, '\n')
.replace('&nbsp;', '');
content = content.trim();
return content;
}
export function isWeiXin() {
var ua = window.navigator.userAgent.toLowerCase();
return ua.includes('micromessenger');
}
export function stringFixed(str, limit, mask) {
if (limit === void 0) { limit = 6; }
if (mask === void 0) { mask = '…'; }
if (str.length > limit) {
return str.substr(0, limit) + mask;
}
return str;
}
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { EventEmitter } from 'scilla';
import { StackNavigator } from "./StackNavigator";
var showLog = false;
var Navigator = (function (_super) {
tslib_1.__extends(Navigator, _super);
function Navigator() {
var _this = _super.call(this) || this;
_this._classDic = {};
_this._instanceDic = {};
_this.stack = new StackNavigator(_this);
return _this;
}
Navigator.prototype.register = function (name, clazz) {
this._classDic[name] = clazz;
};
Navigator.prototype.push = function (name, parameters) {
if (parameters === void 0) { parameters = null; }
this.stack.push(name, parameters);
};
Navigator.prototype.pop = function (parameters) {
if (parameters === void 0) { parameters = null; }
this.stack.pop(parameters);
};
Navigator.prototype.popToBottom = function (parameters) {
if (parameters === void 0) { parameters = null; }
this.stack.popTo(0, null, parameters);
};
Navigator.prototype.popAll = function (name, parameters) {
if (parameters === void 0) { parameters = null; }
this.stack.popAll(name, parameters);
};
Navigator.prototype.replace = function (name, parameters) {
if (parameters === void 0) { parameters = null; }
this.stack.replace(name, parameters);
};
Navigator.prototype.jump = function (name, parameters) {
if (parameters === void 0) { parameters = null; }
this.stack.jump(name, parameters);
};
Object.defineProperty(Navigator.prototype, "currentView", {
get: function () {
return this._currentView;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Navigator.prototype, "currentName", {
get: function () {
return this._currentName;
},
enumerable: true,
configurable: true
});
Navigator.prototype.newView = function (name) {
return new this._classDic[name]();
};
Navigator.prototype.getViewInstanceByName = function (name) {
var view = this._instanceDic[name];
if (!view) {
view = this._instanceDic[name] = this.newView(name);
}
return view;
};
Navigator.prototype.addView = function (view, addToBottom) {
};
Navigator.prototype.onEnter = function (name, last, action, parameters) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var view, addToBottom;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
view = this.getViewInstanceByName(name);
this._currentView = view;
this._currentName = name;
return [4, view.onWillMount(last, action, parameters)];
case 1:
_a.sent();
addToBottom = view.onAddView();
this.addView(view, addToBottom);
if (showLog)
console.log(name + ' will enter.');
this.emit(Navigator.VIEW_WILL_ENTER, { name: name, last: last, action: action, parameters: parameters });
return [4, view.onWillEnter(last, action, parameters)];
case 2:
_a.sent();
if (showLog)
console.log(name + ' did enter.');
this.emit(Navigator.VIEW_DID_ENTER, { name: name, last: last, action: action, parameters: parameters });
view.onDidEnter(last, action, parameters);
return [2];
}
});
});
};
Navigator.prototype.onLeave = function (name, next, action, parameters) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var view;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
view = this.getViewInstanceByName(name);
return [4, view.onWillUnMount(name, action, parameters)];
case 1:
_a.sent();
if (showLog)
console.log(name + ' will leave.');
this.emit(Navigator.VIEW_WILL_LEAVE, { name: name, next: next, action: action, parameters: parameters });
return [4, view.onWillLeave(next, action, parameters)];
case 2:
_a.sent();
if (showLog)
console.log(name + ' did leave.');
this.emit(Navigator.VIEW_DID_LEAVE, { name: name, next: next, action: action, parameters: parameters });
view.onDidLeave(next, action, parameters);
return [2];
}
});
});
};
Navigator.prototype.onError = function (error) {
};
Navigator.VIEW_WILL_ENTER = 'VIEW_WILL_ENTER';
Navigator.VIEW_DID_ENTER = 'VIEW_DID_ENTER';
Navigator.VIEW_WILL_LEAVE = 'VIEW_WILL_LEAVE';
Navigator.VIEW_DID_LEAVE = 'VIEW_DID_LEAVE';
return Navigator;
}(EventEmitter));
export { Navigator };
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { VirtualNavigator } from "./VirtualNavigator";
import { SceneStart, ScenePlay } from "../scenes";
import ScillaComponent from "components/base/ScillaComponent";
var SingleSceneNavigator = (function (_super) {
tslib_1.__extends(SingleSceneNavigator, _super);
function SingleSceneNavigator() {
return _super !== null && _super.apply(this, arguments) || this;
}
SingleSceneNavigator.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._navigator = new VirtualNavigator(this.entity);
this._navigator.register('start', 'SceneStart', SceneStart);
this._navigator.register('play', 'ScenePlay', ScenePlay);
this.push('start');
};
SingleSceneNavigator.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
};
SingleSceneNavigator.prototype.onSleep = function () {
_super.prototype.onSleep.call(this);
};
SingleSceneNavigator.prototype.onDestroy = function () {
_super.prototype.onDestroy.call(this);
};
SingleSceneNavigator.prototype.push = function (name, parameters) {
if (parameters === void 0) { parameters = null; }
this._navigator.stack.push(name, parameters);
};
SingleSceneNavigator.prototype.pop = function (parameters) {
if (parameters === void 0) { parameters = null; }
this._navigator.stack.pop(parameters);
};
SingleSceneNavigator.prototype.popToBottom = function (parameters) {
if (parameters === void 0) { parameters = null; }
this._navigator.stack.popTo(0, null, parameters);
};
SingleSceneNavigator.prototype.popAll = function (name, parameters) {
if (parameters === void 0) { parameters = null; }
this._navigator.stack.popAll(name, parameters);
};
SingleSceneNavigator.prototype.replace = function (name, parameters) {
if (parameters === void 0) { parameters = null; }
this._navigator.stack.replace(name, parameters);
};
SingleSceneNavigator.prototype.jump = function (name, parameters) {
if (parameters === void 0) { parameters = null; }
this._navigator.stack.jump(name, parameters);
};
return SingleSceneNavigator;
}(ScillaComponent));
export default SingleSceneNavigator;
//# sourceMappingURL=module.js.map
\ No newline at end of file
export var NavigatorAction;
(function (NavigatorAction) {
NavigatorAction[NavigatorAction["Push"] = 0] = "Push";
NavigatorAction[NavigatorAction["Pop"] = 1] = "Pop";
NavigatorAction[NavigatorAction["Replace"] = 2] = "Replace";
NavigatorAction[NavigatorAction["Jump"] = 3] = "Jump";
})(NavigatorAction || (NavigatorAction = {}));
var StackNavigator = (function () {
function StackNavigator(delegate) {
this._stack = [];
this._delegate = delegate;
}
StackNavigator.prototype.catchPromise = function (p) {
var _this = this;
if (p) {
p.catch((function (e) {
_this._delegate.onError(e);
}));
}
};
StackNavigator.prototype.push = function (name, parameters) {
if (parameters === void 0) { parameters = null; }
var last = this.getTopSceneName();
if (last) {
if (last == name) {
return;
}
this.catchPromise(this._delegate.onLeave(last, name, NavigatorAction.Push, parameters));
}
this._stack.push(name);
this.catchPromise(this._delegate.onEnter(name, last, NavigatorAction.Push, parameters));
};
StackNavigator.prototype.popTo = function (index, name, parameters) {
if (parameters === void 0) { parameters = null; }
if (this._stack.length > 0 && this._stack.length < (index + 1)) {
return;
}
var last = this.getTopSceneName();
this._stack.splice(Math.max(index + 1, 0));
var next = this._stack[index];
if (!next) {
this._stack.push(next = name);
}
if (last) {
this.catchPromise(this._delegate.onLeave(last, next, NavigatorAction.Pop, parameters));
}
this.catchPromise(this._delegate.onEnter(next, last, NavigatorAction.Pop, parameters));
};
StackNavigator.prototype.pop = function (parameters) {
if (parameters === void 0) { parameters = null; }
this.popTo(this._stack.length - 2, null, parameters);
};
StackNavigator.prototype.popAll = function (name, parameters) {
if (parameters === void 0) { parameters = null; }
this.popTo(-1, name, parameters);
};
StackNavigator.prototype.replace = function (name, parameters) {
if (parameters === void 0) { parameters = null; }
var last = this._stack.pop();
this._stack.push(name);
this.catchPromise(this._delegate.onLeave(last, name, NavigatorAction.Replace, parameters));
this.catchPromise(this._delegate.onEnter(name, last, NavigatorAction.Replace, parameters));
};
StackNavigator.prototype.jump = function (name, parameters) {
if (parameters === void 0) { parameters = null; }
if (this._stack.length < 2) {
this.push(name, parameters);
return;
}
var last = this._stack.pop();
this._stack.splice(1);
var next = name;
this._stack.push(next);
this._delegate.onLeave(last, next, NavigatorAction.Pop, parameters);
this._delegate.onEnter(next, last, NavigatorAction.Pop, parameters);
};
StackNavigator.prototype.getTopSceneName = function () {
return this._stack.length > 0 ? this._stack[this._stack.length - 1] : null;
};
StackNavigator.prototype.getBottomSceneName = function () {
return this._stack.length > 0 ? this._stack[0] : null;
};
return StackNavigator;
}());
export { StackNavigator };
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { EventEmitter } from 'scilla';
import { StackNavigator } from "./StackNavigator";
var showLog = false;
export var VIEW_WILL_ENTER = 'VIEW_WILL_ENTER';
export var VIEW_DID_ENTER = 'VIEW_DID_ENTER';
export var VIEW_WILL_LEAVE = 'VIEW_WILL_LEAVE';
export var VIEW_DID_LEAVE = 'VIEW_DID_LEAVE';
var VirtualNavigator = (function (_super) {
tslib_1.__extends(VirtualNavigator, _super);
function VirtualNavigator(container) {
var _this = _super.call(this) || this;
_this._container = container;
_this._classDic = {};
_this.stack = new StackNavigator(_this);
return _this;
}
VirtualNavigator.prototype.register = function (alias, childName, componentDef) {
this._classDic[alias] = {
childName: childName,
componentDef: componentDef,
};
};
Object.defineProperty(VirtualNavigator.prototype, "currentView", {
get: function () {
return this._currentView;
},
enumerable: true,
configurable: true
});
Object.defineProperty(VirtualNavigator.prototype, "currentName", {
get: function () {
return this._currentName;
},
enumerable: true,
configurable: true
});
VirtualNavigator.prototype.getViewInstanceByName = function (name) {
var _a = this._classDic[name], childName = _a.childName, componentDef = _a.componentDef;
var scene = this._container.getChildrenByName(childName)[0];
var component = scene.getComponent(componentDef);
return component;
};
VirtualNavigator.prototype.onEnter = function (name, last, action, parameters) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var view;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
view = this.getViewInstanceByName(name);
this._currentView = view;
this._currentName = name;
return [4, view.onWillMount(last, action, parameters)];
case 1:
_a.sent();
if (showLog)
console.log(name + ' will enter.');
this.emit(VIEW_WILL_ENTER, { name: name, last: last, action: action, parameters: parameters });
return [4, view.onWillEnter(last, action, parameters)];
case 2:
_a.sent();
if (showLog)
console.log(name + ' did enter.');
this.emit(VIEW_DID_ENTER, { name: name, last: last, action: action, parameters: parameters });
view.onDidEnter(last, action, parameters);
return [2];
}
});
});
};
VirtualNavigator.prototype.onLeave = function (name, next, action, parameters) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var view;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
view = this.getViewInstanceByName(name);
return [4, view.onWillUnMount(name, action, parameters)];
case 1:
_a.sent();
if (showLog)
console.log(name + ' will leave.');
this.emit(VIEW_WILL_LEAVE, { name: name, next: next, action: action, parameters: parameters });
return [4, view.onWillLeave(next, action, parameters)];
case 2:
_a.sent();
if (showLog)
console.log(name + ' did leave.');
this.emit(VIEW_DID_LEAVE, { name: name, next: next, action: action, parameters: parameters });
view.onDidLeave(next, action, parameters);
return [2];
}
});
});
};
VirtualNavigator.prototype.onError = function (error) {
};
return VirtualNavigator;
}(EventEmitter));
export { VirtualNavigator };
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { utils, engine } from "scilla";
export function callApi(uri, params, method, responseType, ignoreSuccessField) {
if (params === void 0) { params = null; }
if (method === void 0) { method = 'post'; }
if (responseType === void 0) { responseType = 'json'; }
if (ignoreSuccessField === void 0) { ignoreSuccessField = false; }
var ts = Date.now() + Math.floor(Math.random() * 9999999);
var url = uri.indexOf('//') === 0 ? uri : "" + engine.customConfig.webServiceUrl + uri + "?_=" + ts;
params = params || {};
var options = {
method: method,
};
if (!DEBUG) {
options.credentials = 'include';
}
var temp = typeof params === 'string' ? params : utils.objectStringify(params);
switch (method.toUpperCase()) {
case 'GET':
if (temp && temp.length > 0) {
url += (url.indexOf('?') < 0 ? '?' : '') + '&' + temp;
}
break;
case 'POST':
options.body = temp;
options.headers = {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
};
break;
}
var fetchMethod = responseType == 'jsonp' ? window['fetchJsonp'] : fetch;
return fetchMethod(url, options)
.then(function (response) {
if (response.type === 'opaque') {
return null;
}
return response.text();
})
.then(function (response) {
if (response) {
var data = void 0;
switch (responseType) {
case 'json':
try {
data = JSON.parse(response);
}
catch (e) {
console.log('decode json failed: ' + url);
return Promise.reject({});
}
if (ignoreSuccessField || data.success) {
return {
data: data.hasOwnProperty('data') ? data.data : data,
origin: data,
};
}
else {
return Promise.reject(data.code);
}
case 'html':
var html = null;
return html;
case 'txt':
return response;
}
}
return Promise.reject();
});
}
export function polling(successFunc, uri, params, maxTimes, delay, abortFunc, method, responseType) {
if (maxTimes === void 0) { maxTimes = 10; }
if (delay === void 0) { delay = 500; }
if (method === void 0) { method = 'POST'; }
if (responseType === void 0) { responseType = 'json'; }
return tslib_1.__awaiter(this, void 0, Promise, function () {
function func() {
return callApi(uri, params, method, responseType).then(function (data) {
if (successFunc(data)) {
lastData = data;
return Promise.reject('success');
}
});
}
var lastData, needBreak, i;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
i = 0;
_a.label = 1;
case 1:
if (!(i < maxTimes)) return [3, 5];
return [4, func().catch(function (e) {
if (e === 'success') {
needBreak = true;
}
else {
throw e;
}
})];
case 2:
_a.sent();
if (needBreak) {
return [3, 5];
}
if (abortFunc()) {
throw new Error('abort');
}
return [4, utils.waitPromise(delay)];
case 3:
_a.sent();
_a.label = 4;
case 4:
i++;
return [3, 1];
case 5:
if (!needBreak) {
throw new Error('timeout');
}
return [2, lastData];
}
});
});
}
export function getToken(uri, params, method, responseType) {
if (method === void 0) { method = 'POST'; }
if (responseType === void 0) { responseType = 'json'; }
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _this = this;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!window['getDuibaToken']) return [3, 1];
window['getDuibaToken'](function (tokenObj) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
params.token = tokenObj.token;
return [4, this.send(uri, params, method, responseType)];
case 1:
_a.sent();
return [2];
}
});
}); }, function () {
});
return [3, 3];
case 1: return [4, this.send(uri, params, method, responseType)];
case 2:
_a.sent();
_a.label = 3;
case 3: return [2];
}
});
});
}
export function createSgin(ticketId, score, gameData, submitToken) {
return window['duiba_md5'](ticketId + '' + score + '' + gameData + '' + submitToken);
}
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import ScillaComponent from "components/base/ScillaComponent";
import { fade, flew, none, zoom } from "./PopupEffect";
import { decorators } from "scilla";
import CustomButton from "../game/CustomButton";
var dirtyFieldTrigger = decorators.dirtyFieldTrigger;
var DialogContent = (function (_super) {
tslib_1.__extends(DialogContent, _super);
function DialogContent() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.effect = PopupEffect.none;
_this.effectImpl = none;
_this.show = function (data, callback) {
_this.bubbling('showDialog', _this.entity.name, data, callback);
};
_this.hide = function (action) {
_this.bubbling('hideDialog', _this.entity.name, action || 'close');
};
return _this;
}
DialogContent.prototype.onModify = function (value, key, oldValue) {
_super.prototype.onModify.call(this, value, key, oldValue);
if (key === 'effect') {
this.effectImpl = effects[value];
}
};
DialogContent.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
var buttons = this.entity.getChildrenByName('CloseButton');
if (buttons.length > 0) {
this._closeButton = buttons[0].getComponent(CustomButton);
this._closeButton.onClick.addListener(this.onTapCloseButton, this);
}
};
DialogContent.prototype.onTapCloseButton = function () {
this.hide();
};
DialogContent.prototype.setup = function (data) {
};
tslib_1.__decorate([
dirtyFieldTrigger
], DialogContent.prototype, "effect", void 0);
return DialogContent;
}(ScillaComponent));
export default DialogContent;
var effects = {
none: none,
fade: fade,
flew: flew,
zoom: zoom,
};
export var PopupEffect;
(function (PopupEffect) {
PopupEffect["none"] = "none";
PopupEffect["fade"] = "fade";
PopupEffect["flew"] = "flew";
PopupEffect["zoom"] = "zoom";
})(PopupEffect || (PopupEffect = {}));
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import DialogContent from "./DialogContent";
import RectRenderer from "components/renderer/RectRenderer";
import TouchInterrupt from "components/base/TouchInterrupt";
import Transform from "components/base/Transform";
import ScillaComponent from "components/base/ScillaComponent";
import { none } from "./PopupEffect";
import { createTween } from "scilla";
var Popup = (function (_super) {
tslib_1.__extends(Popup, _super);
function Popup() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.blackLayerDuration = 300;
_this._dialogStack = [];
return _this;
}
Popup.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
this._touchInterrupt = this.getComponent(TouchInterrupt);
this._touchInterrupt.enabled = false;
var bgRenderer = this._bgRenderer = this.getComponent(RectRenderer);
bgRenderer.enabled = false;
};
Popup.prototype.onUpdate = function (t) {
_super.prototype.onUpdate.call(this, t);
};
Popup.prototype.onSleep = function () {
_super.prototype.onSleep.call(this);
};
Popup.prototype.onDestroy = function () {
_super.prototype.onDestroy.call(this);
};
Popup.prototype.setBgVisible = function (visible) {
var _this = this;
if (visible) {
this._bgRenderer.enabled = true;
}
this._bgRenderer.alpha = visible ? 0 : 1;
createTween(this, this._bgRenderer, true)
.to({ alpha: visible ? 1 : 0 }, this.blackLayerDuration)
.call(function () {
if (!visible) {
_this._bgRenderer.enabled = false;
}
});
};
Popup.prototype.getDialogInStack = function (name) {
var e_1, _a;
var result;
try {
for (var _b = tslib_1.__values(this._dialogStack), _c = _b.next(); !_c.done; _c = _b.next()) {
var dialog = _c.value;
if (dialog.name === name) {
result = dialog;
break;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return result;
};
Popup.prototype.bringToTop = function (dialogConfig) {
var index = this._dialogStack.indexOf(dialogConfig);
if (index >= 0) {
this._dialogStack.splice(index, 1);
}
this._dialogStack.push(dialogConfig);
};
Popup.prototype.delete = function (dialogConfig) {
var index = this._dialogStack.indexOf(dialogConfig);
this._dialogStack.splice(index, 1);
};
Popup.prototype.showDialog = function (name, data, callback) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var dialogConfig, dialog, parent, content, transform, effect, effectOptions;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
dialogConfig = this.getDialogInStack(name);
dialog = this.entity.getChildrenByName(name)[0];
if (!dialogConfig) {
dialogConfig = {
name: name, data: data, callback: callback, dialog: dialog
};
dialog.enabled = true;
}
this.bringToTop(dialogConfig);
parent = dialog.parent;
parent.removeChild(dialog);
parent.addChildAt(dialog, parent.children.length);
this.setBgVisible(true);
this._touchInterrupt.enabled = true;
content = dialog.getComponent(DialogContent);
content && content.setup(data);
transform = dialog.getComponent(Transform);
effect = content ? content.effectImpl : none;
effectOptions = content ? content.showEffectOptions : null;
return [4, effect.show(transform, effectOptions)];
case 1:
_a.sent();
return [2];
}
});
});
};
Popup.prototype.hideDialog = function (name, action, data) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var dialogConfig, dialog, transform, content, effect, effectOptions;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
dialogConfig = this.getDialogInStack(name);
if (!dialogConfig) {
return [2];
}
dialog = this.entity.getChildrenByName(name)[0];
this.delete(dialogConfig);
if (this._dialogStack.length === 0) {
this.setBgVisible(false);
this._touchInterrupt.enabled = false;
}
transform = dialog.getComponent(Transform);
content = dialog.getComponent(DialogContent);
effect = content ? content.effectImpl : none;
effectOptions = content ? content.hideEffectOptions : null;
return [4, effect.hide(transform, effectOptions)];
case 1:
_a.sent();
dialog.enabled = false;
if (dialogConfig.callback) {
dialogConfig.callback(action, data);
dialogConfig.callback = null;
}
return [2];
}
});
});
};
Popup.prototype.hideAll = function () {
var e_2, _a;
try {
for (var _b = tslib_1.__values(this._dialogStack), _c = _b.next(); !_c.done; _c = _b.next()) {
var dialog = _c.value;
this.hideDialog(dialog.name);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
};
return Popup;
}(ScillaComponent));
export default Popup;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import { createTween, ease, engine } from "scilla";
function bearingsToOutPos(bearings) {
var _a = engine.renderContext.stageSize, width = _a.width, height = _a.height;
var x, y;
switch (bearings) {
case 'south':
x = 0;
y = height / 2;
break;
case 'west':
x = -width / 2;
y = 0;
break;
case 'east':
x = width / 2;
y = 0;
break;
case 'north':
default:
x = 0;
y = -height / 2;
}
return {
x: x, y: y,
};
}
export var none = {
show: function (transform, options) {
transform.position.setXY(0, 0);
return Promise.resolve();
},
hide: function (transform, options) {
transform.position.setXY(engine.renderContext.stageSize.width, 0);
return Promise.resolve();
}
};
export var fade = {
show: function (transform, options) {
options = options || {};
transform.alpha = 0;
var toProps = {
alpha: 1,
};
return new Promise(function (resolve) {
createTween(transform, transform)
.to(toProps, options.duration || 300, options.easeFunc)
.call(resolve);
});
},
hide: function (transform, options) {
options = options || {};
var toProps = {
alpha: 0,
};
return new Promise(function (resolve) {
createTween(transform, transform)
.to(toProps, options.duration || 200, options.easeFunc)
.call(resolve);
});
}
};
export var flew = {
show: function (transform, options) {
options = options || {};
var outPos = bearingsToOutPos(options.bearings);
transform.position.copyFrom(outPos);
var toProps = {
position: { x: 0, y: 0, },
};
var withFade = options.hasOwnProperty('withFade') ? options.withFade : false;
if (withFade) {
transform.alpha = 0;
toProps.alpha = 1;
}
return new Promise(function (resolve) {
createTween(transform, transform)
.to(toProps, options.duration || 300, options.easeFunc || ease.backOut)
.call(resolve);
});
},
hide: function (transform, options) {
options = options || {};
var outPos = bearingsToOutPos(options.bearings);
var toProps = {
position: outPos,
};
var withFade = options.hasOwnProperty('withFade') ? options.withFade : false;
if (withFade) {
toProps.alpha = 0;
}
return new Promise(function (resolve) {
createTween(transform, transform)
.to(toProps, options.duration || 200, options.easeFunc || ease.backIn)
.call(resolve);
});
}
};
export var zoom = {
show: function (transform, options) {
options = options || {};
transform.scale.setXY(0, 0);
var toProps = {
scale: { x: 1, y: 1, },
};
var withFade = options.hasOwnProperty('withFade') ? options.withFade : false;
if (withFade) {
transform.alpha = 0;
toProps.alpha = 1;
}
return new Promise(function (resolve) {
createTween(transform, transform)
.to(toProps, options.duration || 300, options.easeFunc || ease.backOut)
.call(resolve);
});
},
hide: function (transform, options) {
options = options || {};
var toProps = {
scale: { x: 0, y: 0 },
};
var withFade = options.hasOwnProperty('withFade') ? options.withFade : false;
if (withFade) {
toProps.alpha = 0;
}
return new Promise(function (resolve) {
createTween(transform, transform)
.to(toProps, options.duration || 200, options.easeFunc || ease.backIn)
.call(resolve);
});
}
};
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { engine } from "scilla";
import { playAnimation } from "../animation-utils";
import ScillaComponent from "components/base/ScillaComponent";
var animationConfig = {
enter: {},
leave: {},
};
var ScenePlay = (function (_super) {
tslib_1.__extends(ScenePlay, _super);
function ScenePlay() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._level = 3;
return _this;
}
ScenePlay.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
};
ScenePlay.prototype.onDidEnter = function (last, action, parameters) {
};
ScenePlay.prototype.onDidLeave = function (next, action, parameters) {
};
ScenePlay.prototype.onWillEnter = function (last, action, parameters) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, playAnimation(animationConfig.enter, this)];
case 1:
_a.sent();
return [2];
}
});
});
};
ScenePlay.prototype.onWillLeave = function (next, action, parameters) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, playAnimation(animationConfig.leave, this)];
case 1:
_a.sent();
return [2];
}
});
});
};
ScenePlay.prototype.onWillMount = function (last, action, parameters) {
return undefined;
};
ScenePlay.prototype.onWillUnMount = function (next, action, parameters) {
return undefined;
};
ScenePlay.prototype.reset = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var id, url, _a;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
id = 1;
url = "singles/" + id + ".jpg";
_a = this;
return [4, engine.assetsManager.loadImage(url)];
case 1:
_a._img = _b.sent();
this.startLevel();
return [2];
}
});
});
};
ScenePlay.prototype.nextLevel = function () {
this._level++;
this.startLevel();
};
ScenePlay.prototype.startLevel = function () {
this._puzzle.start(this._img, this._level);
};
return ScenePlay;
}(ScillaComponent));
export default ScenePlay;
//# sourceMappingURL=module.js.map
\ No newline at end of file
import * as tslib_1 from "tslib";
import { playAnimation } from "../animation-utils";
import ScillaComponent from "components/base/ScillaComponent";
var animationConfig = {
enter: {},
leave: {},
};
var SceneStart = (function (_super) {
tslib_1.__extends(SceneStart, _super);
function SceneStart() {
return _super !== null && _super.apply(this, arguments) || this;
}
SceneStart.prototype.onCreate = function () {
_super.prototype.onCreate.call(this);
};
SceneStart.prototype.showRuleDialog = function () {
this.bubbling('showDialog', 'Rule');
};
SceneStart.prototype.onDidEnter = function (last, action, parameters) {
};
SceneStart.prototype.onDidLeave = function (next, action, parameters) {
};
SceneStart.prototype.onWillEnter = function (last, action, parameters) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, playAnimation(animationConfig.enter, this)];
case 1:
_a.sent();
return [2];
}
});
});
};
SceneStart.prototype.onWillLeave = function (next, action, parameters) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, playAnimation(animationConfig.leave, this)];
case 1:
_a.sent();
return [2];
}
});
});
};
SceneStart.prototype.onWillMount = function (last, action, parameters) {
return undefined;
};
SceneStart.prototype.onWillUnMount = function (next, action, parameters) {
return undefined;
};
return SceneStart;
}(ScillaComponent));
export default SceneStart;
//# sourceMappingURL=module.js.map
\ No newline at end of file
export { default as SceneStart } from "./SceneStart";
export { default as ScenePlay } from "./ScenePlay";
//# sourceMappingURL=module.js.map
\ No newline at end of file
/Users/rockyl/.scilla/components
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
export const outputs = {};
import * as entry_0 from 'components/animation/Zoom';
outputs['components/animation/Zoom'] = entry_0;
import * as entry_1 from 'components/animation/Translation';
outputs['components/animation/Translation'] = entry_1;
import * as entry_2 from 'components/renderer/HtmlRenderer';
outputs['components/renderer/HtmlRenderer'] = entry_2;
import * as entry_3 from 'components/ui/ScrollView';
outputs['components/ui/ScrollView'] = entry_3;
import * as entry_4 from 'components/ui/Button';
outputs['components/ui/Button'] = entry_4;
import * as entry_5 from 'components/animation/TouchZoom';
outputs['components/animation/TouchZoom'] = entry_5;
import * as entry_6 from 'components/animation/Fade';
outputs['components/animation/Fade'] = entry_6;
import * as entry_7 from 'components/animation/Wave';
outputs['components/animation/Wave'] = entry_7;
import * as entry_8 from 'components/other/RelativeLayout';
outputs['components/other/RelativeLayout'] = entry_8;
import * as entry_9 from 'components/other/FullStageSize';
outputs['components/other/FullStageSize'] = entry_9;
import * as entry_10 from 'components/other/CameraController';
outputs['components/other/CameraController'] = entry_10;
import * as entry_11 from 'components/renderer/TextureRenderer';
outputs['components/renderer/TextureRenderer'] = entry_11;
import * as entry_12 from 'components/renderer/RectRenderer';
outputs['components/renderer/RectRenderer'] = entry_12;
import * as entry_13 from 'components/renderer/FrameAnimationRenderer';
outputs['components/renderer/FrameAnimationRenderer'] = entry_13;
import * as entry_14 from 'components/renderer/TextRenderer';
outputs['components/renderer/TextRenderer'] = entry_14;
import * as entry_15 from 'components/renderer/LineRenderer';
outputs['components/renderer/LineRenderer'] = entry_15;
import * as entry_16 from 'components/renderer/CircleRenderer';
outputs['components/renderer/CircleRenderer'] = entry_16;
import * as entry_17 from 'components/base/TouchInterrupt';
outputs['components/base/TouchInterrupt'] = entry_17;
import * as entry_18 from 'components/base/InteractComponent';
outputs['components/base/InteractComponent'] = entry_18;
import * as entry_19 from 'components/renderer/GraphicRenderer';
outputs['components/renderer/GraphicRenderer'] = entry_19;
import * as entry_20 from 'components/base/Transform';
outputs['components/base/Transform'] = entry_20;
import * as entry_21 from 'components/base/ScillaComponent';
outputs['components/base/ScillaComponent'] = entry_21;
import * as entry_22 from 'components/renderer/Renderer';
outputs['components/renderer/Renderer'] = entry_22;
import * as entry_23 from 'build/scripts/MainController';
outputs['./scripts/MainController'] = entry_23;
import * as entry_24 from 'build/scripts/api/ApiComponent';
outputs['./scripts/api/ApiComponent'] = entry_24;
import * as entry_25 from 'build/scripts/api/SampleApi';
outputs['./scripts/api/SampleApi'] = entry_25;
import * as entry_26 from 'build/scripts/api/SamplePollingApi';
outputs['./scripts/api/SamplePollingApi'] = entry_26;
import * as entry_27 from 'build/scripts/common/BuriedPoint';
outputs['./scripts/common/BuriedPoint'] = entry_27;
import * as entry_28 from 'build/scripts/common/CountDown';
outputs['./scripts/common/CountDown'] = entry_28;
import * as entry_29 from 'build/scripts/common/DotWaiting';
outputs['./scripts/common/DotWaiting'] = entry_29;
import * as entry_30 from 'build/scripts/common/FloatMissing';
outputs['./scripts/common/FloatMissing'] = entry_30;
import * as entry_31 from 'build/scripts/common/FlySequence';
outputs['./scripts/common/FlySequence'] = entry_31;
import * as entry_32 from 'build/scripts/common/LabelCarousel';
outputs['./scripts/common/LabelCarousel'] = entry_32;
import * as entry_33 from 'build/scripts/common/RunNumber';
outputs['./scripts/common/RunNumber'] = entry_33;
import * as entry_34 from 'build/scripts/common/Toast';
outputs['./scripts/common/Toast'] = entry_34;
import * as entry_35 from 'build/scripts/common/WaveController';
outputs['./scripts/common/WaveController'] = entry_35;
import * as entry_36 from 'build/scripts/dialogs/AlertDialogContent';
outputs['./scripts/dialogs/AlertDialogContent'] = entry_36;
import * as entry_37 from 'build/scripts/dialogs/PKChallenge';
outputs['./scripts/dialogs/PKChallenge'] = entry_37;
import * as entry_38 from 'build/scripts/dialogs/PKMatching';
outputs['./scripts/dialogs/PKMatching'] = entry_38;
import * as entry_39 from 'build/scripts/dialogs/PKResult';
outputs['./scripts/dialogs/PKResult'] = entry_39;
import * as entry_40 from 'build/scripts/dialogs/RuleDialogContent';
outputs['./scripts/dialogs/RuleDialogContent'] = entry_40;
import * as entry_41 from 'build/scripts/dialogs/SingleResult';
outputs['./scripts/dialogs/SingleResult'] = entry_41;
import * as entry_42 from 'build/scripts/dialogs/pkresult/AnimLayer';
outputs['./scripts/dialogs/pkresult/AnimLayer'] = entry_42;
import * as entry_43 from 'build/scripts/dialogs/pkresult/ResultLayer';
outputs['./scripts/dialogs/pkresult/ResultLayer'] = entry_43;
import * as entry_44 from 'build/scripts/game/ApiProcess';
outputs['./scripts/game/ApiProcess'] = entry_44;
import * as entry_45 from 'build/scripts/game/BottomButtonController';
outputs['./scripts/game/BottomButtonController'] = entry_45;
import * as entry_46 from 'build/scripts/game/CreditsBar';
outputs['./scripts/game/CreditsBar'] = entry_46;
import * as entry_47 from 'build/scripts/game/CustomButton';
outputs['./scripts/game/CustomButton'] = entry_47;
import * as entry_48 from 'build/scripts/game/CustomTextRenderer';
outputs['./scripts/game/CustomTextRenderer'] = entry_48;
import * as entry_49 from 'build/scripts/game/GameStage';
outputs['./scripts/game/GameStage'] = entry_49;
import * as entry_50 from 'build/scripts/game/Hole';
outputs['./scripts/game/Hole'] = entry_50;
import * as entry_51 from 'build/scripts/game/Item';
outputs['./scripts/game/Item'] = entry_51;
import * as entry_52 from 'build/scripts/game/ItemLayer';
outputs['./scripts/game/ItemLayer'] = entry_52;
import * as entry_53 from 'build/scripts/game/Miner';
outputs['./scripts/game/Miner'] = entry_53;
import * as entry_54 from 'build/scripts/game/NoticeBar';
outputs['./scripts/game/NoticeBar'] = entry_54;
import * as entry_55 from 'build/scripts/game/PKResultAnimSide';
outputs['./scripts/game/PKResultAnimSide'] = entry_55;
import * as entry_56 from 'build/scripts/game/PKResultSide';
outputs['./scripts/game/PKResultSide'] = entry_56;
import * as entry_57 from 'build/scripts/game/TimesCard';
outputs['./scripts/game/TimesCard'] = entry_57;
import * as entry_58 from 'build/scripts/game/TwoLinesButton';
outputs['./scripts/game/TwoLinesButton'] = entry_58;
import * as entry_59 from 'build/scripts/navigator/Navigator';
outputs['./scripts/navigator/Navigator'] = entry_59;
import * as entry_60 from 'build/scripts/navigator/SingleSceneNavigator';
outputs['./scripts/navigator/SingleSceneNavigator'] = entry_60;
import * as entry_61 from 'build/scripts/navigator/StackNavigator';
outputs['./scripts/navigator/StackNavigator'] = entry_61;
import * as entry_62 from 'build/scripts/navigator/VirtualNavigator';
outputs['./scripts/navigator/VirtualNavigator'] = entry_62;
import * as entry_63 from 'build/scripts/popup/DialogContent';
outputs['./scripts/popup/DialogContent'] = entry_63;
import * as entry_64 from 'build/scripts/popup/Popup';
outputs['./scripts/popup/Popup'] = entry_64;
import * as entry_65 from 'build/scripts/scenes/ScenePlay';
outputs['./scripts/scenes/ScenePlay'] = entry_65;
import * as entry_66 from 'build/scripts/scenes/SceneStart';
outputs['./scripts/scenes/SceneStart'] = entry_66;
{"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/animation-utils.ts":1555497204000,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/api/ApiComponent.ts":1560762040522.844,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/api/SampleApi.ts":1557469247751.934,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/api/SamplePollingApi.ts":1558516166920.5125,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/common/BuriedPoint.ts":1560762040442.0632,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/common/CountDown.ts":1560762040466.13,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/common/DotWaiting.ts":1560762040447.3147,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/common/FloatMissing.ts":1560762254569.4714,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/common/FlySequence.ts":1560762254563.4946,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/common/LabelCarousel.ts":1560762040472.642,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/common/RunNumber.ts":1560762040525.7534,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/common/Toast.ts":1560762254556.8164,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/common/WaveController.ts":1560762040535.6562,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/configs.ts":1557904130425.2163,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/dialogs/AlertDialogContent.ts":1560762040444.5261,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/dialogs/PKChallenge.ts":1560762040531.245,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/dialogs/PKMatching.ts":1560762040556.6838,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/dialogs/PKResult.ts":1560762040490.9277,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/dialogs/pkresult/AnimLayer.ts":1560762040553.1018,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/dialogs/pkresult/ResultLayer.ts":1560762040478.8127,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/dialogs/RuleDialogContent.ts":1560762040538.9695,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/dialogs/SingleResult.ts":1560762040500.7737,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/ApiProcess.ts":1560762040563.9863,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/BottomButtonController.ts":1560762040460.03,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/CreditsBar.ts":1560762040547.9001,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/CustomButton.ts":1560762040481.1667,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/CustomTextRenderer.ts":1560762040468.758,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/GameStage.ts":1560762040508.2104,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/Hole.ts":1560762040483.6372,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/Item.ts":1560762040493.9673,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/ItemLayer.ts":1560762040515.058,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/Miner.ts":1560762254566.8733,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/NoticeBar.ts":1560762040528.5356,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/PKResultAnimSide.ts":1560762254577.6477,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/PKResultSide.ts":1560762254560.5415,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/TimesCard.ts":1560762040550.4917,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/TwoLinesButton.ts":1560762254571.4585,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/game/utils.ts":1559115931293.07,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/MainController.ts":1560762040518.4475,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/navigator/Navigator.ts":1559115931293.3818,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/navigator/SingleSceneNavigator.ts":1560762254580.711,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/navigator/StackNavigator.ts":1559115931293.6724,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/navigator/VirtualNavigator.ts":1559115931293.9812,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/net/webService.ts":1559037295638.014,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/popup/DialogContent.ts":1560762254574.9548,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/popup/Popup.ts":1560762040560.495,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/popup/PopupEffect.ts":1558606074270.4177,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/scenes/index.ts":1554809935000,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/scenes/ScenePlay.ts":1560762040457.2278,"/Users/rockyl/WorkSpaces/scilla/samples/super-miner/assets/scripts/scenes/SceneStart.ts":1560762040512.0667}
...@@ -28,79 +28,80 @@ ...@@ -28,79 +28,80 @@
"globalEvent": [ "globalEvent": [
"src/GlobalEvent.ts" "src/GlobalEvent.ts"
], ],
"components/animation/Zoom": [ "components/animation/Fade": [
"components/src/animation/Zoom/1.0.0/index" "components/src/animation/Fade/1.0.0/index"
],
"components/animation/TouchZoom": [
"components/src/animation/TouchZoom/1.0.0/index"
], ],
"components/animation/Translation": [ "components/animation/Translation": [
"components/src/animation/Translation/1.0.0/index" "components/src/animation/Translation/1.0.0/index"
], ],
"components/renderer/HtmlRenderer": [ "components/animation/Wave": [
"components/src/renderer/HtmlRenderer/1.0.0/index" "components/src/animation/Wave/1.0.0/index"
], ],
"components/ui/ScrollView": [ "components/animation/Zoom": [
"components/src/ui/ScrollView/1.0.0/index" "components/src/animation/Zoom/1.0.0/index"
], ],
"components/ui/Button": [ "components/base/InteractComponent": [
"components/src/ui/Button/1.0.0/index" "components/src/base/InteractComponent/1.0.0/index"
], ],
"components/animation/TouchZoom": [ "components/base/ScillaComponent": [
"components/src/animation/TouchZoom/1.0.0/index" "components/src/base/ScillaComponent/1.0.0/index"
], ],
"components/animation/Fade": [ "components/base/TouchInterrupt": [
"components/src/animation/Fade/1.0.0/index" "components/src/base/TouchInterrupt/1.0.0/index"
], ],
"components/animation/Wave": [ "components/base/Transform": [
"components/src/animation/Wave/1.0.0/index" "components/src/base/Transform/1.0.3/index"
], ],
"components/other/RelativeLayout": [ "components/other/CameraController": [
"components/src/other/RelativeLayout/1.0.0/index" "components/src/other/CameraController/1.0.0/index"
], ],
"components/other/FullStageSize": [ "components/other/FullStageSize": [
"components/src/other/FullStageSize/1.0.0/index" "components/src/other/FullStageSize/1.0.0/index"
], ],
"components/other/CameraController": [ "components/other/RelativeLayout": [
"components/src/other/CameraController/1.0.0/index" "components/src/other/RelativeLayout/1.0.0/index"
],
"components/renderer/TextureRenderer": [
"components/src/renderer/TextureRenderer/1.0.0/index"
], ],
"components/renderer/RectRenderer": [ "components/renderer/CircleRenderer": [
"components/src/renderer/RectRenderer/1.0.0/index" "components/src/renderer/CircleRenderer/1.0.0/index"
], ],
"components/renderer/FrameAnimationRenderer": [ "components/renderer/FrameAnimationRenderer": [
"components/src/renderer/FrameAnimationRenderer/1.0.0/index" "components/src/renderer/FrameAnimationRenderer/1.0.0/index"
], ],
"components/renderer/TextRenderer": [ "components/renderer/GraphicRenderer": [
"components/src/renderer/TextRenderer/1.0.0/index" "components/src/renderer/GraphicRenderer/1.0.0/index"
],
"components/renderer/HtmlRenderer": [
"components/src/renderer/HtmlRenderer/1.0.0/index"
], ],
"components/renderer/LineRenderer": [ "components/renderer/LineRenderer": [
"components/src/renderer/LineRenderer/1.0.0/index" "components/src/renderer/LineRenderer/1.0.0/index"
], ],
"components/renderer/CircleRenderer": [ "components/renderer/RectRenderer": [
"components/src/renderer/CircleRenderer/1.0.0/index" "components/src/renderer/RectRenderer/1.0.0/index"
],
"components/base/TouchInterrupt": [
"components/src/base/TouchInterrupt/1.0.0/index"
], ],
"components/base/InteractComponent": [ "components/renderer/Renderer": [
"components/src/base/InteractComponent/1.0.0/index" "components/src/renderer/Renderer/1.0.0/index"
], ],
"components/renderer/GraphicRenderer": [ "components/renderer/TextRenderer": [
"components/src/renderer/GraphicRenderer/1.0.0/index" "components/src/renderer/TextRenderer/1.0.0/index"
], ],
"components/base/Transform": [ "components/renderer/TextureRenderer": [
"components/src/base/Transform/1.0.3/index" "components/src/renderer/TextureRenderer/1.0.0/index"
], ],
"components/base/ScillaComponent": [ "components/ui/Button": [
"components/src/base/ScillaComponent/1.0.0/index" "components/src/ui/Button/1.0.0/index"
], ],
"components/renderer/Renderer": [ "components/ui/ScrollView": [
"components/src/renderer/Renderer/1.0.0/index" "components/src/ui/ScrollView/1.0.0/index"
] ]
} }
}, },
"include": [ "include": [
"src", "src",
"assets" "assets"
] ],
"compileOnSave": false
} }
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
# yarn lockfile v1 # yarn lockfile v1
"scilla-components@git+http://gitlab2.dui88.com/laoqifeng/scilla-components#dev":
version "1.0.2"
resolved "git+http://gitlab2.dui88.com/laoqifeng/scilla-components#61b7ca17b74be5e8b77a1e9c90f4847140be6655"
"scilla-launcher@git+http://gitlab2.dui88.com/laoqifeng/scilla-launcher#dev": "scilla-launcher@git+http://gitlab2.dui88.com/laoqifeng/scilla-launcher#dev":
version "1.0.1" version "1.0.1"
resolved "git+http://gitlab2.dui88.com/laoqifeng/scilla-launcher#40cb0087c6df55c07a4e86c28b703973f6b6fd58" resolved "git+http://gitlab2.dui88.com/laoqifeng/scilla-launcher#40cb0087c6df55c07a4e86c28b703973f6b6fd58"
......
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