Commit 126afde7 authored by 任建锋's avatar 任建锋

--

parent 9ec41639
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import { GDispatcher } from "../../libs/tc/util/GDispatcher";
import SceneCtrl from "../ctrls/sceneCtrl";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { Data } from "../../libs/tw/data/Data";
import { DataManager } from "../../libs/tw/manager/DataManager";
import { NetName } from "../../libs/tw/enum/NetName";
import Loading from "../loading/Loading";
export default class LoadingScene extends Scene {
public pBar: eui.ProgressBar;
public pIconImg: eui.Image;
public percentLb: eui.Label;
public mainbg: eui.Image;
private iconAct: egret.MovieClip;
private lastVal: number;
public get skinKey() { return 'LoadingScene' }
public get groupName() { return 'loading_scene' }
constructor(data?) {
super(data);
if (data) {
}
this.percentHeight = 100;
this.lastVal = 0;
}
initEvents() {
GDispatcher.addEvent('progress', this.setProgress, this);//626 117
}
removeEvents() {
GDispatcher.removeEvent('progress', this.setProgress, this);
}
protected onSkinComplete(): void {
super.onSkinComplete();
Loading.instace.show()
// this.mainbg.texture = this.bgtexture;
/* this.iconAct.anchorOffsetX = 165;
this.iconAct.x = 115;
this.addChild(this.iconAct);
this.iconAct.gotoAndPlay(0, -1); */
}
start(data?) {
}
protected onLoad(): void {
this.initUI();
}
private initUI(): void {
//初始化数据
this.initData();
}
private initData(): void {
}
private setProgress(data): void {
let v = data[0];
let time = 450;
//this.pBar.value = v;
// egret.Tween.get(this.iconAct).to({x:115 + 509 * v * 0.01}, time * (v - this.lastVal) * 0.01).wait(500).call(()=>{
// if(v >= 100){
// SceneCtrl.instance.change(ModuleTypes.START_SCENE);
// }
// });
//this.iconAct.x = 115 + 509 * v * 0.01;
setTimeout(() => {
if (v >= 100) {
Loading.instace.hide()
if (this.getQueryString("shareCode")) {
NetManager.ins.getIndex((success) => {
if (!success) {
return
}
this.goLastScene()
}, DataManager.ins.customCfgData.actId, true, this.getQueryString("shareCode"))
} else {
NetManager.ins.getIndex((success) => {
if (!success) {
return
}
this.goLastScene()
}, DataManager.ins.customCfgData.actId, true)
}
}
}, 500);
this.lastVal = v;
this.percentLb.text = v + '%';
}
indexData
goLastScene() {
this.indexData = DataManager.ins.getData(NetName.GET_INDEX).data;
if (this.indexData.winFlag == null) {
if (this.indexData.nickName) {
NetManager.ins.getGameZone((success) => {
if (!success) {
return
}
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}, DataManager.ins.customCfgData.actId)
} else {
SceneCtrl.instance.change(ModuleTypes.START_SCENE);
}
} else {
if (this.indexData.winFlag == true) {
this.openPrizePanel(this.indexData.lastRank,this.indexData.prize)
} else {
if(this.indexData.nickName){
this.openLosePanel(this.indexData.lastRank,"你没有中奖,下次继续努力")
}else{
this.openLosePanel(this.indexData.lastRank,"活动已结束")
}
}
}
}
/**
* 排名开奖中奖
* @param lastRank 排名
* @param prize 奖品
*/
openPrizePanel(lastRank, prize) {
console.log("排名开奖中奖")
const data = { lastRank: lastRank, prize: prize }
SceneCtrl.instance.change(ModuleTypes.OVER_PRIZE_SCENE, data);
}
/**
* 排名开奖未中奖
* @param lastRank 排名
*/
openLosePanel(lastRank,text) {
console.log("排名开奖未中奖")
const data = { lastRank: lastRank,text:text}
SceneCtrl.instance.change(ModuleTypes.OVER_PRIZE_SCENE, data);
}
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 bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('lodingBg_jpg');
// console.log('载背景并设置背景图片mainscene');
// var mcJson = await RES.getResAsync('loadingIconMc_json');
// var mcImg = await RES.getResAsync('loadingIconMc_png');
// var mcFactory = new egret.MovieClipDataFactory(mcJson, mcImg);
//this.iconAct = new egret.MovieClip(mcFactory.generateMovieClipData());
return new Promise(function (resolve, reject) {
resolve();
});
}
//循环播放动画
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();
}
}
\ No newline at end of file
import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import { GDispatcher } from "../../libs/tc/util/GDispatcher";
import SceneCtrl from "../ctrls/sceneCtrl";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { Data } from "../../libs/tw/data/Data";
import { DataManager } from "../../libs/tw/manager/DataManager";
import { NetName } from "../../libs/tw/enum/NetName";
import Loading from "../loading/Loading";
export default class LoadingScene extends Scene {
public pBar: eui.ProgressBar;
public pIconImg: eui.Image;
public percentLb: eui.Label;
public mainbg: eui.Image;
private iconAct: egret.MovieClip;
private lastVal: number;
public get skinKey() { return 'LoadingScene' }
public get groupName() { return 'loading_scene' }
constructor(data?) {
super(data);
if (data) {
}
this.percentHeight = 100;
this.lastVal = 0;
}
initEvents() {
GDispatcher.addEvent('progress', this.setProgress, this);//626 117
}
removeEvents() {
GDispatcher.removeEvent('progress', this.setProgress, this);
}
protected onSkinComplete(): void {
super.onSkinComplete();
Loading.instace.show()
// this.mainbg.texture = this.bgtexture;
/* this.iconAct.anchorOffsetX = 165;
this.iconAct.x = 115;
this.addChild(this.iconAct);
this.iconAct.gotoAndPlay(0, -1); */
}
start(data?) {
}
protected onLoad(): void {
this.initUI();
}
private initUI(): void {
//初始化数据
this.initData();
}
private initData(): void {
}
private setProgress(data): void {
let v = data[0];
let time = 450;
//this.pBar.value = v;
// egret.Tween.get(this.iconAct).to({x:115 + 509 * v * 0.01}, time * (v - this.lastVal) * 0.01).wait(500).call(()=>{
// if(v >= 100){
// SceneCtrl.instance.change(ModuleTypes.START_SCENE);
// }
// });
//this.iconAct.x = 115 + 509 * v * 0.01;
setTimeout(() => {
if (v >= 100) {
Loading.instace.hide()
if (this.getQueryString("shareCode")&&this.getQueryString("shareCode")!="null"&&this.getQueryString("shareCode")!="undefined") {
NetManager.ins.getIndex((success) => {
if (!success) {
return
}
this.goLastScene()
}, DataManager.ins.customCfgData.actId, true, this.getQueryString("shareCode"))
} else {
NetManager.ins.getIndex((success) => {
if (!success) {
return
}
this.goLastScene()
}, DataManager.ins.customCfgData.actId, true)
}
}
}, 500);
this.lastVal = v;
this.percentLb.text = v + '%';
}
indexData
goLastScene() {
this.indexData = DataManager.ins.getData(NetName.GET_INDEX).data;
if (this.indexData.winFlag == null) {
if (this.indexData.nickName) {
NetManager.ins.getGameZone((success) => {
if (!success) {
return
}
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}, DataManager.ins.customCfgData.actId)
} else {
SceneCtrl.instance.change(ModuleTypes.START_SCENE);
}
} else {
if (this.indexData.winFlag == true) {
this.openPrizePanel(this.indexData.lastRank,this.indexData.prize)
} else {
if(this.indexData.nickName){
this.openLosePanel(this.indexData.lastRank,"你没有中奖,下次继续努力")
}else{
this.openLosePanel(this.indexData.lastRank,"活动已结束")
}
}
}
}
/**
* 排名开奖中奖
* @param lastRank 排名
* @param prize 奖品
*/
openPrizePanel(lastRank, prize) {
console.log("排名开奖中奖")
const data = { lastRank: lastRank, prize: prize }
SceneCtrl.instance.change(ModuleTypes.OVER_PRIZE_SCENE, data);
}
/**
* 排名开奖未中奖
* @param lastRank 排名
*/
openLosePanel(lastRank,text) {
console.log("排名开奖未中奖")
const data = { lastRank: lastRank,text:text}
SceneCtrl.instance.change(ModuleTypes.OVER_PRIZE_SCENE, data);
}
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 bgtexture: egret.Texture;
protected async preLoadRes() {
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('lodingBg_jpg');
// console.log('载背景并设置背景图片mainscene');
// var mcJson = await RES.getResAsync('loadingIconMc_json');
// var mcImg = await RES.getResAsync('loadingIconMc_png');
// var mcFactory = new egret.MovieClipDataFactory(mcJson, mcImg);
//this.iconAct = new egret.MovieClip(mcFactory.generateMovieClipData());
return new Promise(function (resolve, reject) {
resolve();
});
}
//循环播放动画
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();
}
}
\ No newline at end of file
No preview for this file type
<?xml version="1.0" encoding="utf-8"?>
<e:Skin width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Skin width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing" xmlns:tween="egret.tween.*">
<w:Declarations>
<tween:TweenGroup id="loop">
<tween:TweenItem target="{helpBtn}">
<tween:Set>
<tween:props>
<e:Object scaleX="{1}" scaleY="{1}"/>
</tween:props>
</tween:Set>
<tween:To duration="500">
<tween:props>
<e:Object scaleX="{0.9}" scaleY="{0.9}"/>
</tween:props>
</tween:To>
<tween:To duration="500">
<tween:props>
<e:Object scaleX="{1}" scaleY="{1}"/>
</tween:props>
</tween:To>
</tween:TweenItem>
</tween:TweenGroup>
</w:Declarations>
<e:Image source="helpBg_jpg" x="0" y="0"/>
<e:Button id="helpBtn" label="" y="618" skinName="ui.IconButtonSkin" icon="helpBtn_png" width="441" height="113" anchorOffsetX="220.5" anchorOffsetY="56.5" x="375.5"/>
</e:Skin>
\ No newline at end of file
......@@ -65,7 +65,7 @@
</e:skinName>
</e:Button>
</e:Group>
<e:Group id="prize" width="750" height="1206" x="0" y="0" locked="true">
<e:Group id="prize" width="750" height="1206" x="0" y="0">
<e:Image x="66" y="228" scaleX="1" scaleY="1" source="newpet_prize_bg_ico_png"/>
<e:Image id="image1" source="newpet_star_ico_png" x="373" y="521" anchorOffsetX="228" anchorOffsetY="166" scaleX="1" scaleY="1"/>
<e:Button id="closeBtn2" label="" horizontalCenter="0.5" verticalCenter="354.5" x="155" y="760" scaleX="1" scaleY="1">
......
......@@ -82,7 +82,7 @@ export default class LoadingScene extends Scene {
setTimeout(() => {
if (v >= 100) {
Loading.instace.hide()
if (this.getQueryString("shareCode")) {
if (this.getQueryString("shareCode")&&this.getQueryString("shareCode")!="null"&&this.getQueryString("shareCode")!="undefined") {
NetManager.ins.getIndex((success) => {
if (!success) {
return
......
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