Commit 8cb21f11 authored by AU-Pro-mac's avatar AU-Pro-mac

Merge branch 'yd11_20200922' of

parents 8800b354 ebb238c9
{
"code": "000000",
"data": {
},
"success": true,
"message": "成功"
}
{
"code": "000000",
"data": {
"fakeUserName": "cccccccccc",
"fakeUserImgUrl": "https://yun.duiba.com.cn/spark-dev/assets/白色.41dae4fd01f4750aea58f694b40d97a9da8f23ca.png",
"win": true,
"userName": "xxxxxxxxxxx",
"userImgUrl": "https://yun.duiba.com.cn/spark-dev/assets/白色.41dae4fd01f4750aea58f694b40d97a9da8f23ca.png",
"isNewUser": true
},
"success": true,
"message": "成功"
}
\ No newline at end of file
This diff is collapsed.
...@@ -40,7 +40,7 @@ export class Main { ...@@ -40,7 +40,7 @@ export class Main {
private requestID; private requestID;
private _pause: boolean; private _pause: boolean;
constructor(canvas: HTMLCanvasElement) { constructor(canvas: HTMLCanvasElement) {
console.warn=function(){} console.warn = function () { }
var sysInfo; var sysInfo;
//@ts-ignore 存在my就初始化 //@ts-ignore 存在my就初始化
if (my) { if (my) {
...@@ -83,7 +83,7 @@ export class Main { ...@@ -83,7 +83,7 @@ export class Main {
} }
// 切换游戏 // 切换游戏
changeGameSence (gameType) { changeGameSence(gameType) {
this.gameType = gameType this.gameType = gameType
if (gameType === 1) changeScene(CsdScene) if (gameType === 1) changeScene(CsdScene)
else if (gameType === 2) changeScene(XxlScene) else if (gameType === 2) changeScene(XxlScene)
...@@ -91,12 +91,12 @@ export class Main { ...@@ -91,12 +91,12 @@ export class Main {
else return else return
} }
loadImageTextures (resCanvasList) { loadImageTextures(resCanvasList) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
FYGE.GlobalLoader.loadImage((s, image) => { FYGE.GlobalLoader.loadImage((s, image) => {
if (s) { if (s) {
console.log('loadImageTextures') console.log('loadImageTextures')
FYGE.createTextureSheet(new FYGE.BaseTexture(image), lottieTexture ); FYGE.createTextureSheet(new FYGE.BaseTexture(image), lottieTexture);
resolve('complete') resolve('complete')
} }
}, resCanvasList['63cb446e-1158-4a94-bf0c-c19ecc7d2cc6'].url) }, resCanvasList['63cb446e-1158-4a94-bf0c-c19ecc7d2cc6'].url)
...@@ -116,7 +116,7 @@ export class Main { ...@@ -116,7 +116,7 @@ export class Main {
// await RES.loadGroup("common"); // await RES.loadGroup("common");
Ins.stageW = this.stage.viewRect.width; Ins.stageW = this.stage.viewRect.width;
Ins.stageH = this.stage.viewRect.height; Ins.stageH = this.stage.viewRect.height;
console.log("舞台宽高:",Ins.stageW,Ins.stageH) console.log("舞台宽高:", Ins.stageW, Ins.stageH)
let resCanvasList = Object.assign(resCanvasList_, resCanvasListCsd) let resCanvasList = Object.assign(resCanvasList_, resCanvasListCsd)
...@@ -125,14 +125,13 @@ export class Main { ...@@ -125,14 +125,13 @@ export class Main {
this.loadImageTextures(resCanvasList).then(res => { this.loadImageTextures(resCanvasList).then(res => {
// changeScene(OpenAni) // changeScene(OpenAni)
// changeScene(XxlScene) changeScene(XxlScene)
changeScene(CsdScene)
}) })
await InitLottie.initLottieList(resLottieList); await InitLottie.initLottieList(resLottieList);
console.log("initLottieList完成") console.log("initLottieList完成")
FYGE.GDispatcher.dispatchEvent("loadEnd"); FYGE.GDispatcher.dispatchEvent("loadEnd");
// showPanel(NoStepPanel) // showPanel(NoStepPanel)
//测试 //测试
// sendTbNet(TbNetName.aaa, {}, (s, res) => { // sendTbNet(TbNetName.aaa, {}, (s, res) => {
...@@ -163,7 +162,7 @@ export class Main { ...@@ -163,7 +162,7 @@ export class Main {
// console.log('navigateToPage pageshop, success,res',s,res) // console.log('navigateToPage pageshop, success,res',s,res)
// }) // })
// }, 5000); // }, 5000);
} }
//在小程序显示时调用onShow //在小程序显示时调用onShow
......
...@@ -3,66 +3,17 @@ import { GDispatcher } from "./Main"; ...@@ -3,66 +3,17 @@ import { GDispatcher } from "./Main";
//接口枚举,包括需要调用淘宝的api,用是否含有兑吧区分,或者单独区分 //接口枚举,包括需要调用淘宝的api,用是否含有兑吧区分,或者单独区分
export enum TbNetName { export enum TbNetName {
navigateToPage = "mine.navigateToPage", navigateToPage = "mine.navigateToPage",
showModal = "mine.showModal", showModal = "mine.showModal",
/** /**
* 埋点统计 到时改名字 * 埋点统计 到时改名字
* activityId params elemType * activityId params elemType
*/ */
trackingReport = "squirrelsAdoptRest2c.trackingReport", trackingReport = "squirrelsAdoptRest2c.trackingReport",
getActivityBaseInfoById= "bubbleSurviva.getActivityBaseInfoById",
/** getActivityBaseInfoById = "bubbleSurviva.getActivityBaseInfoById",
* 获取游戏信息
* activityId
*/
getGameInfo = "babycare.getGameInfo",
/**
* 消耗道具 ,会返回剩余所有道具数量
* activityId type
*/
consumerTools = "babycare.consumerTools",
/**
* 提交分数
* activityId level score stars isVisitSuccess(是否通关)
*/
gameOver = "babycare.gameOver",
/**
* 领取任务奖励
* activityId taskType
*/
receiveTaskRewards = "babycare.receiveTaskRewards",
/**
* 积分兑换道具和体力
* activityId type credits
*/
exchange = "babycare.exchange",
/**
* 根据等级获取奖品列表
* activityId level
*/
getPrizesByLevel = "babycare.getPrizesByLevel",
/**
* 查询用户积分
* activityId
*/
queryCredits = "babycare.queryCredits",
/**
* 开始闯关,会返回体力值
* activityId level
*/
dojoin = "babycare.dojoin",
/**
* 完成任务(浏览商品详情页, 关注店铺)
* activityId taskType
*/
completeTask = "babycare.completeTask",
/**
* 任务列表
* activityId
*/
// getTaskList = "babycare.getTaskList", // getTaskList = "babycare.getTaskList",
///////////////////前端调用接口都加个mine ///////////////////前端调用接口都加个mine
...@@ -125,7 +76,13 @@ export enum TbNetName { ...@@ -125,7 +76,13 @@ export enum TbNetName {
reportAnalytics = "mine.reportAnalytics", reportAnalytics = "mine.reportAnalytics",
// 推出游戏 返回主页 // 推出游戏 返回主页
backToPage = "mine.backToPage" backToPage = "mine.backToPage",
// 获取用户信息
getUserInfo = "mine.getUserInfo",
// 获取奖品信息
getPrizeInfo = "mine.getPrizeInfo"
} }
//返回数据类型,到时再调整 //返回数据类型,到时再调整
......
import { layers } from "../../module/views/layers"
import { Panel } from "../../module/views/Panel"
import { Ins } from "../Ins"
import { GDispatcher } from "../Main"
import { sendTbNet, TbNetName } from "../TaoBaoNet"
import { Tools } from "../Tools"
export class MatchingPanel extends Panel {
bg: FYGE.Sprite
matchImg: FYGE.Sprite
matchImgRes = ["6ffd395c-2bbd-424b-8322-6ffd89f26dc7",
"09ad238c-792e-45f2-98a0-fb64c97fc343",
"8dd8a44b-1d9f-4ef5-8654-a37642ce6c57",
"7e4905a6-b811-4923-820c-57cb725a7341"]
nowM = 0
repeat = 0
initUi() {
this.bg = Ins.initSprite("b896bbc5-e4e1-4161-97c8-6f43b066f30b")
this.addChild(this.bg)
this.x = Ins.stageW - this.width >> 1
this.y = (Ins.stageH - this.height >> 1) + layers.stageOffsetY
//不显示动画
this.isShowing = true
//匹配时间
this.repeat = 5 + Math.floor(10 * Math.random())
this.matchImg = Ins.initSprite(this.matchImgRes[this.nowM])
this.matchImg.x = (this.bg.width - this.matchImg.width >> 1) - 40
this.matchImg.y = 300
this.addChild(this.matchImg)
this.matching()
}
matching() {
if (this.repeat > 0) {
this.repeat--
this.nowM++
if (this.nowM > 3) {
this.nowM = 0
}
this.matchImg.texture = Ins.getRes(this.matchImgRes[this.nowM])
setTimeout(() => {
this.matching()
}, 500)
} else {
this.matchImg.visible = false
this.matchSuc()
}
}
matchSuc() {
let lContainer = new FYGE.Container()
lContainer.y = (this.bg.height >> 1) - 180
let left = Ins.initSprite("d5a0cbd7-6cb5-4dee-9a42-52a907eb6aed")
lContainer.addChild(left)
//头像背景
let leftAvatarBg = Ins.initSprite("2a8ee937-a863-4f5f-89eb-c8be40e0d5c5")
leftAvatarBg.x = 180
leftAvatarBg.y = -25
lContainer.addChild(leftAvatarBg)
//头像
let leftAvatar = FYGE.Sprite.fromUrl(this.data.userImgUrl)
leftAvatar.x = leftAvatarBg.x
leftAvatar.y = -25
lContainer.addChild(leftAvatar)
//遮罩
let lcircle = Tools.getCircle(48, 0xffff00)
lcircle.x = 233
lcircle.y = 27
lContainer.addChild(lcircle)
leftAvatar.mask = lcircle
//昵称
let lnickName = Tools.getText(this.data.userName, 30, "#fff", FYGE.TEXT_ALIGN.RIGHT, 180)
lnickName.y = 40
lContainer.addChild(lnickName)
this.addChild(lContainer)
FYGE.Tween.get(lContainer).set({ x: -150 - lContainer.width }).to({ x: 50 }, 150).to({ x: 0 }, 50)
let rContainer = new FYGE.Container()
rContainer.y = (this.bg.height >> 1) + 150
let right = Ins.initSprite("781f95f5-18e1-49d6-aeb7-0464ddacd279")
rContainer.addChild(right)
rContainer.x = this.bg.width - rContainer.width
//头像背景
let rightAvatarBg = Ins.initSprite("2a8ee937-a863-4f5f-89eb-c8be40e0d5c5")
rightAvatarBg.x = right.width - 180 - rightAvatarBg.width
rightAvatarBg.y = -25
rContainer.addChild(rightAvatarBg)
//头像
let rightAvatar = FYGE.Sprite.fromUrl(this.data.fakeUserImgUrl)
rightAvatar.x = rightAvatarBg.x
rightAvatar.y = -25
rContainer.addChild(rightAvatar)
//遮罩
let rcircle = Tools.getCircle(48, 0xffff00)
rcircle.x = right.width - 233
rcircle.y = 27
rContainer.addChild(rcircle)
rightAvatar.mask = rcircle
//昵称
let rnickName = Tools.getText(this.data.fakeUserName, 30, "#fff", FYGE.TEXT_ALIGN.LEFT, 180)
rnickName.x = right.width - 180
rnickName.y = 40
rContainer.addChild(rnickName)
this.addChild(rContainer)
FYGE.Tween.get(rContainer).set({ x: 900 }).to({ x: this.bg.width - rContainer.width - 50 }, 150).to({ x: this.bg.width - rContainer.width }, 50)
let pk = Ins.initSprite("5bc08e08-54d1-4b67-a146-679c4ce1984d")
pk.x = (this.bg.width - pk.width >> 1) + 5
pk.anchorX = pk.width >> 1
pk.anchorY = pk.height >> 1
pk.y = (this.bg.height - pk.height >> 1) + 35
this.addChild(pk)
FYGE.Tween.get(pk).set({ scaleX: 5, scaleY: 5, alpha: 0 }).wait(100).to({ scaleX: 1, scaleY: 1, alpha: 1 }, 200)
let sq = Ins.initSprite("c1875fdc-c1a1-491a-ba5b-1783f87e8d06")
sq.x = this.bg.width - sq.width >> 1
sq.y = (this.bg.height - sq.height >> 1) + 40
FYGE.Tween.get(sq).set({ alpha: 0 }).to({ alpha: 1 }, 200)
this.addChild(sq)
setTimeout(() => {
this.hidePanel()
GDispatcher.dispatchEvent("MatchCompelete")
}, 1000)
}
}
\ No newline at end of file
import { RES } from "../../module/RES"; import { RES } from "../../module/RES";
import resCanvasList from "../../resCanvasList"; import resCanvasList from "../../resCanvasList";
import { LightCircle } from "./lightCircle";
import { config } from "./XxlConfig";
...@@ -9,51 +11,81 @@ declare interface point { ...@@ -9,51 +11,81 @@ declare interface point {
} }
export default class CircleItem extends FYGE.Sprite { export default class CircleItem extends FYGE.Container {
//类型 //类型
type: number type: number
circleRes = ['2a747211-0210-4215-86a2-a6955b37c45b', '7d1ec658-9371-4d52-b4d7-e75d04037daf', '6a1345f6-969c-4969-8bfb-f4de637df34d', '2e12a9ec-46be-487f-a9cd-550dd0af3746'] circleRes = ['2a747211-0210-4215-86a2-a6955b37c45b', '7d1ec658-9371-4d52-b4d7-e75d04037daf', '6a1345f6-969c-4969-8bfb-f4de637df34d', '2e12a9ec-46be-487f-a9cd-550dd0af3746', 'b022fbdd-8607-435a-a205-19fc3b5123eb']
point: point point: point
index: number index: number
nnnn: number bg: FYGE.Sprite = new FYGE.Sprite()
bg2: FYGE.Sprite = new FYGE.Sprite()
//自身价值
score: number = 0
constructor(type: number, point: point, index: number) { constructor(type: number, point: point, index: number) {
super(); super();
console.log("type:" + type)
this.type = type this.type = type
this.point = { x: point.x + 39, y: point.y + 39 } this.point = { x: point.x + 36.5, y: point.y + 39.5 }
this.x = point.x this.x = point.x
this.y = point.y this.y = point.y
this.index = index this.index = index
this.texture = RES.getRes( this.score = config.score[type]
this.addChild(this.bg2)
this.bg2.alpha = 0.8
this.bg2.anchorX = 36.5
this.bg2.anchorY = 39.5
this.addChild(this.bg)
this.bg.anchorX = 36.5
this.bg.anchorY = 39.5
this.bg2.texture = RES.getRes(
resCanvasList[this.circleRes[type]].url
);
this.bg.texture = RES.getRes(
resCanvasList[this.circleRes[type]].url resCanvasList[this.circleRes[type]].url
); );
} }
toBig() {
console.log("变大")
this.scaleX = 1.1
this.scaleY = 1.1
}
toNormal() { explode(cb) {
this.scaleY = this.scaleX = 1 //上层
FYGE.Tween.get(this.bg).wait(250).to({ scaleX: 0, scaleY: 0 }, 250).call(() => {
this.bg.alpha = 1
this.bg.scaleX = this.bg.scaleY = 1
})
//下层
FYGE.Tween.get(this.bg2).to({ alpha: 0, scaleX: 1.5, scaleY: 1.5 }, 500).call(() => {
this.bg2.alpha = 0.8
this.bg2.scaleX = this.bg2.scaleY = 1
cb()
})
} }
changeConfig(type: number, point: point, index: number) { changeConfig(type: number, point: point, index: number) {
this.type = type this.type = type
this.point = { x: point.x + 39, y: point.y + 39 } this.point = { x: point.x + 36.5, y: point.y + 39.5 }
this.x = point.x this.x = point.x
this.y = point.y this.y = point.y
this.index = index this.index = index
console.log("type:" + type)
this.score = config.score[type]
this.texture = RES.getRes( this.bg2.texture = this.bg.texture = RES.getRes(
resCanvasList[this.circleRes[type]].url resCanvasList[this.circleRes[type]].url
); );
} }
......
import CircleItem from "./CircleItem" import CircleItem from "./CircleItem"
import { LightCircle } from "./lightCircle";
declare interface point { declare interface point {
...@@ -9,6 +10,8 @@ declare interface point { ...@@ -9,6 +10,8 @@ declare interface point {
export class ObjectPool { export class ObjectPool {
_circleItemPool: CircleItem[] = [] _circleItemPool: CircleItem[] = []
_lightCirclePool: LightCircle[] = []
getItem(type: number, ponit: point, index: number): CircleItem { getItem(type: number, ponit: point, index: number): CircleItem {
// console.log(this._circleItemPool.length) // console.log(this._circleItemPool.length)
let co = this._circleItemPool.shift() let co = this._circleItemPool.shift()
...@@ -25,4 +28,18 @@ export class ObjectPool { ...@@ -25,4 +28,18 @@ export class ObjectPool {
} }
this._circleItemPool.push(co) this._circleItemPool.push(co)
} }
getLightCircle(): LightCircle {
let lc = this._lightCirclePool.shift()
return lc || new LightCircle()
}
putLightCircle(lc: LightCircle) {
if (lc.parent) {
lc.parent.removeChild(lc)
}
this._lightCirclePool.push(lc)
}
} }
\ No newline at end of file
import { Ins } from "../Ins"
import { Tools } from "../Tools"
import { LightCircle } from "./lightCircle"
export class Star extends FYGE.Container {
starContainer: FYGE.Container = new FYGE.Container()
bg: FYGE.Sprite = Ins.initSprite("2ce5cca4-0ea6-4460-a30c-6bd80446e38d")
whiteStar: FYGE.Sprite = Ins.initSprite("0bc476b6-e334-40ac-8d60-614febb85885")
pinkStar: FYGE.Sprite = Ins.initSprite("5c5a81d6-4d33-4332-b4d8-a5947eedfa67")
tipText: FYGE.TextField = Tools.getText("1000分", 20)
lightCircle: LightCircle = new LightCircle()
constructor(text: string) {
super()
this.addChild(this.starContainer)
this.starContainer.addChild(this.bg)
this.starContainer.anchorX = this.bg.width >> 1
this.starContainer.anchorY = this.bg.height >> 1
this.starContainer.addChild(this.whiteStar)
this.whiteStar.x = (this.bg.width - this.whiteStar.width) >> 1
this.whiteStar.y = (this.bg.height - this.whiteStar.height) >> 1
this.starContainer.addChild(this.pinkStar)
this.pinkStar.visible = false
this.pinkStar.x = (this.bg.width - this.pinkStar.width) >> 1
this.pinkStar.y = (this.bg.height - this.pinkStar.height) >> 1
this.addChild(this.lightCircle)
this.lightCircle.x = -100 + (this.starContainer.width >> 1)
this.lightCircle.y = -100 + (this.starContainer.height >> 1)
this.tipText.y = 60
this.tipText.text = text
this.addChild(this.tipText)
}
bling() {
this.lightCircle.play()
FYGE.Tween.get(this.starContainer).to({ scaleX: 0.3, scaleY: 0.3 }, 200).call(() => {
this.pinkStar.visible = true
}).to({ scaleX: 1.3, scaleY: 1.3 }, 200).to({ scaleX: 1, scaleY: 1 }, 100)
}
}
\ No newline at end of file
export const config = {
//倒计时时间s
time: 120,
//3关分数
first: 1000,
second: 2000,
third: 3000,
//5种每个球的分数
score: [10, 10, 10, 10, 10]
}
\ No newline at end of file
import { RES } from "../../module/RES";
import { GTool } from "../../module/tools/GTool";
import { Ins } from "../Ins";
export class LightCircle extends FYGE.Sprite {
/**
* 用到的图片库
*/
private static resPool: string[] = [
'da63a36d-3bec-4707-8624-3fbb3dea02ab',
"3456aea7-5f71-4964-a366-89eb2379082e",
"cf8eaf18-c14d-4d4e-96e6-1cd3b8fbbab3",
"512d1a11-0a61-461d-98f9-280188a120b8",
"b38eceeb-780d-4f30-aa29-76a63f0dd24c",
"370ac7a9-8654-4b6d-b58b-ca8ee5d46d4a",
"9c259901-9df9-471e-80ec-d7da2f3079d0",
"c1af4634-b601-48b5-b194-0754f80fcd1b",
"7716e0b7-81ad-4925-97bb-7a0f41be64cb",
"35aa2a64-6f17-4665-8e8a-31b8504081cf",
"8cfb811c-1e3f-4deb-91c2-781f473167c3",
"5edcc725-aa13-4ee0-a7eb-e065d2e8a802"
]
intervalHandler
count = 0
effectFrame = 42
constructor() {
super()
this.mouseChildren = false;
this.mouseEnable = false;
}
play() {
let that = this
that.intervalHandler = setInterval(() => {
that.texture = Ins.getRes(LightCircle.resPool[that.count])
that.count++
if (that.count >= LightCircle.resPool.length) {
clearInterval(this.intervalHandler);
this.count = 0
}
}, that.effectFrame)
}
}
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