Commit 6f053187 authored by 王勇霞's avatar 王勇霞

首页更改

parent b2a3b31d
......@@ -32,7 +32,7 @@
height: 100%;
overflow: hidden;
position: absolute;
background-color: #9a3636;
background-color: #54c5f4;
-webkit-user-select: none;
/* Safari */
-ms-user-select: none;
......
resource/GameScene/cdbg.png

9.21 KB | W: | H:

resource/GameScene/cdbg.png

6.09 KB | W: | H:

resource/GameScene/cdbg.png
resource/GameScene/cdbg.png
resource/GameScene/cdbg.png
resource/GameScene/cdbg.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/cloud.png

4.83 KB | W: | H:

resource/GameScene/cloud.png

13.5 KB | W: | H:

resource/GameScene/cloud.png
resource/GameScene/cloud.png
resource/GameScene/cloud.png
resource/GameScene/cloud.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/controlpeo.png

29.9 KB | W: | H:

resource/GameScene/controlpeo.png

23.3 KB | W: | H:

resource/GameScene/controlpeo.png
resource/GameScene/controlpeo.png
resource/GameScene/controlpeo.png
resource/GameScene/controlpeo.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/gamebg.jpg

288 KB | W: | H:

resource/GameScene/gamebg.jpg

347 KB | W: | H:

resource/GameScene/gamebg.jpg
resource/GameScene/gamebg.jpg
resource/GameScene/gamebg.jpg
resource/GameScene/gamebg.jpg
  • 2-up
  • Swipe
  • Onion skin
......@@ -5,11 +5,11 @@
"name": "FailPanel"
},
{
"keys": "cdbg.png,closemusic.png,cloud.png,controlpeo.png,gamebg.jpg,gamebuild.png,leftbtn.png,monster.png,openmusic.png,rightbtn.png,scorebg.png,tianpop.png,xiangpop.png",
"keys": "cdbg.png,cloud.png,controlpeo.png,gamebg.jpg,monster.png,num_0.png,num_1.png,num_2.png,num_3.png,num_4.png,num_5.png,num_6.png,num_7.png,num_8.png,num_9.png,num_s.png,reset.png,tianpop.png,xiangpop.png",
"name": "GameScene"
},
{
"keys": "guide.png",
"keys": "guide.png,step1_img.png,step1_tips.png,step2_img.png,step2_tips.png,step3_img.png,step3_tips.png,step4_img.png",
"name": "GuidePanel"
},
{
......@@ -24,16 +24,12 @@
"keys": "infoline.png,light.png,sucbg.png,sucstar.png,sun.png",
"name": "SuccessPanel"
},
{
"keys": "bg.mp3,fail.mp3,get.mp3,jump.mp3",
"name": "bgm"
},
{
"keys": "closebtn.png,comCloseBtn.png,surebtn.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,关闭按钮2.png",
"name": "common"
},
{
"keys": "crypeo.svga,guidecount.svga,jumppeo.svga,popstar.svga,startbtn.svga,startpeo.svga,startpeople.svga,startpop.svga",
"keys": "atmosphere.svga,crypeo.svga,guidecount.svga,jumppeo.svga,left.svga,popstar.svga,right.svga,startbtn.svga,startpeo.svga,startpeople.svga,startpop.svga",
"name": "svga"
}
],
......
......@@ -11,7 +11,6 @@ import { G_EVENT } from "./common/G_EVENT";
import { Tools } from "./Tools";
import { destroyWebNetData } from "./webNet";
import { StartScene } from "./scenes/StartScene";
import { preloadSound } from "./common/SoundWeb";
/**
* 全局事件,为了和小程序交互
......@@ -25,7 +24,12 @@ export class Main {
private requestID;
private _pause: boolean;
private canvas: HTMLCanvasElement
constructor(canvas: HTMLCanvasElement) {
constructor(canvas: HTMLCanvasElement, data = {
time: 60,
longitude: "",
latitude: ""
}) {
Tools.configInfo = data;
var sysInfo;
//淘宝小程序环境就用canvas初始化
if (!window) {//自行处理吧,这么判断也不保险,万一淘宝小程序加进了window
......@@ -80,14 +84,6 @@ export class Main {
console.log("通用资源加载完成")
//h5环境时,隐藏加载中
if (FYGE.getEnv() == "web" && document.getElementById("__loading__")) document.getElementById("__loading__").style.display = "none";
let isIOS = Tools.isIOS()
if(isIOS){
Tools.isMusic = false
}else{
Tools.isMusic = true
}
preloadSound("bg")
changeScene(StartScene)
......
......@@ -5,11 +5,11 @@ export const ResJson = {
"name": "FailPanel"
},
{
"keys": "cdbg.png,closemusic.png,cloud.png,controlpeo.png,gamebg.jpg,gamebuild.png,leftbtn.png,monster.png,openmusic.png,rightbtn.png,scorebg.png,tianpop.png,xiangpop.png",
"keys": "cdbg.png,cloud.png,controlpeo.png,gamebg.jpg,monster.png,num_0.png,num_1.png,num_2.png,num_3.png,num_4.png,num_5.png,num_6.png,num_7.png,num_8.png,num_9.png,num_s.png,reset.png,tianpop.png,xiangpop.png",
"name": "GameScene"
},
{
"keys": "guide.png",
"keys": "guide.png,step1_img.png,step1_tips.png,step2_img.png,step2_tips.png,step3_img.png,step3_tips.png,step4_img.png",
"name": "GuidePanel"
},
{
......@@ -24,16 +24,12 @@ export const ResJson = {
"keys": "infoline.png,light.png,sucbg.png,sucstar.png,sun.png",
"name": "SuccessPanel"
},
{
"keys": "bg.mp3,fail.mp3,get.mp3,jump.mp3",
"name": "bgm"
},
{
"keys": "closebtn.png,comCloseBtn.png,surebtn.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,关闭按钮2.png",
"name": "common"
},
{
"keys": "crypeo.svga,guidecount.svga,jumppeo.svga,popstar.svga,startbtn.svga,startpeo.svga,startpeople.svga,startpop.svga",
"keys": "atmosphere.svga,crypeo.svga,guidecount.svga,jumppeo.svga,left.svga,popstar.svga,right.svga,startbtn.svga,startpeo.svga,startpeople.svga,startpop.svga",
"name": "svga"
}
],
......
......@@ -303,127 +303,6 @@ export const SkinJson = {
"source": "gamebg.jpg"
},
"id": "bg"
},
{
"name": "gamebuild",
"x": 0,
"y": 826,
"type": "sprite",
"props": {
"source": "gamebuild.png"
}
},
{
"name": "controlbtn",
"x": 80,
"y": 1164,
"type": "container",
"children": [
{
"name": "rightbtn",
"x": 0,
"y": 0,
"type": "sprite",
"props": {
"source": "rightbtn.png"
},
"id": "right"
},
{
"name": "leftbtn",
"x": 385,
"y": 0,
"type": "sprite",
"props": {
"source": "leftbtn.png"
},
"id": "left"
}
]
},
{
"name": "score",
"x": 280,
"y": 264,
"type": "container",
"children": [
{
"name": "scorebg",
"x": 0,
"y": 0,
"type": "sprite",
"props": {
"source": "scorebg.png"
},
"id": "scorebg"
},
{
"name": "scorenum",
"x": 140,
"y": 26,
"type": "text",
"props": {
"text": "",
"size": 44,
"fillColor": "#ffffff",
"textAlpha": 1,
"lineHeight": 44
},
"id": "scorenum"
}
]
},
{
"name": "countdown",
"x": 23,
"y": 264,
"type": "container",
"children": [
{
"name": "cdbg",
"x": 0,
"y": 0,
"type": "sprite",
"props": {
"source": "cdbg.png"
},
"id": "cdbg"
},
{
"name": "cdnum",
"x": 94,
"y": 26,
"type": "text",
"props": {
"text": "0s",
"size": 44,
"fillColor": "#ffffff",
"textAlpha": 1,
"lineHeight": 44
},
"id": "cdnum"
}
]
},
{
"name": "closemusic",
"x": 650,
"y": 265,
"type": "sprite",
"props": {
"source": "closemusic.png"
},
"id": "close"
},
{
"name": "openmusic",
"x": 650,
"y": 265,
"type": "sprite",
"props": {
"source": "openmusic.png"
},
"id": "open"
}
]
},
......
......@@ -7,6 +7,11 @@ import Ease = FYGE.Ease;
* 定制,记录一些全局量和通用方法
*/
export class Tools {
public static configInfo: {
longitude: string,
latitude: string,
time: number
}
/**
* 缓存key
......@@ -15,8 +20,6 @@ export class Tools {
public static isMember: boolean;
public static isMusic:boolean = true;
/**
* 全局数据,重要数据
*/
......
......@@ -2,7 +2,7 @@ import { Panel } from "../../module/views/Panel";
import { changeScene, getCurrentScene, showPanel, showToast } from "../../module/ctrls";
import { StartScene } from "../scenes/StartScene";
import { GuidePanel } from "./GuidePanel";
import { getWebData, WebNetName, sendLog, LOG_TYPE, getPxTokenSave, sendWebNet } from "../webNet";
import { getWebData, WebNetName, LOG_TYPE, getPxTokenSave, sendWebNet } from "../webNet";
export class FailPanel extends Panel {
get groupNames() { return ["FailPanel"] };
get skinName() { return "FailPanel" };
......@@ -24,18 +24,14 @@ export class FailPanel extends Panel {
this.score.x = 92
this.score.textWidth = 568
this.score.textAlign = FYGE.TEXT_ALIGN.CENTER
sendLog(LOG_TYPE.EXPOSURE, 40)
sendLog(LOG_TYPE.EXPOSURE, 39)
}
back() {
this.hidePanel()
sendLog(LOG_TYPE.CLICK, 40)
changeScene(StartScene)
}
isOpen = false
async restart() {
sendLog(LOG_TYPE.CLICK, 39)
this.btnDelay(this.restartbtn)
if (!this.isOpen) {
this.isOpen = true
......
......@@ -4,10 +4,16 @@ import { RES } from "../../module/RES";
import { getCurrentScene } from "../../module/ctrls";
import { GameScene } from "../scenes/GameScene";
import { StartScene } from "../scenes/StartScene";
import UI from "../UI";
import { Tools } from "../Tools";
export class GuidePanel extends Panel {
get groupNames() { return ["GuidePanel"] };
get groupNames() { return ["GuidePanel", "GameScene"] };
get skinName() { return "GuidePanel" };
rectlayer;
clicklayer;
guideStep = 1;
svga
initUi() {
......@@ -15,35 +21,91 @@ export class GuidePanel extends Panel {
svga
async start(data) {
super.start();
GameScene.instance.scorenum.text = "0"
GameScene.instance.cdnum.text = StartScene.instance.gameInfo.duration
let svgashow = this.svga = new FYGE.SvgaAni(await RES.getResAsync("guidecount.svga"))
this.clicklayer = UI.Rect(this, 750, 1624, 0x000000, 0, 0, 0, 0.01);
this.rectlayer = UI.Ctn(this, 0, 0);
this.rectlayer.mouseEnable = false
this.rectlayer.mouseChildren = false
let svgashow = this.svga = new FYGE.SvgaAni(await RES.getResAsync("guidecount.svga"));
this.svga.position.set(170, 660)
this.svga.visible = false
this.svga.stop()
this.addChild(svgashow)
this.addChild(svgashow);
this.clicklayer.addEventListener(FYGE.MouseEvent.CLICK, () => {
if (this.guideStep < 4) {
this.guideStep++
this.guideUI();
} else if((this.guideStep == 4)) {
this.guideStep++
this.showCount();
}
}, this)
if(getWebData(WebNetName.indexInfo).data.ifFirstPlay){
this.guideUI();
} else {
this.showCount();
}
// GameScene.instance.scorenum.text = "0"
// GameScene.instance.cdnum.text = StartScene.instance.gameInfo.duration
// svgashow.lockStep = true
if(getWebData(WebNetName.startGame).data.firstGame){
}
step3_img;
async guideUI() {
this.rectlayer.removeChildren()
if (this.guideStep == 1) {
UI.Sp(this.rectlayer, 'step1_img.png', 48, 860);
let step1_tips = UI.Sp(this.rectlayer, 'step1_tips.png', 188, 776);
FYGE.Tween.get(step1_tips, {
loop: true
})
.to({ alpha: 0.2},500)
.to({ alpha: 1},500)
svgashow.startAniRange(0,200,1,()=>{
svgashow.startAniRange(200,270,0)
this.svga.addEventListener(FYGE.MouseEvent.CLICK,this.showCount,this)
} else if (this.guideStep == 2) {
UI.Sp(this.rectlayer, 'step2_img.png', 50, 492);
let step2_tips = UI.Sp(this.rectlayer, 'step2_tips.png', 198, 900);
FYGE.Tween.get(step2_tips, {
loop: true
})
this.svga.visible = true
}else{
this.showCount()
.to({ alpha: 0.2},500)
.to({ alpha: 1},500)
} else if (this.guideStep == 3) {
this.step3_img = UI.Sp(this.rectlayer, 'step3_img.png', 311, 333);
this.cdUIRender(Tools.configInfo.time)
let step3_tips = UI.Sp(this.rectlayer, 'step3_tips.png', 236, 850);
FYGE.Tween.get(step3_tips, {
loop: true
})
.to({ alpha: 0.2},500)
.to({ alpha: 1},500)
} else if (this.guideStep == 4){
let atmosphere = new FYGE.SvgaAni(await RES.getResAsync("atmosphere.svga"))
this.rectlayer.addChild(atmosphere)
atmosphere.position.set(18, 324)
UI.Sp(this.rectlayer, 'step4_img.png', 95, 540);
}
}
cdUIRender(num = 60) {
// 先清除所有节点
this.step3_img.removeChildren();
let str = num + 's';
let arr = str.split("");
let startPos = (130 - (30 * arr.length)) / 2
arr.forEach((item, index) => {
UI.Sp(this.step3_img, `num_${item}.png`, startPos + (index * 30), 38)
})
}
showCount(){
this.svga.removeEventListener(FYGE.MouseEvent.CLICK,this.showCount,this)
this.svga.startAniRange(275,undefined,1,()=>{
this.removeChild(this.rectlayer)
this.svga.visible = true
this.svga.startAniRange(1,105,1,()=>{
this.removeChild(this.svga)
setTimeout(()=>{
this.hidePanel()
getCurrentScene().upDateInfo()
},100)
})
this.svga.visible = true
}
initEvents() {
super.initEvents();
......
......@@ -2,7 +2,7 @@ import { Panel } from "../../module/views/Panel";
import { RES } from "../../module/RES";
import { changeScene } from "../../module/ctrls";
import { StartScene } from "../scenes/StartScene";
import { getWebData, WebNetName, sendLog, LOG_TYPE } from "../webNet";
import { getWebData, WebNetName, LOG_TYPE } from "../webNet";
export class SuccessPanel extends Panel {
get groupNames() { return ["SuccessPanel"] };
get skinName() { return "SuccessPanel" };
......@@ -38,11 +38,9 @@ export class SuccessPanel extends Panel {
let endInfo = getWebData(WebNetName.submitGame).data
this.score.text = endInfo.score+""
this.sunscore.text = "x"+endInfo.sunNum+""
sendLog(LOG_TYPE.EXPOSURE,38)
}
back(){
this.hidePanel()
sendLog(LOG_TYPE.CLICK,38)
changeScene(StartScene)
}
initEvents() {
......
This diff is collapsed.
......@@ -61,8 +61,8 @@ export class StartScene extends Scene {
"sun": 10
}
// this.openGame()
// TODO_wyx
this.openGame()
// for (let i = 0; i < data.gamecfs.length; i++) {
// if (data.gamecfs[i].code == data.gameCode) {
......@@ -75,35 +75,39 @@ export class StartScene extends Scene {
openRule() {
GDispatcher.dispatchEvent("openRule");
}
isOpen = false
startId;
getWordList() {
let dataInfo = getWebData(WebNetName.indexInfo).data.dataInfo;
let hasWordList:any = [];
let noWordList:any = [];
dataInfo.forEach(item => {
if (item.context) {
hasWordList = hasWordList.concat(item.context.split(""))
}
})
allWords.forEach(item => {
if (!hasWordList.includes(item) && !noWordList.includes(item)) {
noWordList.push(item)
}
})
return noWordList
}
async openGame() {
this.btnDelay(this.startbtn)
if (this.indexInfo) {
if (!this.indexInfo.dailyPass) {
if (!this.isOpen) {
this.isOpen = true
let token = ""
const { success, code, data, message } = await sendWebNet(WebNetName.startGame, { token: token })
if (!success) {
this.isOpen = false
if (code == "20004") {
showToast("今日已过关,明日再来~")
} else {
showToast(message || "网络异常,请重试~")
}
if (this.getWordList().length == 0) {
showToast("您已获取今日全部游戏奖励,\n请明日再来");
return
}
this.isOpen = false
const { success, code, data, desc } = await sendWebNet(WebNetName.startGame, {
activityId: getUrlParams('activityId'),
type: 3
})
if (success) {
this.startId = data.startId;
changeScene(GameScene)
}
} else {
showToast("今日已过关,明日再来~")
}
} else {
showToast("网络异常,请重试~")
showToast(desc || "网络开小差了,稍后再试")
}
}
goback() {
GDispatcher.dispatchEvent("backIndex");
......
import * as Matter from "matter-js";
import { RES } from "../../../module/RES";
import UI from "../../UI";
export default class MapItem extends FYGE.Container {
public phyBody: Matter.Body;
itemImg: FYGE.Sprite;
constructor() {
super();
let itemImg = this.itemImg = new FYGE.Sprite();
itemImg.texture = RES.getRes("cloud.png");
itemImg.width = itemImg.width*1.4
itemImg.position.set(-itemImg.width / 2, -10);
this.addChild(itemImg);
// itemImg.position.set(-itemImg.width / 2, -10);
let itemImg = this.itemImg = UI.Sp(this, "cloud.png", 0, 0);
this.phyBody = Matter.Bodies.rectangle(this.x, this.y,itemImg.width,5, {
this.phyBody = Matter.Bodies.rectangle(this.x, this.y,itemImg.width, 5, {
isStatic: true,
friction: 1,
isSensor: true, // 传感器,可以检测到碰撞,但是不参与碰撞
render: {
fillStyle: "blue" // 填充的颜色
}
});
this.phyBody.gameType = 'item'
setTimeout(() => {
this.setPhyPos();
}, 200)
}
......
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