Commit 4d051813 authored by 熊东起's avatar 熊东起

aa

parent 08fbade8
......@@ -14,3 +14,4 @@ import {...} from '@spark/compoundFish'
## Publish
`npm run pub`
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
scripts/yuer.png

655 KB | W: | H:

scripts/yuer.png

123 KB | W: | H:

scripts/yuer.png
scripts/yuer.png
scripts/yuer.png
scripts/yuer.png
  • 2-up
  • Swipe
  • Onion skin
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
scripts/幼年鱼完整拆分新.png

490 KB | W: | H:

scripts/幼年鱼完整拆分新.png

93.9 KB | W: | H:

scripts/幼年鱼完整拆分新.png
scripts/幼年鱼完整拆分新.png
scripts/幼年鱼完整拆分新.png
scripts/幼年鱼完整拆分新.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -9,8 +9,8 @@ export class GameStage extends GAME.WidgetBase {
private async _setup() {
await loadSpine([
"//yun.duiba.com.cn/aurora/assets/6e7380da60c7b6ea1a2cf4d632c8acd2344bfa61.spi",
"//yun.duiba.com.cn/aurora/assets/b3be7191bda93fd1006dfdb5c0a349765634f026.spi"
"//yun.duiba.com.cn/aurora/assets/d9d572f862ca57f72bea13b42ec06d1b4eaeffa4.spi",
"//yun.duiba.com.cn/aurora/assets/d9d572f862ca57f72bea13b42ec06d1b4eaeffa4.spi"
]);
// await loadSpineOnce("//yun.duiba.com.cn/aurora/assets/210e9484fce76f282f7bc6f99f985e589062cd46.spi");
const gameIndex = new GameIndex();
......
import { timer } from './game.type';
/**
* Created by _xdq on 2021/10/09.
* 鱼
......@@ -36,7 +37,7 @@ export class Fish extends GAME.Container {
/** 等级 */
private _level: number = 0;
/** 碰撞半径 */
public R: number = 50;
public R: number = 50 * 0.85;
/** 本次是否改变方向 */
public isChangeDir: boolean = false;
/** 等级文字框 */
......@@ -46,7 +47,7 @@ export class Fish extends GAME.Container {
/** 鱼的状态 */
public fishStatus: FishStatus = FishStatus.common;
/** 每秒产生的鱼币 */
private _production: number = 1;
private _production: number = 0;
/** 上浮的金币 */
private floatCoin: Graphics = null;
/** 动效 */
......@@ -63,6 +64,8 @@ export class Fish extends GAME.Container {
public fishName: string = ""
/** 产量文字 */
private proText: TextField = null;
/** 动画 */
private aniClip: any = null;
get production(): number {
return this._production;
......@@ -71,8 +74,6 @@ export class Fish extends GAME.Container {
set production(v: number) {
if (this._production == v) return;
this._production = v;
this.updateFloatCoin();
this.proText && (this.proText.text = `+${GUtils.changeUnit(v)}`);
}
......@@ -82,15 +83,15 @@ export class Fish extends GAME.Container {
}
public set horizontalDir(v: FishDir) {
if(this._horizontalDir == v) return;
if (this._horizontalDir == v) return;
this._horizontalDir = v;
if (v === FishDir.right) {
this.scaleX = -1;
this.scaleX = -0.85;
this.levelCon.scaleX = -1;
this.floatCoin && (this.floatCoin.scaleX = -1);
} else if (v === FishDir.left) {
this, this.scaleX = 1;
this.scaleX = 0.85;
this.levelCon.scaleX = 1;
this.floatCoin && (this.floatCoin.scaleX = 1);
}
......@@ -142,7 +143,7 @@ export class Fish extends GAME.Container {
levelCon.drawCircle(0, 0, 16);
levelCon.endFill();
levelCon.endStroke();
levelCon.position.set(60, 70);
levelCon.position.set(35, 60);
this.levelCon = levelCon;
const leveltxt = getText(levelCon, "0", 20, "0xffffff", TEXT_ALIGN.CENTER, 40, -19, -10.5);
......@@ -156,7 +157,7 @@ export class Fish extends GAME.Container {
/** 加载鱼动画 */
async loadSpine() {
const spineDataSmall = await loadSpineOnce("//yun.duiba.com.cn/aurora/assets/6e7380da60c7b6ea1a2cf4d632c8acd2344bfa61.spi");
const spineDataSmall = await loadSpineOnce("//yun.duiba.com.cn/aurora/assets/d9d572f862ca57f72bea13b42ec06d1b4eaeffa4.spi");
if (this.spinePlayer) return;
const spinePlayer = new Spine(spineDataSmall, false);
......@@ -166,7 +167,9 @@ export class Fish extends GAME.Container {
this.addChild(spinePlayer);
spinePlayer.position.set(0, 60);
spinePlayer.setSkin(this.level + "");
spinePlayer.animationManager.showAni('animation', 0);
// spinePlayer.animationManager.showAni('animation', 0);
// spinePlayer.setSkin("2");
// spinePlayer.animationManager.showAni('qingnian', 0);
}
......@@ -183,18 +186,50 @@ export class Fish extends GAME.Container {
if (!this.spinePlayer)
await this.initUi();
let spiStr = this.level > 24 ? "//yun.duiba.com.cn/aurora/assets/850b54a695922273b0ec12af26838222495967fb.spi" :
"//yun.duiba.com.cn/aurora/assets/d9d572f862ca57f72bea13b42ec06d1b4eaeffa4.spi";
const spineDataBig = await loadSpineOnce(spiStr);
this.removeChild(this.spinePlayer);
const spinePlayer = new Spine(spineDataBig, false);
this.spinePlayer = spinePlayer;
// console.log(spinePlayer.aniNames);
// console.log(spinePlayer.skinNames);
this.addChild(spinePlayer);
spinePlayer.position.set(0, 60);
// this.level > 24 ? spinePlayer.animationManager.showAni('qingnian', 0) : spinePlayer.animationManager.showAni('animation', 0);
if (this.level > 24) {
const spineDataBig = await loadSpineOnce("//yun.duiba.com.cn/aurora/assets/b3be7191bda93fd1006dfdb5c0a349765634f026.spi");
this.removeChild(this.spinePlayer);
const spinePlayer = new Spine(spineDataBig, false);
this.spinePlayer = spinePlayer;
// console.log(spinePlayer.aniNames);
// console.log(spinePlayer.skinNames);
this.addChild(spinePlayer);
let aniClip1 = spinePlayer.animationManager.showAni('qingnian2');
this.aniClip = aniClip1;
spinePlayer.position.set(0, 60);
spinePlayer.animationManager.showAni('qingnian', 0);
// aniClip1.stop();
// console.log("时间---",aniClip1.totalTime)
aniClip1.startAniRange(GUtils.getRandom(0, 0.5), aniClip1.totalTime, 0);
} else {
let aniClip2 = spinePlayer.animationManager.showAni('biyan');
spinePlayer.position.set(-20, 80);
// spinePlayer.animationManager.stop();
this.aniClip = aniClip2;
// aniClip2.stop();
aniClip2.startAniRange(GUtils.getRandom(0, 0.5), aniClip2.totalTime, 0);
}
// if(data.isCall){
// this.onRemoveAni();
// }
// this.onRemoveAni();
// this.addChild(this.compoundAni);
this.compoundAni.visible = false;
this.addChild(this.levelCon);
......@@ -217,7 +252,7 @@ export class Fish extends GAME.Container {
/** 刷新头顶鱼币 */
private updateFloatCoin() {
// console.log("更新鱼币-----999999>>>>>>>>>");
if (this.floatCoin) {
TWEEN.removeTweens(this.floatCoin);
this.removeChild(this.floatCoin);
......@@ -240,16 +275,21 @@ export class Fish extends GAME.Container {
this.floatCoin.alpha = 0;
if (this.horizontalDir === FishDir.right) {
this.scaleX = -0.85;
this.floatCoin && (this.floatCoin.scaleX = -1);
this.levelCon && (this.levelCon.scaleX = -1);
} else if (this.horizontalDir === FishDir.left) {
this.scaleX = 0.85;
this.floatCoin && (this.floatCoin.scaleX = 1);
this.levelCon && (this.levelCon.scaleX = 1);
}
TWEEN.get(this, { loop: false })
TWEEN.get(this.floatCoin, { loop: false },null,true)
.wait(GUtils.getRandom(4000, 0))
.call(() => {
this.floatCoin && TWEEN.get(this.floatCoin, { loop: true })
TWEEN.removeTweens(this.floatCoin);
this.floatCoin && TWEEN.get(this.floatCoin, { loop: true },null,true)
.set({ y: originY, alpha: 1 })
.to({ y: originY - 40, alpha: 0.1 }, 1000)
.set({ y: originY, alpha: 0 })
......@@ -262,19 +302,34 @@ export class Fish extends GAME.Container {
showCanCompoundAni() {
if (this.compoundAni && this.compoundAni.visible) return;
if (this.compoundAni) {
this.addChild(this.compoundAni);
// this.addChild(this.compoundAni);
this.compoundAni.visible = true;
} else {
// console.log("展示合成动画------>>>>>>")
this.compoundAni = this.addChild(new MovieClip(getAssetByUUID("round-light")));
this.compoundAni.position.set(-112, -70);
this.compoundAni.visible = true;
}
}
/** 移除动画--闭眼 */
onRemoveAni() {
this.aniClip && this.aniClip.stop();
// window["aaa"] = this.aniClip;
}
/** 播放动画 */
onStartAni() {
this.aniClip && this.aniClip.stop();
this.aniClip && this.aniClip.startAniRange(GUtils.getRandom(0, 0.3), this.aniClip.totalTime, 0);
}
/** 移除 */
onRecyle() {
try {
// console.log("移除鱼--------->>")
this.level = 0;
this.fishId = "";
this.price = 0;
......
......@@ -6,9 +6,9 @@ export default class GameCfg {
/** 鱼的数量 */
static MAX_FISH_COUNT: number = 12;
/** 鱼的最大速度 */
static FISH_MAX_SPEED: number = 0.38;
static FISH_MAX_SPEED: number = 0.28;
/** 鱼的最小速度 */
static FISH_MIN_SPEED: number = 0.22;
static FISH_MIN_SPEED: number = 0.28;
/** 派发事件 -- 点击解锁 */
static GAME_UN_LOCK: string = "game-unlock";
/** 选中拖动的鱼 */
......
This diff is collapsed.
......@@ -73,7 +73,7 @@ const loadSpineData = async (url: string) => {
try {
GAME.loadSpine(url, (spineData: any) => {
resolve(spineData);
console.log("9889",spineData)
// console.log("9889",spineData)
});
} catch (error) {
reject(error);
......
......@@ -9,6 +9,10 @@ export class GUtils {
static getRandom(max: number, min: number): number {
return Number((Math.random() * (max - min) + min).toFixed(2));
}
/** 随机数 */
static getRandomInt(max: number, min: number): number {
return Math.floor((Math.random() * (max - min) + min));
}
/** 获取角度 */
static getAngle(dy: number, dx: number): number {
const angle = Math.atan2(dy, dx) / Math.PI * 180;
......
......@@ -39,6 +39,8 @@ export default class WorkeSite extends Container {
private floatCoin: Graphics = null;
/** 上浮文字 */
private floatText: TextField = null;
/** 产量 */
private _production: number = 0;
public get workerStatus(): WorkerStatus {
return this._workerStatus;
}
......@@ -108,7 +110,35 @@ export default class WorkeSite extends Container {
set workingFish(v: Fish) {
if (this._workingFish == v) return;
// console.log("打工台更新------");
this._workingFish = v;
// setTimeout(() => {
// this.updateFloatCoin();
// });
}
get workingFish(): Fish {
return this._workingFish;
}
get production(): number {
return this._production;
}
set production(v: number) {
if (this._production == v) return;
this._production = v;
setTimeout(() => {
// console.log("99999==1111",v)
this.updateFloatCoin();
this.floatText && (this.floatText.text = `+${GUtils.changeUnit(v)}`);
})
}
updateFloatCoin() {
// console.log("99999==1111",this.workingFish.production)
//飘金币
if (this.floatCoin) {
TWEEN.removeTweens(this.floatCoin);
......@@ -133,20 +163,15 @@ export default class WorkeSite extends Container {
this.floatCoin.alpha = 0;
TWEEN.get(this, { loop: false })
.wait(GUtils.getRandom(4000, 0))
.wait(GUtils.getRandom(2000, 0))
.call(() => {
this.floatCoin && TWEEN.get(this.floatCoin, { loop: true })
.set({ y: originY, alpha: 1 })
.to({ y: originY - 20, alpha: 0.1 }, 800)
.set({ y: originY, alpha: 0 })
.wait(4000);
.wait(2000);
});
}
}
get workingFish(): Fish {
return this._workingFish;
}
......
......@@ -6,6 +6,8 @@ export type FishType = { [key: string]: number };
export type CommonType = { [key: string]: number };
export type timer = typeof setInterval;
/** 对象池 */
export const fishPoolName = "fish-pool";
......@@ -30,7 +32,8 @@ export interface FishOptions {
dir: { [key: string]: FishDir }
production: number,
price: number,
fishName: string
fishName: string,
isCall?: boolean
}
/** 打工状态 */
......
......@@ -27,7 +27,13 @@ function App() {
function onReady(widget) {
console.log('CanvasWidget ready!')
document.body.addEventListener(
'touchmove',
function (e) {
e.preventDefault();
},
{ passive: false }
);
}
/**
......
#root {
position: fixed;
width: 100vw;
height: 100vh;
}
body{
position: fixed;
width: 100vw;
height: 100vh;
}
.App {
position: fixed;
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;
label{
display: flex;
......@@ -10,13 +22,28 @@
}
.canvas-widget {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
canvas{
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
}
}
.control-bar {
position: absolute;
right: 10px;
bottom: 10px;
position: fixed;
top: 0;
left: 0;
// position: absolute;
// right: 10px;
// bottom: 10px;
}
}
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