Commit e1f211a2 authored by 任建锋's avatar 任建锋

--

parent e2c08d80
No preview for this file type
import DialogContent from '../popup/DialogContent';
import BuriedPoint, { addBuriedPoints,addBuriedPointConfig,logExposure} from '../common/BuriedPoint';
import { Entity, Texture } from 'scilla/src';
import { TextureRenderer, Transform, TextRenderer, Button } from 'scilla-components/src';
export default class GameOverPanel extends DialogContent {
onAwake() {
super.onAwake();
}
data
//BuriedPoint
img:Entity
title:Entity;
level:Entity;
localText:Entity;
imgTextureRenderer
imgTransform
titleTextRenderer
levelTextRenderer
BuriedPoint
localTextTransform
setup(data: any = {}) {
console.log(data)
this.data=data
this.imgTextureRenderer=this.img.getComponent(TextureRenderer)
this.imgTransform=this.img.getComponent(Transform)
this.localTextTransform=this.localText.getComponent(Transform)
this.titleTextRenderer=this.title.getComponent(TextRenderer)
this.levelTextRenderer=this.level.getComponent(TextRenderer)
if(data.exposure){
this.BuriedPoint=this.getComponent(BuriedPoint)
this.BuriedPoint.setConfig(data.exposure.dpm, data.exposure.dcm,true)
//this.BuriedPoint.se
}
var img = new Image();
img.src = data.imgurl;
img.onload = ()=>{
this.imgTextureRenderer.texture.setImg(img)
this.imgTextureRenderer.texture.bounds.height=img.height;
this.imgTextureRenderer.texture.bounds.width=img.width;
this.imgTransform.width=img.width;
this.imgTransform.height=img.height;
};
this.titleTextRenderer.text=data.title
this.localTextTransform.alpha=1;
switch(data.prizeType){
case 0:
this.levelTextRenderer.text="幸运奖";
this.localTextTransform.alpha=0;
break;
case 1:
this.levelTextRenderer.text="一等奖";
break;
case 2:
this.levelTextRenderer.text="二等奖";
break;
case 3:
this.levelTextRenderer.text="三等奖";
break;
case 4:
this.levelTextRenderer.text="四等奖";
break;
}
}
onclick_useBtn() {
if(this.data.exposure){
this.BuriedPoint.onTouchTap()
}
window.location.href=this.data.link;
this.bubbling('fuckNavigator', 'start')
}
onclick_closeBtn() {
this.bubbling('fuckNavigator', 'start')
}
}
import DialogContent from '../popup/DialogContent';
import BuriedPoint, { addBuriedPoints,addBuriedPointConfig,logExposure} from '../common/BuriedPoint';
import { Entity, Texture } from 'scilla/src';
import { TextureRenderer, Transform, TextRenderer, Button } from 'scilla-components/src';
export default class GameOverPanel extends DialogContent {
onAwake() {
super.onAwake();
}
data
//BuriedPoint
img:Entity
title:Entity;
level:Entity;
localText:Entity;
imgTextureRenderer
imgTransform
titleTextRenderer
levelTextRenderer
BuriedPoint
localTextTransform
setup(data: any = {}) {
console.log(data)
this.data=data
this.imgTextureRenderer=this.img.getComponent(TextureRenderer)
this.imgTransform=this.img.getComponent(Transform)
this.localTextTransform=this.localText.getComponent(Transform)
this.titleTextRenderer=this.title.getComponent(TextRenderer)
this.levelTextRenderer=this.level.getComponent(TextRenderer)
if(data.exposure){
this.BuriedPoint=this.getComponent(BuriedPoint)
this.BuriedPoint.setConfig(data.exposure.dpm, data.exposure.dcm,true)
//this.BuriedPoint.se
}
var img = new Image();
img.src = data.imgurl;
img.onload = ()=>{
this.imgTextureRenderer.texture.setImg(img)
this.imgTextureRenderer.texture.bounds.height=img.height;
this.imgTextureRenderer.texture.bounds.width=img.width;
this.imgTransform.width=img.width;
this.imgTransform.height=img.height;
};
this.titleTextRenderer.text=data.title
this.localTextTransform.alpha=1;
switch(data.prizeType){
case 0:
this.levelTextRenderer.text="幸运奖";
this.localTextTransform.alpha=0;
break;
case 1:
this.levelTextRenderer.text="一等奖";
break;
case 2:
this.levelTextRenderer.text="二等奖";
break;
case 3:
this.levelTextRenderer.text="三等奖";
break;
case 4:
this.levelTextRenderer.text="四等奖";
break;
}
}
onclick_useBtn() {
if(this.data.exposure){
this.BuriedPoint.onTouchTap()
}
if(this.data.prizeType==0){
window.location.href=this.data.luck.luckBagDetail.link;
}else{
window.location.href=this.data.link;
}
this.bubbling('fuckNavigator', 'start')
}
onclick_closeBtn() {
this.bubbling('fuckNavigator', 'start')
}
}
import DialogContent from '../popup/DialogContent';
import BuriedPoint, { addBuriedPoints,addBuriedPointConfig,logExposure} from '../common/BuriedPoint';
import { Entity, Texture } from 'scilla/src';
import { TextureRenderer, Transform, TextRenderer, Button } from 'scilla-components/src';
export default class GameOverPanel extends DialogContent {
onAwake() {
super.onAwake();
}
data
//BuriedPoint
img:Entity
title:Entity;
level:Entity;
localText:Entity;
imgTextureRenderer
imgTransform
titleTextRenderer
levelTextRenderer
BuriedPoint
localTextTransform
setup(data: any = {}) {
console.log(data)
this.data=data
this.imgTextureRenderer=this.img.getComponent(TextureRenderer)
this.imgTransform=this.img.getComponent(Transform)
this.localTextTransform=this.localText.getComponent(Transform)
this.titleTextRenderer=this.title.getComponent(TextRenderer)
this.levelTextRenderer=this.level.getComponent(TextRenderer)
if(data.exposure){
this.BuriedPoint=this.getComponent(BuriedPoint)
this.BuriedPoint.setConfig(data.exposure.dpm, data.exposure.dcm,true)
//this.BuriedPoint.se
}
var img = new Image();
img.src = data.imgurl;
img.onload = ()=>{
this.imgTextureRenderer.texture.setImg(img)
this.imgTextureRenderer.texture.bounds.height=img.height;
this.imgTextureRenderer.texture.bounds.width=img.width;
this.imgTransform.width=img.width;
this.imgTransform.height=img.height;
};
this.titleTextRenderer.text=data.title
this.localTextTransform.alpha=1;
switch(data.prizeType){
case 0:
this.levelTextRenderer.text="幸运奖";
this.localTextTransform.alpha=0;
break;
case 1:
this.levelTextRenderer.text="一等奖";
break;
case 2:
this.levelTextRenderer.text="二等奖";
break;
case 3:
this.levelTextRenderer.text="三等奖";
break;
case 4:
this.levelTextRenderer.text="四等奖";
break;
}
}
onclick_useBtn() {
if(this.data.exposure){
this.BuriedPoint.onTouchTap()
}
if(this.data.prizeType==0){
if(this.data.luck){
if(this.data.luck.luckBagDetail){
window.location.href=this.data.luck.luckBagDetail.link;
}
}
}else{
window.location.href=this.data.link;
}
this.bubbling('fuckNavigator', 'start')
}
onclick_closeBtn() {
this.bubbling('fuckNavigator', 'start')
}
}
import DialogContent from '../popup/DialogContent';
import BuriedPoint, { addBuriedPoints,addBuriedPointConfig,logExposure} from '../common/BuriedPoint';
import { Entity, Texture } from 'scilla/src';
import { TextureRenderer, Transform, TextRenderer, Button } from 'scilla-components/src';
export default class GameOverPanel extends DialogContent {
onAwake() {
super.onAwake();
}
data
//BuriedPoint
img:Entity
title:Entity;
level:Entity;
localText:Entity;
imgTextureRenderer
imgTransform
titleTextRenderer
levelTextRenderer
BuriedPoint
localTextTransform
setup(data: any = {}) {
console.log(data)
this.data=data
this.imgTextureRenderer=this.img.getComponent(TextureRenderer)
this.imgTransform=this.img.getComponent(Transform)
this.localTextTransform=this.localText.getComponent(Transform)
this.titleTextRenderer=this.title.getComponent(TextRenderer)
this.levelTextRenderer=this.level.getComponent(TextRenderer)
if(data.exposure){
this.BuriedPoint=this.getComponent(BuriedPoint)
this.BuriedPoint.setConfig(data.exposure.dpm, data.exposure.dcm,true)
//this.BuriedPoint.se
}
var img = new Image();
img.src = data.imgurl;
img.onload = ()=>{
this.imgTextureRenderer.texture.setImg(img)
this.imgTextureRenderer.texture.bounds.height=img.height;
this.imgTextureRenderer.texture.bounds.width=img.width;
this.imgTransform.width=img.width;
this.imgTransform.height=img.height;
};
this.titleTextRenderer.text=data.title
this.localTextTransform.alpha=1;
switch(data.prizeType){
case 0:
this.levelTextRenderer.text="幸运奖";
this.localTextTransform.alpha=0;
break;
case 1:
this.levelTextRenderer.text="一等奖";
break;
case 2:
this.levelTextRenderer.text="二等奖";
break;
case 3:
this.levelTextRenderer.text="三等奖";
break;
case 4:
this.levelTextRenderer.text="四等奖";
break;
}
}
onclick_useBtn() {
if(this.data.exposure){
this.BuriedPoint.onTouchTap()
}
if(this.data.prizeType==0){
if(this.data.luck){
if(this.data.luck.luckBagDetail){
window.location.href=this.data.luck.luckBagDetail.link;
}
}
}else{
window.location.href=this.data.link;
}
this.bubbling('fuckNavigator', 'start')
}
onclick_closeBtn() {
this.bubbling('fuckNavigator', 'start')
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText();
this.updateStartBtnState();
}
canBegin=false;
updateCountText() {
//this.freeLimit;
console.log(this.freeLimit)
let text
this.canBegin=true;
if (this.freeLimit!=undefined&&this.freeLimit!=null) {
text = `剩余次数:${this.freeLimit}次`;
if(this.freeLimit<=0){
this.canBegin=false;
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
this.startBtnButton.interactable=true;
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
/* this.broadcast('callApi', 1, 'getOrderStatus', {
orderId: this.doJoin
}); */
if(!this.doJoin){
return
}
this.grabState=true;
if(this.doJoin){
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
console.log("s2")
this.hasPrize=false;
}
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText();
this.updateStartBtnState();
}
canBegin=false;
updateCountText() {
//this.freeLimit;
console.log(this.freeLimit)
let text
this.canBegin=true;
if (this.freeLimit!=undefined&&this.freeLimit!=null) {
text = `剩余次数:${this.freeLimit}次`;
if(this.freeLimit<=0){
this.canBegin=false;
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
this.startBtnButton.interactable=true;
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
/* this.broadcast('callApi', 1, 'getOrderStatus', {
orderId: this.doJoin
}); */
if(!this.doJoin){
return
}
this.grabState=true;
if(this.doJoin){
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
console.log("s2")
this.hasPrize=false;
}
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
this.bubbling('showDialog', 'AlertLose',"出错了");
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText();
this.updateStartBtnState();
}
canBegin=false;
updateCountText() {
//this.freeLimit;
console.log(this.freeLimit)
let text
this.canBegin=true;
if (this.freeLimit!=undefined&&this.freeLimit!=null) {
text = `剩余次数:${this.freeLimit}次`;
if(this.freeLimit<=0){
this.canBegin=false;
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
this.startBtnButton.interactable=true;
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
if(!this.doJoin){
return
}
this.grabState=true;
if(this.doJoin){
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
console.log("s2")
this.hasPrize=false;
}
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
this.bubbling('showDialog', 'AlertLose',"出错了");
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText();
this.updateStartBtnState();
}
canBegin=false;
updateCountText() {
//this.freeLimit;
console.log(this.freeLimit)
let text
this.canBegin=true;
if (this.freeLimit!=undefined&&this.freeLimit!=null) {
text = `剩余次数:${this.freeLimit}次`;
if(this.freeLimit<=0){
this.canBegin=false;
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
this.startBtnButton.interactable=true;
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
if(!this.doJoin){
return
}
this.grabState=true;
if(this.doJoin){
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
console.log("s2")
this.hasPrize=false;
}
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
this.bubbling('showDialog', 'AlertLose',"出错了");
this.startBtnButton.interactable=true;
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText();
this.updateStartBtnState();
}
canBegin=false;
updateCountText() {
//this.freeLimit;
console.log(this.freeLimit)
let text
this.canBegin=true;
if (this.freeLimit!=undefined&&this.freeLimit!=null) {
text = `剩余次数:${this.freeLimit}次`;
if(this.freeLimit<=0){
this.canBegin=false;
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
this.startBtnButton.interactable=true;
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
if(!this.doJoin){
return
}
this.grabState=true;
if(this.doJoin){
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
console.log("s2")
this.hasPrize=false;
}
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
if(data)
switch(data){
case "400001":
this.bubbling('showDialog', 'AlertLose',"活动不存在");
break;
case "400002":
this.bubbling('showDialog', 'AlertLose',"参与次数不足");
break;
case "400003":
this.bubbling('showDialog', 'AlertLose',"排行榜订单不存在");
break;
case "400004":
this.bubbling('showDialog', 'AlertLose',"排行榜订单状态不正确");
break;
case "400005":
this.bubbling('showDialog', 'AlertLose',"活动已结束");
break;
}
this.startBtnButton.interactable=true;
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText();
this.updateStartBtnState();
}
canBegin=false;
updateCountText() {
//this.freeLimit;
console.log(this.freeLimit)
let text
this.canBegin=true;
if (this.freeLimit!=undefined&&this.freeLimit!=null) {
text = `剩余次数:${this.freeLimit}次`;
if(this.freeLimit<=0){
this.canBegin=false;
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
this.startBtnButton.interactable=true;
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
if(!this.doJoin){
return
}
this.grabState=true;
if(this.doJoin){
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
console.log("s2")
this.hasPrize=false;
}
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
if(data)
switch(data){
case "400001":
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
break;
case "400002":
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
break;
case "400003":
this.bubbling('showDialog', 'AlertLose',"排行榜订单不存在");
break;
case "400004":
this.bubbling('showDialog', 'AlertLose',"排行榜订单状态不正确");
break;
case "400005":
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
break;
default:
this.bubbling('showDialog', 'AlertLose',"网络异常,请稍后再试");
}
this.startBtnButton.interactable=true;
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText();
this.updateStartBtnState();
}
canBegin=false;
updateCountText() {
//this.freeLimit;
console.log(this.freeLimit)
let text
this.canBegin=true;
if (this.freeLimit!=undefined&&this.freeLimit!=null) {
text = `剩余次数:${this.freeLimit}次`;
if(this.freeLimit<=0){
this.canBegin=false;
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
this.startBtnButton.interactable=true;
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
if(!this.doJoin){
return
}
this.grabState=true;
if(this.doJoin){
this.freeLimit=this.doJoin.freeLimit;
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
console.log("s2")
this.hasPrize=false;
}
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
if(data)
switch(data){
case "400001":
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
break;
case "400002":
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
break;
case "400003":
this.bubbling('showDialog', 'AlertLose',"排行榜订单不存在");
break;
case "400004":
this.bubbling('showDialog', 'AlertLose',"排行榜订单状态不正确");
break;
case "400005":
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
break;
default:
this.bubbling('showDialog', 'AlertLose',"网络异常,请稍后再试");
}
this.startBtnButton.interactable=true;
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText();
this.updateStartBtnState();
}
canBegin=false;
updateCountText() {
//this.freeLimit;
console.log(this.freeLimit)
let text
this.canBegin=true;
if (this.freeLimit!=undefined&&this.freeLimit!=null) {
text = `剩余次数:${this.freeLimit}次`;
if(this.freeLimit<=0){
this.canBegin=false;
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
this.startBtnButton.interactable=true;
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
if(!this.doJoin){
return
}
this.grabState=true;
this.freeLimit=this.doJoin.freeLimit;
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
if(data)
switch(data){
case "400001":
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
break;
case "400002":
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
break;
case "400003":
this.bubbling('showDialog', 'AlertLose',"排行榜订单不存在");
break;
case "400004":
this.bubbling('showDialog', 'AlertLose',"排行榜订单状态不正确");
break;
case "400005":
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
break;
default:
this.bubbling('showDialog', 'AlertLose',"网络异常,请稍后再试");
}
this.startBtnButton.interactable=true;
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText();
this.updateStartBtnState();
}
canBegin=false;
updateCountText() {
//this.freeLimit;
console.log(this.freeLimit)
let text
this.canBegin=true;
if (this.freeLimit!=undefined&&this.freeLimit!=null) {
text = `剩余次数:${this.freeLimit}次`;
if(this.freeLimit<=0){
this.canBegin=false;
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
this.startBtnButton.interactable=true;
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
if(!this.doJoin){
return
}
this.grabState=true;
this.freeLimit=this.doJoin.freeLimit;
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
this.updateCountText()
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
if(data)
switch(data){
case "400001":
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
break;
case "400002":
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
break;
case "400003":
this.bubbling('showDialog', 'AlertLose',"排行榜订单不存在");
break;
case "400004":
this.bubbling('showDialog', 'AlertLose',"排行榜订单状态不正确");
break;
case "400005":
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
break;
default:
this.bubbling('showDialog', 'AlertLose',"网络异常,请稍后再试");
}
this.startBtnButton.interactable=true;
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText(this.freeLimit);
this.updateStartBtnState();
}
canBegin=false;
updateCountText(freeLimit) {
//this.freeLimit;
console.log(freeLimit)
let text
this.canBegin=true;
if (freeLimit!=undefined&&freeLimit!=null) {
text = `剩余次数:${freeLimit}次`;
if(freeLimit<=0){
this.canBegin=false;
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
this.startBtnButton.interactable=true;
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
if(!this.doJoin){
return
}
this.grabState=true;
//this.freeLimit=this.doJoin.freeLimit;
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
this.updateCountText()
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
if(data)
switch(data){
case "400001":
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
break;
case "400002":
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
break;
case "400003":
this.bubbling('showDialog', 'AlertLose',"排行榜订单不存在");
break;
case "400004":
this.bubbling('showDialog', 'AlertLose',"排行榜订单状态不正确");
break;
case "400005":
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
break;
default:
this.bubbling('showDialog', 'AlertLose',"网络异常,请稍后再试");
}
this.startBtnButton.interactable=true;
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText(this.freeLimit);
this.updateStartBtnState();
}
canBegin=false;
updateCountText(freeLimit) {
//this.freeLimit;
console.log(freeLimit)
let text
this.canBegin=true;
if (freeLimit!=undefined&&freeLimit!=null) {
text = `剩余次数:${freeLimit}次`;
if(freeLimit<=0){
this.canBegin=false;
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
this.startBtnButton.interactable=true;
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
if(!this.doJoin){
return
}
this.grabState=true;
this.freeLimitApi=this.doJoin.freeLimit;
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
//this.updateCountText()
this.updateCountText(this.freeLimitApi);
this.updateStartBtnState();
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
if(data)
switch(data){
case "400001":
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
break;
case "400002":
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
break;
case "400003":
this.bubbling('showDialog', 'AlertLose',"排行榜订单不存在");
break;
case "400004":
this.bubbling('showDialog', 'AlertLose',"排行榜订单状态不正确");
break;
case "400005":
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
break;
default:
this.bubbling('showDialog', 'AlertLose',"网络异常,请稍后再试");
}
this.startBtnButton.interactable=true;
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText(this.freeLimit);
this.updateStartBtnState();
}
canBegin=false;
updateCountText(freeLimit) {
//this.freeLimit;
console.log(freeLimit)
let text
this.canBegin=true;
if (freeLimit!=undefined&&freeLimit!=null) {
text = `剩余次数:${freeLimit}次`;
if(freeLimit<=0){
this.canBegin=false;
//this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
this.startBtnButton.interactable=true;
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
if(!this.doJoin){
return
}
this.grabState=true;
this.freeLimitApi=this.doJoin.freeLimit;
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
//this.updateCountText()
this.updateCountText(this.freeLimitApi);
this.updateStartBtnState();
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
if(data)
switch(data){
case "400001":
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
break;
case "400002":
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
break;
case "400003":
this.bubbling('showDialog', 'AlertLose',"排行榜订单不存在");
break;
case "400004":
this.bubbling('showDialog', 'AlertLose',"排行榜订单状态不正确");
break;
case "400005":
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
break;
default:
this.bubbling('showDialog', 'AlertLose',"网络异常,请稍后再试");
}
this.startBtnButton.interactable=true;
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
/**
* Created by rockyl on 2019-04-09.
*/
import ScillaComponent from "scilla-components/src/base/ScillaComponent";
import { dynamic, Entity, Tween } from "scilla/src";
import { setText } from "../entityUtils";
import { alien } from "../navigator/StackNavigator";
import Wave from 'components/animation/Wave'
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform, Button } from 'scilla-components/src';
import {createTween, ease} from "scilla";
export default class SceneStart extends ScillaComponent implements INavigatorViewBase {
//index: dynamic;
doJoin: dynamic;
getOrderStatus: dynamic;
freeLimit: dynamic;
startTime: dynamic;
endTime: dynamic;
freeLimitApi
countTxt: Entity;
startbtn: Entity;
recordbtn: Entity;
pingziFront: Entity;
pingziBack: Entity;
rankbtn: Entity;
rulebtn: Entity;
gouzi: Entity;
pingzi_1: Entity;
pingzi_2: Entity;
gouzi_pingzi: Entity;
loading: Entity;
private startBtnAnimation;
pingziFrontTransform:Transform;
pingziBackTransform:Transform;
gouziTransform:Transform;
pingzi_1Transform:Transform;
pingzi_2Transform:Transform;
gouzi_pingziTransform:Transform;
loadingTransform:Transform;
startBtnButton:Button;
onAwake() {
super.onAwake();
this.setCountText('');
this.startBtnAnimation = this.startbtn.getComponent(Transform);
this.startBtnButton = this.startbtn.getComponent(Button);
this.pingziFrontTransform = this.pingziFront.getComponent(Transform);
this.pingziBackTransform = this.pingziBack.getComponent(Transform);
this.gouziTransform = this.gouzi.getComponent(Transform);
this.pingzi_1Transform = this.pingzi_1.getComponent(Transform);
this.pingzi_2Transform = this.pingzi_2.getComponent(Transform);
this.gouzi_pingziTransform = this.gouzi_pingzi.getComponent(Transform);
this.loadingTransform = this.loading.getComponent(Transform);
this.grabState=false;
this.hasPrize=false;
this.gouzi_pingziTransform.alpha=0
this.pingzi_2Transform.alpha=1
this.playAnimation()
this.setVisible(this.loadingTransform,false)
this.initGameStage()
}
playAnimation(){
createTween(this, this.pingziBackTransform,true,{loop:-1})
.set({position: {x: 47.5}})
.to({position: {x: -152.5}},1000)
createTween(this, this.pingziFrontTransform,true,{loop:-1})
.set({position: {x: -110}})
.to({position: {x: 110}},1000)
.call(()=>{
this.setVisible(this.loadingTransform,false)
//console.log(`2`)
if(this.grabState){
this.grabState=false;
var time=1000;
if(this.hasPrize){
time=1000;
}else{
time=500;
}
createTween(this, this.gouziTransform,true,{loop:0})
.set({position: {y: 132.5}})
.to({position: {y: 335}},time)
.call(()=>{
if(this.hasPrize){
this.hasPrize=false;
this.pingzi_2Transform.alpha=0
this.gouzi_pingziTransform.alpha=1
setTimeout(()=>{
this.pingzi_2Transform.alpha=1
},1000)
}
})
.to({position: {y: 132.5}},1000)
.call(()=>{
this.hasGraDo()
this.pingzi_2Transform.alpha=1
this.gouzi_pingziTransform.alpha=0
})
}
})
}
//是否隐藏对象
setVisible(obj,state){
if(state){
obj.alpha=1;
}else{
obj.alpha=0;
}
}
private setCountText(text: string) {
setText(this.countTxt, text);
}
initGameStage() {
this.updateCountText(this.freeLimit);
this.updateStartBtnState();
}
canBegin=false;
updateCountText(freeLimit) {
//this.freeLimit;
console.log(freeLimit)
let text
this.canBegin=true;
if (freeLimit!=undefined&&freeLimit!=null) {
text = `剩余次数:${freeLimit}次`;
if(freeLimit<=0){
this.canBegin=false;
//this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
}
}
if (this.startTime!=undefined&&this.startTime!=null) {
if(Date.now()<this.startTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
}
}
if (this.endTime!=undefined&&this.endTime!=null) {
if(Date.now()>this.endTime){
this.canBegin=false;
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
}
}
this.setCountText(text);
}
updateStartBtnState(){
this.startBtnButton.interactable=this.canBegin;
if(this.canBegin){
createTween(this, this.startBtnAnimation,true,{loop:-1})
.set({scale: {x: 1, y: 1}})
.to({scale: {x: .9, y: .9}}, 300)
.wait(1000)
.to({scale: {x: 1, y: 1}}, 300)
}
}
grabState=false;
hasPrize=false;
onFinish_orderStatus(){
if(!this.getOrderStatus){
this.bubbling('showDialog', 'Alert',"查询超时,请点击首页【奖品】按钮查看。");
}
}
onResponse_orderStatus() {
//this.bubbling('showDialog', 'GameOver');
console.log(1)
console.log(this.getOrderStatus)
this.grabState=true;
if(this.getOrderStatus.code == "C000000001"){
this.hasPrize=false;
}
else if(this.getOrderStatus.lottery){
if(this.getOrderStatus.lottery.type=="thanks"){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
}else{
this.hasPrize=false;
}
}
hasGraDo(){
if(this.freeLimitApi>0){
this.startBtnButton.interactable=true;
}else{
this.startBtnButton.interactable=false;
}
if(this.doJoin){
if(this.doJoin.prizeType==5){
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}else{
this.bubbling('showDialog', 'GameOver',this.doJoin);
}
}else{
//this.bubbling('showDialog', 'GameNoPrize');
this.bubbling('showDialog', 'AlertLose',"您与奖品擦肩而过");
}
}
onError_orderStatus() {
console.log(2)
}
onClick_startbtn() {
/* this.grabState=true;
this.hasPrize=true; */
this.setVisible(this.loadingTransform,true)
this.startBtnButton.interactable=false;
if (window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
this.broadcast('callApi', 1, 'doJoin', {
token:tokenObj.token,
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}, (key: string, messageObj: any) => {
this.onGotDojoinError();
});
} else {
this.broadcast('callApi', 1, 'doJoin', {
activityId: window['CFG'].actId,
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
});
}
}
onGotDojoin() {
console.log('onGotDojoin', this.doJoin);
if(!this.doJoin){
return
}
this.grabState=true;
this.freeLimitApi=this.doJoin.freeLimit;
console.log("s1")
if(this.doJoin.prizeType==5){
this.hasPrize=false;
}else{
this.hasPrize=true;
}
//this.updateCountText()
this.updateCountText(this.freeLimitApi);
this.updateStartBtnState();
}
onGotDojoinError(data?) {
console.log('onGotDojoinError')
console.log(this.doJoin)
console.log(data)
if(data)
switch(data){
case "400001":
this.bubbling('showDialog', 'Alert',"活动还未开始\n敬请期待");
break;
case "400002":
this.bubbling('showDialog', 'AlertLose',"您已经没有抽奖次数了");
break;
case "400003":
this.bubbling('showDialog', 'AlertLose',"排行榜订单不存在");
break;
case "400004":
this.bubbling('showDialog', 'AlertLose',"排行榜订单状态不正确");
break;
case "400005":
this.bubbling('showDialog', 'Alert',"活动已结束\n下次早点来哦");
break;
default:
this.bubbling('showDialog', 'AlertLose',"网络异常,请稍后再试");
}
this.startBtnButton.interactable=true;
}
onGot_getNgameStartStatus() {
//console.log('onGot_getNgameStartStatus', this.getNgameStartStatus);
//fuck 不可以循环引用
this.bubbling('fuck', 'play');
}
onGotError_getNgameStartStatus() {
//console.log(this.getNgameStartStatus)
console.log('onGotError_getNgameStartStatus');
}
onClick_rulebtn() {
console.log('onClick_rulebtn');
this.bubbling('showDialog', 'Rule');
}
onClick_recordbtn() {
console.log('onClick_rulebtn');
//this.bubbling('showDialog', 'Rule');
}
onClick_rankbtn() {
alert('onClick_rankbtn')
// globalEvent.emit('alert', {title: 'Success', content: 'You complete this puzzle', button: 'Next level'}, this.onAlertClose);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = true;
}
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
this.entity.enabled = false;
}
async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
}
async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
}
onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
return undefined;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>new-kickball</title>
<meta name="viewport"
content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="true" />
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<style>
html,
body,
p {
padding: 0;
margin: 0;
border: 0;
}
html,
body {
height: 100%;
background-color: #282C34;
}
#loading {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
display: -webkit-flex;
justify-content: center;
-webkit-justify-content: center;
align-items: center;
-webkit-align-items: center;
}
#floatLayer::-webkit-scrollbar {
display: none
}
</style>
</head>
<body>
<script src="https://cdn.bootcss.com/fetch-jsonp/1.1.3/fetch-jsonp.min.js"></script>
<div id="gameContainer" style="width: 100%;height: 100%;overflow: hidden;"></div>
<div id="loading">
<img src="loading.gif" />
</div>
<script src="./zepto.min.js"></script>
<script src="./security.js"></script>
<script src="debug/bundle.js"></script>
<script>
var CFG = {
activityId: 3561555,//活动id
freeLimit: 3,//剩余次数
weixinUid:'1',//微信uid
nickname:'nickname',//昵称
avatar: 'avatar',
startTime:1561447512324,
endTime:1561887512324
};
function requirelogin() {
console.log('requirelogin');
}
var rule="测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试"
setTimeout(function () {
var loadingEl = document.getElementById('loading');
function onProcess(p) {
if (p >= 1) {
loadingEl.style.display = 'none';
}
}
var options = {};//window['inputOptions'] ||
window['new-kickball'].startup(document.getElementById('gameContainer'), options, onProcess);
}, 100);
</script>
<script>
document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] +
':35729/livereload.js?snipver=1"></' + 'script>')
</script>
</body>
</html>
\ No newline at end of file
<head>
<meta charset="UTF-8">
<title>new-kickball</title>
<meta name="viewport"
content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="true" />
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<style>
html,
body,
p {
padding: 0;
margin: 0;
border: 0;
}
html,
body {
height: 100%;
background-color: #282C34;
}
#loading {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
display: -webkit-flex;
justify-content: center;
-webkit-justify-content: center;
align-items: center;
-webkit-align-items: center;
}
#floatLayer::-webkit-scrollbar {
display: none
}
</style>
</head>
<body>
<script src="https://cdn.bootcss.com/fetch-jsonp/1.1.3/fetch-jsonp.min.js"></script>
<div id="gameContainer" style="width: 100%;height: 100%;overflow: hidden;"></div>
<div id="loading">
<img src="loading.gif" />
</div>
<script src="//yun.duiba.com.cn/db_games/activity/wx_test/zepto.min.js"></script>
<script src="//yun.duiba.com.cn/db_games/activity/wx_test/security.js"></script>
<script src="//yun.duiba.com.cn/db_games/activity/wwjsjf-20190619/1561532327/bundle.js"></script>
<script>
function requirelogin() {
console.log('requirelogin');
}
var rule="测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试";
setTimeout(function () {
var loadingEl = document.getElementById('loading');
function onProcess(p) {
if (p >= 1) {
loadingEl.style.display = 'none';
}
}
var options = {
resPath:"//yun.duiba.com.cn/db_games/activity/wwjsjf-20190619/1561532327/"
};//window['inputOptions'] ||
window['new-kickball'].startup(document.getElementById('gameContainer'), options, onProcess);
}, 100);
</script>
</body>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"success":true,
"code":"400001",
"desc":null,
"timestamp":1561445946866,
"data":{
"orderId":1,
"prizeId":null,
"title":"5搜豆",
"prizeType":5,
"orderStatus":1,
"imgurl":"//yun.duiba.com.cn/images/201806/y7jhibke16.png",
"link":"//activity.m.duiba.com.cn/activity/takePrizeNew?recordId=4552894285&dbnewopen",
"freeLimit":2
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{"ver":"1.0.1","uuid":"65ad1c9d-457e-437c-a678-1f52ebb98381","subMetas":{"bg":{"ver":"1.0.1","uuid":"719a4bf8-e2f0-4822-81a6-6870eba0ab37","rawTextureUuid":"65ad1c9d-457e-437c-a678-1f52ebb98381","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/new-kickball/assets/singles/bg.jpg"}
{"ver":"1.0.1","uuid":"8e27acb0-5de3-4923-a0d6-74c8f97ecf03","subMetas":{"bg_play":{"ver":"1.0.1","uuid":"21efcb53-689b-482d-bcff-91176ecbad9e","rawTextureUuid":"8e27acb0-5de3-4923-a0d6-74c8f97ecf03","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/new-kickball/assets/singles/bg_play.jpg"}
{"ver":"1.0.1","uuid":"c4d9cb82-8eed-4444-9638-bec8180db868","subMetas":{"button-red":{"ver":"1.0.1","uuid":"856e2ee2-68ef-4c4d-bc52-369867b98982","rawTextureUuid":"c4d9cb82-8eed-4444-9638-bec8180db868","type":"texture"}},"type":"texture","imagePath":"/Users/wanghongyuan/new-kickball/assets/singles/button-red.png"}
{"ver":"1.0.1","uuid":"35e70b9d-cdc2-4030-8579-e5893ca56ea1","subMetas":{},"isGroup":true}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment