Commit 02e8f760 authored by wjf's avatar wjf

Merge branch 'dev' of gitlab2.dui88.com:wanghongyuan/xiaoxiaole into dev

parents 2e1b1e16 cb6cf2a3
// tslint:disable: no-var-keyword
// tslint:disable: prefer-const
import { loadSvga } from "../../src/loadSvga"; import { loadSvga } from "../../src/loadSvga";
import MainScene from "../../src/mainScene/MainScene"; import MainScene from "../../src/mainScene/MainScene";
import MapScene from "../../src/mapScene/MapScene"; import MapScene from "../../src/mapScene/MapScene";
...@@ -56,6 +57,7 @@ import ScratchPanel from "../../src/panels/ScratchPanel"; ...@@ -56,6 +57,7 @@ import ScratchPanel from "../../src/panels/ScratchPanel";
import ScratchPrizePanel from "../../src/panels/ScratchPrizePanel"; import ScratchPrizePanel from "../../src/panels/ScratchPrizePanel";
import Turntable from "../../src/panels/TurntablePanel/Turntable"; import Turntable from "../../src/panels/TurntablePanel/Turntable";
import BagQuitPanel from "../../src/panels/BagQuitPanel"; import BagQuitPanel from "../../src/panels/BagQuitPanel";
import H52Scene from "../../src/H52Scene";
export default class MainBase extends eui.UILayer { export default class MainBase extends eui.UILayer {
constructor() { constructor() {
...@@ -108,6 +110,7 @@ export default class MainBase extends eui.UILayer { ...@@ -108,6 +110,7 @@ export default class MainBase extends eui.UILayer {
const scenes = [ const scenes = [
[ModuleTypes.INVITE_SCENE, { cls: H5Scene }], [ModuleTypes.INVITE_SCENE, { cls: H5Scene }],
[ModuleTypes.INVITE_SCENE2, { cls: H52Scene }],
[ModuleTypes.START_SCENE, { cls: StartScene }], [ModuleTypes.START_SCENE, { cls: StartScene }],
[ModuleTypes.MAP_SCENE, { cls: MapScene }], [ModuleTypes.MAP_SCENE, { cls: MapScene }],
[ModuleTypes.PLAY_SCENE, { cls: PlayScene }], [ModuleTypes.PLAY_SCENE, { cls: PlayScene }],
...@@ -168,6 +171,7 @@ export default class MainBase extends eui.UILayer { ...@@ -168,6 +171,7 @@ export default class MainBase extends eui.UILayer {
}) })
} }
// tslint:disable-next-line: cyclomatic-complexity
private async runGame() { private async runGame() {
await this.loadResource(); await this.loadResource();
RES.getResAsync('mapBg_mp3'); RES.getResAsync('mapBg_mp3');
...@@ -186,6 +190,7 @@ export default class MainBase extends eui.UILayer { ...@@ -186,6 +190,7 @@ export default class MainBase extends eui.UILayer {
else { else {
RES.getResAsync('main_mapbottom_png'); RES.getResAsync('main_mapbottom_png');
RES.getResAsync('lightani_png'); RES.getResAsync('lightani_png');
for (var i = 1; i < 19; i++) { for (var i = 1; i < 19; i++) {
RES.getResAsync("boom" + i + "_png") RES.getResAsync("boom" + i + "_png")
} }
...@@ -224,6 +229,7 @@ export default class MainBase extends eui.UILayer { ...@@ -224,6 +229,7 @@ export default class MainBase extends eui.UILayer {
for (var i = 1; i <= 11; i++) { for (var i = 1; i <= 11; i++) {
RES.getResAsync("stepAni" + i + "_png") RES.getResAsync("stepAni" + i + "_png")
} }
var aaa = [1, 3, 5, 7, 9, 11, 14, 16, 18, 19, 21, 23, 25, 27, 29, 32, 34]; var aaa = [1, 3, 5, 7, 9, 11, 14, 16, 18, 19, 21, 23, 25, 27, 29, 32, 34];
for (var i = 1; i <= 60; i++) { for (var i = 1; i <= 60; i++) {
if (aaa.indexOf(i) >= 0) { if (aaa.indexOf(i) >= 0) {
...@@ -301,6 +307,10 @@ export default class MainBase extends eui.UILayer { ...@@ -301,6 +307,10 @@ export default class MainBase extends eui.UILayer {
this.ajaxElement().then(() => { this.ajaxElement().then(() => {
SceneCtrl.instance.change(ModuleTypes.INVITE_SCENE); SceneCtrl.instance.change(ModuleTypes.INVITE_SCENE);
}) })
}else if (window['isInvitePage'] == 2) {
this.ajaxElement().then(() => {
SceneCtrl.instance.change(ModuleTypes.INVITE_SCENE2);
})
} }
else else
this.createGameScene(); this.createGameScene();
...@@ -317,6 +327,7 @@ export default class MainBase extends eui.UILayer { ...@@ -317,6 +327,7 @@ export default class MainBase extends eui.UILayer {
]); ]);
loadSvga(getResPath() + 'resource/assets/svgas/box.svga'); loadSvga(getResPath() + 'resource/assets/svgas/box.svga');
loadSvga(getResPath() + 'resource/assets/svgas/invite.svga'); loadSvga(getResPath() + 'resource/assets/svgas/invite.svga');
loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga');
} }
catch (e) { catch (e) {
console.error(e); console.error(e);
......
export enum ModuleTypes { export enum ModuleTypes {
INVITE_SCENE, INVITE_SCENE,
INVITE_SCENE2,
START_SCENE, START_SCENE,
MAP_SCENE, MAP_SCENE,
PLAY_SCENE, PLAY_SCENE,
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
"resource/skins/FriendShareSkin.exml", "resource/skins/FriendShareSkin.exml",
"resource/skins/FriendSkin.exml", "resource/skins/FriendSkin.exml",
"resource/skins/H5Skin.exml", "resource/skins/H5Skin.exml",
"resource/skins/H52Skin.exml",
"resource/skins/IconButtonSkin.exml", "resource/skins/IconButtonSkin.exml",
"resource/skins/InviteCutTimePanelSkin.exml", "resource/skins/InviteCutTimePanelSkin.exml",
"resource/skins/InviteItemSkin.exml", "resource/skins/InviteItemSkin.exml",
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="H52Skin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image source="invitebg_jpg"/>
<e:Image id="gobtn" source="h5_gobtn_png" y="995" horizontalCenter="0"/>
<e:Image id="rulebtn" source="h5btn_png" y="954" horizontalCenter="0" visible="false"/>
</e:Skin>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e:Skin class="LoadingSceneSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing"> <e:Skin class="LoadingSceneSkin" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Group id="container" y="-45.45" x="-3"/>
<e:Image scaleX="1" scaleY="1" y="73.35" horizontalCenter="0" source=""/> <e:Image scaleX="1" scaleY="1" y="73.35" horizontalCenter="0" source=""/>
<e:Group horizontalCenter="0" verticalCenter="-190" touchEnabled="false"> <e:Group horizontalCenter="0" verticalCenter="-190" touchEnabled="false">
<e:Image scaleX="1" scaleY="1" horizontalCenter="0" verticalCenter="0" source="turntable_bg_png"/>
<e:Group id="panel" anchorOffsetX="253.5" anchorOffsetY="253.5" rotation="0" horizontalCenter="0" verticalCenter="0" width="507" height="507"> <e:Group id="panel" anchorOffsetX="253.5" anchorOffsetY="253.5" rotation="0" horizontalCenter="0" verticalCenter="0" width="507" height="507">
<e:Image scaleX="1" scaleY="1" anchorOffsetX="253.5" anchorOffsetY="253.5" rotation="0" horizontalCenter="0" verticalCenter="0" source="turntable_panel_png"/> <e:Image scaleX="1" scaleY="1" anchorOffsetX="253.5" anchorOffsetY="253.5" rotation="0" horizontalCenter="0" verticalCenter="0" source="turntable_panel_png"/>
<e:Group id="prize0" y="-10" x="179"> <e:Group id="prize0" y="-10" x="179">
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<e:Button id="start_btn" label="" anchorOffsetX="93" anchorOffsetY="140" horizontalCenter="0" verticalCenter="-25"> <e:Button id="start_btn" label="" anchorOffsetX="93" anchorOffsetY="140" horizontalCenter="0" verticalCenter="-25">
</e:Button> </e:Button>
</e:Group> </e:Group>
<e:Button id="closeBtn" label="" y="135.31" x="565.89"> <e:Button id="closeBtn" label="" y="292.88" x="565.89">
<e:skinName> <e:skinName>
<e:Skin states="up,down,disabled"> <e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/> <e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
...@@ -41,4 +41,5 @@ ...@@ -41,4 +41,5 @@
</e:Skin> </e:Skin>
</e:skinName> </e:skinName>
</e:Button> </e:Button>
<e:Group id="container2"/>
</e:Skin> </e:Skin>
\ No newline at end of file
/** /**
* 简单的倒计时 * 简单的倒计时
* 2019.10.24 * Created by haiyoucuv on 2019/10/24
*/ */
export default class CutTimer { export default class CutTimer {
private _timer: egret.Timer = null; private _timer: egret.Timer = null;
......
import Scene from "../libs/new_wx/components/Scene";
import Utils from "./Utils";
import PanelCtrl from "../libs/new_wx/ctrls/panelCtrl";
export default class H52Scene extends Scene {
async start(data?) {
super.start();
// this['rulebtn'].addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{
// PanelCtrl.instance.show('inviterule')
// },this);
this['gobtn'].addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{
const code = Utils.getRequestByKey('shareCode2');
window.location.href = `${window['targetUrl']}&shareCode2=${code}`
},this);
}
get skinKey() { return 'H52' }
}
...@@ -23,6 +23,7 @@ import Utils from "../Utils"; ...@@ -23,6 +23,7 @@ import Utils from "../Utils";
import { GDispatcher } from "../../libs/tc/util/GDispatcher"; import { GDispatcher } from "../../libs/tc/util/GDispatcher";
import Loading from "../../libs/new_wx/components/Loading"; import Loading from "../../libs/new_wx/components/Loading";
import ScratchIcon from "./icon/ScratchIcon"; import ScratchIcon from "./icon/ScratchIcon";
import TurntableIcon from "./icon/TurntableIcon";
let doHelpFlag = false; let doHelpFlag = false;
// let adTag = false; // let adTag = false;
...@@ -37,17 +38,19 @@ export default class MapScene extends Scene { ...@@ -37,17 +38,19 @@ export default class MapScene extends Scene {
static starHash: any = {}; static starHash: any = {};
_data; _data;
private icons = {};
sendInvite() { sendInvite() {
const code = Utils.getRequestByKey('shareCode'); const code = Utils.getRequestByKey('shareCode');
if(!code) return; if (!code) return;
const dojoin = DataManager.ins.getData('hc_doJoin'); const dojoin = DataManager.ins.getData('hc_doJoin');
if(!dojoin) return; if (!dojoin) return;
if(doHelpFlag) { if (doHelpFlag) {
return; return;
} }
NetManager.ins.doHelp((success, res) => { NetManager.ins.doHelp((success, res) => {
doHelpFlag = true; doHelpFlag = true;
switch(true) { switch (true) {
case (res.code == "400017"): case (res.code == "400017"):
showToast("您不是新用户呢~"); showToast("您不是新用户呢~");
break; break;
...@@ -58,7 +61,7 @@ export default class MapScene extends Scene { ...@@ -58,7 +61,7 @@ export default class MapScene extends Scene {
showToast("已经给好友助力过了哦~"); showToast("已经给好友助力过了哦~");
break; break;
} }
if(!success) { if (!success) {
return; return;
} }
showToast("助力成功"); showToast("助力成功");
...@@ -72,10 +75,12 @@ export default class MapScene extends Scene { ...@@ -72,10 +75,12 @@ export default class MapScene extends Scene {
async start(data?) { async start(data?) {
super.start(); super.start();
this.addIcon(); // 添加Icon
this.sendInvite(); this.sendInvite();
PanelCtrl.instance.show('back'); PanelCtrl.instance.show('back');
this.updateMyInfo(); this.updateMyInfo();
this.updateAdData(); this.updateAdData();
GDispatcher.dispatchEvent("getInviteInfo"); // 查询邀请信息,控制邀请有礼角标 GDispatcher.dispatchEvent("getInviteInfo"); // 查询邀请信息,控制邀请有礼角标
...@@ -85,14 +90,12 @@ export default class MapScene extends Scene { ...@@ -85,14 +90,12 @@ export default class MapScene extends Scene {
// PanelCtrl.instance.show('failed'); // PanelCtrl.instance.show('failed');
}, 1000); }, 1000);
if(getBgOn() && MapScene['firstPlayBgTag'] == true) { if (getBgOn() && MapScene['firstPlayBgTag'] == true) {
playBg(); playBg();
} }
stopGamebg(); stopGamebg();
let scratchBtn = new ScratchIcon("scratch", this["scratchGroup"], this["scratchBtn"], this["scratchTipsBg"], this["scratchTips"]);
NetManager.ins.getSignInfo(() => { NetManager.ins.getSignInfo(() => {
const panels = []; const panels = [];
const date = new Date(); const date = new Date();
...@@ -104,12 +107,12 @@ export default class MapScene extends Scene { ...@@ -104,12 +107,12 @@ export default class MapScene extends Scene {
const oldTimerStr2 = localStorage.getItem('nowTimer2Str' + window['CFG'].consumerId); const oldTimerStr2 = localStorage.getItem('nowTimer2Str' + window['CFG'].consumerId);
const hc_advert = DataManager.ins.getData('hc_advert').data; const hc_advert = DataManager.ins.getData('hc_advert').data;
let {noticeAdvert} = hc_advert; let { noticeAdvert } = hc_advert;
if(noticeAdvert == null) { if (noticeAdvert == null) {
noticeAdvert = {enable: false} noticeAdvert = { enable: false }
} }
if(noticeAdvert && noticeAdvert.enable && nowTimerStr2 != oldTimerStr2) { if (noticeAdvert && noticeAdvert.enable && nowTimerStr2 != oldTimerStr2) {
// if (!adTag) { // if (!adTag) {
panels.push('ad'); panels.push('ad');
// adTag = true; // adTag = true;
...@@ -117,16 +120,16 @@ export default class MapScene extends Scene { ...@@ -117,16 +120,16 @@ export default class MapScene extends Scene {
localStorage.setItem('nowTimer2Str' + window['CFG'].consumerId, nowTimerStr2); localStorage.setItem('nowTimer2Str' + window['CFG'].consumerId, nowTimerStr2);
} }
const {signInfoVO} = DataManager.ins.getData('getSignInfo'); const { signInfoVO } = DataManager.ins.getData('getSignInfo');
if(signInfoVO.continueDay < 7) { //表示明天还可以签到 if (signInfoVO.continueDay < 7) { //表示明天还可以签到
if(signInfoVO.todaySigned == 0 && oldTimerStr != nowTimerStr) { if (signInfoVO.todaySigned == 0 && oldTimerStr != nowTimerStr) {
panels.push('sign'); panels.push('sign');
localStorage.setItem('nowTimerStr' + window['CFG'].consumerId, nowTimerStr); localStorage.setItem('nowTimerStr' + window['CFG'].consumerId, nowTimerStr);
} }
} }
this.updateSign(); this.updateSign();
if(!readCache() && getHomeData().levels.length <= 0) { //引导 if (!readCache() && getHomeData().levels.length <= 0) { //引导
const guide = new GuideCon(() => { const guide = new GuideCon(() => {
PanelCtrl.instance.showPanels(panels); PanelCtrl.instance.showPanels(panels);
...@@ -168,18 +171,18 @@ export default class MapScene extends Scene { ...@@ -168,18 +171,18 @@ export default class MapScene extends Scene {
let target; let target;
const homeData = getHomeData(); const homeData = getHomeData();
if(homeData.levels.length == 0) { if (homeData.levels.length == 0) {
target = 1; target = 1;
} else if(homeData.levels.length == window['total_level']) { } else if (homeData.levels.length == window['total_level']) {
target = window['total_level'] + 1; target = window['total_level'] + 1;
} else { } else {
target = homeData.levels.length + 1; target = homeData.levels.length + 1;
} }
for(const key in MapScene.iconHash) { for (const key in MapScene.iconHash) {
const levelOrder = parseInt(key); const levelOrder = parseInt(key);
const element = MapScene.iconHash[key]; const element = MapScene.iconHash[key];
element.addEventListener(egret.TouchEvent.TOUCH_TAP, () => { element.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if( if (
(levelOrder > (homeData.levels.length + 1) && levelOrder > 1) (levelOrder > (homeData.levels.length + 1) && levelOrder > 1)
|| (levelOrder > window['last_level']) || (levelOrder > window['last_level'])
) { ) {
...@@ -191,7 +194,7 @@ export default class MapScene extends Scene { ...@@ -191,7 +194,7 @@ export default class MapScene extends Scene {
}, this); }, this);
} }
if(homeData.levels.length < window['total_level']) { if (homeData.levels.length < window['total_level']) {
const targetIcon = MapScene.iconHash[target]; const targetIcon = MapScene.iconHash[target];
const light = RES.getRes('lightani_png'); const light = RES.getRes('lightani_png');
...@@ -204,7 +207,7 @@ export default class MapScene extends Scene { ...@@ -204,7 +207,7 @@ export default class MapScene extends Scene {
pic.anchorOffsetY = 61; pic.anchorOffsetY = 61;
// pic.x = 50 - 2; // pic.x = 50 - 2;
// pic.y = 37 + 10; // pic.y = 37 + 10;
egret.Tween.get(pic, {loop: true}).to({scaleX: 2, scaleY: 2, alpha: 0}, 1000).wait(1000); egret.Tween.get(pic, { loop: true }).to({ scaleX: 2, scaleY: 2, alpha: 0 }, 1000).wait(1000);
this['pic'] = pic; this['pic'] = pic;
} }
...@@ -214,8 +217,8 @@ export default class MapScene extends Scene { ...@@ -214,8 +217,8 @@ export default class MapScene extends Scene {
this.showLog(); this.showLog();
this.updateBox(); this.updateBox();
if(data.level) { if (data.level) {
if(homeData.remainEnargy == 0) if (homeData.remainEnargy == 0)
PanelCtrl.instance.show('bloodPanel') PanelCtrl.instance.show('bloodPanel')
else else
...@@ -223,8 +226,8 @@ export default class MapScene extends Scene { ...@@ -223,8 +226,8 @@ export default class MapScene extends Scene {
} }
this.stage.once(egret.TouchEvent.TOUCH_TAP, () => { this.stage.once(egret.TouchEvent.TOUCH_TAP, () => {
if(!MapScene['firstPlayBgTag']) { if (!MapScene['firstPlayBgTag']) {
if(getBgOn()) { if (getBgOn()) {
playBg(); playBg();
} }
MapScene['firstPlayBgTag'] = true; MapScene['firstPlayBgTag'] = true;
...@@ -232,7 +235,7 @@ export default class MapScene extends Scene { ...@@ -232,7 +235,7 @@ export default class MapScene extends Scene {
}, this); }, this);
let lastOrder = homeData.levels.length + 1; let lastOrder = homeData.levels.length + 1;
if(homeData.levels.length >= window['total_level']) if (homeData.levels.length >= window['total_level'])
lastOrder = window['total_level']; lastOrder = window['total_level'];
this.scroll.viewport.scrollV = this.getScrollV(lastOrder, this.stage.stageHeight); this.scroll.viewport.scrollV = this.getScrollV(lastOrder, this.stage.stageHeight);
// console.warn(this.getScrollV(lastOrder, this.stage.stageHeight)) // console.warn(this.getScrollV(lastOrder, this.stage.stageHeight))
...@@ -242,31 +245,39 @@ export default class MapScene extends Scene { ...@@ -242,31 +245,39 @@ export default class MapScene extends Scene {
Promise.all([ Promise.all([
RES.getResAsync(`${key}_json`), RES.getResAsync(`${key}_json`),
RES.getResAsync(`${key}_png`)]); RES.getResAsync(`${key}_png`)]);
} catch(error) { } catch (error) {
} }
} }
// 添加图标
private addIcon(){
this.icons = {
"scratchIcon": new ScratchIcon("scratchIcon", this["scratchGroup"], this["scratchBtn"], this["scratchTipsBg"], this["scratchTips"]),
"turntableIcon": new TurntableIcon("turntableIcon", this["turnTableGroup"], this["turnTableBtn"], this["turnTableTipsBg"], this["turnTableTips"])
};
}
updateMyInfo() { updateMyInfo() {
this['avatar'].visible = false; this['avatar'].visible = false;
this['nameTxt'].text = ''; this['nameTxt'].text = '';
// NetManager.ins.hc_userInfo(() => { // NetManager.ins.hc_userInfo(() => {
this['avatar'].visible = true; this['avatar'].visible = true;
const {data} = DataManager.ins.getData('hc_userInfo'); const { data } = DataManager.ins.getData('hc_userInfo');
if(data) if (data)
this['avatar'].source = data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png"; this['avatar'].source = data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png";
else else
this['avatar'].source = "http://yun.duiba.com.cn/db_games/default_avatar.png"; this['avatar'].source = "http://yun.duiba.com.cn/db_games/default_avatar.png";
if(data && data.nickname) if (data && data.nickname)
this['nameTxt'].text = getNick(data.nickname); this['nameTxt'].text = getNick(data.nickname);
// }); // });
} }
updateSign() { updateSign() {
const {signInfoVO} = DataManager.ins.getData('getSignInfo'); const { signInfoVO } = DataManager.ins.getData('getSignInfo');
if(signInfoVO.continueDay < 7) { //表示明天还可以签到 if (signInfoVO.continueDay < 7) { //表示明天还可以签到
this['sign_s1'].visible = signInfoVO.todaySigned == 0; this['sign_s1'].visible = signInfoVO.todaySigned == 0;
this['sign_s2'].visible = !this['sign_s1'].visible; this['sign_s2'].visible = !this['sign_s1'].visible;
} else { } else {
...@@ -276,14 +287,14 @@ export default class MapScene extends Scene { ...@@ -276,14 +287,14 @@ export default class MapScene extends Scene {
updateAdData() { updateAdData() {
const hc_advert = DataManager.ins.getData('hc_advert').data; const hc_advert = DataManager.ins.getData('hc_advert').data;
let {mapAdvert} = hc_advert; let { mapAdvert } = hc_advert;
if(mapAdvert == null) if (mapAdvert == null)
mapAdvert = {enable: false, advertList: []} mapAdvert = { enable: false, advertList: [] }
this['adBtn'].visible = mapAdvert.enable; this['adBtn'].visible = mapAdvert.enable;
if(mapAdvert.enable) { if (mapAdvert.enable) {
let result; let result;
result = mapAdvert.advertList; result = mapAdvert.advertList;
if(Array.isArray(mapAdvert.advertList)) { if (Array.isArray(mapAdvert.advertList)) {
const index = Math.floor(mapAdvert.advertList.length * Math.random()); const index = Math.floor(mapAdvert.advertList.length * Math.random());
result = mapAdvert.advertList[index]; result = mapAdvert.advertList[index];
} }
...@@ -296,10 +307,10 @@ export default class MapScene extends Scene { ...@@ -296,10 +307,10 @@ export default class MapScene extends Scene {
destroy() { destroy() {
super.destroy(); super.destroy();
if(this['pic']) if (this['pic'])
egret.Tween.removeTweens(this['pic']); egret.Tween.removeTweens(this['pic']);
if(this.inviteTimer){ if(this.inviteTimer) {
this.inviteTimer.stop(); this.inviteTimer.stop();
this.inviteTimer.removeEventListener(egret.TimerEvent.TIMER, this.inviteCutTimer, this); this.inviteTimer.removeEventListener(egret.TimerEvent.TIMER, this.inviteCutTimer, this);
} }
...@@ -307,11 +318,11 @@ export default class MapScene extends Scene { ...@@ -307,11 +318,11 @@ export default class MapScene extends Scene {
getScrollV(lastOrder, stageHeight) { getScrollV(lastOrder, stageHeight) {
// lastOrder = 69; // lastOrder = 69;
if(lastOrder <= 7) {//顶部的1-7关 if (lastOrder <= 7) {//顶部的1-7关
return this.getScrollV1(lastOrder, stageHeight); return this.getScrollV1(lastOrder, stageHeight);
} }
if(lastOrder >= window['total_level'] - 10) {//底部的60-70关 70-10 if (lastOrder >= window['total_level'] - 10) {//底部的60-70关 70-10
return this.getScrollV2(lastOrder, stageHeight); return this.getScrollV2(lastOrder, stageHeight);
} }
//中部的4个循环*13 8~59 //中部的4个循环*13 8~59
...@@ -322,7 +333,7 @@ export default class MapScene extends Scene { ...@@ -322,7 +333,7 @@ export default class MapScene extends Scene {
const ylist = [26, 158, 302, 435, 547, 674, 821, 897, 969, 1072, 1137, 1254, 1367]; const ylist = [26, 158, 302, 435, 547, 674, 821, 897, 969, 1072, 1137, 1254, 1367];
const y0 = this._data.top.height;//顶部的高度 const y0 = this._data.top.height;//顶部的高度
let a0 = (lastOrder - MapTopPart.LEVEL_NUMS) % MapRpeatPart.LEVEL_NUMS; //减去7后的order 8-7 = 1 let a0 = (lastOrder - MapTopPart.LEVEL_NUMS) % MapRpeatPart.LEVEL_NUMS; //减去7后的order 8-7 = 1
if(a0 == 0) a0 = MapRpeatPart.LEVEL_NUMS if (a0 == 0) a0 = MapRpeatPart.LEVEL_NUMS
const a1 = Math.ceil((lastOrder - MapTopPart.LEVEL_NUMS) / MapRpeatPart.LEVEL_NUMS) - 1;//当前地图repeat的顺序 const a1 = Math.ceil((lastOrder - MapTopPart.LEVEL_NUMS) / MapRpeatPart.LEVEL_NUMS) - 1;//当前地图repeat的顺序
const y1 = ylist[a0 - 1]; const y1 = ylist[a0 - 1];
const y2 = y0 + y1 + a1 * this._data.list[0].height; const y2 = y0 + y1 + a1 * this._data.list[0].height;
...@@ -332,7 +343,7 @@ export default class MapScene extends Scene { ...@@ -332,7 +343,7 @@ export default class MapScene extends Scene {
getScrollV1(lastOrder, stageHeight) { getScrollV1(lastOrder, stageHeight) {
const ylist = [492, 550.35, 744, 803, 810, 975, 1089.69].map(i => i + 40); const ylist = [492, 550.35, 744, 803, 810, 975, 1089.69].map(i => i + 40);
const targetY = ylist[lastOrder - 1] - stageHeight / 2; const targetY = ylist[lastOrder - 1] - stageHeight / 2;
if(targetY <= 0) return 0 if (targetY <= 0) return 0
return targetY; return targetY;
} }
...@@ -344,7 +355,7 @@ export default class MapScene extends Scene { ...@@ -344,7 +355,7 @@ export default class MapScene extends Scene {
+ this._data.bottom.height; + this._data.bottom.height;
const ylist = [44, 148.44, 331, 403, 513, 660, 829.69, 949.69, 1052.69, 1148.69, 1209.69].map(i => i + 40); const ylist = [44, 148.44, 331, 403, 513, 660, 829.69, 949.69, 1052.69, 1148.69, 1209.69].map(i => i + 40);
const targetY = y0 + ylist[lastOrder - 1] - stageHeight / 2; const targetY = y0 + ylist[lastOrder - 1] - stageHeight / 2;
if(targetY >= (totalHeight - stageHeight)) return totalHeight - stageHeight if (targetY >= (totalHeight - stageHeight)) return totalHeight - stageHeight
return targetY; return targetY;
} }
...@@ -366,7 +377,7 @@ export default class MapScene extends Scene { ...@@ -366,7 +377,7 @@ export default class MapScene extends Scene {
updateBox() { updateBox() {
const homeData = getHomeData(); const homeData = getHomeData();
if(homeData.canReceiveTreasureBoxNum <= 0) if (homeData.canReceiveTreasureBoxNum <= 0)
setGray(this['box']); setGray(this['box']);
this['boxiconWrapper'].visible = homeData.canReceiveTreasureBoxNum > 0; this['boxiconWrapper'].visible = homeData.canReceiveTreasureBoxNum > 0;
this['totalStarTxt'].text = `${homeData.totalStars}/${homeData.nextRangeStarsNum}`; this['totalStarTxt'].text = `${homeData.totalStars}/${homeData.nextRangeStarsNum}`;
...@@ -388,7 +399,7 @@ export default class MapScene extends Scene { ...@@ -388,7 +399,7 @@ export default class MapScene extends Scene {
parent.addChild(avatar); parent.addChild(avatar);
avatar.x = item.x + 10; avatar.x = item.x + 10;
avatar.y = item.y - avatar.height - 30; avatar.y = item.y - avatar.height - 30;
if(!MapScene.starHash[level].visible) { if (!MapScene.starHash[level].visible) {
avatar.y = item.y - avatar.height; avatar.y = item.y - avatar.height;
} }
} }
...@@ -396,11 +407,11 @@ export default class MapScene extends Scene { ...@@ -396,11 +407,11 @@ export default class MapScene extends Scene {
updateFriends() { updateFriends() {
NetManager.ins.hc_mapRank(() => { NetManager.ins.hc_mapRank(() => {
const hc_mapRank = DataManager.ins.getData('hc_mapRank').data; const hc_mapRank = DataManager.ins.getData('hc_mapRank').data;
if(!hc_mapRank) return; if (!hc_mapRank) return;
const {data} = DataManager.ins.getData('hc_userInfo'); const { data } = DataManager.ins.getData('hc_userInfo');
hc_mapRank.forEach((ele) => { hc_mapRank.forEach((ele) => {
if(ele.levelNum == getHomeData().levels.length + 1) { if (ele.levelNum == getHomeData().levels.length + 1) {
if(data == null) if (data == null)
ele.rank[0].avatar = "http://yun.duiba.com.cn/db_games/default_avatar.png"; ele.rank[0].avatar = "http://yun.duiba.com.cn/db_games/default_avatar.png";
else else
ele.rank[0].avatar = data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png"; ele.rank[0].avatar = data.avatar || "http://yun.duiba.com.cn/db_games/default_avatar.png";
...@@ -415,24 +426,24 @@ export default class MapScene extends Scene { ...@@ -415,24 +426,24 @@ export default class MapScene extends Scene {
this['goldTxt'].text = `${homeData.wealth}`; this['goldTxt'].text = `${homeData.wealth}`;
for(let j = 1; j < window['total_level']; j++) { for (let j = 1; j < window['total_level']; j++) {
this.disableIcon(j + 1); this.disableIcon(j + 1);
} }
for(let i = 0; i < homeData.levels.length; i++) { for (let i = 0; i < homeData.levels.length; i++) {
const level = homeData.levels[i]; const level = homeData.levels[i];
const star = MapScene.starHash[i + 1]; const star = MapScene.starHash[i + 1];
if(level) { if (level) {
star.setStar(level.stars); star.setStar(level.stars);
this.enableIcon(level.levelNum); this.enableIcon(level.levelNum);
} else { } else {
this.disableIcon(level.levelNum); this.disableIcon(level.levelNum);
} }
} }
if(homeData.levels.length == 0) { if (homeData.levels.length == 0) {
const star = MapScene.starHash[1]; const star = MapScene.starHash[1];
star.setStar(0); star.setStar(0);
this.enableIcon(1); this.enableIcon(1);
} else if(homeData.levels.length == window['last_level']) { } else if (homeData.levels.length == window['last_level']) {
} else { } else {
const star = MapScene.starHash[homeData.levels.length + 1]; const star = MapScene.starHash[homeData.levels.length + 1];
...@@ -446,11 +457,11 @@ export default class MapScene extends Scene { ...@@ -446,11 +457,11 @@ export default class MapScene extends Scene {
updateTimerView() { updateTimerView() {
//更新倒计时 //更新倒计时
if(this._countDown == null) { if (this._countDown == null) {
this._countDown = new CountDown(this['countdown']); this._countDown = new CountDown(this['countdown']);
} }
const data = getHomeData(); const data = getHomeData();
if(data.remainEnargy >= BLOOD_NUMS_MAX) { //满了 if (data.remainEnargy >= BLOOD_NUMS_MAX) { //满了
this._countDown.stop(); this._countDown.stop();
this['fullTxt'].visible = true; this['fullTxt'].visible = true;
...@@ -470,28 +481,28 @@ export default class MapScene extends Scene { ...@@ -470,28 +481,28 @@ export default class MapScene extends Scene {
onTap_inviteBtn() { onTap_inviteBtn() {
NetManager.ins.getInviteInfo((success, res) => { NetManager.ins.getInviteInfo((success, res) => {
if(!success || !res.data) { if (!success || !res.data) {
return; return;
} }
let flag = res.data.completeFlag; let flag = res.data.completeFlag;
switch(true) { switch (true) {
case (flag == 0): // 未完成 case (flag == 0): // 未完成
this.loadsvga(res); this.loadsvga(res);
break; break;
case (flag == 1): // 完成未开奖 待领奖 请求领奖接口 case (flag == 1): // 完成未开奖 待领奖 请求领奖接口
try { try {
if(window['getRST']) window['getRST'](); if (window['getRST']) window['getRST']();
} catch(error) { } catch (error) {
console.warn(error) console.warn(error)
} }
NetManager.ins.acceptInvitationPrize((success, res) => { NetManager.ins.acceptInvitationPrize((success, res) => {
if(!success) { if (!success) {
showToast("哎呀,萌狮开小差啦!\n过会再来看吧!"); showToast("哎呀,萌狮开小差啦!\n过会再来看吧!");
GDispatcher.dispatchEvent("getInviteInfo"); GDispatcher.dispatchEvent("getInviteInfo");
return; return;
} }
// console.log(res.data); // console.log(res.data);
if(res.data.completeFlag == 3) { if (res.data.completeFlag == 3) {
showToast("哎呀,萌狮开小差啦!\n过会再来看吧!"); showToast("哎呀,萌狮开小差啦!\n过会再来看吧!");
GDispatcher.dispatchEvent("getInviteInfo"); GDispatcher.dispatchEvent("getInviteInfo");
} else { } else {
...@@ -506,7 +517,7 @@ export default class MapScene extends Scene { ...@@ -506,7 +517,7 @@ export default class MapScene extends Scene {
case (flag == 4): // 可以开启下一次发任务 case (flag == 4): // 可以开启下一次发任务
NetManager.ins.acceptInvitationInfo((success, res) => { NetManager.ins.acceptInvitationInfo((success, res) => {
if(!success) { if (!success) {
return; return;
} }
this.loadsvga(res); this.loadsvga(res);
...@@ -522,7 +533,7 @@ export default class MapScene extends Scene { ...@@ -522,7 +533,7 @@ export default class MapScene extends Scene {
} }
loadsvga(res) { loadsvga(res) {
if(MapScene['svga']) { if (MapScene['svga']) {
const mv = MapScene['svga'] const mv = MapScene['svga']
mv.gotoAndStop(1); mv.gotoAndStop(1);
res.data.svga = mv; res.data.svga = mv;
...@@ -547,14 +558,14 @@ export default class MapScene extends Scene { ...@@ -547,14 +558,14 @@ export default class MapScene extends Scene {
*/ */
getInviteInfo() { getInviteInfo() {
NetManager.ins.getInviteInfo((success, res) => { NetManager.ins.getInviteInfo((success, res) => {
if(!success || !res.data) { if (!success || !res.data) {
return; return;
} }
let flag = res.data.completeFlag; let flag = res.data.completeFlag;
if(this.inviteTimer) { if (this.inviteTimer) {
this.inviteTimer.stop(); this.inviteTimer.stop();
} }
switch(true) { switch (true) {
case (flag == 0): // 未完成 显示倒计时 case (flag == 0): // 未完成 显示倒计时
this["inviteGroup"].visible = true; this["inviteGroup"].visible = true;
this["inviteTipsBg"].visible = true; this["inviteTipsBg"].visible = true;
...@@ -601,7 +612,7 @@ export default class MapScene extends Scene { ...@@ -601,7 +612,7 @@ export default class MapScene extends Scene {
// 倒计时 // 倒计时
private inviteCutTimer() { private inviteCutTimer() {
let timer = this.convertTime(this.cutTime -= 1000); let timer = this.convertTime(this.cutTime -= 1000);
if(timer.hour === "00" if (timer.hour === "00"
&& timer.min === "00" && timer.min === "00"
&& timer.sec === "00") { && timer.sec === "00") {
this.inviteTimer.stop(); this.inviteTimer.stop();
...@@ -639,25 +650,8 @@ export default class MapScene extends Scene { ...@@ -639,25 +650,8 @@ export default class MapScene extends Scene {
}, window['signActivityId']) }, window['signActivityId'])
} }
////////////////////////////////////////////////// 刮刮卡 //////////////////////////////////////////////////
onTap_scratchBtn() {
NetManager.ins.getInviteInfo((success, res) => {
if(!success) {
return;
}
PanelCtrl.instance.show('scratch', res.data);
});
}
////////////////////////////////////////////////// 大转盘 //////////////////////////////////////////////////
onTap_turnTableBtn() {
PanelCtrl.instance.show('turnTable')
}
protected initEvents() { protected initEvents() {
// this['goldBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this) // this['goldBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this)
this['turnTableBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_turnTableBtn, this)
// this['scratchBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_scratchBtn, this)
this['inviteBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_inviteBtn, this) this['inviteBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_inviteBtn, this)
this['friendBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_friendBtn, this) this['friendBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_friendBtn, this)
this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_adBtn, this) this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_adBtn, this)
...@@ -705,9 +699,9 @@ export default class MapScene extends Scene { ...@@ -705,9 +699,9 @@ export default class MapScene extends Scene {
async onTap_boxLayer() { async onTap_boxLayer() {
NetManager.ins.clickLog(getlogItem(1)); NetManager.ins.clickLog(getlogItem(1));
const data = getHomeData(); const data = getHomeData();
if(data.canReceiveTreasureBoxNum > 0) { if (data.canReceiveTreasureBoxNum > 0) {
this['boxLayer'].visible = true; this['boxLayer'].visible = true;
if(!this._mc) if (!this._mc)
this._mc = await loadSvga(getResPath() + 'resource/assets/svgas/box.svga', this['boxani']); this._mc = await loadSvga(getResPath() + 'resource/assets/svgas/box.svga', this['boxani']);
this._mc.stop(); this._mc.stop();
this._mc.gotoAndStop(1); this._mc.gotoAndStop(1);
...@@ -719,18 +713,18 @@ export default class MapScene extends Scene { ...@@ -719,18 +713,18 @@ export default class MapScene extends Scene {
await wait(50); await wait(50);
this._mc.visible = true; this._mc.visible = true;
const a = 100, b = 10; const a = 100, b = 10;
egret.Tween.get(this._mc, {loop: true}).set({rotation: b}) egret.Tween.get(this._mc, { loop: true }).set({ rotation: b })
.to({rotation: -b}, a).to({rotation: b}, a) .to({ rotation: -b }, a).to({ rotation: b }, a)
.to({rotation: -b}, a).to({rotation: b}, a) .to({ rotation: -b }, a).to({ rotation: b }, a)
.to({rotation: -b}, a).to({rotation: b}, a) .to({ rotation: -b }, a).to({ rotation: b }, a)
.to({rotation: 0}, a / 2) .to({ rotation: 0 }, a / 2)
.wait(1000); .wait(1000);
} }
} }
async playAni() { async playAni() {
if(this._mc) { if (this._mc) {
egret.Tween.removeTweens(this._mc); egret.Tween.removeTweens(this._mc);
this._mc.gotoAndPlay(1, true); this._mc.gotoAndPlay(1, true);
await this.onPlaySTOP(); await this.onPlaySTOP();
...@@ -741,7 +735,7 @@ export default class MapScene extends Scene { ...@@ -741,7 +735,7 @@ export default class MapScene extends Scene {
async onPlaySTOP() { async onPlaySTOP() {
return new Promise((r) => { return new Promise((r) => {
const func = () => { const func = () => {
if(this._mc.currentFrame >= 100) { if (this._mc.currentFrame >= 100) {
this._mc.removeEventListener(egret.Event.ENTER_FRAME, func, this); this._mc.removeEventListener(egret.Event.ENTER_FRAME, func, this);
this._mc.stop(); this._mc.stop();
r(); r();
...@@ -760,14 +754,14 @@ export default class MapScene extends Scene { ...@@ -760,14 +754,14 @@ export default class MapScene extends Scene {
this['boxani'].touchChildren = false; this['boxani'].touchChildren = false;
await this.playAni(); await this.playAni();
try { try {
if(window['getRST']) window['getRST'](); if (window['getRST']) window['getRST']();
} catch(error) { } catch (error) {
console.warn(error) console.warn(error)
} }
NetManager.ins.hc_openTreasureBox((success) => { NetManager.ins.hc_openTreasureBox((success) => {
this['boxani'].touchEnabled = true; this['boxani'].touchEnabled = true;
this['boxani'].touchChildren = true; this['boxani'].touchChildren = true;
if(success) { if (success) {
const boxdata = DataManager.ins.getData('hc_openTreasureBox').data; const boxdata = DataManager.ins.getData('hc_openTreasureBox').data;
const homeData = DataManager.ins.getData('hc_home').data; const homeData = DataManager.ins.getData('hc_home').data;
homeData.canReceiveTreasureBoxNum = boxdata.canReceiveTreasureBoxNum; homeData.canReceiveTreasureBoxNum = boxdata.canReceiveTreasureBoxNum;
...@@ -777,19 +771,19 @@ export default class MapScene extends Scene { ...@@ -777,19 +771,19 @@ export default class MapScene extends Scene {
this.updateBox(); this.updateBox();
const data = DataManager.ins.getData('hc_openTreasureBox').data; const data = DataManager.ins.getData('hc_openTreasureBox').data;
NetManager.ins.getPlugOrderStatus((s) => { NetManager.ins.getPlugOrderStatus((s) => {
if(s) { if (s) {
const data = DataManager.ins.getData('getPlugOrderStatus'); const data = DataManager.ins.getData('getPlugOrderStatus');
//区分奖品 //区分奖品
if(data.lottery && data.lottery.type != 'thanks') { if (data.lottery && data.lottery.type != 'thanks') {
PanelCtrl.instance.show('box'); PanelCtrl.instance.show('box');
} else {
showToast('哎呀!奖励与您擦肩而过!快继续闯关!');
}
} else { } else {
showToast('哎呀!奖励与您擦肩而过!快继续闯关!'); showToast('哎呀!奖励与您擦肩而过!快继续闯关!');
} }
}, } else {
showToast('哎呀!奖励与您擦肩而过!快继续闯关!');
}
},
data.orderNum, data.orderNum,
() => { () => {
return DataManager.ins.getData('getPlugOrderStatus').result == 0 return DataManager.ins.getData('getPlugOrderStatus').result == 0
...@@ -823,7 +817,7 @@ export default class MapScene extends Scene { ...@@ -823,7 +817,7 @@ export default class MapScene extends Scene {
onTap_bloodBtn() { onTap_bloodBtn() {
NetManager.ins.clickLog(getlogItem(2)); NetManager.ins.clickLog(getlogItem(2));
if(getHomeData().remainEnargy > 0) if (getHomeData().remainEnargy > 0)
PanelCtrl.instance.show('bloodPanel') PanelCtrl.instance.show('bloodPanel')
else else
PanelCtrl.instance.show('blood2Panel') PanelCtrl.instance.show('blood2Panel')
...@@ -846,9 +840,9 @@ export default class MapScene extends Scene { ...@@ -846,9 +840,9 @@ export default class MapScene extends Scene {
} }
} }
export const getNick = (nickname, max = 4) => { export const getNick = (nickname, max = 4) => {
if(!nickname) return nickname; if (!nickname) return nickname;
if(nickname.length > max) if (nickname.length > max)
return nickname.slice(0, max) + '...'; return nickname.slice(0, max) + '...';
return nickname; return nickname;
} }
\ No newline at end of file
/** /**
* 地图页图标基类 * 地图页图标基类
* 2019.10.24 * Created by haiyoucuv on 2019/10/25
*/ */
export default class IconBase{ export default class IconBase{
private iconGroup:eui.Group; private iconGroup:eui.Group;
...@@ -14,12 +14,16 @@ export default class IconBase{ ...@@ -14,12 +14,16 @@ export default class IconBase{
} }
constructor(name:string, group:eui.Group, btn:eui.Button, tipsBg:eui.Image, tipsLabel:eui.Label){ constructor(name:string, group:eui.Group, btn:eui.Button, tipsBg?:eui.Image, tipsLabel?:eui.Label){
this.iconGroup = group; this.iconGroup = group;
this.iconBtn = btn; this.iconBtn = btn;
this.iconTipsBg = tipsBg; this.iconTipsBg = tipsBg;
this.iconTips = tipsLabel; this.iconTips = tipsLabel;
this._name = name; this._name = name;
this.start();
}
protected start(){
this.initEvents(); this.initEvents();
} }
...@@ -28,7 +32,7 @@ export default class IconBase{ ...@@ -28,7 +32,7 @@ export default class IconBase{
} }
protected onTouchBtn(e:egret.TouchEvent){ protected onTouchBtn(e:egret.TouchEvent){
console.log("基类");
} }
protected removeEvents(){ protected removeEvents(){
......
import IconBase from "./IconBase"; import IconBase from "./IconBase";
import { NetManager } from "../../../libs/tw/manager/NetManager";
import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl";
export default class ScratchIcon extends IconBase { export default class ScratchIcon extends IconBase {
constructor(name: string, group: eui.Group, btn: eui.Button, tipsBg: eui.Image, tipsLabel: eui.Label) { constructor(name: string, group: eui.Group, btn: eui.Button, tipsBg?: eui.Image, tipsLabel?: eui.Label) {
super(name, group, btn, tipsBg, tipsLabel); super(name, group, btn, tipsBg, tipsLabel);
} }
protected start() {
super.start();
}
protected initEvents() { protected initEvents() {
super.initEvents(); super.initEvents();
} }
protected onTouchBtn(e: egret.TouchEvent) { protected onTouchBtn(e: egret.TouchEvent) {
super.onTouchBtn(e); super.onTouchBtn(e);
console.log("子类"); NetManager.ins.getInviteInfo((success, res) => {
if(!success) {
return;
}
PanelCtrl.instance.show('scratch', res.data);
});
} }
protected removeEvents() { protected removeEvents() {
......
import IconBase from "./IconBase";
import { NetManager } from "../../../libs/tw/manager/NetManager";
import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl";
import { loadTurntableSvga } from "../../panels/TurntablePanel/Turntable";
export default class TurntableIcon extends IconBase {
constructor(name: string, group: eui.Group, btn: eui.Button, tipsBg?: eui.Image, tipsLabel?: eui.Label) {
super(name, group, btn, tipsBg, tipsLabel);
}
protected start() {
super.start();
}
protected initEvents() {
super.initEvents();
}
protected onTouchBtn(e: egret.TouchEvent) {
super.onTouchBtn(e);
loadTurntableSvga((mv) => {
PanelCtrl.instance.show('turnTable', {mv:mv})
})
}
protected removeEvents() {
super.removeEvents();
}
protected destory() {
super.destory();
}
}
\ No newline at end of file
...@@ -214,75 +214,4 @@ class InviteItem extends eui.ItemRenderer { ...@@ -214,75 +214,4 @@ class InviteItem extends eui.ItemRenderer {
} }
}, this); }, this);
} }
} }
\ No newline at end of file
// ////////////////////////////////////////////////////////////////////////////////////////////////
// // 端内分享提示
// class ShareTips extends ComponentBase {
// public inviteGroup: eui.Group;
// public btn1: eui.Button;
// public btn2: eui.Button;
//
// private img: string;
//
// setUrl(img: string) {
// this.img = img;
// }
//
// start() {
// this.once(egret.TouchEvent.ADDED_TO_STAGE, () => {
// this.height = this.stage.stageHeight;
// }, this);
//
// this.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
// hideShare();
// }, this);
//
// this.btn1.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
// this.getFunc();//朋友圈
// hideShare();
// }, this);
//
// this.btn2.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
// this.getFunc();//朋友圈
// hideShare();
// }, this);
// }
//
// getFunc() {
// NetManager.ins.getShareCode((success, res) => {
// if(!success) {
// return;
// }
// if(iswx()) { //微信端
//
// } else {//端内
// window["inviteShare"](res.data);
// }
// });
// }
//
// get skinKey() {
// return 'ShareTips';
// }
// }
//
// let inited = false;
// let _share: ShareTips;
// const initShare = () => {
// const layer = layers.shareLayer;
// const share = new ShareTips();
// share.loadSkin();
// share.start();
// layer.addChild(share);
// _share = share;
// };
//
// const showShareTips = (url: string) => {
// if(!inited) {
// initShare();
// inited = true;
// }
// _share.setUrl(url);
// layers.shareLayer.visible = true;
// };
\ No newline at end of file
...@@ -10,11 +10,19 @@ import submit from "../../../libs/new_tw/ctrls/submit"; ...@@ -10,11 +10,19 @@ import submit from "../../../libs/new_tw/ctrls/submit";
import Loading from "../../../libs/new_wx/components/Loading"; import Loading from "../../../libs/new_wx/components/Loading";
import { NetManager } from "../../../libs/tw/manager/NetManager"; import { NetManager } from "../../../libs/tw/manager/NetManager";
import Utils from "../../Utils"; import Utils from "../../Utils";
import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath";
import wait from "../../../libs/new_tc/wait";
export const loadTurntableSvga = (callback) => {
loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => {
await wait(100);
callback(mv);
})
}
export default class Turntable extends Panel { export default class Turntable extends Panel {
public panel:eui.Group; public panel: eui.Group;
public start_btn:eui.Button; public start_btn: eui.Button;
public closeBtn:eui.Button; public closeBtn: eui.Button;
public get skinKey() { public get skinKey() {
return 'Turntable' return 'Turntable'
...@@ -24,10 +32,11 @@ export default class Turntable extends Panel { ...@@ -24,10 +32,11 @@ export default class Turntable extends Panel {
super(); super();
this.data = data; this.data = data;
} }
hand;
start(data?) { async start(data?) {
super.start(); super.start();
this['container'].addChild(this.data.mv);
this.hand = await loadSvga(getResPath() + 'resource/assets/svgas/hand.svga', this['container2'])
} }
initEvents() { initEvents() {
...@@ -129,7 +138,7 @@ export default class Turntable extends Panel { ...@@ -129,7 +138,7 @@ export default class Turntable extends Panel {
*/ */
private rotate(rotation: number, time: number, callFun: Function) { private rotate(rotation: number, time: number, callFun: Function) {
let tw = egret.Tween.get(this.panel); let tw = egret.Tween.get(this.panel);
tw.to({rotation: rotation}, time, egret.Ease.cubicInOut).wait(500).call(callFun); tw.to({ rotation: rotation }, time, egret.Ease.cubicInOut).wait(500).call(callFun);
} }
protected onSkinComplete(): void { protected onSkinComplete(): void {
...@@ -151,14 +160,14 @@ export default class Turntable extends Panel { ...@@ -151,14 +160,14 @@ export default class Turntable extends Panel {
} }
private panelEffect() { private panelEffect() {
egret.Tween.get(this.panel).to({rotation: 360}, 20000).call(() => { egret.Tween.get(this.panel).to({ rotation: 360 }, 20000).call(() => {
this.panelEffect(); this.panelEffect();
}); });
} }
protected async preLoadRes() { protected async preLoadRes() {
return new Promise(function(resolve, reject) { return new Promise(function (resolve, reject) {
resolve(); resolve();
}); });
} }
......
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