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

first

parent d17d9f4a
[1015/093634.432:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
[1018/100252.685:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
......@@ -48,13 +48,13 @@
<script>
window.addEventListener("load", function() {
//是否完成新手
const scheduleFinished =0;
const scheduleFinished =1;
//目标分数
const targetScore = 20;
//是否音乐
const isMusic = true;
//时间
let tickSeconds = 10;
let tickSeconds = 60;
//获取canvas
var canvas = document.getElementById("canvas");
canvas.width = document.body.clientWidth * (window.devicePixelRatio || 1)
......
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from "../ctrls/sceneCtrl";
......@@ -21,49 +20,66 @@ class Layers extends FYGE.Container {
"_popupLayer",
"_toastLayer",
"_topLayer",
"_shareLayer"
"_shareLayer",
];
for (var i = 0; i < arr.length; i++) {
this[arr[i]] = new FYGE.Container();
//有些时候,定宽的时候,部分layer置顶,部分居中,再处理
//为了都置顶和置左,stage的方式永远居中视窗,要么改stage永远左上为00
// this[arr[i]].y = this.stageOffsetY;
console.log(this.stageHeight);
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._sceneLayer.y = this.stageOffsetY
//初始化场景层级
SceneCtrl.instance.init(this.sceneLayer)
SceneCtrl.instance.init(this.sceneLayer);
//初始化弹框层级
PanelCtrl.instance.init(this.popupLayer)
PanelCtrl.instance.init(this.popupLayer);
}
/**
* 底图所在层级,比如统一的背景
*/
get bottomLayer() { return this._bottomLayer }
get bottomLayer() {
return this._bottomLayer;
}
/**
* 场景
*/
get sceneLayer() { return this._sceneLayer }
get sceneLayer() {
return this._sceneLayer;
}
/**
* 弹框
*/
get popupLayer() { return this._popupLayer }
get popupLayer() {
return this._popupLayer;
}
/**
* toast所在层级
*/
get toastLayer() { return this._toastLayer }
get toastLayer() {
return this._toastLayer;
}
/**
* 顶层,比如统一标题栏等
*/
get topLayer() { return this._topLayer }
get topLayer() {
return this._topLayer;
}
/**
* 分享引导层
*/
get shareLayer() { return this._shareLayer }
get shareLayer() {
return this._shareLayer;
}
/**
* 舞台信息都放在layers里吧
* 舞台可见高度,初始化后才能使用
......@@ -111,5 +127,5 @@ export function destroyLayers() {
//所有层级移除,init会重新建
layers.removeChildren();
//从父级stage移除自己,init会重新加
if (layers.parent) layers.parent.removeChild(layers)
if (layers.parent) layers.parent.removeChild(layers);
}
This diff is collapsed.
This diff is collapsed.
{
"groups": [
{
"keys": "cat_drop.svga,cat_getfish.svga,cat_jumpstart.svga,cat_over.svga,cat_setup.svga,cat_sky.svga,cat_spake.svga,high_bg.svga,high_ready.svga,high_timer_1.svga,high_timer_2.svga,high_timer_3.svga",
"keys": "cat_drop.svga,cat_getfish.svga,cat_jiazi.svga,cat_jumpstart.svga,cat_over.svga,cat_setup.svga,cat_sky.svga,cat_spake.svga,high_bg.svga",
"name": "catHighSvga"
},
{
......@@ -17,7 +17,7 @@
"name": "gameSuccessPanel"
},
{
"keys": "cat_house.png,cat_jiazi.png,cat_shadow.png,fish.png,high_bg.jpg,high_cat_common.png,high_down.png,high_fish.png,high_global_scor.png,high_ground.png,high_hetun.png,high_pointer.png,high_ready.png,high_score_0.png,high_score_1.png,high_score_2.png,high_score_3.png,high_score_4.png,high_score_5.png,high_score_6.png,high_score_7.png,high_score_8.png,high_score_9.png,high_start.png,high_timer_1.png,high_timer_2.png,high_timer_3.png,high_tv.png,high_yaohaung.png,timerCountBg.png",
"keys": "cat_house.png,cat_jiazi.png,cat_shadow.png,fish.png,high_bg.jpg,high_cat_common.png,high_clock.png,high_down.png,high_fish.png,high_global_score.png,high_ground.png,high_hetun.png,high_pointer.png,high_ready.png,high_scorebg.png,high_score_0.png,high_score_1.png,high_score_2.png,high_score_3.png,high_score_4.png,high_score_5.png,high_score_6.png,high_score_7.png,high_score_8.png,high_score_9.png,high_start.png,high_timer_1.png,high_timer_2.png,high_timer_3.png,high_tv.png,high_yaohaung.png,score_high_0.png,score_high_1.png,score_high_2.png,score_high_3.png,score_high_4.png,score_high_5.png,score_high_6.png,score_high_7.png,score_high_8.png,score_high_9.png,timerCountBg.png",
"name": "stackHigh"
}
],
......
resource/stackHigh/high_ready.png

49.1 KB | W: | H:

resource/stackHigh/high_ready.png

42.5 KB | W: | H:

resource/stackHigh/high_ready.png
resource/stackHigh/high_ready.png
resource/stackHigh/high_ready.png
resource/stackHigh/high_ready.png
  • 2-up
  • Swipe
  • Onion skin
resource/stackHigh/high_timer_1.png

9.9 KB | W: | H:

resource/stackHigh/high_timer_1.png

14.3 KB | W: | H:

resource/stackHigh/high_timer_1.png
resource/stackHigh/high_timer_1.png
resource/stackHigh/high_timer_1.png
resource/stackHigh/high_timer_1.png
  • 2-up
  • Swipe
  • Onion skin
resource/stackHigh/high_timer_2.png

21.3 KB | W: | H:

resource/stackHigh/high_timer_2.png

26.2 KB | W: | H:

resource/stackHigh/high_timer_2.png
resource/stackHigh/high_timer_2.png
resource/stackHigh/high_timer_2.png
resource/stackHigh/high_timer_2.png
  • 2-up
  • Swipe
  • Onion skin
resource/stackHigh/high_timer_3.png

27.7 KB | W: | H:

resource/stackHigh/high_timer_3.png

32.6 KB | W: | H:

resource/stackHigh/high_timer_3.png
resource/stackHigh/high_timer_3.png
resource/stackHigh/high_timer_3.png
resource/stackHigh/high_timer_3.png
  • 2-up
  • Swipe
  • Onion skin
import { DataMgr } from "./DataMgr";
import { MConfigs } from "../Global/MConfigs";
import GuideMask from "../game/GuideMask";
import { GDispatcher } from "../StackHighMain";
import TimerCountMgr from "./TimerCountMgr";
// import Pot from "../game/Pot";
// import Food from "../game/Food";
......@@ -44,15 +46,20 @@ export default class GuideMgr {
private currentGuideMask: GuideMask = null;
//first
public drawFirstGuide(isEnd: boolean = false) {
public async drawFirstGuide(isEnd: boolean = false) {
DataMgr.game.pause = true;
this.currentGuideMask = new GuideMask();
this.currentGuideMask.onClick = (context) => {
//新手引导
GDispatcher.dispatchEvent("new-guide");
console.log("888")
//@ts-ignore
context.dispose();
this.currentGuideMask = null;
DataMgr.game.pause = false;
DataMgr.game.newGuideOver();
// TimerCountMgr.instance.drawTimerCount();
if (isEnd) {
this.guideFlag = false;
}
......
This diff is collapsed.
import { RES } from "../../module/RES";
import { layers } from "../../module/views/layers";
import { MConst } from "../Global/MConst";
import { DataMgr } from "../Mgr/DataMgr";
const blockPng = {
catHouse: "cat_house.png",
catJiazi: "cat_jiazi.png",
......@@ -10,7 +11,8 @@ const blockPng = {
export class Block extends FYGE.Container {
public dir: -1 | 1; //叠块高度
private blockBitmap: FYGE.Sprite;
private blockName: string = "catHouse"; //叠块名
// private blockSvga: FYGE.MovieClip;
public blockName: string = "catHouse"; //叠块名
public currentScore: number = 1;
constructor() {
super();
......@@ -20,6 +22,12 @@ export class Block extends FYGE.Container {
blockBitmap.anchorY = blockBitmap.height / 2;
this.addChild(blockBitmap);
this.x = 750 / 2 - blockBitmap.width / 2;
// let blockSvga = new FYGE.MovieClip(RES.getRes("cat_jiazi.svga"));
// this.addChild(blockSvga);
// blockSvga.anchorX = blockSvga.videoWidth / 2;
// blockSvga.anchorY = blockSvga.videoHeight / 2;
// blockSvga.visible = false;
// this.blockSvga = blockSvga;
}
/** init 初始化 */
......@@ -28,11 +36,26 @@ export class Block extends FYGE.Container {
this.currentScore = id+1;
this.dir = Math.random() > 0.5 ? 1 : -1;
this.blockName = MConst.blockName[id];
if(id == 1){
this.blockBitmap.visible = false;
// this.blockSvga.visible = true;
//架子svga
let blockSvga = new FYGE.MovieClip(RES.getRes("cat_jiazi.svga"));
this.addChild(blockSvga);
blockSvga.anchorX = blockSvga.videoWidth / 2;
blockSvga.anchorY = blockSvga.videoHeight / 2;
blockSvga.startAniRange(0,blockSvga.totalFrames,0,()=>{});
// console.log("这个svga高度+++++++++",blockSvga.videoHeight,this.height);
}else{
this.blockBitmap.visible = true;
this.blockBitmap.texture = RES.getRes(blockPng[this.blockName]);
console.log(this.blockName)
}
// console.log(this.blockName)
}
/** 叠块飞入 */
onMove(index) {
onMove(index,lastBlockName) {
let self = this;
this.visible = true;
this.x =
this.dir > 0
......@@ -52,6 +75,9 @@ export class Block extends FYGE.Container {
MConst.blockEnterTimer *
(Math.random() > 0.5 ? 1 : -1);
console.log("时间++", duration);
if(lastBlockName == ""){
duration = 1500;
}
// let globalX =
// this.dir > 0
// ? -this.dir * MConst.blockConfig[this.blockName][0] -
......@@ -60,7 +86,9 @@ export class Block extends FYGE.Container {
let globalX = 750 / 2 - this.blockBitmap.width / 2;
console.log("目标位置++", this.dir, globalX, 750);
return new Promise((resolve) => {
FYGE.Tween.get(this).to({ x: globalX }, duration).call(resolve);
FYGE.Tween.get(this).to({ x: globalX }, duration).call(()=>{
// DataMgr.game.score += self.currentScore;
}).call(resolve);
});
}
/** 移动结束 */
......
......@@ -38,7 +38,7 @@ export class Cat extends FYGE.Container {
}
/** 初始化 */
init({ initY }) {
this.initY = initY - 270 + 10;
this.initY = initY - 270;
this.y = this.initY;
this.jumping = false;
// this.onChange();
......@@ -107,7 +107,7 @@ export class Cat extends FYGE.Container {
}
set catStatus(v: CatStatus) {
if (this.catStatus == v) return;
if(v != CatStatus.SETUP && this.catStatus == CatStatus.GETFISH)return;
if(v != CatStatus.SETUP && this.catStatus == CatStatus.GETFISH && v != CatStatus.OVER && v != CatStatus.HITAWAY)return;
this._catStatus = v;
//改变SVga
this.catSvaga && this.SVGAContainer.removeChildren(this.catSvaga);
......
......@@ -40,7 +40,7 @@ export default class GuideMask extends FYGE.Container {
//描述
let descText = Tool.getText(
"看准时机,在物体飞进来的瞬间踩住\n跳到更高的地方",
"帮助猫咪跳到最高处\n它才能抓住小鱼干哦~",
30,
"#ffffff",
FYGE.TEXT_ALIGN.CENTER,
......
This diff is collapsed.
......@@ -26,47 +26,104 @@ export default class TimerCount extends FYGE.Container {
private countDown(callback: () => void) {
let allIn = new FYGE.Container();
this.addChild(allIn);
SoundMgr.instance.playSound("timeCount",false);
//加入SVGA
let readySvga = new FYGE.MovieClip(RES.getRes("high_ready.svga"));
allIn.addChild(readySvga);
readySvga.stop();
let time1Svga = new FYGE.MovieClip(RES.getRes("high_timer_1.svga"));
allIn.addChild(time1Svga);
time1Svga.stop();
let time2Svga = new FYGE.MovieClip(RES.getRes("high_timer_2.svga"));
allIn.addChild(time2Svga);
time2Svga.stop();
let time3Svga = new FYGE.MovieClip(RES.getRes("high_timer_3.svga"));
allIn.addChild(time3Svga);
time3Svga.stop();
// let readySvga = new FYGE.MovieClip(RES.getRes("high_ready.svga"));
// allIn.addChild(readySvga);
// readySvga.stop();
// let time1Svga = new FYGE.MovieClip(RES.getRes("high_timer_1.svga"));
// allIn.addChild(time1Svga);
// time1Svga.stop();
// let time2Svga = new FYGE.MovieClip(RES.getRes("high_timer_2.svga"));
// allIn.addChild(time2Svga);
// time2Svga.stop();
// let time3Svga = new FYGE.MovieClip(RES.getRes("high_timer_3.svga"));
// allIn.addChild(time3Svga);
// time3Svga.stop();
time1Svga.visible = time2Svga.visible = time3Svga.visible = false;
//倒计时音效
SoundMgr.instance.playSound("timeCount",false);
readySvga.startAniRange(0, readySvga.totalFrames, 1, () => {
FYGE.Tween.get(this)
.call(() => {
time3Svga.visible = true;
time3Svga.startAniRange(0, time3Svga.totalFrames, 1, () => {
time3Svga.visible = false;
});
})
.wait(1000)
.call(() => {
time2Svga.visible = true;
time2Svga.startAniRange(0, time2Svga.totalFrames, 1, () => {
time2Svga.visible = false;
});
// time1Svga.visible = time2Svga.visible = time3Svga.visible = false;
// //倒计时音效
// readySvga.startAniRange(0, readySvga.totalFrames, 1, () => {
// FYGE.Tween.get(this)
// .call(() => {
// time3Svga.visible = true;
// time3Svga.startAniRange(0, time3Svga.totalFrames, 1, () => {
// time3Svga.visible = false;
// });
// })
// .wait(1000)
// .call(() => {
// time2Svga.visible = true;
// time2Svga.startAniRange(0, time2Svga.totalFrames, 1, () => {
// time2Svga.visible = false;
// });
// })
// .wait(1000)
// .call(() => {
// time1Svga.visible = true;
// time1Svga.startAniRange(0, time1Svga.totalFrames, 1, () => {
// time1Svga.visible = false;
// callback();
// FYGE.Tween.removeTweens(self);
// });
// });
// });
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 = [
"high_ready.png",
"high_timer_3.png",
"high_timer_2.png",
"high_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();
})
.wait(1000)
.to({ alpha: 0 }, 200)
.call(() => {
time1Svga.visible = true;
time1Svga.startAniRange(0, time1Svga.totalFrames, 1, () => {
time1Svga.visible = false;
callback();
FYGE.Tween.removeTweens(self);
});
//执行完销毁吧,浏览器自己回收吧
// allIn.destroy();
this.removeChild(allIn);
// if (getBgOn()) playBg();
});
} else {
t.set({ alpha: 0 });
}
if (i == 0) {
t.call(() => {
timeBg.alpha = 1;
});
}
}
}
}
......@@ -4,8 +4,8 @@ export namespace MConst {
width: 750,
height: 1624
};
export const CatJumpSpeed = 28;//貓起跳速度
export const gravity = 0.98;//下落加速度
export const CatJumpSpeed = 26;//貓起跳速度
export const gravity = 0.9;//下落加速度
export const baseTrueH = 300;//底座真实高度
export const catTrueH = 226;//猫咪真实高度
export const blockName = ["catTV","catJiazi","catHouse","catHetun"];
......@@ -18,7 +18,7 @@ export namespace MConst {
export const blockAverageH = 178;//叠块皮平均高度
export const blockInitOffsetX = 10;//滑块初始偏移量X
export const baseOffsetY = 250;//物体block偏移量
export const blockDurationRange = [500,1200];//叠块出现所需时间
export const blockDurationRange = [1100,1300];//叠块出现所需时间
export const blockAddSpeed = 20;//叠块时间递减
export const blockEnterTimer = 0.2;//叠块进入时间系数
export let options = {
......
......@@ -33,24 +33,24 @@ export class GameFailPanel extends Panel {
//描述
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("high_seecat.png"));
......@@ -86,6 +86,8 @@ export class GameFailPanel extends Panel {
//看猫咪
onClickSeeCat() {
if (this.againBtn.visible) {
GDispatcher.dispatchEvent("clickBuried", { md: 51 });
}else{
GDispatcher.dispatchEvent("clickBuried", { md: 37 });
}
GDispatcher.dispatchEvent("high-see-cat");
......
......@@ -36,18 +36,18 @@ export class GameSuccessPanel extends Panel {
//数据
const { isAgain, glodCoin } = this.data;
// var isAgain = false;
// var isAgain = false,glodCoin=77;
//描述
let title = Tool.getText(
"达成目标分数",
"太棒了,目标达成!",
34,
"#333333",
FYGE.TEXT_ALIGN.CENTER,
230
320
);
this.addChild(title);
title.position.set(270, 800);
title.position.set(240, 800);
//获得奖励
let getPrizeText = Tool.getText(
"获得奖励",
......@@ -62,7 +62,7 @@ export class GameSuccessPanel extends Panel {
//金币
let coin = new FYGE.Sprite(RES.getRes("high_coin.png"));
this.addChild(coin);
coin.position.set(315, 920);
coin.position.set(330, 920);
let coinText = Tool.getText(
`X${glodCoin}`,
......@@ -72,7 +72,7 @@ export class GameSuccessPanel extends Panel {
90
);
this.addChild(coinText);
coinText.position.set(365, 928);
coinText.position.set(360, 928);
//再来一次
this.againBtn = new FYGE.Button(RES.getRes("high_again.png"));
......@@ -105,6 +105,7 @@ export class GameSuccessPanel extends Panel {
//等等再来玩
onClickAwait() {
GDispatcher.dispatchEvent("high-await");
GDispatcher.dispatchEvent("clickBuried", { md: 50 });
this.hidePanel();
}
......@@ -116,7 +117,7 @@ export class GameSuccessPanel extends Panel {
GDispatcher.dispatchEvent("clickBuried", { md: 35 });
}
GDispatcher.dispatchEvent("high-share");
this.hidePanel();
// this.hidePanel();
}
initEvents() {
......
......@@ -11,7 +11,7 @@ import { SoundMgr } from "../Mgr/SoundMgr";
export class GameScenes extends Scene {
public game: StackHigh = null;
get groupNames() {
return ["stackHigh", "catHighSvga", "hideAndSeek"];
return ["stackHigh", "catHighSvga"];
}
initUi() {
......@@ -33,7 +33,12 @@ export class GameScenes extends Scene {
if (!this.game) {
this.game = new StackHigh(this);
}
if (MConst.options.scheduleFinished == 0) {
GuideMgr.instance.drawFirstGuide(true);
} else if (MConst.options.scheduleFinished == 1) {
TimerCountMgr.instance.drawTimerCount();
}
//设置隐藏属性和改变可见属性的事件的名称
let hidden: string,
visibilityChange: 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