Commit 4d8c2b38 authored by 任建锋's avatar 任建锋

--

parent ac7195ab
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
const co = require('co');
const fs = require('fs');
const path = require('path');
const OSS = require('ali-oss');
const chalk = require('chalk');
const ProgressBar = require('progress');
class TuiaAutoUpload {
constructor(props, type) {
this.type = type;
const defaultOptions = {
dir: undefined,
originDir: undefined
}
this.options = Object.assign({}, defaultOptions, props);
if (!this.options.dir || !this.options.originDir) {
console.log(chalk.red('缺少参数,初始化失败'))
return;
}
this.init();
}
init() {
var _this = this;
this.client = new OSS({
region: 'oss-cn-hangzhou',
accessKeyId: 'LTAIqO2wblIxQvwc',
accessKeySecret: '4brsaSRbRpjxw3oDIxJi6bNMcndIR6',
bucket: _this.type === 'prod' ? 'duiba' : 'daily-duiba'
});
this.bar = new ProgressBar(chalk.yellow(` 文件上传中 [:bar] :current/${this.files().length} :percent :elapseds`), {
complete: '●',
incomplete: '○',
width: 20,
total: this.files().length,
callback: () => {
console.log(chalk.green('\n All complete.'));
console.log(chalk.blue(`\n 本次队列文件共${this.files().length}个,已存在文件${this.existFiles}个,上传文件${this.uploadFiles}个,上传失败文件${this.errorFiles}个\n`));
}
})
return this;
}
files() {
var _this = this;
if (this._files) return this._files;
this._files = [];
/**
* 文件遍历方法
* @param filePath 需要遍历的文件路径
*/
function fileDisplay(filePath) {
//根据文件路径读取文件,返回文件列表
var files = fs.readdirSync(filePath);
files.forEach(function (filename) {
//获取当前文件的绝对路径
var filedir = path.join(filePath, filename);
//根据文件路径获取文件信息,返回一个fs.Stats对象
var stats = fs.statSync(filedir);
var isFile = stats.isFile();//是文件
var isDir = stats.isDirectory();//是文件夹
if (isFile) {
var sep = '/';
if ('win32' == process.platform)
sep = '\\';
var newDirArr = filedir.split(sep);
newDirArr.shift();
_this._files.push(newDirArr.join('/'));
}
if (isDir) {
fileDisplay(filedir);//递归,如果是文件夹,就继续遍历该文件夹下面的文件
}
});
}
//调用文件遍历方法
fileDisplay(this.options.dir);
return this._files;
}
start() {
this.files().map((file, index) => {
let _this = this;
const path1 = path.join(__dirname, 'bin-release', file);
let originFile;
this.existFiles = 0;
this.uploadFiles = 0;
this.errorFiles = 0;
co(function* () {
const originPath = `${_this.options.originDir}${file}`;
try {
originFile = yield _this.client.head(originPath);
} catch (error) {
originFile = error;
}
if (_this.type === 'prod') {
if (originFile.status === 404) {
yield _this.client.put(originPath, path1);
_this.uploadFiles += 1;
} else {
_this.existFiles += 1;
}
} else if (_this.type === 'dev') {
if (originFile.status === 404 || originFile.status === 200) {
_this.existFiles += 1;
}
yield _this.client.put(originPath, path1, {
headers: {
'Cache-Control': 'no-cache'
}
})
_this.uploadFiles += 1;
}
_this.bar.tick();
}).catch(function (err) {
_this.errorFiles += 1;
console.log(err);
});
});
}
}
const configFileName = 'project.json';
if (!fs.existsSync(configFileName)) {
throw new Error(`${configFileName}不存在.`)
}
let config = fs.readFileSync('project.json');
config = JSON.parse(config + '');
if (!config.type) {
throw new Error(`${configFileName}的type不存在.`)
}
if (!config.name) {
throw new Error(`${configFileName}的name不存在.`)
}
const now = new Date();
const version = Math.round(now.getTime() / 1000);
console.log(`版本号:
${version}`)
const autoupload = new TuiaAutoUpload({
dir: './bin-release/',
originDir: `/db_games/${config.type}/${config.name}/${version}/`
}, "prod")
autoupload.start()
https://blog.csdn.net/qq_20659435/article/details/90899851
var regular="(\\S+)//(\\S+)/(\\S+)/(\\S+)/(\\S+)";
var re = new RegExp(regular,"g");
data=window.location.href.replace(re,"$4")
console.log(data)
\ No newline at end of file
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
this.initPetClip()
}
initPetClip(){
var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
// mv.lockStep=true;
mv.gotoAndPlay(1, true)
// mv.play()
// mv.gotoAndPlay(30, true)
// mv.gotoAndStop(10)
this.petGroup_lv_0.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
//mv.stop()
// mv.startAniRange(30,60);
}, this)
}, function (error) {
alert(error.message);
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private onLoad(): void {
this.initUI();
}
private initUI(): void {
// egret.Tween.get(this.startBtn, {loop:true})
// .to({scaleX:1.05, scaleY:1.05}, 150)
// .to({scaleX:0.9, scaleY:0.9}, 150)
// .to({scaleX:1.05, scaleY:1.05}, 150)
// .to({scaleX:0.9, scaleY:0.9}, 150).wait(500);
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
......@@ -10,8 +10,16 @@ import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
......@@ -25,20 +33,36 @@ export default class StartScene1 extends Scene {
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
//this.startBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_startBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
//this.startBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_startBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
......@@ -48,10 +72,14 @@ export default class StartScene1 extends Scene {
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
......@@ -59,18 +87,56 @@ export default class StartScene1 extends Scene {
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
this.initPetClip()
}
initPetClip(){
var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
// mv.lockStep=true;
mv.gotoAndPlay(1, true)
// mv.play()
// mv.gotoAndPlay(30, true)
// mv.gotoAndStop(10)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
//mv.stop()
// mv.startAniRange(30,60);
}, this)
}, function (error) {
alert(error.message);
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private onLoad(): void {
this.initUI();
}
private initUI():void{
private initUI(): void {
// egret.Tween.get(this.startBtn, {loop:true})
// .to({scaleX:1.05, scaleY:1.05}, 150)
// .to({scaleX:0.9, scaleY:0.9}, 150)
......@@ -79,24 +145,24 @@ export default class StartScene1 extends Scene {
}
private onTap_ruleBtn():void{
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn():void{
// PanelCtrl.instance.btnDelay(this.startBtn);
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene(){
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
......@@ -114,18 +180,18 @@ export default class StartScene1 extends Scene {
return null;
};
private onTap_prizeBtn():void{
console.log('点击prizeBtn');
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord():string{
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
......@@ -136,11 +202,11 @@ export default class StartScene1 extends Scene {
recordUrl = window['recordUrl'];
}
if(recordUrl.indexOf('?') != -1){
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
}else{
} else {
recordUrl += '?origins=' + oaId + '00';
}
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
......@@ -151,14 +217,14 @@ export default class StartScene1 extends Scene {
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
......@@ -10,8 +10,16 @@ import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
......@@ -25,20 +33,36 @@ export default class StartScene1 extends Scene {
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
//this.startBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_startBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
//this.startBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_startBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
......@@ -48,10 +72,14 @@ export default class StartScene1 extends Scene {
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
......@@ -59,68 +87,77 @@ export default class StartScene1 extends Scene {
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
this.initPetClip()
}
initPetClip(){
var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private onLoad(): void {
this.initUI();
}
private initUI():void{
private initUI(): void {
// egret.Tween.get(this.startBtn, {loop:true})
// .to({scaleX:1.05, scaleY:1.05}, 150)
// .to({scaleX:0.9, scaleY:0.9}, 150)
// .to({scaleX:1.05, scaleY:1.05}, 150)
// .to({scaleX:0.9, scaleY:0.9}, 150).wait(500);
egret.Tween.get(this.startBtn, {loop:true})
.to({scaleX:0.9, scaleY:1.1}, 170)
.to({scaleX:1, scaleY:1}, 160)
.to({scaleX:0.95, scaleY:1.05}, 170)
.to({scaleX:1, scaleY:1}, 170).wait(500);
// egret.Tween.get(this.musicBtn, {loop:true}).to({rotation:360}, 2000);
let d1x = this.dog1.x;
let d1y = this.dog1.y;
egret.Tween.get(this.dog1, {loop:true}).to({x:d1x + 5, y:d1y - 5}, 1000).to({x:d1x, y:d1y}, 1000);
let d2x = this.dog2.x;
let d2y = this.dog2.y;
egret.Tween.get(this.dog2, {loop:true}).to({x:d2x - 5, y:d2y - 5}, 1000).to({x:d2x, y:d2y}, 1000);
let d3x = this.dog3.x;
let d3y = this.dog3.y;
egret.Tween.get(this.dog3, {loop:true}).to({y:d3y - 5}, 1000).to({y:d3y}, 1000);
this.titleGroup.addChild(this.titleAct);
setTimeout(() => {
this.titleAct.gotoAndPlay(0);
}, 200);
}
private onTap_ruleBtn():void{
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn():void{
PanelCtrl.instance.btnDelay(this.startBtn);
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene(){
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
......@@ -138,38 +175,18 @@ export default class StartScene1 extends Scene {
return null;
};
private onTap_musicBtn():void{
console.log('点击musicBtn');
PanelCtrl.instance.btnDelay(this.musicBtn);
StartScene1.isPlayMusic = !StartScene1.isPlayMusic;
if(StartScene1.isPlayMusic){
this.musicBtn.currentState = 'up';
this.setMusicBtnAct(true);
window['musicPlay'](true);
}else{
this.musicBtn.currentState = 'disabled';
window['musicPlay'](false);
this.setMusicBtnAct(false);
}
}
private setMusicBtnAct(isStop:boolean):void{
if(isStop){
egret.Tween.resumeTweens(this.musicBtn);
}else{
egret.Tween.pauseTweens(this.musicBtn);
}
}
private onTap_prizeBtn():void{
console.log('点击prizeBtn');
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord():string{
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
......@@ -180,11 +197,11 @@ export default class StartScene1 extends Scene {
recordUrl = window['recordUrl'];
}
if(recordUrl.indexOf('?') != -1){
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
}else{
} else {
recordUrl += '?origins=' + oaId + '00';
}
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
......@@ -195,14 +212,14 @@ export default class StartScene1 extends Scene {
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async initPetClip(url,pet){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error.message);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
await this.initPetClip()
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async initPetClip(url,pet){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error.message);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
await this.initPetClip("/petAn/pet_lv_0/auto.svga",this.pets[0][0])
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async initPetClip(url,pet){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error.message);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
await this.initPetClip("/petAn/pet_lv_0/auto.svga",this.pets[0])
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async initPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error.message);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
console.log(await this.initPetClip("/petAn/pet_lv_0/auto.svga"))
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async initPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error.message);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
this.pets[0]=await this.initPetClip("/petAn/pet_lv_0/auto.svga");
this.pets[0].gotoAndStop(0)
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async initPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error.message);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
this.pets[0]=await this.initPetClip("/petAn/pet_lv_0/auto.svga");
await this.sleep(10000)
this.pets[0].gotoAndStop(0)
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async initPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error.message);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
this.pets[0]=await this.initPetClip("/petAn/pet_lv_0/auto.svga");
this.pets[0].gotoAndStop(0);
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async LoadPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
this.pets[0]=await this.LoadPetClip("/petAn/pet_lv_0/auto.svga");
this.pets[0].gotoAndStop(0);
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async LoadPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
this.pets[0][0]=await this.LoadPetClip("/petAn/pet_lv_0/auto.svga");
this.pets[0][0].gotoAndStop(0);
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[0][0]
async LoadPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
this.pets[0][0]=await this.LoadPetClip("/petAn/pet_lv_0/auto.svga");
this.pets[0][0].gotoAndStop(0);
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async LoadPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
this.pets[0][0]=await this.LoadPetClip("/petAn/pet_lv_0/auto.svga");
this.pets[0][0].gotoAndStop(0);
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets:string[][]
async LoadPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
this.pets[0][0]=await this.LoadPetClip("/petAn/pet_lv_0/auto.svga");
this.pets[0][0].gotoAndStop(0);
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async LoadPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
this.pets[0][0]=await this.LoadPetClip("/petAn/pet_lv_0/auto.svga");
this.pets[0][0].gotoAndStop(0);
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async LoadPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
this.pets[0]=1
this.pets[0][0]=await this.LoadPetClip("/petAn/pet_lv_0/auto.svga");
this.pets[0][0].gotoAndStop(0);
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async LoadPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
private async initUI() {
this.pets[0]=[]
this.pets[0][0]=await this.LoadPetClip("/petAn/pet_lv_0/auto.svga");
this.pets[0][0].gotoAndStop(0);
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async LoadPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
petAns=[
"auto",
"click",
"food",
"play",
"sick_keep",
"sick"
]
private async initUI() {
for(let i=0;i<7;i++){
for(let j=0;j<this.petAns.length;j++){
this.pets[i]=[]
this.pets[i][j]=await this.LoadPetClip("/petAn/pet_lv_0/auto.svga");
this.pets[i][j].gotoAndStop(0);
}
}
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
import { DataManager } from './../../libs/tw/manager/DataManager';
import { ModuleTypes } from './../types/sceneTypes';
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from '../ctrls/sceneCtrl';
import { NetManager } from '../../libs/tw/manager/NetManager';
import Loading from '../loading/Loading';
import { Buried } from '../../libs/tw/util/Buried';
import { GCache } from '../../libs/tc/util/GCache';
export default class StartScene1 extends Scene {
public mainbg:eui.Image;
public petGroup:eui.Group;
public harvestListMask:eui.Rect;
public harvestListGroup:eui.Group;
public harvestBtn:eui.Button;
public harvestDwon:eui.Image;
public harvestUp:eui.Image;
// 用于控制全局音乐是否播放和音乐按钮状态
public static isPlayMusic: boolean = true;
public get skinKey() { return 'StartScene' }
public get groupName() { return 'start_scene' }
constructor(data?) {
super(data);//95fcf3
}
initEvents() {
super.initEvents();
// this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
removeEvents() {
super.removeEvents();
// this.ruleBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
this.harvestBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_harvestBtn, this);
// this.prizeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_prizeBtn, this);
// this.musicBtn.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTap_musicBtn, this);
}
isHarvestListGroupShow=false;
onTap_harvestBtn(){
this.isHarvestListGroupShow=!this.isHarvestListGroupShow;
this.harvestUp.visible=false;
this.harvestDwon.visible=false;
if(this.isHarvestListGroupShow){
this.harvestUp.visible=true;
this["listShow"].play(0)
}else{
this.harvestDwon.visible=true;
this["listHide"].play(0)
}
}
start(data?) {
super.start(data);
this.percentHeight = 100;
}
private bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
this.bgtexture = await RES.getResAsync('startBg_jpg');
// await this.sleep(10000)
// console.log('载背景并设置背景图片mainscene');
return new Promise(function (resolve, reject) {
resolve();
});
}
protected onSkinComplete(): void {
super.onSkinComplete();
this.mainbg.texture = this.bgtexture;
this.isHarvestListGroupShow=false;
this.harvestUp.visible=false;
this.harvestListGroup.mask=this.harvestListMask;
this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
if (this.stage) {
this.onLoad();
}
console.log("test")
}
pets=[]
async LoadPetClip(url){
/* var parser = new window["SVGA"].Parser();
parser.load("/petAn/pet_lv_0/auto.svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem)
mv.gotoAndPlay(1, true)
this.petGroup.addChild(mv);
let fun
mv.addEventListener(egret.Event.COMPLETE, fun = function () {
console.log("播放完成")
mv.removeEventListener(egret.Event.COMPLETE,fun,this)
}, this)
}, function (error) {
alert(error.message);
}) */
return new Promise((resolev,reject)=>{
var parser = new window["SVGA"].Parser();
parser.load(url, (videoItem) => {
let pet = new window["SVGA"].EgretMovieClip(videoItem)
this.petGroup.addChild(pet);
resolev(pet)
}, (error)=>{
reject(error);
})
})
}
async sleep(time){
return new Promise(resolev=>{
setTimeout(resolev,time)
})
}
private async onLoad() {
await this.initUI();
}
petAns=[
"auto",
"click",
"food",
"play",
"sick_keep",
"sick"
]
private async initUI() {
for(let i=0;i<7;i++){
for(let j=0;j<this.petAns.length;j++){
this.pets[i]=[]
this.pets[i][j]=await this.LoadPetClip(`/petAn/pet_lv_${i}/${this.petAns[j]}.svga`);
this.pets[i][j].gotoAndStop(0);
}
}
}
private onTap_ruleBtn(): void {
console.log('点击rule');
// PanelCtrl.instance.btnDelay(this.ruleBtn);
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
}
private onTap_startBtn(): void {
// PanelCtrl.instance.btnDelay(this.startBtn);
NetManager.ins.getHome((succuss) => {
if (!succuss) {
return;
}
this.showMainScene();
}, this.getQueryString("dailyMark"), window["CFG"].activityId)
}
private async showMainScene() {
await RES.loadGroup('msg_panel');
await RES.getResAsync('msgBg0_png');
await RES.getResAsync('msgBg1_png');
await RES.getResAsync('msgBg2_png');
await RES.getResAsync('msgBg3_png');
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
};
private onTap_prizeBtn(): void {
console.log('点击prizeBtn');
// PanelCtrl.instance.btnDelay(this.prizeBtn);
window.location.href = this.gotoRecord();//window["recordUrl"];
}
//获取我的奖品
private gotoRecord(): string {
let recordUrl: string;
let oaId: number;
if (DataManager.ins.customCfgData) {
oaId = DataManager.ins.customCfgData.oaId;
recordUrl = DataManager.ins.customCfgData.recordUrl;
} else {
oaId = DataManager.ins.gameCfgData.gameInfo.oaId;
recordUrl = window['recordUrl'];
}
if (recordUrl.indexOf('?') != -1) {
recordUrl += '&origins=' + oaId + '00';
} else {
recordUrl += '?origins=' + oaId + '00';
}
// recordUrl += ',' + (window['plugId'] ? window['plugId'] : 4500) + '01';
// for(let i = 0; i < window['plugIdArr'].length; i++){
// recordUrl += ',' + window['plugIdArr'][i] + '01';
// }
return recordUrl;
}
//循环播放动画
private playAnimation(target: egret.tween.TweenGroup, isLoop: boolean = true): void {
if (isLoop) {
for (var key in target.items) {
target.items[key].props = { loop: true };
}
}
target.play();
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
https://rdc.aliyun.com/req/1677481/asd
var regular="(\\S+)//(\\S+)/(\\S+)/(\\S+)/(\\S+)";
var re = new RegExp(regular,"g");
data=window.location.href.replace(re,"$4")
console.log(data)
data=window.location.href.replace(/(\S+)//(\S+)/(\S+)/(\S+)/(\S+)/,"$4")
console.log(data)
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
https://blog.csdn.net/qq_20659435/article/details/90899851
var regular="(\\S+)//(\\S+)/(\\S+)/(\\S+)/(\\S+)";
var re = new RegExp(regular,"g");
data=window.location.href.replace(re,"$4")
console.log(data)
\ No newline at end of file
......@@ -28,7 +28,7 @@
</w:Declarations>
<e:Group width="750" height="1624" x="0" verticalCenter="-8">
<e:Image id="mainbg" source="startBg_jpg" y="0" x="0" scaleX="1" scaleY="1"/>
<e:Group id="petGroup_lv_0" width="748" height="1022" x="0" y="-3" anchorOffsetX="0" anchorOffsetY="0" scaleX="1" scaleY="1">
<e:Group id="petGroup" width="748" height="1022" x="0" y="-3" anchorOffsetX="0" anchorOffsetY="0" scaleX="1" scaleY="1">
<e:Image source="start_pet_1_bg_png" x="461" y="703" scaleX="1" scaleY="1"/>
</e:Group>
</e:Group>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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