Commit 20a59a15 authored by wangzhujun's avatar wangzhujun

1232

parent f8ec00ed
......@@ -38,8 +38,9 @@
data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
</div>
<img id="shareImg" />
<img id="placeImg" />
<img id="mapImg" />
<img id="creImg" />
<script src="libs/modules/egret/egret.js"></script>
<script src="libs/modules/egret/egret.web.js"></script>
<script src="libs/modules/eui/eui.js"></script>
......@@ -54,7 +55,7 @@
// window['pageID'] = 'TeamShareScene';
// window['pageID'] = 'JoinShareScene';
// window['pageID'] = 'TransScene';
window['pageID'] = 'Share2Scene';
// window['pageID'] = 'Share2Scene';
window['indexhtml'] = 'https://yazuwei.activity-1.m.duiba.com.cn/projectx/pbe1f2241/index.html'
window['TransLink']='';
window['projectId'] = "1";
......
......@@ -5,7 +5,7 @@
"name": "Preload"
},
{
"keys": "certificate_btn_png,certificate_cover_png,certificate_jpg,joinshare_btn_png,sharestarter_bg_jpg,sharestarter_btn_png,sharestarter_sharebtn_png,share2mask_png,share2btn_png,share2bg_jpg,confirm_btn_png,confirm_bg_png,transfer _toast3_png,transfer _toast2_png,transfer _toast1_png,transfer _title_png,transfer _btn_png,trans_bg_jpg,teamshare_btn_png,transferrecord_bg_png,transferrecord_item_bg_png,关闭按钮 _png,teamshare_bg_jpg,joinshare_bg_jpg",
"keys": "certificate_btn_png,certificate_cover_png,joinshare_btn_png,sharestarter_bg_jpg,sharestarter_btn_png,sharestarter_sharebtn_png,share2mask_png,share2btn_png,share2bg_jpg,confirm_btn_png,confirm_bg_png,transfer _toast3_png,transfer _toast2_png,transfer _toast1_png,transfer _title_png,transfer _btn_png,trans_bg_jpg,teamshare_btn_png,transferrecord_bg_png,transferrecord_item_bg_png,关闭按钮 _png,teamshare_bg_jpg,certificate_jpg,certificate_bg_png,joinshare_bg_jpg",
"name": "Normal"
},
{
......@@ -646,11 +646,6 @@
"type": "image",
"name": "certificate_cover_png"
},
{
"url": "assets/certificate/certificate.jpg",
"type": "image",
"name": "certificate_jpg"
},
{
"url": "assets/pk/pkBG.jpg",
"type": "image",
......@@ -671,6 +666,16 @@
"type": "image",
"name": "pkscorebg2_png"
},
{
"url": "assets/certificate/certificate.jpg",
"type": "image",
"name": "certificate_jpg"
},
{
"url": "assets/certificate/certificate_bg.png",
"type": "image",
"name": "certificate_bg_png"
},
{
"url": "assets/joinshare/joinshare_bg.jpg",
"type": "image",
......
......@@ -2,9 +2,15 @@
<e:Skin class="CertificateSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Group verticalCenter="0">
<e:Image source="certificate_jpg"/>
<e:Group id="cerGroup" x="99" y="442">
<e:Image x="0" y="0" source="certificate_bg_png" scaleX="1" scaleY="1"/>
<e:Label id="to" text="132****1234" x="328.7" y="580.21" textColor="0x000000" size="24" width="145" textAlign="center" scaleX="1" scaleY="1"/>
<e:Label id="from" text="132****1234" x="80.35" y="580.21" textColor="0x000000" size="24" width="145" textAlign="center" scaleX="1" scaleY="1"/>
<e:Image id="cover" source="certificate_cover_png" x="410" y="500" scaleX="1" scaleY="1"/>
</e:Group>
<e:Image id="btn" source="certificate_btn_png" y="1210" horizontalCenter="0"/>
<e:Label id="to" text="132****1234" x="427.7" y="1022.21" textColor="0x000000" size="24" width="145" textAlign="center"/>
<e:Label id="from" text="132****1234" x="179.35" y="1022.21" textColor="0x000000" size="24" width="145" textAlign="center"/>
<e:Image id="cover" source="certificate_cover_png" x="509" y="942"/>
</e:Group>
</e:Skin>
\ No newline at end of file
......@@ -2,11 +2,9 @@
<e:Skin class="CertificateSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Group verticalCenter="0">
<e:Image source="joinshare_bg_jpg" scaleX="1" scaleY="1"/>
<e:Image id="btn" source="joinshare_btn_png" y="797" horizontalCenter="0" x="192.21" scaleX="1" scaleY="1"/>
<e:Group x="304.56" y="316.83" scaleX="1" scaleY="1">
<e:Image id="avatar" y="0" width="136" height="136" x="0" source=""/>
<e:Rect id="avatarMask" width="136" height="136" y="0" ellipseWidth="136" ellipseHeight="136"/>
</e:Group>
<e:Image id="btn" source="joinshare_btn_png" y="772" horizontalCenter="0" x="192.21" scaleX="1" scaleY="1"/>
<e:Image id="logo" width="474" height="88" y="241" source="starttitle_png" scaleX="1" scaleY="1" horizontalCenter="0"/>
</e:Group>
<e:Group id="sharemask" x="0" y="0" visible="false">
<e:Rect id="rect0" width="750" height="1624" x="0" y="0" fillAlpha="0.7"/>
......
......@@ -3,13 +3,20 @@
<e:Group width="750" height="1169" anchorOffsetY="0" horizontalCenter="0" verticalCenter="-11.5">
<e:Image width="750" height="1624" x="0" y="-216" scaleX="1" scaleY="1" source="startBG_jpg"/>
<e:Group id="logoGroup" width="474" height="268" x="139" y="-2">
<e:Image width="82" height="82" x="195" y="0" scaleX="1" scaleY="1" source="yyhlogo_png"/>
<e:Image width="474" height="88" x="0" y="88" source="starttitle_png" scaleX="1" scaleY="1"/>
<e:Image width="384" height="52" x="45" y="186" source="littletitle_png" scaleX="1" scaleY="1"/>
<e:Image width="23" height="19" x="122" y="250" source="horn_png" scaleX="1" scaleY="1"/>
<e:Label id="peolab" text="总共有100人参与活动" x="152" y="250" size="18" textColor="0xfefeff" scaleX="1" scaleY="1"/>
</e:Group>
<e:Image width="82" height="82" x="334" y="-2" scaleX="1" scaleY="1" source="yyhlogo_png"/>
<e:Image width="474" height="88" x="139" y="86" source="starttitle_png" scaleX="1" scaleY="1"/>
<e:Image width="384" height="52" x="184" y="184" source="littletitle_png" scaleX="1" scaleY="1"/>
<e:Image width="23" height="19" x="261" y="248" source="horn_png" scaleX="1" scaleY="1"/>
<e:Label id="peolab" text="总共有100人参与活动" x="291" y="248" size="18" textColor="0xfefeff" scaleX="1" scaleY="1"/>
<e:Image id="hz" width="200" height="241" x="488" y="147" scaleX="1" scaleY="1" source="unCHNhangzhou_png"/>
<e:Image id="am" width="200" height="218" x="52" y="262" scaleX="1" scaleY="1" source="unCHNaomen_png"/>
<e:Image id="xg" width="200" height="296" x="270" y="295" source="unCHNxianggang_png" scaleX="1" scaleY="1"/>
......
......@@ -32,6 +32,7 @@ export default class StartScene extends Scene {
public pkBtn:eui.Button;
public rankBtn:eui.Button;
public hand:eui.Image;
public logoGroup:eui.Group;
protected get skinKey() { return 'Start' }
......@@ -48,6 +49,10 @@ export default class StartScene extends Scene {
super();
this.initBuired();
StartScene.instance = this;
console.log("innerhight"+window.innerHeight)
console.log("stagehight"+GameConst.stage.stageHeight)
// console.log("thisstagehight"+this.stage.stageHeight);
if(data.type){
this.startdata = data.data;
this.level = data.data.currentLevel
......@@ -109,6 +114,12 @@ export default class StartScene extends Scene {
this.once(egret.Event.ADDED_TO_STAGE, () => {
this.height = 750/window.innerWidth*window.innerHeight;
}, this);
if(window.innerHeight>650){
this.logoGroup.y -= window.innerHeight-650;
}
if(GameConst.getQueryString("joinTeamCode")){
GCache.writeCache("isGuide",true);
GCache.writeCache("isGuide2",true);
......@@ -200,6 +211,27 @@ export default class StartScene extends Scene {
}
}
for(let n = 0;n<this.level;n++){
this.onTap(this[this.arr[n]],()=>{
Waiting.instance.show();
yzwNet.shareFootprintList((s)=>{
Waiting.instance.hide();
if(!s){
if(DataManager.ins.getData("shareFootprintList") && DataManager.ins.getData("shareFootprintList").message){
ToastCtrl.instance.show(DataManager.ins.getData("shareFootprintList").message)
}else{
ToastCtrl.instance.show("网路异常请重试~");
}
// ToastCtrl.instance.show("网路异常请重试~");
return
}
let data = DataManager.ins.getData("shareFootprintList").data;
let mapdata = {data:data,num:n+1,type:2};
SceneCtrl.instance.change(ModuleTypes.RECORDMAP_SCENE,mapdata)
},window['projectId'])
});
}
for(let i = this.level;i<this.arr.length;i++){
if(i == this.level){
if(this.startdata.nextLevelScore>this.startdata.currentScore){
......
......@@ -2,10 +2,12 @@ import Scene from "../views/Scene";
import PanelCtrl from "../ctrls/panelCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import SceneCtrl from "../ctrls/sceneCtrl";
import GameConst from "../GameConst";
export default class CertificateScene extends Scene{
protected get skinKey(){return 'Certificate'}
public cerGroup:eui.Group;
constructor(data){
super();
......@@ -20,10 +22,15 @@ export default class CertificateScene extends Scene{
this._from=data.from;
this['from'].text = data.inviterPhone;
this['to'].text = data.inviteePhone;
document.getElementById('creImg').style.display = "block";
setTimeout(()=>{
this.getScreen();
},1000)
}
onTap_btn(){
console.log('onTap_btn')
document.getElementById('creImg').style.display = "none";
if(this._from == 'ShareStarterScene') {
SceneCtrl.instance.change(ModuleTypes.ShareStarterScene);
}else {
......@@ -35,4 +42,59 @@ export default class CertificateScene extends Scene{
initEvents(){
this.onTap(this['btn'],this.onTap_btn);
}
//长按识别二维码
getScreen(){
setTimeout(() => {
let img = this.getPrintScreenData(this.cerGroup,0,0,558,697);
console.log(img);
this.showImgByImgData(document.getElementById('creImg'),img,100,(GameConst.stage.stageHeight-697)/2-21.5,558,697,false);
}, 500);
}
/**
* 白鹭截canvas为img
* @param scene 当前场景
* @param startX 截图开始的x坐标
* @param startY 截图开始的y坐标
* @param width 截图的宽度
* @param height 截图的高度
* return base64的png图片
*/
public getPrintScreenData(scene, startX, startY, width, height): any {
let renderTexture: egret.RenderTexture = new egret.RenderTexture();
renderTexture.drawToTexture(scene, new egret.Rectangle(startX, startY, width, height));
// egret.updateAllScreens();
let imageData = renderTexture.toDataURL("image/png");
return imageData;
}
/**
* 将截图的图片展示到img标签,提供长按保存功能
* @param img dom的Img标签 document.getElementById('shareImg');
* @param imageData base64图片数据
* @param startX 截图的x
* @param startY 截图的y
* @param width 截图的宽度
* @param imgLoadCallBack 加载图片完成后的回调
*/
public showImgByImgData(img: any, imageData: string, startX: number, startY: number, width: number, height:number,isVisible: boolean, imgLoadCallBack?: Function): any {
img.style.position = 'absolute';
let widthP = width / this.stage.stageWidth;
img.style.width = `${widthP * 100}%`;
let heightP = height / this.stage.stageHeight;
img.style.height = `${heightP * 100}%`;
let leftP = startX / this.stage.stageWidth;
img.style.left = `${leftP * 100}%`;
let topP = startY / this.stage.stageHeight;
img.style.top = `${topP * 100}%`;
if (isVisible) {
img.style.opacity = 1;
} else {
img.style.opacity = 0;
}
img['src'] = imageData;
img.onload = imgLoadCallBack ? imgLoadCallBack : () => { };
}
}
\ No newline at end of file
......@@ -20,8 +20,6 @@ export default class JoinShareScene extends Scene {
NetManager.ins.showLog(getlogItem(5));
// this['from'].text = '11111111';
// this['to'].text = '22222222';
this['avatar'].mask = this['avatarMask'];
this['avatar'].source = GameConst.getQueryString('avatar');
}
onTap_btn() {
......
......@@ -68,8 +68,8 @@ export default class PKScene extends Scene{
this.addEventListener(egret.Event.ENTER_FRAME,this.onEnterFrame,this);
this.allscore.text = data.pkTotalScore;
this.myscore.text = data.pkMyScore;
this.myteamnum.text = data.myTeamSteps;
this.otherteamnum.text = data.enemyTeamSteps;
this.myteamnum.text = data.myTeamSteps+"步";
this.otherteamnum.text = data.enemyTeamSteps+"步";
let point:egret.Point = this.team1.localToGlobal(this.team1.x,this.team1.y)
if(data.myTeamSteps<50000){
......
......@@ -76,12 +76,12 @@ export default class PKScorePanel extends Panel{
for(let i = 0;i<data.pkResult.myTeamMembers.length;i++){
this["team"+(i+1)]["onGroup"].visible = true;
if(data.pkResult.pkResult == 0){//pk结果 0 失败,1 获胜,2 平局
this["team"+(i+1)]["onnum"].text = data.pkResult.myTeamMembers[i].steps
this["team"+(i+1)]["onnum"].text = data.pkResult.myTeamMembers[i].steps+"步"
}else if(data.pkResult.pkResult == 1){
this["team"+(i+1)]["onnum"].text = data.pkResult.myTeamMembers[i].score
this["team"+(i+1)]["onnum"].text = data.pkResult.myTeamMembers[i].score+"分"
}else if(data.pkResult.pkResult == 2){
this["team"+(i+1)]["onnum"].text = data.pkResult.myTeamMembers[i].steps
this["team"+(i+1)]["onnum"].text = data.pkResult.myTeamMembers[i].steps+"步"
}
this["team"+(i+1)]["avatar"].source = data.pkResult.myTeamMembers[i].avatar;
this["team"+(i+1)]['avatar'].mask = this["team"+(i+1)]['avatarMask'];
......
......@@ -6,6 +6,7 @@ import { DataManager } from "../../libs/tw/manager/DataManager";
import SceneCtrl from "../ctrls/sceneCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import StartScene from "../startScene/StartScene";
import GameConst from "../GameConst";
export default class PlacePanel extends Panel{
protected get skinKey(){return 'Place'}
......@@ -40,6 +41,10 @@ export default class PlacePanel extends Panel{
}else if(data == 8){
this.mapBG.source = "mapmg_png"
}
document.getElementById('placeImg').style.display = "block";
setTimeout(()=>{
this.getScreen();
},500)
}
initEvents(){
......@@ -50,6 +55,7 @@ export default class PlacePanel extends Panel{
}
backStart(){
Waiting.instance.show();
document.getElementById('placeImg').style.display = "none";
yzwNet.homeBaseInfo((s)=>{
Waiting.instance.hide();
if(!s){
......@@ -94,4 +100,58 @@ export default class PlacePanel extends Panel{
}
//长按识别二维码
getScreen(){
setTimeout(() => {
let img = this.getPrintScreenData(this.mapBG,0,0,683,801);
console.log(img);
this.showImgByImgData(document.getElementById('placeImg'),img,33,GameConst.stage.stageHeight/2-460,683,801,false);
}, 500);
}
/**
* 白鹭截canvas为img
* @param scene 当前场景
* @param startX 截图开始的x坐标
* @param startY 截图开始的y坐标
* @param width 截图的宽度
* @param height 截图的高度
* return base64的png图片
*/
public getPrintScreenData(scene, startX, startY, width, height): any {
let renderTexture: egret.RenderTexture = new egret.RenderTexture();
renderTexture.drawToTexture(scene, new egret.Rectangle(startX, startY, width, height));
// egret.updateAllScreens();
let imageData = renderTexture.toDataURL("image/png");
return imageData;
}
/**
* 将截图的图片展示到img标签,提供长按保存功能
* @param img dom的Img标签 document.getElementById('shareImg');
* @param imageData base64图片数据
* @param startX 截图的x
* @param startY 截图的y
* @param width 截图的宽度
* @param imgLoadCallBack 加载图片完成后的回调
*/
public showImgByImgData(img: any, imageData: string, startX: number, startY: number, width: number, height:number,isVisible: boolean, imgLoadCallBack?: Function): any {
img.style.position = 'absolute';
let widthP = width / this.stage.stageWidth;
img.style.width = `${widthP * 100}%`;
let heightP = height / this.stage.stageHeight;
img.style.height = `${heightP * 100}%`;
let leftP = startX / this.stage.stageWidth;
img.style.left = `${leftP * 100}%`;
let topP = startY / this.stage.stageHeight;
img.style.top = `${topP * 100}%`;
if (isVisible) {
img.style.opacity = 1;
} else {
img.style.opacity = 0;
}
img['src'] = imageData;
img.onload = imgLoadCallBack ? imgLoadCallBack : () => { };
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import Waiting from "../waiting/Waiting";
import StartScene from "../startScene/StartScene";
import { ModuleTypes } from "../types/sceneTypes";
import SceneCtrl from "../ctrls/sceneCtrl";
import GameConst from "../GameConst";
export default class RecordMapScene extends Scene{
protected get skinKey(){return 'RecordMap'}
......@@ -42,6 +43,10 @@ export default class RecordMapScene extends Scene{
}else if(data.num == 8){
this.mapBG.source = "mapmg_png"
}
document.getElementById('mapImg').style.display = "block";
setTimeout(()=>{
this.getScreen();
},500)
const arr = ["HZ","AM","XG","TB","RB","HG","CX","MG"];
if(data.data){
for(let i =0;i<data.data.length;i++){
......@@ -50,6 +55,30 @@ export default class RecordMapScene extends Scene{
}
}
}
if(data.type && data.type == 2){
this.onTap(this.backBtn,()=>{Waiting.instance.show();
document.getElementById('mapImg').style.display = "none";
yzwNet.homeBaseInfo((s)=>{
Waiting.instance.hide();
if(!s){
if(DataManager.ins.getData("homeBaseInfo") && DataManager.ins.getData("homeBaseInfo").message){
ToastCtrl.instance.show(DataManager.ins.getData("homeBaseInfo").message)
}else{
ToastCtrl.instance.show("网络异常请重试~");
}
// ToastCtrl.instance.show("网络异常请重试~");
return;
}
Waiting.instance.hide();
let data = DataManager.ins.getData("homeBaseInfo").data;
SceneCtrl.instance.change(ModuleTypes.START_SCENE,data);
},window['projectId'])})
}else{
this.onTap(this.backBtn,()=>{
document.getElementById('mapImg').style.display = "none";
SceneCtrl.instance.change(ModuleTypes.RECORD_SCENE,StartScene.instance.level)})
}
......@@ -58,7 +87,7 @@ export default class RecordMapScene extends Scene{
initEvents(){
super.initEvents();
this.onTap(this.shareBtn,this.sharePic)
this.onTap(this.backBtn,()=>{SceneCtrl.instance.change(ModuleTypes.RECORD_SCENE,StartScene.instance.level)})
}
sharePic(){
......@@ -82,4 +111,58 @@ export default class RecordMapScene extends Scene{
}
//长按识别二维码
getScreen(){
setTimeout(() => {
let img = this.getPrintScreenData(this.mapBG,0,0,683,801);
console.log(img);
this.showImgByImgData(document.getElementById('mapImg'),img,33,GameConst.stage.stageHeight/2-460,683,801,false);
}, 500);
}
/**
* 白鹭截canvas为img
* @param scene 当前场景
* @param startX 截图开始的x坐标
* @param startY 截图开始的y坐标
* @param width 截图的宽度
* @param height 截图的高度
* return base64的png图片
*/
public getPrintScreenData(scene, startX, startY, width, height): any {
let renderTexture: egret.RenderTexture = new egret.RenderTexture();
renderTexture.drawToTexture(scene, new egret.Rectangle(startX, startY, width, height));
// egret.updateAllScreens();
let imageData = renderTexture.toDataURL("image/png");
return imageData;
}
/**
* 将截图的图片展示到img标签,提供长按保存功能
* @param img dom的Img标签 document.getElementById('shareImg');
* @param imageData base64图片数据
* @param startX 截图的x
* @param startY 截图的y
* @param width 截图的宽度
* @param imgLoadCallBack 加载图片完成后的回调
*/
public showImgByImgData(img: any, imageData: string, startX: number, startY: number, width: number, height:number,isVisible: boolean, imgLoadCallBack?: Function): any {
img.style.position = 'absolute';
let widthP = width / this.stage.stageWidth;
img.style.width = `${widthP * 100}%`;
let heightP = height / this.stage.stageHeight;
img.style.height = `${heightP * 100}%`;
let leftP = startX / this.stage.stageWidth;
img.style.left = `${leftP * 100}%`;
let topP = startY / this.stage.stageHeight;
img.style.top = `${topP * 100}%`;
if (isVisible) {
img.style.opacity = 1;
} else {
img.style.opacity = 0;
}
img['src'] = imageData;
img.onload = imgLoadCallBack ? imgLoadCallBack : () => { };
}
}
\ No newline at end of file
{
"code":null,
"data":{
"currentLevel":1,
"currentLevel":5,
"treasureBoxNum":0,
"currentScore":2000,
"pkResult":{
......
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