Commit e7ff8f68 authored by 熊东起's avatar 熊东起

first

parent 2b77eccb
......@@ -48,7 +48,7 @@
<script>
window.addEventListener("load", function() {
//是否完成新手
const scheduleFinished =0;
const scheduleFinished =1;
//目标分数
const targetScore = 120;
//是否音乐
......
......@@ -28,6 +28,10 @@ class Layers extends FYGE.Container {
//有些时候,定宽的时候,部分layer置顶,部分居中,再处理
//为了都置顶和置左,stage的方式永远居中视窗,要么改stage永远左上为00
// this[arr[i]].y = this.stageOffsetY;
if (this.stageHeight > 1624) {
this[arr[i]].scaleY = this.stageHeight / 1624;
this[arr[i]].y = this.stageOffsetY;
}
//如果定宽这里没必要,肯定是0
// this[arr[i]].x = this.stageOffsetX;//去掉,定高时就居中了
this.addChild(this[arr[i]]);
......
This diff is collapsed.
This diff is collapsed.
import { DataMgr } from "./DataMgr";
import { MConfigs } from "../Global/MConfigs";
import GuideMask from "../game/GuideMask";
import { GDispatcher } from "../HideAndSeekMain";
import TimerCountMgr from "./TimerCountMgr";
// import Pot from "../game/Pot";
// import Food from "../game/Food";
......@@ -62,10 +64,13 @@ export default class GuideMgr {
DataMgr.game.pause = true;
this.currentGuideMask = new GuideMask();
this.currentGuideMask.onClick = (context) => {
//新手引导
GDispatcher.dispatchEvent("new-guide");
//@ts-ignore
context.dispose();
this.currentGuideMask = null;
DataMgr.game.pause = false;
TimerCountMgr.instance.drawTimerCount();
if (isEnd) {
this.guideFlag = false;
}
......
......@@ -2,14 +2,14 @@ import { Howl } from "howler";
export const starMP3Name = {
bgm:
"https://yun.duiba.com.cn/aurora/assets/9ace0b569cbc43c61eb18a84f5d36dcd60423819.mp3",
shoot:
"https://yun.duiba.com.cn/aurora/assets/78d86205f37e736f922bf476a4b278dd4c5d029c.mp3",
collect:
"https://yun.duiba.com.cn/aurora/assets/564b39022bfe147f9eb4bdf6a6b95142186df265.mp3",
dong:
"https://yun.duiba.com.cn/aurora/assets/f259780c1de05136d15c0aa4b5a72b91ff871f16.mp3",
boom:
"https://yun.duiba.com.cn/aurora/assets/ed6f41a38d28e03acf791dd3672c0364e6754821.mp3",
ready:
"https://yun.duiba.com.cn/aurora/assets/ed1a835c5f52a84528059255984e0f794d550fea.mp3",
catch:
"https://yun.duiba.com.cn/aurora/assets/cf8b2b06aa17e0768b90494d70f92628efb009e0.mp3",
goout:
"https://yun.duiba.com.cn/aurora/assets/a9db68b83e3f13df12332e895d3162642ba99bdf.mp3",
start:
"https://yun.duiba.com.cn/aurora/assets/513b33f7e391b6531ce2c6d51cbd94599d80978c.mp3",
};
export class SoundMgr {
......
......@@ -634,5 +634,5 @@ export const ResJson = {
"name": "hideAndSeekSvga"
}
],
"path": "https://yun.duiba.com.cn/db_games/activity/kickball-feile/1601605847/resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/kickball-feile/1602989302/resource/"
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ import { PoolElement } from "../Component/Pool";
import { MConfigs } from "../Global/MConfigs";
import { MConst } from "../Global/MConst";
import { DataMgr } from "../Mgr/DataMgr";
import { SoundMgr } from "../Mgr/SoundMgr";
import MoveObjcet from "./MoveObject";
/** 纹理宽高 */
const textureSize = {
......@@ -56,6 +57,7 @@ export default class Cat extends MoveObjcet implements PoolElement {
y: initPoint.y - this.catSVGA.videoHeight / 2-15,
};
this.addEventListener(FYGE.MouseEvent.CLICK, this.onClickCat, this);
SoundMgr.instance.playSound("goout",false);
}
/** 猫咪上移 */
......@@ -86,6 +88,7 @@ export default class Cat extends MoveObjcet implements PoolElement {
/** 点击猫咪 */
onClickCat() {
if (this.catType == CatType.COMMON) {
SoundMgr.instance.playSound("catch",false);
this.isMoved = true;
console.log("888", this.id);
//改变状态 TODO
......
......@@ -43,7 +43,7 @@ export default class GuideMask extends FYGE.Container {
//描述
let descText = Tool.getText(
"点击从纸箱中钻出的猫咪\n把猫咪从纸箱中抓出来",
"小猫咪在纸箱中钻来钻去\n摸到调皮的它,就能赢得金币哦~",
30,
"#ffffff",
FYGE.TEXT_ALIGN.CENTER,
......@@ -81,7 +81,7 @@ export default class GuideMask extends FYGE.Container {
//描述
let descText = Tool.getText(
"在有限的时间内\n尽可能的达成目标分数",
"要在限定时间内\n达到目标分数才能获得奖励哦~",
30,
"#ffffff",
FYGE.TEXT_ALIGN.CENTER,
......
......@@ -308,11 +308,9 @@ export default class HideAndSeek extends FYGE.Container {
/** 创建猫咪 */
private createCats() {
//新手引导
if (
GuideMgr.instance.guideFlag == true &&
MConst.options.scheduleFinished == 1
) {
if (MConst.options.scheduleFinished == 0) {
GuideMgr.instance.drawFirstGuide(true);
MConst.options.scheduleFinished = 1;
}
// console.log(")))", MConst.tickSeconds * 1000, this.timer);
let idArr = GameFun.appearRandomId(
......@@ -342,7 +340,7 @@ export default class HideAndSeek extends FYGE.Container {
let cat = this.catPool.spwan(id, currentContainer);
let catPoint = MConfigs.catPoint[id];
cat.init(catPoint, id);
console.log("猫咪位置", cat.x, cat.y, id);
// console.log("猫咪位置", cat.x, cat.y, id);
this.createBubbleCD = MConst.CatGroupCd;
});
}
......@@ -367,7 +365,7 @@ export default class HideAndSeek extends FYGE.Container {
}
/** 分数加1 */
onAddScore(catX: number,catY: number){
onAddScore(catX: number, catY: number) {
var addCount = Tool.getText(
`+1`,
40,
......@@ -380,10 +378,10 @@ export default class HideAndSeek extends FYGE.Container {
addCount.alpha = 1;
this.node.addChild(addCount);
FYGE.Tween.get(addCount)
.to({y:catY-80,alpha:0},500)
.call(() => {
addCount && this.node.removeChild(addCount);
});
.to({ y: catY - 80, alpha: 0 }, 500)
.call(() => {
addCount && this.node.removeChild(addCount);
});
}
/** 游戏暂停 */
......@@ -408,6 +406,7 @@ export default class HideAndSeek extends FYGE.Container {
if (result.data.leftTimes > 0) {
showPanel(GameFailPanel, { isAgain: true });
GDispatcher.dispatchEvent("showBuried", { md: 41 });
GDispatcher.dispatchEvent("showBuried", { md: 53 });
} else {
showPanel(GameFailPanel, { isAgain: false });
GDispatcher.dispatchEvent("showBuried", { md: 43 });
......@@ -426,6 +425,7 @@ export default class HideAndSeek extends FYGE.Container {
glodCoin: result.data.goldenCorn,
});
GDispatcher.dispatchEvent("showBuried", { md: 42 });
GDispatcher.dispatchEvent("showBuried", { md: 54 });
}
}
}
......
import { RES } from "../../module/RES";
import { SoundMgr } from "../Mgr/SoundMgr";
/** 倒计时 */
export default class TimerCount extends FYGE.Container {
......@@ -25,13 +26,73 @@ export default class TimerCount extends FYGE.Container {
private countDown(callback: () => void) {
let allIn = new FYGE.Container();
this.addChild(allIn);
//加入SVGA
let readySvga = new FYGE.MovieClip(RES.getRes("ready-1-2-3.svga"));
allIn.addChild(readySvga);
readySvga.stop();
SoundMgr.instance.playSound("ready",false);
// //加入SVGA
// let readySvga = new FYGE.MovieClip(RES.getRes("ready-1-2-3.svga"));
// allIn.addChild(readySvga);
// readySvga.stop();
readySvga.startAniRange(0, readySvga.totalFrames, 1, () => {
callback && callback();
});
// readySvga.startAniRange(0, readySvga.totalFrames, 1, () => {
// callback && callback();
// SoundMgr.instance.playSound("start",false);
// });
//背景
var timeBg = new FYGE.Sprite(RES.getRes("timerCountBg.png"));
timeBg.anchorTexture.set(0.5, 0.5);
timeBg.x = 750 / 2;
timeBg.y = 1624 / 2;
timeBg.alpha = 1;
allIn.addChild(timeBg);
var fourImages = [];
var fourTextures = [
"cat_ready.png",
"cat_timer_3.png",
"cat_timer_2.png",
"cat_timer_1.png",
];
for (var i = 0; i < fourTextures.length; i++) {
var t: FYGE.Texture = RES.getRes(fourTextures[i]);
var im = new FYGE.Sprite(t);
//都需要居中
im.anchorTexture.set(0.5, 0.5);
im.x = 750 / 2;
im.y = 1624 / 2;
im.alpha = 0;
fourImages.push(im);
allIn.addChild(im);
}
//如果背景音乐开着的话先关闭
// if (getBgOn()) stopBg();
for (let i = 0; i < 4; i++) {
let im = fourImages[i];
let delta = i * 1000;
let t = FYGE.Tween.get(im);
t.wait(delta)
.set({ alpha: 1, scaleX: 0.1, scaleY: 0.1 })
.to({ scaleX: 1, scaleY: 1 }, 500, FYGE.Ease.backOut)
.wait(500);
if (i == 3) {
t.call(() => {
callback && callback();
SoundMgr.instance.playSound("start",false);
})
.to({ alpha: 0 }, 200)
.call(() => {
//执行完销毁吧,浏览器自己回收吧
// allIn.destroy();
this.removeChild(allIn);
// if (getBgOn()) playBg();
});
} else {
t.set({ alpha: 0 });
}
if (i == 0) {
t.call(() => {
timeBg.alpha = 1;
});
}
}
}
}
......@@ -8,14 +8,14 @@ export namespace MConst {
export const countDown = 1 * 60;//倒计时时间
export let tickSeconds = 60;//倒计时
export const CatGroupCd = 2000;//貓咪出現間隔
export const CatGroupCd = 1800;//貓咪出現間隔
export const CatSplitVelocityY = 8.8;//貓出現速度
export const CatGavity = 0.02//猫咪加速
export const CatInitOffetY = 220;//猫咪初始化偏移量
export const CatAppearProudDis = 1000;//猫咪出现嘚瑟间隔--不能点
export const CatWaitTime = 1000;//嘚瑟-猫咪缩回去
export const CatAppearProudDis = 800;//猫咪出现嘚瑟间隔--不能点
export const CatWaitTime = 300;//嘚瑟-猫咪缩回去
export const CatHideTime = 800;//猫咪缩回去时间
export let options = {
scheduleFinished: null,
......
......@@ -29,28 +29,28 @@ export class GameFailPanel extends Panel {
//数据
const { isAgain } = this.data;
// var isAgain = false;//是否只有一颗 按钮
// var isAgain = true;//是否只有一颗 按钮
//描述
let title = Tool.getText(
`${isAgain ? "不想失去奖励" : "猫咪累了"}`,
`${isAgain ? "不想失去奖励?" : "猫咪累了"}`,
38,
"#333333",
FYGE.TEXT_ALIGN.CENTER,
230
280
);
this.addChild(title);
title.position.set(260, 820);
title.position.set(240, 820);
//获得奖励
let getPrizeText = Tool.getText(
`${isAgain ? "不如再试一次" : "等等再来玩"}`,
`${isAgain ? "那再试一次吧~" : "过会儿再来陪它玩吧~"}`,
32,
`${isAgain ? "#3b8edd" : "#333333"}`,
FYGE.TEXT_ALIGN.CENTER,
230
400
);
this.addChild(getPrizeText);
getPrizeText.position.set(260, 880);
getPrizeText.position.set(180, 880);
//看猫
this.seeCat = new FYGE.Button(RES.getRes("cat_seecat.png"));
......@@ -86,7 +86,9 @@ export class GameFailPanel extends Panel {
//看猫咪
onClickSeeCat() {
if (!this.againBtn.visible) {
GDispatcher.dispatchEvent("clickBuried", { md: 40 });
GDispatcher.dispatchEvent("clickBuried", { md: 43 });
}else{
GDispatcher.dispatchEvent("clickBuried", { md: 53 });
}
GDispatcher.dispatchEvent("hideCat-see-cat");
this.hidePanel();
......
......@@ -36,18 +36,18 @@ export class GameSuccessPanel extends Panel {
//数据
const { isAgain, glodCoin } = this.data;
// var isAgain = true;
// var isAgain = true,glodCoin=100;
//描述
let title = Tool.getText(
"达成目标分数",
"太棒了,目标达成!",
34,
"#333333",
FYGE.TEXT_ALIGN.CENTER,
230
320
);
this.addChild(title);
title.position.set(270, 780);
title.position.set(240, 780);
//获得奖励
let getPrizeText = Tool.getText(
"获得奖励",
......@@ -62,7 +62,7 @@ export class GameSuccessPanel extends Panel {
//金币
let coin = new FYGE.Sprite(RES.getRes("cat_coin.png"));
this.addChild(coin);
coin.position.set(315, 900);
coin.position.set(330, 900);
let coinText = Tool.getText(
`x${glodCoin}`,
......@@ -72,7 +72,7 @@ export class GameSuccessPanel extends Panel {
90
);
this.addChild(coinText);
coinText.position.set(365, 908);
coinText.position.set(360, 908);
//爱心
// let love = new FYGE.Sprite(RES.getRes("bubble_love.png"));
// this.addChild(love);
......@@ -119,6 +119,7 @@ export class GameSuccessPanel extends Panel {
//等等再来玩
onClickAwait() {
GDispatcher.dispatchEvent("hideCat-await");
GDispatcher.dispatchEvent("clickBuried", { md: 54 });
this.hidePanel();
}
......@@ -128,7 +129,7 @@ export class GameSuccessPanel extends Panel {
if (this.againBtn.visible) {
GDispatcher.dispatchEvent("clickBuried", { md: 40 });
} else {
GDispatcher.dispatchEvent("clickBuried", { md: 40 });
GDispatcher.dispatchEvent("clickBuried", { md: 42 });
}
GDispatcher.dispatchEvent("hideCat-share");
......
......@@ -33,6 +33,7 @@ export class GameScenes extends Scene {
if (!this.game) {
this.game = new HideAndSeek(this);
}
if (MConst.options.scheduleFinished == 1)
TimerCountMgr.instance.drawTimerCount();
//设置隐藏属性和改变可见属性的事件的名称
let hidden: string,
......
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