Commit 88dfd6e5 authored by Master Q's avatar Master Q

我是傻逼

parent 4510bcfd
{
"success": true
}
\ No newline at end of file
......@@ -10,18 +10,10 @@
"skiingOneCardScore": 2,
"skiingScoreRewardCreditsList": [
{
"score": 100,
"score": 10,
"rewardCredits": 10
},
{
"score": 200,
"rewardCredits": 10
},
{
"score": 500,
"rewardCredits": 40
}
],
"skiingGuideFlag": 0
"skiingGuideFlag": 1
}
}
\ No newline at end of file
{
"success": true,
"message": "",
"code": "",
"data": {
"startId": 1234,
"haveRadish": true
}
}
\ No newline at end of file
{
"success": true,
"message": "",
"code": "",
"data": {
"score": 123,
"maxScore": 234,
"rewardCredits": 10
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -15,17 +15,19 @@
"mock-webpack-plugin": "^2.0.0",
"path": "^0.12.7",
"progress": "^2.0.0",
"psd": "^3.2.0",
"readline": "^1.3.0",
"ts-loader": "^4.0.0",
"tslint": "^5.9.1",
"typescript": "^3.5.1",
"webpack": "^4.1.0",
"webpack-cli": "^3.1.1",
"webpack-dev-server": "^3.1.0",
"webpack-merge": "^4.1.2",
"psd": "^3.2.0",
"readline": "^1.3.0"
"webpack-merge": "^4.1.2"
},
"dependencies": {
"js-md5": "^0.7.3"
},
"dependencies": {},
"scripts": {
"psd": "node scripts/psdH && node scripts/flushRes",
"psdSin": "node scripts/psdHSin",
......
{
"groups": [
{
"keys": "GameSceneBack.png,PrizeCard.png,Rabbit.png,Radish.png,SnowBall.png,Star.png,guide1.png,score+.png,score0.png,score1.png,score2.png,score3.png,score4.png,score5.png,score6.png,score7.png,score8.png,score9.png,雪人.svga",
"keys": "GameOverPanelBack.png,atomphere.png,back.png,cancel-btn.png,confirm-btn.png",
"name": "GameOverPanel"
},
{
"keys": "GameSceneBack.png,PrizeCard.png,Rabbit.png,SnowBall.png,Star.png,countDown-back.png,finalgiftbox-disabled.png,finalgiftbox.png,giftbox-disabled.png,giftbox.png,goal0.png,guide1.png,progress-back.png,progress-point.png,radish-tips.png,score+.png,score-back.png,score0.png,score1.png,score2.png,score3.png,score4.png,score5.png,score6.png,score7.png,score8.png,score9.png,雪人.svga",
"name": "GameScene"
},
{
......@@ -9,11 +13,11 @@
"name": "IndexScene"
},
{
"keys": "comCloseBtn.png,com_light.png,com_light2.png,index_sound_off.png,index_sound_on.png,percennt0.png,percennt1.png,percennt2.png,percennt3.png,percennt4.png,percennt5.png,percennt6.png,percennt7.png,percennt8.png,percennt9.png,percenntp.png,toastBg.png,waitingBg.png,waitingRot.png",
"keys": "Radish.png,comCloseBtn.png,com_light.png,com_light2.png,gn0.png,gn1.png,gn2.png,gn3.png,gn4.png,gn5.png,gn6.png,gn7.png,gn8.png,gn9.png,gnm.png,index_sound_off.png,index_sound_on.png,toastBg.png,waitingBg.png,waitingRot.png",
"name": "common"
},
{
"keys": "左右建筑.svga,游戏倒计时 2.svga,游戏兔子.svga,游戏道路循环.svga,道具光环.svga,首页兔子.svga,首页背景动画.svga",
"keys": "左右建筑.svga,游戏倒计时 2.svga,游戏兔子.svga,游戏道路循环.svga,获奖弹窗.svga,道具光环.svga,首页兔子.svga,首页背景动画.svga",
"name": "svga"
}
],
......
......@@ -21,6 +21,11 @@ export default class Clock {
}
restart() {
this.reset()
this.start()
}
stop() {
this.running = false;
......
......@@ -10,6 +10,7 @@ import { SkinJson } from "./SkinJson";
import { G_EVENT } from "./common/G_EVENT";
import { Tools } from "./Tools";
import IndexScene from './scenes/IndexScene';
import { GameOverPanel } from "./components/GameOverPanel";
/**
* 全局事件,为了和小程序交互
......@@ -183,6 +184,11 @@ export class Main {
// vtodo 是否是新手
changeScene(IndexScene);
// showPanel(GameOverPanel, {
// "score": 11,
// "maxScore": 11,
// "rewardCredits": 11
// })
}
}
......
export const ResJson = {
"groups": [
{
"keys": "GameSceneBack.png,PrizeCard.png,Rabbit.png,Radish.png,SnowBall.png,Star.png,guide1.png,score+.png,score0.png,score1.png,score2.png,score3.png,score4.png,score5.png,score6.png,score7.png,score8.png,score9.png,雪人.svga",
"name": "GameScene"
"keys": "GameOverPanelBack.png,atomphere.png,back.png,cancel-btn.png,confirm-btn.png",
"name": "GameOverPanel",
"atlas": {
"back.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 865,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 865,
"ro": false
},
"atomphere.png": {
"x": 754,
"y": 2,
"w": 750,
"h": 791,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 791,
"ro": false
},
"GameOverPanelBack.png": {
"x": 2,
"y": 869,
"w": 616,
"h": 599,
"ox": 0,
"oy": 0,
"sw": 616,
"sh": 599,
"ro": false
},
"cancel-btn.png": {
"x": 620,
"y": 869,
"w": 258,
"h": 95,
"ox": 0,
"oy": 0,
"sw": 258,
"sh": 95,
"ro": true
},
"confirm-btn.png": {
"x": 620,
"y": 1129,
"w": 258,
"h": 95,
"ox": 0,
"oy": 0,
"sw": 258,
"sh": 95,
"ro": true
}
}
},
{
"keys": "GameSceneBack.png,PrizeCard.png,Rabbit.png,SnowBall.png,Star.png,countDown-back.png,finalgiftbox-disabled.png,finalgiftbox.png,giftbox-disabled.png,giftbox.png,goal0.png,guide1.png,progress-back.png,progress-point.png,radish-tips.png,score+.png,score-back.png,score0.png,score1.png,score2.png,score3.png,score4.png,score5.png,score6.png,score7.png,score8.png,score9.png,雪人.svga",
"name": "GameScene",
"atlas": {
"GameSceneBack.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 1624,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 1624,
"ro": false
},
"guide1.png": {
"x": 754,
"y": 2,
"w": 750,
"h": 1624,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 1624,
"ro": false
},
"radish-tips.png": {
"x": 1506,
"y": 2,
"w": 592,
"h": 186,
"ox": 0,
"oy": 0,
"sw": 592,
"sh": 186,
"ro": true
},
"progress-back.png": {
"x": 1506,
"y": 596,
"w": 459,
"h": 130,
"ox": 0,
"oy": 0,
"sw": 459,
"sh": 130,
"ro": true
},
"Rabbit.png": {
"x": 2,
"y": 1628,
"w": 228,
"h": 315,
"ox": 0,
"oy": 0,
"sw": 228,
"sh": 315,
"ro": true
},
"score-back.png": {
"x": 1506,
"y": 1057,
"w": 240,
"h": 55,
"ox": 0,
"oy": 0,
"sw": 240,
"sh": 55,
"ro": true
},
"SnowBall.png": {
"x": 1506,
"y": 1299,
"w": 176,
"h": 209,
"ox": 0,
"oy": 0,
"sw": 176,
"sh": 209,
"ro": false
},
"PrizeCard.png": {
"x": 1506,
"y": 1510,
"w": 185,
"h": 189,
"ox": 0,
"oy": 0,
"sw": 185,
"sh": 189,
"ro": false
},
"Star.png": {
"x": 319,
"y": 1701,
"w": 138,
"h": 158,
"ox": 0,
"oy": 0,
"sw": 138,
"sh": 158,
"ro": true
},
"countDown-back.png": {
"x": 1563,
"y": 1057,
"w": 80,
"h": 93,
"ox": 0,
"oy": 0,
"sw": 80,
"sh": 93,
"ro": true
},
"goal0.png": {
"x": 319,
"y": 1628,
"w": 64,
"h": 55,
"ox": 0,
"oy": 0,
"sw": 64,
"sh": 55,
"ro": true
},
"finalgiftbox-disabled.png": {
"x": 1638,
"y": 596,
"w": 49,
"h": 49,
"ox": 0,
"oy": 0,
"sw": 49,
"sh": 49,
"ro": false
},
"finalgiftbox.png": {
"x": 1638,
"y": 647,
"w": 49,
"h": 49,
"ox": 0,
"oy": 0,
"sw": 49,
"sh": 49,
"ro": false
},
"score0.png": {
"x": 1658,
"y": 698,
"w": 33,
"h": 46,
"ox": 0,
"oy": 0,
"sw": 33,
"sh": 46,
"ro": false
},
"score3.png": {
"x": 1658,
"y": 746,
"w": 33,
"h": 46,
"ox": 0,
"oy": 0,
"sw": 33,
"sh": 46,
"ro": false
},
"score6.png": {
"x": 1658,
"y": 794,
"w": 31,
"h": 46,
"ox": 0,
"oy": 0,
"sw": 31,
"sh": 46,
"ro": false
},
"score8.png": {
"x": 1658,
"y": 842,
"w": 32,
"h": 46,
"ox": 0,
"oy": 0,
"sw": 32,
"sh": 46,
"ro": false
},
"score9.png": {
"x": 1658,
"y": 890,
"w": 32,
"h": 46,
"ox": 0,
"oy": 0,
"sw": 32,
"sh": 46,
"ro": false
},
"score2.png": {
"x": 1658,
"y": 938,
"w": 32,
"h": 45,
"ox": 0,
"oy": 0,
"sw": 32,
"sh": 45,
"ro": false
},
"score5.png": {
"x": 1658,
"y": 985,
"w": 33,
"h": 45,
"ox": 0,
"oy": 0,
"sw": 33,
"sh": 45,
"ro": false
},
"score1.png": {
"x": 1658,
"y": 1032,
"w": 30,
"h": 44,
"ox": 0,
"oy": 0,
"sw": 30,
"sh": 44,
"ro": false
},
"score4.png": {
"x": 376,
"y": 1628,
"w": 35,
"h": 44,
"ox": 0,
"oy": 0,
"sw": 35,
"sh": 44,
"ro": false
},
"score7.png": {
"x": 1658,
"y": 1078,
"w": 32,
"h": 44,
"ox": 0,
"oy": 0,
"sw": 32,
"sh": 44,
"ro": false
},
"giftbox-disabled.png": {
"x": 413,
"y": 1628,
"w": 37,
"h": 43,
"ox": 0,
"oy": 0,
"sw": 37,
"sh": 43,
"ro": false
},
"giftbox.png": {
"x": 452,
"y": 1628,
"w": 37,
"h": 43,
"ox": 0,
"oy": 0,
"sw": 37,
"sh": 43,
"ro": false
},
"score+.png": {
"x": 1658,
"y": 1124,
"w": 34,
"h": 34,
"ox": 0,
"oy": 0,
"sw": 34,
"sh": 34,
"ro": false
},
"progress-point.png": {
"x": 376,
"y": 1674,
"w": 20,
"h": 20,
"ox": 0,
"oy": 0,
"sw": 20,
"sh": 20,
"ro": false
}
}
},
{
"keys": "index-scene-back.png,index_back_btn.png,index_rule_btn.png,lucky-ani.png,start-btn.png",
"name": "IndexScene"
"name": "IndexScene",
"atlas": {
"index-scene-back.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 1624,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 1624,
"ro": false
},
"lucky-ani.png": {
"x": 754,
"y": 2,
"w": 751,
"h": 761,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 952,
"ro": false
},
"start-btn.png": {
"x": 754,
"y": 765,
"w": 454,
"h": 118,
"ox": 0,
"oy": 0,
"sw": 454,
"sh": 118,
"ro": false
},
"index_back_btn.png": {
"x": 1210,
"y": 765,
"w": 131,
"h": 53,
"ox": 0,
"oy": 0,
"sw": 131,
"sh": 53,
"ro": false
},
"index_rule_btn.png": {
"x": 1343,
"y": 765,
"w": 130,
"h": 53,
"ox": 0,
"oy": 0,
"sw": 130,
"sh": 53,
"ro": false
}
}
},
{
"keys": "comCloseBtn.png,com_light.png,com_light2.png,index_sound_off.png,index_sound_on.png,percennt0.png,percennt1.png,percennt2.png,percennt3.png,percennt4.png,percennt5.png,percennt6.png,percennt7.png,percennt8.png,percennt9.png,percenntp.png,toastBg.png,waitingBg.png,waitingRot.png",
"name": "common"
"keys": "Radish.png,comCloseBtn.png,com_light.png,com_light2.png,gn0.png,gn1.png,gn2.png,gn3.png,gn4.png,gn5.png,gn6.png,gn7.png,gn8.png,gn9.png,gnm.png,index_sound_off.png,index_sound_on.png,toastBg.png,waitingBg.png,waitingRot.png",
"name": "common",
"atlas": {
"com_light.png": {
"x": 2,
"y": 2,
"w": 746,
"h": 756,
"ox": 0,
"oy": 0,
"sw": 746,
"sh": 756,
"ro": false
},
"toastBg.png": {
"x": 750,
"y": 2,
"w": 460,
"h": 130,
"ox": 0,
"oy": 0,
"sw": 460,
"sh": 130,
"ro": true
},
"waitingBg.png": {
"x": 2,
"y": 760,
"w": 160,
"h": 180,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 180,
"ro": true
},
"com_light2.png": {
"x": 184,
"y": 760,
"w": 138,
"h": 140,
"ox": 0,
"oy": 0,
"sw": 138,
"sh": 140,
"ro": false
},
"Radish.png": {
"x": 750,
"y": 464,
"w": 63,
"h": 85,
"ox": 0,
"oy": 0,
"sw": 63,
"sh": 85,
"ro": true
},
"comCloseBtn.png": {
"x": 750,
"y": 529,
"w": 72,
"h": 72,
"ox": 0,
"oy": 0,
"sw": 72,
"sh": 72,
"ro": false
},
"index_sound_off.png": {
"x": 750,
"y": 603,
"w": 62,
"h": 62,
"ox": 0,
"oy": 0,
"sw": 62,
"sh": 62,
"ro": false
},
"index_sound_on.png": {
"x": 814,
"y": 603,
"w": 62,
"h": 62,
"ox": 0,
"oy": 0,
"sw": 62,
"sh": 62,
"ro": false
},
"waitingRot.png": {
"x": 824,
"y": 529,
"w": 56,
"h": 56,
"ox": 0,
"oy": 0,
"sw": 56,
"sh": 56,
"ro": false
},
"gn0.png": {
"x": 184,
"y": 902,
"w": 18,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 18,
"sh": 24,
"ro": true
},
"gn1.png": {
"x": 210,
"y": 902,
"w": 17,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 17,
"sh": 24,
"ro": true
},
"gn2.png": {
"x": 236,
"y": 902,
"w": 18,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 18,
"sh": 24,
"ro": true
},
"gn3.png": {
"x": 262,
"y": 902,
"w": 17,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 17,
"sh": 24,
"ro": true
},
"gn4.png": {
"x": 837,
"y": 464,
"w": 19,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 19,
"sh": 24,
"ro": true
},
"gn5.png": {
"x": 288,
"y": 902,
"w": 18,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 18,
"sh": 24,
"ro": true
},
"gn6.png": {
"x": 314,
"y": 902,
"w": 18,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 18,
"sh": 24,
"ro": true
},
"gn7.png": {
"x": 837,
"y": 485,
"w": 18,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 18,
"sh": 24,
"ro": false
},
"gn8.png": {
"x": 857,
"y": 485,
"w": 18,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 18,
"sh": 24,
"ro": false
},
"gn9.png": {
"x": 750,
"y": 667,
"w": 18,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 18,
"sh": 24,
"ro": true
},
"gnm.png": {
"x": 863,
"y": 464,
"w": 10,
"h": 19,
"ox": 0,
"oy": 0,
"sw": 10,
"sh": 19,
"ro": false
}
}
},
{
"keys": "左右建筑.svga,游戏倒计时 2.svga,游戏兔子.svga,游戏道路循环.svga,道具光环.svga,首页兔子.svga,首页背景动画.svga",
"keys": "左右建筑.svga,游戏倒计时 2.svga,游戏兔子.svga,游戏道路循环.svga,获奖弹窗.svga,道具光环.svga,首页兔子.svga,首页背景动画.svga",
"name": "svga"
}
],
"path": "./resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/template/1639627848/resource/"
}
\ No newline at end of file
......@@ -110,7 +110,15 @@ export enum TbNetName {
closeCustomLoading = 'mine.closeCustomLoading',
// 首页接口
doIndex = 'snow.index'
doIndex = 'snow.doIndex',
doSubmit = 'snow.doSubmit',
doStart = 'snow.doStart',
doModifySkiingGuideFlag = 'snow.doModifySkiingGuideFlag',
judgeLogin = 'mine.judgeLogin',
showRuleModal = 'mine.showRuleModal',
back = 'mine.back',
indexSceneVisible="mine.indexSceneVisible",
turnBgm = 'mine.turnBgm'
}
export enum TBBgm {
......@@ -161,7 +169,7 @@ export function sendTbNet(
//网络超时
// let waitObj;
//@ts-ignore 本地开发,直接取数据
if (!my) {
if (window.location.port == "8099") {
const netInfo = netName.split(".");
var url = `../../mock/miniTb/${netInfo[0]}/${netInfo[1]}.json`;
fetchAsync(url)
......
......@@ -60,8 +60,12 @@ export default class UI {
public static Sp(
parent: Container,
imageName: string,
x: number = 0, y: number = 0
x: number = 0, y: number = 0,
anchorCenter: boolean = false
): Sprite {
if (!/\./i.test(imageName)) {
imageName += '.png'
}
var texture = RES.getRes(imageName)
var sprite
if (texture) {
......@@ -69,6 +73,9 @@ export default class UI {
} else {
sprite = Sprite.fromUrl(imageName)
}
if (anchorCenter) {
sprite.anchorTexture.set(0.5)
}
sprite.position.set(x, y);
parent && parent.addChild(sprite);
return sprite;
......
......@@ -62,6 +62,7 @@ export default class CircleProgressBar extends FYGE.Container {
this.backCircle.beginStroke(this.opt.backColor, this.opt.lineWidth)
this.backCircle.arc(this.circlePointer.x, this.circlePointer.y, radius, 0, 2*Math.PI)
this.backCircle.endStroke()
this.backCircle.alpha = 0.5
}
strokeProgress(v) {
......@@ -71,18 +72,19 @@ export default class CircleProgressBar extends FYGE.Container {
}
var radius = this.opt.radius
var lw = this.opt.lineWidth
// FYGE.LINE_CAP.ROUND
if (!this.progressCircle) {
this.progressCircle = this.addChild(new FYGE.Shape)
this.progressCircle.anchorX = radius + lw
this.progressCircle.anchorY = radius + lw
this.progressCircle.rotation = -90 // 好看点
this.progressCircle.beginStroke(this.opt.circleColor, this.opt.lineWidth, FYGE.LINE_CAP.ROUND)
this.progressCircle.arc(radius + lw, radius + lw, radius, 0, 2*Math.PI * v)
this.progressCircle.beginStroke(this.opt.circleColor, this.opt.lineWidth)
this.progressCircle.arc(radius + lw, radius + lw, radius, 0, 2*Math.PI * v, true)
this.progressCircle.endStroke()
} else {
this.progressCircle.clear()
this.progressCircle.beginStroke(this.opt.circleColor, this.opt.lineWidth, FYGE.LINE_CAP.ROUND)
.arc(this.circlePointer.x, this.circlePointer.y, radius, 0, 2*Math.PI * v)
this.progressCircle.beginStroke(this.opt.circleColor, this.opt.lineWidth)
.arc(this.circlePointer.x, this.circlePointer.y, radius, 0, 2*Math.PI * v, true)
.endStroke()
}
}
......
......@@ -84,7 +84,7 @@ export class ProgressBar extends FYGE.Container {
var length = this._value * this.maxLength
this.upImage.clear()
.beginFill(this.barColor)
.drawRoundedRect(0, 0, length, this.pHeight, 10)
.drawRoundedRect(0, 1, length, this.pHeight - 2, (this.pHeight - 2) / 2)
.endFill();
}
}
......@@ -3,11 +3,11 @@
* @param time 毫秒计算
* @param onChange 根据时间倒计时的执行函数
*/
export function countDown(time: number, onChange: (t: number) => void) {
export function countDown(time: number, onChange: (t: number) => void, onCallBack?: Function) {
var timeObj = { a: time };
FYGE.Tween.get(timeObj, {
onChange: () => {
onChange(timeObj.a)
onChange && onChange(timeObj.a)
// this.timeTxt.text = "" + Math.round(timeObj.a / 1000) + "s"
// if (timeObj.a < 100) {
// FYGE.Tween.removeTweens(timeObj)
......@@ -16,6 +16,9 @@ export function countDown(time: number, onChange: (t: number) => void) {
}
})
.to({ a: 0 }, time)
.call(() => {
onCallBack && onCallBack()
})
//返回一个,可以中途取消
return timeObj
}
......
import { changeScene } from './../../module/ctrls/index';
import { RES } from "../../module/RES";
import { Panel } from "../../module/views/Panel";
import UI from "../UI";
import IndexScene from '../scenes/IndexScene';
interface GameOverPanelInfer {
"score": number,
"maxScore": number,
"rewardCredits": number,
onGameRestart?: Function
}
export class GameOverPanel extends Panel {
closeBtn: FYGE.Button;
get groupNames(): string[] {
return ['GameOverPanel']
}
onGameRestart: Function
constructor(data: GameOverPanelInfer) {
super()
this.onGameRestart = data.onGameRestart
}
RoleContainer: FYGE.Container
initUi(): void {
const RoleContainer = this.RoleContainer = UI.Ctn(this, (750 - 616) / 2, (1624 -600) / 2)
UI.Sp(RoleContainer, 'atomphere.png', -50, -300)
RoleContainer.addChild(new FYGE.MovieClip(RES.getRes('获奖弹窗.svga')))
.position.set(-70, -330)
UI.Sp(RoleContainer, 'GameOverPanelBack')
// this.closeBtn = UI.Btn(RoleContainer, 'comCloseBtn.png')
// this.closeBtn.position.set( 560, -100)
UI.Btn(RoleContainer, 'cancel-btn.png', function() {
this.hidePanel()
changeScene(IndexScene)
}, this, 40, 430)
UI.Btn(RoleContainer, 'confirm-btn.png', async function() {
this.onGameRestart()
this.hidePanel()
// changeScene(IndexScene)
}, this, 320, 430)
}
start(data?: GameOverPanelInfer): void {
UI.Txt(this.RoleContainer, `获得${data.rewardCredits}活力值`, 36, '#914533', FYGE.TEXT_ALIGN.CENTER, 616, 0, 145)
UI.Txt(this.RoleContainer, `${data.score}`, 48,'#e34539', FYGE.TEXT_ALIGN.CENTER, 305, 0, 310, true)
UI.Txt(this.RoleContainer, `${data.maxScore}`, 48,'#e34539', FYGE.TEXT_ALIGN.CENTER, 385, 265, 310, true)
}
}
\ No newline at end of file
interface NormalScoreGoalCompInfer {
score?: number
}
export class NormalScoreGoalComp extends FYGE.Container {
score
constructor(data: NormalScoreGoalCompInfer) {
super()
this.initUi()
}
initUi() {
}
}
\ No newline at end of file
import { Tools } from './../Tools';
import { RES } from "../../module/RES"
import { Pos } from "./GameScene/ConveyorBelt"
import { GDispatcher } from '../Main';
import { ConveyorBeltGameEle } from './GameScene/ConveyorBeltConfig';
import UI from '../UI';
export interface GameEleInfer {
type: number,
......@@ -8,18 +13,51 @@ export interface GameEleInfer {
export class GameEle extends FYGE.Sprite {
_resType: string // 游戏元素type src
_resType2: string | number // 游戏元素类型 0, 1
_resType2: string | number // 游戏元素类型 0, 1, 2
_score: number
constructor(config:GameEleInfer) {
super(RES.getRes(config.res))
this._resType = config.res
this._resType2 = config.type
this._score = config.score
// const l = UI.Sp(this, 'com_light2.png')
// this.setChildIndex(l, -100)
}
onCollision() {
if (this._resType2 == 1) {
console.log('加分:', this.x, this.y)
GDispatcher.dispatchEvent('update-score', {
score: this._score
})
this.onShowScoreAni(`+${this._score}`, {
x: this.x,
y: this.y
})
} else if (this._resType2 == 0) {
GDispatcher.dispatchEvent('game-over')
} else {
GDispatcher.dispatchEvent('rabbit-buff')
}
}
onShowLightRatation() {
}
onShowScoreAni(scoreText: string, pos: Pos) {
const BitmapTextTextures = Tools.getNumTextures('score')
BitmapTextTextures['+'] = RES.getRes('score+.png')
const BitmapText = new FYGE.BitmapText(BitmapTextTextures)
this.parent.parent.addChild(BitmapText)
BitmapText.text = scoreText
BitmapText.alpha = 0
BitmapText.position.set(pos.x, pos.y)
FYGE.Tween.get(BitmapText)
.to({ y: pos.y - 150, alpha: 1 }, 600)
.wait(300)
.to({alpha: 0}, 300)
.call(() => {
BitmapText.destroy()
})
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import { ConveyorBeltGameEle } from './ConveyorBeltConfig'
import { RES } from '../../../module/RES';
import { getRandomArrayElements } from '../../Tools';
import { RabbitPos } from './GameSceneConfig';
import { GDispatcher } from '../../Main';
// 非障碍元素
const CollsionEle = ConveyorBeltGameEle.filter(item => item.type)
......@@ -23,12 +24,12 @@ interface ConveyorBeltInfer {
export class ConveyorBelt extends FYGE.Container {
ConveyorBeltConfigData: ConveyorBeltInfer
speed: number = 200 // 传送带速度 这里就是 y方向上的速度
speed: number = 200 // 传送带速度 这里就是 y方向上的速度 200 - 650
spt: number // 每隔多长时间会出现下一个
spl: number = 300 // 距离
clock: Clock
tanValue: number // tan 值
conveyorItems: Array<any> = [] // 传送带上的 item
conveyorItems: Array<GameEle> = [] // 传送带上的 item
isStarted: boolean = false // 是否开始
totalDisY: number
startY: number
......@@ -74,6 +75,7 @@ export class ConveyorBelt extends FYGE.Container {
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.onUpdate, this)
}
// 因为碰撞或者移动出去的 销毁
popConveyor(item: GameEle, didu?: boolean) {
if (didu) {
item.onCollision()
......@@ -83,6 +85,16 @@ export class ConveyorBelt extends FYGE.Container {
GPool.takeIn(item['_resType'], item)
}
onReset() {
for (var i = this.conveyorItems.length- 1; i >= 0; i--) {
this.popConveyor(this.conveyorItems[i])
}
}
popConveyorItems(item: GameEle) {
spliceArrItem(this.conveyorItems, item)
}
destroy(): void {
super.destroy()
this.removeEvents
......@@ -105,6 +117,7 @@ export class ConveyorBelt extends FYGE.Container {
this.isStarted = true
// getRandomArrayElements
this.onRenderGameEleData()
this.clock.restart()
}
stop() {
......@@ -114,6 +127,10 @@ export class ConveyorBelt extends FYGE.Container {
onRenderGameEleData() {
const item = getRandomArrItem(ConveyorBeltGameEle)
if (item.type) {
if (item.type == 2) {
GDispatcher.dispatchEvent('show-radish')
ConveyorBeltGameEle.pop()
}
this.onInitGameElement(item)
} else {
const isShouldRenderObstacle = this.ConveyorBeltConfigData.obstacleFunc()
......
......@@ -12,8 +12,12 @@ export const ConveyorBeltGameEle = [
{
type: 0,
res: 'SnowBall.png'
}, {
type: 2, // TODO
}
]
export const specialGameEle = [
{
type: 2,
res: 'Radish.png'
}
]
\ No newline at end of file
import { Tools } from './../../Tools';
import { changeScene } from './../../../module/ctrls/index';
import { GPool } from './../../../module/tools/GPool';
import { GameEle } from './../GameEle';
import { ProgressBar } from './../../common/ProgressBar';
import { RES } from '../../../module/RES';
import { GDispatcher } from '../../Main';
import UI from '../../UI';
import { onceFnc, padStart, spliceArrItem } from '../../utils/utils';
import { NewGuyScene } from '../NewGuyScene/NewGuyScene';
import { Scene } from './../../../module/views/Scene';
import { ConveyorBelt, Pos } from './ConveyorBelt';
import { RabbitPos } from './GameSceneConfig';
import { RabbitPos, GameCfg } from './GameSceneConfig';
import { getTbData, sendTbNet, TbNetName } from '../../TaoBaoNet';
import { layers } from '../../../module/views/layers';
import { countDown } from '../../common/countDown';
import { ConveyorBeltGameEle, specialGameEle } from './ConveyorBeltConfig';
import { showPanel } from '../../../module/ctrls';
import { GameOverPanel } from '../../components/GameOverPanel';
import IndexScene from '../IndexScene';
import CircleProgressBar from '../../common/CircleProgressBar';
const MD5 = require('js-md5')
export class RadishCountDown extends FYGE.Container {
allTime: number = 0
constructor(data: number) {
super()
this.allTime = data
this.initUi()
}
_value: number = 0
get value() {
return this._value
}
set value(v) {
this._value = v
this.CircleProgressBar.value = v
}
CircleProgressBar: CircleProgressBar
bitmapTexture: FYGE.BitmapText
initUi() {
var radish = UI.Sp(this, 'Radish.png')
radish.scale.set(.7)
radish.position.set(-20, -30)
var c = this.CircleProgressBar= this.addChild(new CircleProgressBar({
circleColor: 0xcfdf74,
backColor: 0x212c43,
radius: 40,
lineWidth: 16
}))
var textures = Tools.getNumTextures('gn')
textures[':'] = RES.getRes('gnm.png')
this.bitmapTexture = this.addChild(new FYGE.BitmapText(textures))
this.bitmapTexture.position.set(0, 50)
// this.bitmapTexture.scale
c.value = 0
}
reStart() {
this.CircleProgressBar.value = 0
this.bitmapTexture.text = '00:00'
FYGE.Tween.get(this.CircleProgressBar, {
onChange: () => {
this.bitmapTexture.text = `00:0${5 - (this.CircleProgressBar.value * this.allTime / 1000) >> 0}`
}
})
.to({value: 1}, this.allTime)
}
stop() {
FYGE.Tween.removeTweens(this.CircleProgressBar)
}
}
function SetMouseEventNode(con: FYGE.Container) {
con.mouseChildren = false
con.mouseEnable = false
}
export class GameScene extends Scene {
Rabbit: FYGE.SvgaAni
Rabbit: FYGE.MovieClip
RabbitCont: FYGE.Container
touchStartX: number | null
rabbitPosXList = [-60, 250, 560]
_currRabbitIndex = 1
conveyorList: Array<ConveyorBelt> = []
GameStatus: number = 0 // 未开始0 1 一开始
GameStatus: number = 0 // 未开始0 1 开始 2萝卜
operationCont: FYGE.Container
runway: FYGE.SvgaAni
buildings: FYGE.SvgaAni
runway: FYGE.MovieClip
buildings: FYGE.MovieClip
isNewGuy: boolean
_score: number
scoreText: FYGE.TextField
skiingScoreRewardCreditsList: Array<any> // 目标分数
maxScore: number = 0
goalList: Array<FYGE.Sprite> = [] // 目标
currProgressIns: ProgressBar
currGoalIndex: number = 0
GameDataFromInfer: any
cdt: FYGE.TextField
RadishCountDown: RadishCountDown
get score() {
return this._score
}
set score(v) {
if (v === undefined) return
this._score = v
this.scoreText.text = padStart(v, 4, '0') + '分'
this.currProgressIns.value = v / this.maxScore
const mi = this.skiingScoreRewardCreditsList.findIndex(item => item.score > v)
for (let index = this.currGoalIndex; index < (mi == -1 ? this.goalList.length : mi); index++) {
// @ts-ignore
this.goalList[index].texture = RES.getRes(this.goalList[index]._goalImage+'.png')
}
}
get currRabbitIndex() {
return this._currRabbitIndex
......@@ -35,6 +132,13 @@ export class GameScene extends Scene {
FYGE.Tween.removeTweens(this.RabbitCont)
FYGE.Tween.get(this.RabbitCont)
.to({x: this.rabbitPosXList[v]}, 300 * 310 / Math.abs(this.rabbitPosXList[v] - this.RabbitCont.x))
// for (var i = this.TweenList.length - 1; i >= 0; i --) {
// const ins = this.TweenList[i]
// FYGE.Tween.removeTweens(ins)
// spliceArrItem(this.TweenList, ins)
// this.onTween2Rabbit(ins)
// }
}
get groupNames(): string[] {
......@@ -42,20 +146,20 @@ export class GameScene extends Scene {
}
initUi() {
this.GameDataFromInfer = getTbData(TbNetName.doIndex).data
GameCfg.totalTime = this.GameDataFromInfer.skiingCountdownSeconds
UI.Sp(this, 'GameSceneBack.png')
const runway = this.runway = this.addChild(new FYGE.SvgaAni(RES.getRes('游戏道路循环.svga')))
const runway = this.runway = this.addChild(new FYGE.MovieClip(RES.getRes('游戏道路循环.svga')))
runway.mouseChildren = false
runway.mouseEnable = false
// runway.fps = 10
const buildings = this.buildings = this.addChild(new FYGE.SvgaAni(RES.getRes('左右建筑.svga')))
const buildings = this.buildings = this.addChild(new FYGE.MovieClip(RES.getRes('左右建筑.svga')))
buildings.mouseChildren = false
buildings.mouseEnable = false
// buildings.fps = 10
const func1 = (d: any) => {
this.addChild(d)
}
this.conveyorList.push(this.onInitConveyor({
x: 420,
......@@ -81,53 +185,206 @@ export class GameScene extends Scene {
y: 1624
}))
// @ts-ignore
// window.c = runway
// setTimeout(() => {
// this.onStart()
// }, 300)
const ScoreCont = UI.Ctn(this, 280, 180)
UI.Sp(ScoreCont, 'score-back.png')
this.scoreText = UI.Txt(ScoreCont, '0', 36, '#ffffff', FYGE.TEXT_ALIGN.LEFT, 400, 100, 5, true)
this.onInitNormalScoreGoalBoard()
// @ts-ignore
const RabbitCont = this.RabbitCont = UI.Ctn(this, 250, RabbitPos.y)
const Rabbit = this.Rabbit = RabbitCont.addChild(new FYGE.SvgaAni(RES.getRes('游戏兔子.svga')))
RabbitCont.addChild(new FYGE.SvgaAni(RES.getRes('道具光环.svga')))
// this.addChild(new FYGE.SvgaAni(RES.getRes('游戏兔子.svga')))
const Rabbit = this.Rabbit = RabbitCont.addChild(new FYGE.MovieClip(RES.getRes('游戏兔子.svga')))
const CountDownCom = UI.Ctn(this, 650, 180)
UI.Sp(CountDownCom, 'countDown-back.png')
const cdt = this.cdt = UI.Txt(CountDownCom, `${getTbData(TbNetName.doIndex).data.skiingCountdownSeconds}s`, 30, '#b1231c', FYGE.TEXT_ALIGN.CENTER, 80, 0, 36, true)
// this.addChild(new FYGE.MovieClip(RES.getRes('游戏兔子.svga')))
// Rabbit.anchor.set(0.5)
// Rabbit.position.set()
// this.setChildIndex(Rabbit, 1)
// var c = this.addChild(new RadishCountDown(5000))
// c.position.set(690, 370)
}
/**
* 初始化 分数目标版
*/
onInitNormalScoreGoalBoard() {
const board = UI.Ctn(this, (750 - 459) / 2, 250)
UI.Sp(board, 'progress-back.png')
const p = this.currProgressIns = board.addChild(new ProgressBar(0xffd900, {
showProgressText: false,
type: 'fill',
typeColor: 0x63211b,
width: 390,
height: 12
}))
p.position.set(33, 80)
UI.Sp(p, 'progress-point.png', -10, -4)
UI.Sp(p, 'goal0', 0, -40, true)
const skiingScoreRewardCreditsList = this.skiingScoreRewardCreditsList = getTbData(TbNetName.doIndex).data.skiingScoreRewardCreditsList
const finalScore = this.maxScore = skiingScoreRewardCreditsList.slice(-1)[0].score
for (let i = 0; i < skiingScoreRewardCreditsList.length; i++) {
const goal = skiingScoreRewardCreditsList[i];
UI.Sp(p, 'progress-point.png',goal.score / finalScore * 390 - 10, -4)
const gi = UI.Sp(p, i < skiingScoreRewardCreditsList.length -1 ? 'giftbox-disabled' : 'finalgiftbox-disabled', goal.score / finalScore * 390 - 20, -60)
UI.Txt(p, `${goal.score}分`, 24, '#c14c3b', FYGE.TEXT_ALIGN.LEFT, 200, goal.score / finalScore * 390 - 20, 15)
// @ts-ignore
gi._goalImage = i < skiingScoreRewardCreditsList.length -1 ? 'giftbox' : 'finalgiftbox'
this.goalList.push(gi)
}
}
/**
* 初始化 倒计时
*/
CountDownTween: any
onInitCountDownCom() {
const totalTime = GameCfg.totalTime
const addRadish = onceFnc(() => {
// 添加萝卜
ConveyorBeltGameEle.push(...specialGameEle)
})
this.CountDownTween = countDown(totalTime * 1000, (t) => {
const ct = (t / 1000 >> 0)
this.cdt.text = ct+ 's'
if (t > totalTime * 1 / 3 * 1000 ) {
this.conveyorList.forEach(item => {
item.speed = 200 + (650 - 200) * (totalTime * 1000 - t) / (totalTime * 1000)
})
}
if (ct === totalTime - this.RadishTimeout) {
addRadish()
}
}, () => {
this.onGameOver()
})
}
RadishTimeout: number
start(data: any) {
super.start()
this.isNewGuy = data.isNewGuy
this.onStop()
if (this.isNewGuy) {
this.onStop()
this.RabbitCont.visible = false
this.addChild(new NewGuyScene(() => {
this.addChild(new NewGuyScene(async () => {
await sendTbNet(TbNetName.doModifySkiingGuideFlag, {
flag: 1
})
this.RabbitCont.visible = true
this.onStart()
}))
} else {
// @ts-ignore
window.test = this.onShowRadishTips.bind(this)
this.onStart()
}
}
onStop() {
this.RadishTimeout = null
this.GameStatus = 0
this.Rabbit.stop()
this.runway.stop()
this.buildings.stop()
this.conveyorList.forEach(item => item.stop())
this.CountDownTween && FYGE.Tween.removeTweens(this.CountDownTween)
}
CountDownSvga: FYGE.MovieClip
onStart() {
this.GameStatus = 1
this.Rabbit.play()
this.runway.play()
this.buildings.play()
this.conveyorList.forEach(item => item.start())
this.score = 0
this.cdt.text = `${getTbData(TbNetName.doIndex).data.skiingCountdownSeconds}s`
this.conveyorList.forEach(con => con.onReset())
let s: FYGE.MovieClip
if (this.CountDownSvga) {
s = this.CountDownSvga
} else {
s = this.CountDownSvga = this.addChild(new FYGE.MovieClip(RES.getRes('游戏倒计时 2.svga')))
s.position.set(layers.stageCenterX - 150, layers.stageCenterY - 100)
}
s.startAniRange(1, s.totalFrames, 1, () => {
this.GameStatus = 1
this.Rabbit.play()
this.runway.play()
this.buildings.play()
this.onInitCountDownCom() // 开始倒计时
this.conveyorList.forEach(item => item.start())
if (getTbData(TbNetName.doStart).data.haveRadish) {
this.RadishTimeout = Math.floor(Math.random() * 6 + 5)
}
})
// s.play(1, () => {
// this.GameStatus = 1
// this.Rabbit.play()
// this.runway.play()
// this.buildings.play()
// this.onInitCountDownCom() // 开始倒计时
// this.conveyorList.forEach(item => item.start())
// if (getTbData(TbNetName.doStart).data.haveRadish) {
// this.RadishTimeout = Math.floor(Math.random() * 6 + 5)
// }
// })
}
async onGameOver() {
this.onStop()
const {success, data} = await sendTbNet(TbNetName.doSubmit, {
startId: getTbData(TbNetName.doStart).data.startId,
score: this.score,
signStr: MD5(`${11}_${this.score}_1696BD3E5BB915A0`)
})
if (success) {
showPanel(GameOverPanel, Object.assign(data, {
onGameRestart: this.onGameRestart
}))
}
}
onGameRestart = async () => {
const { success, data } = await sendTbNet(TbNetName.doStart)
if (success) {
this.onStart()
} else {
changeScene(IndexScene)
}
}
/**
* 修改buff
* @param cfg
*/
onChangeBuffStatus(cfg?:any) {
if (cfg) {
if (!this.RadishCountDown) {
this.RadishCountDown = this.addChild(new RadishCountDown(5000))
this.RadishCountDown.position.set(690, 370)
}
this.RadishCountDown.visible = true
this.RadishCountDown.reStart()
this.GameStatus = 2
const t = (this.RabbitCont.children[1] || this.RabbitCont.addChild(new FYGE.MovieClip(RES.getRes('道具光环.svga'))));
t.position.set(-110, 40)
t.visible = true
countDown(5000, null, () => {
this.onChangeBuffStatus(false)
})
} else {
this.RadishCountDown.visible = false
this.GameStatus = 1
this.RabbitCont.children[1] && (this.RabbitCont.children[1].visible = false)
}
}
onInitConveyor(from: Pos, to: Pos) {
......@@ -141,6 +398,26 @@ export class GameScene extends Scene {
return conveyor
}
/**
* 显示逻辑提示
*/
onShowRadishTips() {
const tips = UI.Ctn(this, layers.stageCenterX - 592 / 2, 400)
UI.Sp(tips, 'radish-tips.png')
var r = tips.addChild(new GameEle(specialGameEle[0]))
r.position.set((tips.width - r.width) / 2, 30)
tips.anchorX = 592 / 2
tips.anchorY = tips.height / 2
tips.scale.set(0)
FYGE.Tween.get(tips)
.to({ scaleX: 1, scaleY: 1 }, 600, FYGE.Ease.quadIn)
.wait(1500)
.to({ alpha: 0 }, 300)
.call(() => {
tips.visible = false
})
}
/**
* 放游戏元素显示在上面
*/
......@@ -153,16 +430,33 @@ export class GameScene extends Scene {
}
initEvents(): void {
console.log('initEvents')
this.stage.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onTouchStart, this)
this.stage.addEventListener(FYGE.MouseEvent.MOUSE_UP, this.onTouchUp, this)
this.addEventListener(FYGE.Event.ENTER_FRAME, this.onUpdate, this)
GDispatcher.addEventListener('update-score', this.onUpdateScore, this)
GDispatcher.addEventListener('game-over', this.onGameOver, this)
GDispatcher.addEventListener('show-radish', this.onShowRadishTips, this)
GDispatcher.addEventListener('rabbit-buff', this.onChangeBuffStatus, this)
}
removeEvents(): void {
this.stage.removeEventListener(FYGE.MouseEvent.MOUSE_UP, this.onTouchUp, this)
this.stage.removeEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onTouchStart, this)
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.onUpdate, this)
GDispatcher.removeEventListener('update-score', this.onUpdateScore, this)
GDispatcher.removeEventListener('show-radish', this.onShowRadishTips, this)
GDispatcher.removeEventListener('game-over', this.onGameOver, this)
GDispatcher.removeEventListener('rabbit-buff', this.onChangeBuffStatus, this)
}
/**
* 更新score
* @param e
*/
onUpdateScore(e) {
console.log(e.data)
this.score += e.data.score
}
onTouchStart(e) {
......@@ -188,7 +482,7 @@ export class GameScene extends Scene {
onCollsion(c1: FYGE.Container,c2: FYGE.Container) {
if (!c1 || !c2) return false
const con1 = this.getCollsionGameEleData(c1)
const con2 = this.getCollsionData(c2)
const con2 = this.getCollsionData()
const abs = Math.abs
if (abs(con1.x - con2.x) < (con1.width + con2.width) / 2 && abs(con1.y - con2.y) < (con1.height + con2.height) / 2 ) {
return true
......@@ -201,13 +495,13 @@ export class GameScene extends Scene {
* @param cont
* @returns
*/
getCollsionData(cont: FYGE.Container) {
const h = cont.height
getCollsionData() {
const h = 330
return {
x: cont.x,
y: cont.y + 3 * h / 4,
width: cont.width,
height: cont.height / 4
x: this.rabbitPosXList[this.currRabbitIndex],
y: RabbitPos.y + 3 * h / 4,
width: 228,
height: h / 4
}
}
......@@ -219,17 +513,44 @@ export class GameScene extends Scene {
width: cont.width,
height: cont.height / 4
}
}
}
TweenList: Array<any> = []
onTween2Rabbit = (ge: GameEle) => {
const rabbitData = this.getCollsionData()
FYGE.Tween.get(ge).to({
x: rabbitData.x + rabbitData.width / 2,
y: rabbitData.y + rabbitData.height / 2
}, 300).call(() => {
this.onGameEleCollision(ge)
// spliceArrItem(this.TweenList, ge)
})
// this.TweenList.push(ge)
}
onGameEleCollision(item: GameEle) {
item.parent.setChildIndex(item, 1)
item.onCollision()
item.visible = false
FYGE.Tween.removeTweens(item)
GPool.takeIn(item['_resType'], item)
}
onUpdate() {
if (!this.GameStatus) return
for (let i = 0; i < this.conveyorList.length; i++) {
const items = this.conveyorList[i].conveyorItems
for (const item of items) {
const flag = this.onCollsion(item, this.RabbitCont)
if (flag) {
this.conveyorList[i].popConveyor(item, true)
if (item._resType2 && this.GameStatus == 2 && item.y >= RabbitPos.y - 100) {
this.conveyorList[i].popConveyorItems(item)
this.onTween2Rabbit(item)
} else {
const flag = this.onCollsion(item, this.RabbitCont)
if (flag) {
this.conveyorList[i].popConveyor(item, true)
}
}
}
}
......
export const RabbitPos = {
y: 1100
}
export const GameCfg = {
totalTime: 3000,
radishTime: 5000
}
\ No newline at end of file
......@@ -4,8 +4,13 @@ import { Scene } from "../../module/views/Scene";
import UI from "../UI";
import { RES } from '../../module/RES';
import { GDispatcher } from '../Main';
import { GameScene } from './GameScene/GameScene';
import { getTbData, TbNetName } from '../TaoBaoNet';
import { GameScene, RadishCountDown } from './GameScene/GameScene';
import { getTbData, sendTbNet, TbNetName } from '../TaoBaoNet';
import CircleProgressBar from '../common/CircleProgressBar';
export const IndexSceneConfig = {
ms: false
}
export default class IndexScene extends Scene {
startBtn: FYGE.Button
......@@ -32,10 +37,10 @@ export default class IndexScene extends Scene {
initUi() {
this.indexSceneData = getTbData(TbNetName.doIndex).data
UI.Sp(this, 'index-scene-back.png')
const ani = this.addChild(new FYGE.SvgaAni(RES.getRes('首页兔子.svga')))
ani.position.set((750 - ani.width) / 2, 0)
const ani = this.addChild(new FYGE.MovieClip(RES.getRes('首页兔子.svga')))
ani.position.set(0, 0)
this.addChild(new FYGE.SvgaAni(RES.getRes('首页背景动画.svga')))
this.addChild(new FYGE.MovieClip(RES.getRes('首页背景动画.svga')))
const startBtnCont = UI.Ctn(this, 0, 1270)
this.startBtn = UI.Btn(startBtnCont, 'start-btn.png')
......@@ -48,8 +53,16 @@ export default class IndexScene extends Scene {
this.musicBtn = UI.Btn(this, 'index_sound_on.png')
this.musicBtn.position.set(750 - this.musicBtn.width - 10, 310)
// TODO
this.ms = true
// var c = this.addChild(new RadishCountDown(5000))
// c.position.set(690, 370)
this.ms = IndexSceneConfig.ms
}
start(data?: any): void {
super.start()
sendTbNet(TbNetName.judgeLogin)
sendTbNet(TbNetName.indexSceneVisible, {visible: true})
}
initEvents(): void {
......@@ -59,31 +72,43 @@ export default class IndexScene extends Scene {
this.backBtn.addEventListener(FYGE.MouseEvent.CLICK, this.onBackActivity, this)
}
onGameStart() {
console.log('GameStart')
changeScene(GameScene, {
isNewGuy: !this.indexSceneData.skiingGuideFlag
})
async onGameStart() {
const { success, data } = await sendTbNet(TbNetName.doStart)
if (success) {
sendTbNet(TbNetName.indexSceneVisible, {visible: false})
changeScene(GameScene, {
isNewGuy: !this.indexSceneData.skiingGuideFlag,
haveRadish: data.haveRadish
})
}
}
onRuleShowPanel() {
GDispatcher.dispatchEvent('showRulePanel')
sendTbNet(TbNetName.showRuleModal, {
ruleText: getTbData(TbNetName.doIndex).data.gameRuleDesc
})
}
onBackActivity() {
GDispatcher.dispatchEvent('backActivity')
sendTbNet(TbNetName.back)
}
onMusicChangeStatus() {
this.ms = !this.ms
}
onMusicOperation(v) {
onMusicOperation(v: boolean) {
this.musicBtn.texture = RES.getRes(v ? 'index_sound_on.png' : 'index_sound_off.png')
IndexSceneConfig.ms = v
if (v) {
sendTbNet(TbNetName.turnBgm, {
play: v
})
} else {
sendTbNet(TbNetName.turnBgm, {
play: v
})
}
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
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