Commit 614da85d authored by haiyoucuv's avatar haiyoucuv

init

parent d82fcdb5
设计可能第三方做&终评无设计稿&无详细动画列表
七日签到+签到成功弹窗 6h
活动首页&活动限制 6h
我的背包(奖品+道具,去领取,装扮等)6h
蛇皮肤提醒弹窗 2h
游戏玩法介绍 0.5h
积分明细页 2h
游戏内:
UI 2h
UI-排行榜部分 3h
开始倒计时 1h
蛇:
摇杆 4h
蛇操行走 12h
蛇支持换肤 12h
吃零食、击杀、拖尾动效 12h
生成:
食物生成 2h
零食卡生成 1h
福袋生成 1h
道具生成 4h
道具生成-难度可控 8h
内部道具:
护盾效果&逻辑 4h
吸铁石效果&逻辑 4h
增长效果&逻辑 3h
移速道具效果&逻辑 3h
外部道具:
护盾卡
加速卡 3h
双倍卡 2h
加长卡 2h
道具栏&开合、使用逻辑 2h
道具栏道具冷却动画 6h
零食卡:
零食卡拾取&合成逻辑 12h
加速叠加效果 3h
AI蛇:
AI蛇的AI 16h
AI难度可控 24h
阶段一/二目标展示动画 2h
阶段一 8h
阶段一倒计时闪烁抖动 2h
阶段二 4h
阶段二倒计时破碎 4h
阶段三(无尽模式) 8h
死亡生成食物 4h
复活-无复活卡面板&复活逻辑 6h
复活-有复活卡 2h
结算逻辑 2h
游戏基础防作弊处理(加密,计数等) 12h
分享海报 4h
排行榜:
切换 2h
省榜&激励展示&倒计时 4h
个人榜&激励展示&倒计时 4h
好友榜 2h
排行榜奖励 1h
首页弹窗排列 1h
道具兑换:
道具页 3h
商品详情 2h
兑换&兑换成功弹窗 2h
福袋抽奖:
福袋页 8h
福袋开启&弹窗 2h
福袋五连+弹窗 4h
五连动画 4h
福袋任务 6h
邀请&助力 8h
福袋兑换&弹窗 4h
其他动画效果预估 32h
埋点 6h
自测联调 30h
351.5h = 43.9375d
...@@ -104,8 +104,8 @@ ...@@ -104,8 +104,8 @@
"_prefab": null, "_prefab": null,
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 375, "x": 812,
"y": 812, "y": 375,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
...@@ -860,7 +860,7 @@ ...@@ -860,7 +860,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
"Foods": [ "foods": [
{ {
"__id__": 23 "__id__": 23
} }
...@@ -875,7 +875,7 @@ ...@@ -875,7 +875,7 @@
"__type__": "Item", "__type__": "Item",
"type": 0, "type": 0,
"sp": { "sp": {
"__uuid__": "ad97e5f2-485d-4ebb-a1ef-a63c1c32115a@f9941", "__uuid__": "8f21f897-8cb9-448d-a674-e0574c83e228@da8cd",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
} }
}, },
...@@ -1218,8 +1218,8 @@ ...@@ -1218,8 +1218,8 @@
"__prefab": null, "__prefab": null,
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 750, "width": 1624,
"height": 1624 "height": 750
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -1326,9 +1326,6 @@ ...@@ -1326,9 +1326,6 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
"uiCamera": {
"__id__": 42
},
"handle": { "handle": {
"__id__": 53 "__id__": 53
}, },
...@@ -1426,8 +1423,8 @@ ...@@ -1426,8 +1423,8 @@
"_prefab": null, "_prefab": null,
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 375, "x": 812,
"y": 812, "y": 375,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
...@@ -1815,8 +1812,8 @@ ...@@ -1815,8 +1812,8 @@
"__prefab": null, "__prefab": null,
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 750, "width": 1624,
"height": 1624 "height": 750
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
......
// 事件名称定义 // 事件名称定义
import { ccenum } from "cc";
export const Events = { export const Events = {
changeSkinId: "changeSkinId", // 更换皮肤事件 changeSkinId: "changeSkinId", // 更换皮肤事件
setGameState: "setGameState", // 设置游戏状态事件 setGameState: "setGameState", // 设置游戏状态事件
...@@ -10,6 +12,8 @@ export enum FoodType { ...@@ -10,6 +12,8 @@ export enum FoodType {
FOOD = 0, // 普通食物 FOOD = 0, // 普通食物
MONEY = 1 // 金币 MONEY = 1 // 金币
} }
ccenum(FoodType)
// 移动方向枚举 // 移动方向枚举
export enum DirectionType { export enum DirectionType {
......
import { _decorator, Enum, SpriteFrame, math, v3, Sprite, Collider2D, Component, Prefab } from "cc"; import { _decorator, Enum, SpriteFrame, math, v3, Sprite, Collider2D, Component, Prefab, ccenum } from "cc";
import { PoolManager } from "./PoolManager"; import { PoolManager } from "./PoolManager";
import { FoodType } from "./Enums"; import { FoodType } from "./Enums";
import { Global } from "./Global"; import { Global } from "./Global";
import { MainGame } from "./MainGame";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
...@@ -10,9 +11,7 @@ const { ccclass, property } = _decorator; ...@@ -10,9 +11,7 @@ const { ccclass, property } = _decorator;
*/ */
@ccclass("Item") @ccclass("Item")
class Item { class Item {
@property({ @property({ type: FoodType })
type: FoodType
})
type: FoodType = FoodType.FOOD; type: FoodType = FoodType.FOOD;
@property(SpriteFrame) @property(SpriteFrame)
...@@ -24,8 +23,9 @@ class Item { ...@@ -24,8 +23,9 @@ class Item {
*/ */
@ccclass("FondManger") @ccclass("FondManger")
export class FondManger extends Component { export class FondManger extends Component {
@property([Item])
private Foods: Item[] = []; @property({ type: [Item] })
private foods: Item[] = [];
@property(Prefab) @property(Prefab)
private foodPrefab: Prefab = null; private foodPrefab: Prefab = null;
...@@ -48,22 +48,18 @@ export class FondManger extends Component { ...@@ -48,22 +48,18 @@ export class FondManger extends Component {
* 设置食物 * 设置食物
*/ */
setFood(x?: number, y?: number) { setFood(x?: number, y?: number) {
// 如果没有指定位置,随机生成位置 // 如果没有指定位置,随机生成位置
if (!x) { if (!x) {
x = math.randomRangeInt( x = math.randomRangeInt(-(Global.MAP_WIDTH / 2 - 50), Global.MAP_WIDTH / 2 - 50);
-(Global.MAP_WIDTH / 2 - 50),
Global.MAP_WIDTH / 2 - 50
);
} }
if (!y) { if (!y) {
y = math.randomRangeInt( y = math.randomRangeInt(-(Global.MAP_HIGHT / 2 - 50), Global.MAP_HIGHT / 2 - 50);
-(Global.MAP_HIGHT / 2 - 50),
Global.MAP_HIGHT / 2 - 50
);
} }
// 随机选择食物类型 // 随机选择食物类型
const index = math.randomRangeInt(0, this.Foods.length); const index = math.randomRangeInt(0, this.foods.length);
// 从对象池获取食物节点 // 从对象池获取食物节点
const node = PoolManager.instance.getNode( const node = PoolManager.instance.getNode(
...@@ -75,26 +71,17 @@ export class FondManger extends Component { ...@@ -75,26 +71,17 @@ export class FondManger extends Component {
// 设置食物属性 // 设置食物属性
node.angle = 0; node.angle = 0;
node.setScale(1, 1); node.setScale(1, 1);
node.getComponent(Sprite).spriteFrame = this.Foods[index].sp; node.getComponent(Sprite).spriteFrame = this.foods[index].sp;
// 设置碰撞类型 // 设置碰撞类型
const collider = node.getComponent(Collider2D); const collider = node.getComponent(Collider2D);
if (collider) { if (collider) {
collider.tag = this.Foods[index].type; collider.tag = this.foods[index].type;
} }
node.active = true; node.active = true;
} }
/**
* 生成食物迭代器
*/
private* _getItemGenerator(count: number) {
for (let i = 0; i < count; i++) {
yield this._initItem(i);
}
}
/** /**
* 初始化单个食物 * 初始化单个食物
*/ */
...@@ -107,18 +94,18 @@ export class FondManger extends Component { ...@@ -107,18 +94,18 @@ export class FondManger extends Component {
const y = math.randomRangeInt(-(Global.MAP_HIGHT / 2 - 50), Global.MAP_HIGHT / 2 - 50); const y = math.randomRangeInt(-(Global.MAP_HIGHT / 2 - 50), Global.MAP_HIGHT / 2 - 50);
// 随机选择食物类型 // 随机选择食物类型
index = math.randomRangeInt(0, this.Foods.length); index = math.randomRangeInt(0, this.foods.length);
// 设置食物属性 // 设置食物属性
node.angle = 0; node.angle = 0;
node.setScale(1, 1); node.setScale(1, 1);
node.setPosition(x, y, 0); node.setPosition(x, y, 0);
node.getComponent(Sprite).spriteFrame = this.Foods[index].sp; node.getComponent(Sprite).spriteFrame = this.foods[index].sp;
// 设置碰撞类型 // 设置碰撞类型
const collider = node.getComponent(Collider2D); const collider = node.getComponent(Collider2D);
if (collider) { if (collider) {
collider.tag = this.Foods[index].type; collider.tag = this.foods[index].type;
} }
node.active = true; node.active = true;
...@@ -127,32 +114,10 @@ export class FondManger extends Component { ...@@ -127,32 +114,10 @@ export class FondManger extends Component {
/** /**
* 初始化食物 * 初始化食物
*/ */
async initFond(count: number) { initFond(count: number) {
await this.executePreFrame(this._getItemGenerator(count), 1); for (let i = 0; i < count; i++) {
this._initItem(i);
}
} }
/** }
* 分帧执行
*/
executePreFrame(generator: Generator, frameTime: number): Promise<boolean> {
return new Promise((resolve, reject) => {
const iter = generator;
const next = () => {
const startTime = new Date().getTime();
for (let result = iter.next(); ; result = iter.next()) {
if (!result || result.done) {
resolve(true);
return;
}
if (new Date().getTime() - startTime > frameTime) {
this.scheduleOnce(() => {
next();
});
return;
}
}
};
next();
});
}
}
\ No newline at end of file
...@@ -130,7 +130,7 @@ export class MainGame extends Scene { ...@@ -130,7 +130,7 @@ export class MainGame extends Scene {
if (this.state == GameState.READY) return; if (this.state == GameState.READY) return;
// 更新UI提示 // 更新UI提示
this.LTips.string = `长度:${this.snake.getSnakeLen()} 金币:${this.snake.getmoneySum()}`; this.LTips.string = `长度:${this.snake.getSnakeLen()} 金币:${this.snake.getMoneySum()}`;
// 更新蛇的移动 // 更新蛇的移动
this.snake.setAngle((360 - this.joystick.angle) % 360); this.snake.setAngle((360 - this.joystick.angle) % 360);
...@@ -169,7 +169,7 @@ export class MainGame extends Scene { ...@@ -169,7 +169,7 @@ export class MainGame extends Scene {
break; break;
case GameState.WIN: case GameState.WIN:
director.pause(); director.pause();
console.log("win", this.snake.getSnakeLen(), this.snake.getmoneySum()); console.log("win", this.snake.getSnakeLen(), this.snake.getMoneySum());
break; break;
case GameState.QUIT: case GameState.QUIT:
director.resume(); director.resume();
...@@ -193,7 +193,7 @@ export class MainGame extends Scene { ...@@ -193,7 +193,7 @@ export class MainGame extends Scene {
} }
showGOver() { showGOver() {
console.log("showGOver", this.snake.getSnakeLen(), this.snake.getmoneySum()); console.log("showGOver", this.snake.getSnakeLen(), this.snake.getMoneySum());
} }
private* _getItemGenerator(count: number) { private* _getItemGenerator(count: number) {
......
...@@ -8,9 +8,9 @@ import { ...@@ -8,9 +8,9 @@ import {
v2, v2,
v3, v3,
Vec3, Vec3,
Node, Contact2DType, tween, Prefab, PhysicsGroup, Node, Contact2DType, tween, Prefab, PhysicsGroup, director,
} from "cc"; } from "cc";
import { FoodType } from "./Enums"; import { Events, FoodType, GameState } from "./Enums";
import { Global } from "./Global"; import { Global } from "./Global";
import { PoolManager } from "./PoolManager"; import { PoolManager } from "./PoolManager";
import { isIntersect } from "./uitl"; import { isIntersect } from "./uitl";
...@@ -335,7 +335,7 @@ export class Snake extends Component { ...@@ -335,7 +335,7 @@ export class Snake extends Component {
return this.Bodys.length; return this.Bodys.length;
} }
getmoneySum() { getMoneySum() {
return this.moneySum; return this.moneySum;
} }
...@@ -360,7 +360,7 @@ export class Snake extends Component { ...@@ -360,7 +360,7 @@ export class Snake extends Component {
this.node.active = false; this.node.active = false;
// 发送游戏结束事件 // 发送游戏结束事件
// director.emit(Events.setGameState, GameState.OVER); director.emit(Events.setGameState, GameState.OVER);
} }
// 工具方法 - 计算新位置 // 工具方法 - 计算新位置
......
function* _getItemGenerator(length: number) {
for (let i = 0; i < length; i++) {
yield this._initItem(i);
}
this.ready = true;
}
function executePreFrame(generator: Generator, duration: number) {
return new Promise<void>((resolve, reject) => {
let gen = generator;
// 创建执行函数
let execute = () => {
// 执行之前,先记录开始时间戳
let startTime = new Date().getTime();
// 然后一直从 Generator 中获取已经拆分好的代码段出来执行
for (let iter = gen.next(); ; iter = gen.next()) {
// 判断是否已经执行完所有 Generator 的小代码段
// 如果是的话,那么就表示任务完成
if (iter == null || iter.done) {
resolve();
return;
}
// 每执行完一段小代码段,都检查一下是否
// 已经超过我们分配给本帧,这些小代码端的最大可执行时间
if (new Date().getTime() - startTime > duration) {
// 如果超过了,那么本帧就不在执行,开定时器,让下一帧再执行
this.scheduleOnce(() => {
execute();
});
return;
}
}
};
// 运行执行函数
execute();
});
}
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "020d28d5-d3d5-44c3-ae46-9c83b35f5f7d",
"files": [],
"subMetas": {},
"userData": {}
}
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
"__version__": "1.0.6", "__version__": "1.0.6",
"general": { "general": {
"designResolution": { "designResolution": {
"width": 750, "width": 1624,
"height": 1624 "height": 750
}, },
"downloadMaxConcurrency": 20, "downloadMaxConcurrency": 20,
"renderPipeline": "c7e748e8-be82-4f6f-b2c0-085b604e40e5" "renderPipeline": "c7e748e8-be82-4f6f-b2c0-085b604e40e5"
......
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
"extends": "./temp/tsconfig.cocos.json", "extends": "./temp/tsconfig.cocos.json",
/* Add your custom configuration here. */ /* Add your custom configuration here. */
"compilerOptions": { "compilerOptions": {
"lib": [
"es2015",
"dom"
],
"strict": false, "strict": false,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"moduleResolution": "bundler", "moduleResolution": "bundler",
......
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