diff --git a/assets/GlobalScript/GlobalGameState/GameState.ts b/assets/GlobalScript/GlobalGameState/GameState.ts index 48cf492..b2f2eba 100644 --- a/assets/GlobalScript/GlobalGameState/GameState.ts +++ b/assets/GlobalScript/GlobalGameState/GameState.ts @@ -21,18 +21,18 @@ export class GameState extends Component { } - //当前是否处于暂停状态 + /** 当前是否处于暂停状态 */ PauseState: boolean = false; - //改变暂停状态的回调函数 + /** 改变暂停状态的回调函数 */ ResumeCallBackFunc: ResumeCallback[] = []; - //获取暂停状态 + /** 获取暂停状态 */ IsPauseState(): boolean { return this.PauseState; } - //设置暂停状态 + /** 设置暂停状态 */ SetCurrentPauseState(State: boolean) { //不等于时 设置一次 if (State != this.PauseState) { @@ -45,7 +45,7 @@ export class GameState extends Component { } } - //注册恢复游戏的逻辑回调函数 + /** 注册恢复游戏的逻辑回调函数 */ RegisterResumeCallBack(Func: ResumeCallback) { this.ResumeCallBackFunc.push(Func); } diff --git a/assets/ImagePack/!幻想模拟战.bin b/assets/ImagePack/!幻想模拟战.bin index 67638ea..75b6b14 100644 Binary files a/assets/ImagePack/!幻想模拟战.bin and b/assets/ImagePack/!幻想模拟战.bin differ diff --git a/assets/ImagePack/!幻想模拟战.bin.meta b/assets/ImagePack/!幻想模拟战.bin.meta index c5be628..b742c4b 100644 --- a/assets/ImagePack/!幻想模拟战.bin.meta +++ b/assets/ImagePack/!幻想模拟战.bin.meta @@ -2,7 +2,7 @@ "ver": "1.0.3", "importer": "buffer", "imported": true, - "uuid": "d3385675-1bcd-4592-b0f0-bf716f181429", + "uuid": "6aba7d31-7435-4f59-b5aa-79256df4ede9", "files": [ ".bin", ".json" diff --git a/assets/Script/BoardRoot.ts b/assets/Script/BoardRoot.ts index e8f5cc9..d70ccf1 100644 --- a/assets/Script/BoardRoot.ts +++ b/assets/Script/BoardRoot.ts @@ -1,12 +1,12 @@ /* * @Author: WoNiu * @Date: 2024-03-16 15:26:27 - * @LastEditTime: 2024-03-26 15:43:37 + * @LastEditTime: 2024-03-28 21:13:04 * @LastEditors: WoNiu * @Description: 最底层的地图 图层Component */ import { _decorator, Component, Node } from "cc"; -import { MapTileType, MapTileTypes } from "./MapTile/MapTileData"; +import { MapTileType, MapTileTypes } from "./MapTile/MapTileType"; import { MapTileNode } from "./MapTile/MapTileNode"; const { ccclass } = _decorator; diff --git a/assets/Script/DialogNode.meta b/assets/Script/DialogRoot.meta similarity index 100% rename from assets/Script/DialogNode.meta rename to assets/Script/DialogRoot.meta diff --git a/assets/Script/DialogRoot.ts b/assets/Script/DialogRoot.ts deleted file mode 100644 index 0248077..0000000 --- a/assets/Script/DialogRoot.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * @Author: WoNiu - * @Date: 2024-03-19 17:44:59 - * @LastEditTime: 2024-03-26 13:34:17 - * @LastEditors: WoNiu - * @Description: - */ -import { _decorator, Component, Director, director, Node } from "cc"; -import { SelectNumberNode } from "./DialogNode/SelectNumberNode"; -const { ccclass, property } = _decorator; - -@ccclass("DialogRoot") -/** - * @description: 弹窗 - */ -export class DialogRoot extends Component { - start() { - - } - - update(deltaTime: number) {} - - //* 初始化并显示顺序选择node - initSelectNumberNode(): SelectNumberNode { - const selectNode = new SelectNumberNode(); - selectNode.name = "SelectNumberNode"; - this.node.addChild(selectNode); - return selectNode; - } - - //* 销毁顺序选择node - destroySelectNumberNode() { - /// 一帧结束之后销毁 - director.once(Director.EVENT_END_FRAME, () => { - // 销毁 - this.node.getChildByName("SelectNumberNode").destroy(); - }); - } - -} diff --git a/assets/Script/DialogNode/CardNode.ts b/assets/Script/DialogRoot/CardNode.ts similarity index 100% rename from assets/Script/DialogNode/CardNode.ts rename to assets/Script/DialogRoot/CardNode.ts diff --git a/assets/Script/DialogNode/CardNode.ts.meta b/assets/Script/DialogRoot/CardNode.ts.meta similarity index 100% rename from assets/Script/DialogNode/CardNode.ts.meta rename to assets/Script/DialogRoot/CardNode.ts.meta diff --git a/assets/Script/DialogRoot/DialogRoot.ts b/assets/Script/DialogRoot/DialogRoot.ts new file mode 100644 index 0000000..7f1a4c1 --- /dev/null +++ b/assets/Script/DialogRoot/DialogRoot.ts @@ -0,0 +1,23 @@ +/* + * @Author: WoNiu + * @Date: 2024-03-19 17:44:59 + * @LastEditTime: 2024-03-29 14:00:11 + * @LastEditors: WoNiu + * @Description: 弹窗 + */ +import { _decorator, Component } from "cc"; +const { ccclass, property } = _decorator; + +@ccclass("DialogRoot") +/** + * @description: 弹窗 + */ +export class DialogRoot extends Component { + + + start() {} + + update(deltaTime: number) {} + + +} diff --git a/assets/Script/DialogRoot.ts.meta b/assets/Script/DialogRoot/DialogRoot.ts.meta similarity index 100% rename from assets/Script/DialogRoot.ts.meta rename to assets/Script/DialogRoot/DialogRoot.ts.meta diff --git a/assets/Script/DialogNode/LuckyCoinsNode.ts b/assets/Script/DialogRoot/LuckyCoinsNode.ts similarity index 86% rename from assets/Script/DialogNode/LuckyCoinsNode.ts rename to assets/Script/DialogRoot/LuckyCoinsNode.ts index c7385ab..79b6009 100644 --- a/assets/Script/DialogNode/LuckyCoinsNode.ts +++ b/assets/Script/DialogRoot/LuckyCoinsNode.ts @@ -1,7 +1,7 @@ /* * @Author: WoNiu * @Date: 2024-03-26 11:44:58 - * @LastEditTime: 2024-03-27 15:49:36 + * @LastEditTime: 2024-03-29 14:02:43 * @LastEditors: WoNiu * @Description: 幸运硬币效果类型 */ @@ -20,30 +20,29 @@ import { AnimationNode } from "../../GlobalScript/Animation/AnimationNode"; import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite"; import { NpkImage } from "../../Tool/NPKImage"; import { CloseButtonNode } from "../Common/CloseButtonNode"; -import { GameRootSingleton } from "../GameRootController"; const { ccclass, property } = _decorator; /** * @description: 幸运硬币效果类型 */ export enum LuckyType { - // 前进三格 + /** 前进三格 */ GoThree = 0, - // 移动到月光酒馆 + /** 移动到月光酒馆 */ YeGuangJiuGuan, - // 移动到决斗场 + /** 移动到决斗场 */ JueDouChang, - // 移动到海上列车 + /** 移动到海上列车 */ HaiShangLieChe, - // 我要双倍,点数x2 + /** 我要双倍,点数x2 */ Double, - // 这是我的钱,点数减半 + /** 这是我的钱,点数减半 */ Halve, - // 骑士马战 ,点数+2w + /** 骑士马战 ,点数+2w */ HorseCombat, - // 装备修理, 点数-2w + /** 装备修理, 点数-2w */ Servicing, - // 收取费用,夺取其他人 2w 点数 + /** 收取费用,夺取其他人 2w 点数 */ Charge, } @@ -51,9 +50,10 @@ export enum LuckyType { export class LuckyCoinsNode extends Node { luckyType: LuckyType; - // 幸运硬币的结果 + /** 幸运硬币的结果节点 */ resultNode: Node; + /** 动画完成回调 */ aniDoneBack: Function; constructor(type: LuckyType,aniDone:Function) { diff --git a/assets/Script/DialogNode/LuckyCoinsNode.ts.meta b/assets/Script/DialogRoot/LuckyCoinsNode.ts.meta similarity index 100% rename from assets/Script/DialogNode/LuckyCoinsNode.ts.meta rename to assets/Script/DialogRoot/LuckyCoinsNode.ts.meta diff --git a/assets/Script/DialogNode/SelectNumberNode.ts b/assets/Script/DialogRoot/SelectNumberNode.ts similarity index 100% rename from assets/Script/DialogNode/SelectNumberNode.ts rename to assets/Script/DialogRoot/SelectNumberNode.ts diff --git a/assets/Script/DialogNode/SelectNumberNode.ts.meta b/assets/Script/DialogRoot/SelectNumberNode.ts.meta similarity index 100% rename from assets/Script/DialogNode/SelectNumberNode.ts.meta rename to assets/Script/DialogRoot/SelectNumberNode.ts.meta diff --git a/assets/Script/GameRootController.ts b/assets/Script/GameRootController.ts index 32b7340..2a83e45 100644 --- a/assets/Script/GameRootController.ts +++ b/assets/Script/GameRootController.ts @@ -1,70 +1,72 @@ /* * @Author: WoNiu * @Date: 2024-03-21 13:29:53 - * @LastEditTime: 2024-03-25 01:18:18 + * @LastEditTime: 2024-03-29 14:21:02 * @LastEditors: WoNiu * @Description: */ -import { _decorator,Component, Node } from 'cc'; -import { BoardRoot } from './BoardRoot'; -import { UIRoot } from './UIRoot'; -import { DialogRoot } from './DialogRoot'; +import { _decorator, Component, Node } from "cc"; +import { BoardRoot } from "./BoardRoot"; +import { UIRoot } from "./UIRoot/UIRoot"; +import { GameRoleController } from "./UIRoot/GameRoleController"; +import { DialogRoot } from "./DialogRoot/DialogRoot"; const { ccclass, property } = _decorator; - /** * @description: 游戏根节点的单例 用于直接提供子节点 */ export class GameRootSingleton { - private static readonly _instance: GameRootSingleton = new GameRootSingleton(); + private static readonly _instance: GameRootSingleton = + new GameRootSingleton(); - private constructor() {} - - public static getInstance(): GameRootSingleton { - return GameRootSingleton._instance; - } - - boardRootNode:Node; - UIRootNode: Node; - DialogRootNode: Node; - - boardRoot: BoardRoot; - UIRoot: UIRoot; - DialogRoot: DialogRoot; + private constructor() {} + public static getInstance(): GameRootSingleton { + return GameRootSingleton._instance; } + boardRootNode: Node; + UIRootNode: Node; + DialogRootNode: Node; -@ccclass('GameRootController') + boardRoot: BoardRoot; + UIRoot: UIRoot; + DialogRoot: DialogRoot; + + /** 玩家角色控制脚本 */ + gameRoleController: GameRoleController; + +} + +@ccclass("GameRootController") /** * @description: 游戏根节点脚本 */ export class GameRootController extends Component { + @property(Node) boardRootNode: Node; + @property(Node) UIRootNode: Node; + @property(Node) DialogRootNode: Node; - @property(Node) boardRootNode:Node; - @property(Node) UIRootNode: Node; - @property(Node) DialogRootNode: Node; + start() { + /// 给三个图层添加 root 根脚本 + const game = GameRootSingleton.getInstance(); + game.boardRootNode = this.boardRootNode; + game.UIRootNode = this.UIRootNode; + game.DialogRootNode = this.DialogRootNode; + + /// 给三个图层添加 root 根脚本 + game.boardRoot = this.boardRootNode.getComponent(BoardRoot); + game.UIRoot = this.UIRootNode.getComponent(UIRoot); + game.DialogRoot = this.DialogRootNode.getComponent(DialogRoot); + + /// 在 UI 节点 添加玩家角色控制脚本 + this.UIRootNode.addComponent(GameRoleController); - start() { + // 添加游戏 匹配过程控制 脚本 + game.gameRoleController = this.addComponent(GameRoleController); - /// 给三个图层添加 root 根脚本 - const game = GameRootSingleton.getInstance(); - game.boardRootNode = this.boardRootNode; - game.UIRootNode = this.UIRootNode; - game.DialogRootNode = this.DialogRootNode; + } - /// 给三个图层添加 root 根脚本 - game.boardRoot = this.boardRootNode.getComponent(BoardRoot); - game.UIRoot = this.UIRootNode.getComponent(UIRoot); - game.DialogRoot = this.DialogRootNode.getComponent(DialogRoot); - - - } - - update(deltaTime: number) { - - } + update(deltaTime: number) {} } - - diff --git a/assets/Script/Gamer.meta b/assets/Script/Gamer.meta new file mode 100644 index 0000000..c48c868 --- /dev/null +++ b/assets/Script/Gamer.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "d61e7a19-5a2c-45c6-b9c8-8efecdaafe18", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/UINode/GamerNode.ts b/assets/Script/Gamer/GamerCardNode.ts similarity index 94% rename from assets/Script/UINode/GamerNode.ts rename to assets/Script/Gamer/GamerCardNode.ts index 0b8a7ed..73649c8 100644 --- a/assets/Script/UINode/GamerNode.ts +++ b/assets/Script/Gamer/GamerCardNode.ts @@ -1,23 +1,26 @@ +/* + * @Author: WoNiu + * @Date: 2024-03-09 17:02:06 + * @LastEditTime: 2024-03-27 16:11:51 + * @LastEditors: WoNiu + * @Description: + */ import { _decorator, Color, Label, Node, Size, Sprite, SpriteFrame, tween, UITransform, VerticalTextAlignment } from 'cc'; import { BaseSprite } from '../../GlobalScript/CommonComponent/BaseSprite'; import { NpkImage } from '../../Tool/NPKImage'; import { BaseSpriteFrame } from '../../GlobalScript/CommonComponent/BaseSpriteFrame'; +import { GamerRoleType } from './GamerRoleType'; const { ccclass } = _decorator; -/// 玩家角色类型 -export enum CharacterType{ - /// 剑魂 - JianHun = 0, -} /// 玩家Node封装 -@ccclass('Gamer') -export class GamerNode extends Node { +@ccclass('GamerCardNode') +export class GamerCardNode extends Node { /// 玩家角色类型 - private _characterType : CharacterType; + private _characterType : GamerRoleType; /// 玩家名称 private GamerNameLabel : Label; @@ -34,7 +37,7 @@ export class GamerNode extends Node { private blue = new Color('00baff'); - set charchterType(type:CharacterType){ + set charchterType(type:GamerRoleType){ if(!this.getChildByName('GamerCharacterNode')){ this._characterType = type; this.initCharacterNode(); diff --git a/assets/Script/UINode/GamerNode.ts.meta b/assets/Script/Gamer/GamerCardNode.ts.meta similarity index 100% rename from assets/Script/UINode/GamerNode.ts.meta rename to assets/Script/Gamer/GamerCardNode.ts.meta diff --git a/assets/Script/Gamer/GamerRoleNode.ts b/assets/Script/Gamer/GamerRoleNode.ts new file mode 100644 index 0000000..ba15051 --- /dev/null +++ b/assets/Script/Gamer/GamerRoleNode.ts @@ -0,0 +1,120 @@ +/* + * @Author: WoNiu + * @Date: 2024-03-27 15:58:07 + * @LastEditTime: 2024-03-29 14:40:52 + * @LastEditors: WoNiu + * @Description: + */ +import { + _decorator, + Component, + Node, + Sprite, + SpriteFrame, +} from "cc"; +import { NpkImageTool } from "../../Tool/NPKImage"; +import { GamerRoleAni, GamerRoleType } from "./GamerRoleType"; +import { GameState } from "../../GlobalScript/GlobalGameState/GameState"; +const { ccclass, property } = _decorator; +@ccclass("GamerRoleNode") + +//* ─── 玩家在地图上的角色 Node ──────────────────────────────────────────────────────────── + +/** + * @description: 玩家在地图上的角色 节点 + */ +export class GamerRoleNode extends Node { + constructor(type: GamerRoleType) { + super(); + + //角色类型 设置后自动播放动画 + this.addComponent(RoleAnimation).type = type; + } + +} + +//* ─── 角色动画播放 Component ─────────────────────────────────────────────────────────────────── + +export enum PlayAniState { + //播放中 + playing, + //暂停 + pause, +} + +/** + * @description: 角色的动画 + */ +export class RoleAnimation extends Component { + /** 节点精灵 */ + private sprite: Sprite; + /** 精灵帧总数 */ + private frameCount: number; + /** 是否初始化完成 */ + private InitState: boolean; + /** 精灵帧map缓存 */ + private frameMap: Map = new Map(); + + /** 每一帧需要显示的时间 千分之一秒 */ + private static frameShowTime: number = 60; + + /** 当前帧显示了的时间 */ + private nowFrameTime: number = 0; + + /** 当前帧 */ + private nowFrameIndex: number = 0; + + /** 动画状态 */ + private playState: PlayAniState = PlayAniState.playing; + + /** 角色类型 设置后自动播放动画 */ + set type(type: GamerRoleType) { + + const node = new Node(); + this.node.addChild(node); + + this.sprite = node.addComponent(Sprite); + + //设置类型 + this.sprite.sizeMode = Sprite.SizeMode.RAW; + //设置 + this.sprite.trim = false; + + // 获取所有帧图片 + NpkImageTool.GetNpkImageAll( + GamerRoleAni.getPath(type), + (count, frameMap) => { + this.frameCount = count; + this.frameMap = frameMap; + this.InitState = true; + // 显示第一帧 + this.sprite.spriteFrame = this.frameMap.get(this.nowFrameIndex); + } + ); + } + + start() {} + + update(dt: number) { + //如果游戏世界处于暂停的模式下 不再继续播放 + if (GameState.getInstance().IsPauseState()) return; + //如果初始化未完成,不播放 + if (!this.InitState) return; + //如果不在播放中 + if (this.playState != PlayAniState.playing) return; + + //每帧增加过去的时间 取千分之一秒为单位 + this.nowFrameTime += Math.trunc(dt * 1000); + + // 大于60毫秒换下一帧 + if (this.nowFrameTime < 60) return; + + this.nowFrameTime -= 60; + this.nowFrameTime++; + + // 播放完成后 重新播放 + if (this.nowFrameIndex >= this.frameCount) this.nowFrameIndex = 0; + + this.sprite.spriteFrame = this.frameMap.get(this.nowFrameIndex); + } +} diff --git a/assets/Script/Gamer/GamerRoleNode.ts.meta b/assets/Script/Gamer/GamerRoleNode.ts.meta new file mode 100644 index 0000000..967347f --- /dev/null +++ b/assets/Script/Gamer/GamerRoleNode.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "7b231e75-2650-4560-a447-3e3de615fdae", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/Gamer/GamerRoleType.ts b/assets/Script/Gamer/GamerRoleType.ts new file mode 100644 index 0000000..5b037a3 --- /dev/null +++ b/assets/Script/Gamer/GamerRoleType.ts @@ -0,0 +1,410 @@ +/* + * @Author: WoNiu + * @Date: 2024-03-27 16:10:31 + * @LastEditTime: 2024-03-29 10:49:55 + * @LastEditors: WoNiu + * @Description: 玩家角色类型 + */ +/// 官网总数 63 + +import { NpkImage, NpkImagePath } from "../../Tool/NPKImage"; + +//* ─── 玩家角色类型 ────────────────────────────────────────────────────────────────── + +/** + * @description: 玩家角色类型 + * + */ +export enum GamerRoleType { + /** 散打 */ + SanDa, + /** 柔道 */ + RouDao, + /** 气功 */ + QiGong, + /** 街霸 */ + JieBa, + + /** 女漫游 */ + NvManYou, + /** 女弹药 */ + NvDanYao, + /** 女机械 */ + NvJiXie, + /** 女枪炮 */ + NvQiangPao, + + /** 冰洁 */ + BingJie, + /** 元素爆破 */ + + YuanSuBaoPo, + /** 剑魔 */ + JianMo, + /** 剑宗 */ + + JianZong, + /** 暗殿骑士 */ + AnDianQiShi, + /** 流浪骑士 */ + + LiuLangQiShi, + /** 光枪 */ + GuangQiang, + /** 暗枪 */ + AnQiang, + + /** 女街霸 */ + NvJieBa, + /** 女散打 */ + NvSanDa, + /** 女气功 */ + NvQiGong, + /** 女柔道 */ + NvRouDao, + + /** 弹药 */ + DanYao, + /** 枪炮 */ + QiangPao, + /** 机械 */ + JiXie, + /** 漫游 */ + ManYou, + + /** 战法 */ + ZanFa, + /** 召唤 */ + ZhaoHuan, + /** 魔道 */ + MoDao, + /** 元素 */ + YuanSu, + + /** 复仇 */ + FuChou, + /** 篮拳 */ + LanQuan, + /** 圣骑 */ + ShenQi, + /** 驱魔 */ + QuMo, + + /** 狂战 */ + KuangZhan, + /** 鬼泣 */ + GuiQi, + /** 阿修罗 */ + AXiuLuo, + /** 剑魂 */ + JianHun, + + /** 刺客 */ + Cike, + /** 影武者 */ + YinWuZhe, + /** 忍者 */ + RenZhe, + /** 死灵 */ + SiLin, + /** 普通鬼剑士 */ + GuiJianShi, +} + +//* ─── 角色立绘 路径 ───────────────────────────────────────────────────────────────── + +/** + * @description: 角色立绘 路径 + */ +export class GamerRoleCardDate { + /** NPk路径 */ + npkPath: string; + /** index */ + index: number; + + constructor(index: number) { + this.npkPath = NpkImage.character_sd; + this.index = index; + } + + /** + * @description: 从角色类型获取立绘数据 + */ + static getDate(type: GamerRoleType): GamerRoleCardDate { + switch (type) { + // 散打 + case GamerRoleType.SanDa: + return new GamerRoleCardDate(29); + // 柔道 + case GamerRoleType.RouDao: + return new GamerRoleCardDate(31); + // 气功 + case GamerRoleType.QiGong: + return new GamerRoleCardDate(28); + // 街霸 + case GamerRoleType.JieBa: + return new GamerRoleCardDate(30); + + // 女漫游 + case GamerRoleType.NvManYou: + return new GamerRoleCardDate(20); + // 女弹药 + case GamerRoleType.NvDanYao: + return new GamerRoleCardDate(23); + // 女机械 + case GamerRoleType.NvJiXie: + return new GamerRoleCardDate(22); + // 女枪炮 + case GamerRoleType.NvQiangPao: + return new GamerRoleCardDate(21); + + // 冰洁 + case GamerRoleType.BingJie: + return new GamerRoleCardDate(33); + // 元素爆破 + case GamerRoleType.YuanSuBaoPo: + return new GamerRoleCardDate(32); + + // 剑魔 + case GamerRoleType.JianMo: + return new GamerRoleCardDate(41); + // 剑宗 + case GamerRoleType.JianZong: + return new GamerRoleCardDate(39); + + // 暗殿骑士 + case GamerRoleType.AnDianQiShi: + return new GamerRoleCardDate(40); + // 流浪骑士 + case GamerRoleType.LiuLangQiShi: + return new GamerRoleCardDate(42); + + // 光枪 + case GamerRoleType.GuangQiang: + return new GamerRoleCardDate(48); + // 暗枪 + case GamerRoleType.AnQiang: + return new GamerRoleCardDate(47); + + // 女街霸 + case GamerRoleType.NvJieBa: + return new GamerRoleCardDate(6); + // 女散打 + case GamerRoleType.NvSanDa: + return new GamerRoleCardDate(5); + // 女气功 + case GamerRoleType.NvQiGong: + return new GamerRoleCardDate(4); + // 女柔道 + case GamerRoleType.NvRouDao: + return new GamerRoleCardDate(7); + + // 弹药 + case GamerRoleType.DanYao: + return new GamerRoleCardDate(11); + // 枪炮 + case GamerRoleType.QiangPao: + return new GamerRoleCardDate(9); + // 机械 + case GamerRoleType.JiXie: + return new GamerRoleCardDate(10); + // 漫游 + case GamerRoleType.ManYou: + return new GamerRoleCardDate(8); + + // 战法 + case GamerRoleType.ZanFa: + return new GamerRoleCardDate(14); + // 召唤 + case GamerRoleType.ZhaoHuan: + return new GamerRoleCardDate(13); + // 魔道 + case GamerRoleType.MoDao: + return new GamerRoleCardDate(15); + // 元素 + case GamerRoleType.YuanSu: + return new GamerRoleCardDate(12); + + // 复仇 + case GamerRoleType.FuChou: + return new GamerRoleCardDate(19); + // 篮拳 + case GamerRoleType.LanQuan: + return new GamerRoleCardDate(16); + // 圣骑 + case GamerRoleType.ShenQi: + return new GamerRoleCardDate(17); + // 驱魔 + case GamerRoleType.QuMo: + return new GamerRoleCardDate(18); + + // 狂战 + case GamerRoleType.KuangZhan: + return new GamerRoleCardDate(2); + // 鬼泣 + case GamerRoleType.GuiQi: + return new GamerRoleCardDate(1); + // 阿修罗 + case GamerRoleType.AXiuLuo: + return new GamerRoleCardDate(3); + // 剑魂 + case GamerRoleType.JianHun: + return new GamerRoleCardDate(0); + + // 刺客 + case GamerRoleType.Cike: + return new GamerRoleCardDate(24); + // 影武者 + case GamerRoleType.YinWuZhe: + return new GamerRoleCardDate(27); + // 忍者 + case GamerRoleType.RenZhe: + return new GamerRoleCardDate(26); + // 死灵 + case GamerRoleType.SiLin: + return new GamerRoleCardDate(25); + + // 普通鬼剑士 + case GamerRoleType.GuiJianShi: + return new GamerRoleCardDate(62); + } + } +} + +//* ─── 角色站立动画 路径 ─────────────────────────────────────────────────────────────── + +/** + * @description: 角色站立动画 路径 + */ +export class GamerRoleAni { + /** + * @description: 从角色站立动画 路径 + */ + static getPath(type: GamerRoleType): string { + switch (type) { + // 散打 + case GamerRoleType.SanDa: + return NpkImagePath + "role_1_sanda.img"; + // 柔道 + case GamerRoleType.RouDao: + return NpkImagePath + "role_2_roudao.img"; + // 气功 + case GamerRoleType.QiGong: + return NpkImagePath + "role_3_qigong.img"; + // 街霸 + case GamerRoleType.JieBa: + return NpkImagePath + "role_4_jieba.img"; + // 女漫游 + case GamerRoleType.NvManYou: + return NpkImagePath + "role_5_nv_manyou.img"; + // 女弹药 + case GamerRoleType.NvDanYao: + return NpkImagePath + "role_6_nv_danyao.img"; + // 女机械 + case GamerRoleType.NvJiXie: + return NpkImagePath + "role_7_nv_jixie.img"; + // 女枪炮 + case GamerRoleType.NvQiangPao: + return NpkImagePath + "role_8_nv_qiangpao.img"; + // 冰洁 + case GamerRoleType.BingJie: + return NpkImagePath + "role_9_bingjie.img"; + // 元素爆破 + case GamerRoleType.YuanSuBaoPo: + return NpkImagePath + "role_10_yuasubaopo.img"; + // 剑魔 + case GamerRoleType.JianMo: + return NpkImagePath + "role_11_jianmo.img"; + // 剑宗 + case GamerRoleType.JianZong: + return NpkImagePath + "role_12_jianzong.img"; + // 暗殿骑士 + case GamerRoleType.AnDianQiShi: + return NpkImagePath + "role_13_andianqishi.img"; + // 流浪骑士 + case GamerRoleType.LiuLangQiShi: + return NpkImagePath + "role_14_liulangjianshi.img"; + // 光枪 + case GamerRoleType.GuangQiang: + return NpkImagePath + "role_15_guangqiang.img"; + // 暗枪 + case GamerRoleType.AnQiang: + return NpkImagePath + "role_16_anqiang.img"; + // 女街霸 + case GamerRoleType.NvJieBa: + return NpkImagePath + "role_17_nv_jieba.img"; + // 女散打 + case GamerRoleType.NvSanDa: + return NpkImagePath + "role_18_nv_sanda.img"; + // 女气功 + case GamerRoleType.NvQiGong: + return NpkImagePath + "role_19_nv_qigong.img"; + // 女柔道 + case GamerRoleType.NvRouDao: + return NpkImagePath + "role_20_nv_roudao.img"; + // 弹药 + case GamerRoleType.DanYao: + return NpkImagePath + "role_21_danyao.img"; + // 枪炮 + case GamerRoleType.QiangPao: + return NpkImagePath + "role_22_qiangpao.img"; + // 机械 + case GamerRoleType.JiXie: + return NpkImagePath + "role_23_jixie.img"; + // 漫游 + case GamerRoleType.ManYou: + return NpkImagePath + "role_24_manyou.img"; + // 战法 + case GamerRoleType.ZanFa: + return NpkImagePath + "role_25_zhanfa.img"; + // 召唤 + case GamerRoleType.ZhaoHuan: + return NpkImagePath + "role_26_zhaohuan.img"; + // 魔道 + case GamerRoleType.MoDao: + return NpkImagePath + "role_27_modao.img"; + // 元素 + case GamerRoleType.YuanSu: + return NpkImagePath + "role_28_yuansu.img"; + // 复仇 + case GamerRoleType.FuChou: + return NpkImagePath + "role_29_fuchou.img"; + // 篮拳 + case GamerRoleType.LanQuan: + return NpkImagePath + "role_30_lanquan.img"; + // 圣骑 + case GamerRoleType.ShenQi: + return NpkImagePath + "role_31_shenqi.img"; + // 驱魔 + case GamerRoleType.QuMo: + return NpkImagePath + "role_32_qumo.img"; + // 狂战 + case GamerRoleType.KuangZhan: + return NpkImagePath + "role_33_kuangzhan.img"; + // 鬼泣 + case GamerRoleType.GuiQi: + return NpkImagePath + "role_34_guiqi.img"; + // 阿修罗 + case GamerRoleType.AXiuLuo: + return NpkImagePath + "role_35_axiuluo.img"; + // 剑魂 + case GamerRoleType.JianHun: + return NpkImagePath + "role_36_jianhun.img"; + // 刺客 + case GamerRoleType.Cike: + return NpkImagePath + "role_37_ceke.img"; + // 影武者 + case GamerRoleType.YinWuZhe: + return NpkImagePath + "role_38_yinwuzhe.img"; + // 忍者 + case GamerRoleType.RenZhe: + return NpkImagePath + "role_39_renzhe.img"; + // 死灵 + case GamerRoleType.SiLin: + return NpkImagePath + "role_40_silin.img"; + // 普通鬼剑士 + case GamerRoleType.GuiJianShi: + return NpkImagePath + "role_41_guijian.img"; + } + } +} diff --git a/assets/Script/Gamer/GamerRoleType.ts.meta b/assets/Script/Gamer/GamerRoleType.ts.meta new file mode 100644 index 0000000..31ee5fa --- /dev/null +++ b/assets/Script/Gamer/GamerRoleType.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "150e386d-95e6-4ebc-af15-1ef927aa4788", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/MapTile/MapTileButtonComponent.ts b/assets/Script/MapTile/MapTileButtonComponent.ts index 4bab370..400541f 100644 --- a/assets/Script/MapTile/MapTileButtonComponent.ts +++ b/assets/Script/MapTile/MapTileButtonComponent.ts @@ -11,7 +11,7 @@ import { Vec3, } from "cc"; import { NpkImage } from "../../Tool/NPKImage"; -import { MapTileDirection } from "./MapTileData"; +import { MapTileDirection } from "./MapTileType"; import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite"; import { DiamondCheck, Point } from "./../Common/InDiamondCheck"; const { ccclass } = _decorator; diff --git a/assets/Script/MapTile/MapTileController.ts b/assets/Script/MapTile/MapTileController.ts index ac0446a..0521173 100644 --- a/assets/Script/MapTile/MapTileController.ts +++ b/assets/Script/MapTile/MapTileController.ts @@ -1,12 +1,12 @@ /* * @Author: WoNiu * @Date: 2024-03-16 16:34:19 - * @LastEditTime: 2024-03-27 15:27:08 + * @LastEditTime: 2024-03-28 21:09:58 * @LastEditors: WoNiu * @Description: 地图地块的行为控制器 */ import { _decorator, Component, } from "cc"; -import { MapTileData, MapTileFactory, MapTileType } from "./MapTileData"; +import { MapTileData, MapTileType } from "./MapTileType"; const { ccclass } = _decorator; @ccclass("MapTileController") @@ -20,7 +20,7 @@ export class MapTileController extends Component { private _tileType: MapTileType; set tileType(newType: MapTileType){ this._tileType = newType; - this._tileData = MapTileFactory.getData(newType as MapTileType); + this._tileData = MapTileData.getData(newType as MapTileType); }; get tileType(){ return this._tileType; }; diff --git a/assets/Script/MapTile/MapTileNode.ts b/assets/Script/MapTile/MapTileNode.ts index 0097d31..0e4f209 100644 --- a/assets/Script/MapTile/MapTileNode.ts +++ b/assets/Script/MapTile/MapTileNode.ts @@ -1,11 +1,11 @@ import { _decorator, Node } from "cc"; -import { MapTileDirection, MapTileType } from "./MapTileData"; +import { MapTileDirection, MapTileType } from "./MapTileType"; import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite"; import { MapTileButtonComponent } from "./MapTileButtonComponent"; import { MapTileController } from "./MapTileController"; import { CloseButtonNode } from "../Common/CloseButtonNode"; import { MapTitleAction } from "./MapTitleAction"; -import { LuckyType } from "../DialogNode/LuckyCoinsNode"; +import { LuckyType } from "../DialogRoot/LuckyCoinsNode"; const { ccclass } = _decorator; /// 地块 diff --git a/assets/Script/MapTile/MapTileData.ts b/assets/Script/MapTile/MapTileType.ts similarity index 57% rename from assets/Script/MapTile/MapTileData.ts rename to assets/Script/MapTile/MapTileType.ts index 6d7b592..48ca82d 100644 --- a/assets/Script/MapTile/MapTileData.ts +++ b/assets/Script/MapTile/MapTileType.ts @@ -1,155 +1,165 @@ import { Vec2, v2 } from "cc"; import { NpkImage } from "../../Tool/NPKImage"; -/// 地块类型 + +//* ─── 地块类型 ──────────────────────────────────────────────────────────────────── + +/** 地块类型 */ export enum MapTileType { - /// 赫顿玛尔 + /** 赫顿玛尔 */ HeDunMaEr = 0, - /// 时间广场 + /** 时间广场 */ ShiJianGuangChang, - /// 兽人峡谷 + /** 兽人峡谷 */ ShouRenXiaGu, - /// 超时空漩涡 + /** 超时空漩涡 */ ChaoShiKongXuanWo, - /// 恐怖的栖息地 + /** 恐怖的栖息地 */ KongBuDeQiXiDi, - /// 红色魔女之森 + /** 红色魔女之森 */ HongSeMoNvZhiSen, - /// 月光酒馆 + /** 月光酒馆 */ YueGuangJiuGuan, - /// 亡命杀阵 + /** 亡命杀阵 */ WangMingShaZhen, - /// 皇家娱乐 + /** 皇家娱乐 */ HuangJaiYuLe, - /// 黑暗都市 + /** 黑暗都市 */ HeiAnDuShi, - /// 哈林的命运硬币(左边) + /** 哈林的命运硬币(左边) */ HaLinMingYunYinBi, - /// 第九隔离区 + /** 第九隔离区 */ DiJiuGeLiQu, - /// 决斗场 + /** 决斗场 */ JueDouChang, - /// 腐坏街道 + /** 腐坏街道 */ FuHuaiJieDao, - /// 溢血的地下城 + /** 溢血的地下城 */ YiXueDeDiXiaChen, - /// 普雷·伊西斯 + /** 普雷·伊西斯 */ PuLeiYiXiSi, - /// 沉重的礼拜堂 + /** 沉重的礼拜堂 */ ChenZhongDeLiBaiTang, - /// 螺旋王国 + /** 螺旋王国 */ LuoXuanWangGuo, - /// 海上列车 + /** 海上列车 */ HaiShangLieChe, - /// 暗黑神殿 + /** 暗黑神殿 */ AnHeiShenDian, - /// 痛苦地下城 + /** 痛苦地下城 */ TongKuDiXiaChen, - /// 无底坑道 + /** 无底坑道 */ WuDiKenDao, - /// 切斯特小镇的命运硬币(右边) + /** 切斯特小镇的命运硬币(右边) */ XiaoZhenMingYunYinBi, - /// 记忆之地 + /** 记忆之地 */ JiYiZhiDi, } +//* ─── 所有地块类型数组 ──────────────────────────────────────────────────────────────── + +/** 所有地块类型数组 */ export const MapTileTypes = [ - /// 赫顿玛尔 + /** 赫顿玛尔 */ MapTileType.HeDunMaEr, -/// 时间广场 -MapTileType.ShiJianGuangChang, -/// 兽人峡谷 -MapTileType.ShouRenXiaGu, -/// 超时空漩涡 -MapTileType.ChaoShiKongXuanWo, -/// 恐怖的栖息地 -MapTileType.KongBuDeQiXiDi, -/// 红色魔女之森 -MapTileType.HongSeMoNvZhiSen, + /** 时间广场 */ + MapTileType.ShiJianGuangChang, + /** 兽人峡谷 */ + MapTileType.ShouRenXiaGu, + /** 超时空漩涡 */ + MapTileType.ChaoShiKongXuanWo, + /** 恐怖的栖息地 */ + MapTileType.KongBuDeQiXiDi, + /** 红色魔女之森 */ + MapTileType.HongSeMoNvZhiSen, -/// 月光酒馆 -MapTileType.YueGuangJiuGuan, -/// 亡命杀阵 -MapTileType.WangMingShaZhen, -/// 皇家娱乐 -MapTileType.HuangJaiYuLe, -/// 黑暗都市 -MapTileType.HeiAnDuShi, -/// 哈林的命运硬币(左边) -MapTileType.HaLinMingYunYinBi, -/// 第九隔离区 -MapTileType.DiJiuGeLiQu, + /** 月光酒馆 */ + MapTileType.YueGuangJiuGuan, + /** 亡命杀阵 */ + MapTileType.WangMingShaZhen, + /** 皇家娱乐 */ + MapTileType.HuangJaiYuLe, + /** 黑暗都市 */ + MapTileType.HeiAnDuShi, + /** 哈林的命运硬币(左边) */ + MapTileType.HaLinMingYunYinBi, + /** 第九隔离区 */ + MapTileType.DiJiuGeLiQu, -/// 决斗场 -MapTileType.JueDouChang, -/// 腐坏街道 -MapTileType.FuHuaiJieDao, -/// 溢血的地下城 -MapTileType.YiXueDeDiXiaChen, -/// 普雷·伊西斯 -MapTileType.PuLeiYiXiSi, -/// 沉重的礼拜堂 -MapTileType.ChenZhongDeLiBaiTang, -/// 螺旋王国 -MapTileType.LuoXuanWangGuo, + /** 决斗场 */ + MapTileType.JueDouChang, + /** 腐坏街道 */ + MapTileType.FuHuaiJieDao, + /** 溢血的地下城 */ + MapTileType.YiXueDeDiXiaChen, + /** 普雷·伊西斯 */ + MapTileType.PuLeiYiXiSi, + /** 沉重的礼拜堂 */ + MapTileType.ChenZhongDeLiBaiTang, + /** 螺旋王国 */ + MapTileType.LuoXuanWangGuo, -/// 海上列车 -MapTileType.HaiShangLieChe, -/// 暗黑神殿 -MapTileType.AnHeiShenDian, -/// 痛苦地下城 -MapTileType.TongKuDiXiaChen, -/// 无底坑道 -MapTileType.WuDiKenDao, -/// 切斯特小镇的命运硬币(右边) -MapTileType.XiaoZhenMingYunYinBi, -/// 记忆之地 -MapTileType.JiYiZhiDi, + /** 海上列车 */ + MapTileType.HaiShangLieChe, + /** 暗黑神殿 */ + MapTileType.AnHeiShenDian, + /** 痛苦地下城 */ + MapTileType.TongKuDiXiaChen, + /** 无底坑道 */ + MapTileType.WuDiKenDao, + /** 切斯特小镇的命运硬币(右边) */ + MapTileType.XiaoZhenMingYunYinBi, + /** 记忆之地 */ + MapTileType.JiYiZhiDi, ]; -/// 地块方向 +//* ─── 地块方向 ──────────────────────────────────────────────────────────────────── + +/** 地块方向 */ export enum MapTileDirection { - /// 横 + /** 横 */ horizontal = 24, - /// 竖 + /** 竖 */ vertical = 25, - /// 角落 + /** 角落 */ nook = 26, } -/// 地块的数据 -export class MapTileData { - /// 坐标 - location: Vec2; - /// npk路径 - npkPath: NpkImage; - /// 地块背景index - backgroundIndex: number; - /// 地块方向 - direction: MapTileDirection; - /// 怪物相关数据 +//* ─── 地块的数据 ─────────────────────────────────────────────────────────────────── - /// 列车选择许可 +/** 地块的数据 */ +export class MapTileData { + /** 坐标 */ + location: Vec2; + /** npk路径 */ + npkPath: NpkImage; + /** 地块背景index */ + backgroundIndex: number; + /** 地块方向 */ + direction: MapTileDirection; + /** 怪物相关数据 */ + + /** 列车选择许可 */ trainsSelectLicense: boolean; - /// 决斗场选择许可 + /** 决斗场选择许可 */ duelSelectLicense: boolean; - /// 占领许可 + /** 占领许可 */ occupyLicense: boolean; constructor({ - /// 坐标 + /** 坐标 */ location, - /// 背景index + /** 背景index */ backgroundIndex, - /// 地块方向 + /** 地块方向 */ direction, - /// 占领许可 + /** 占领许可 */ occupyLicense, - /// 列车选择许可 + /** 列车选择许可 */ trainsSelectLicense, - /// 决斗场选择许可 + /** 决斗场选择许可 */ duelSelectLicense, }: { location: Vec2; @@ -168,87 +178,85 @@ export class MapTileData { this.duelSelectLicense = duelSelectLicense ?? true; this.occupyLicense = occupyLicense ?? true; } -} -export class MapTileFactory { static getData(type: MapTileType): MapTileData { switch (type) { /// 赫顿玛尔 case MapTileType.HeDunMaEr: - return MapTileFactory.HeDunMaErData; + return this.HeDunMaErData; /// 时间广场 case MapTileType.ShiJianGuangChang: - return MapTileFactory.ShiJianGuangChangData; + return this.ShiJianGuangChangData; /// 兽人峡谷 case MapTileType.ShouRenXiaGu: - return MapTileFactory.ShouRenXiaGuData; + return this.ShouRenXiaGuData; /// 超时空漩涡 case MapTileType.ChaoShiKongXuanWo: - return MapTileFactory.ChaoShiKongXuanWoData; + return this.ChaoShiKongXuanWoData; /// 恐怖的栖息地 case MapTileType.KongBuDeQiXiDi: - return MapTileFactory.KongBuDeQiXiDiData; + return this.KongBuDeQiXiDiData; /// 红色魔女之森 case MapTileType.HongSeMoNvZhiSen: - return MapTileFactory.HongSeMoNvZhiSenData; + return this.HongSeMoNvZhiSenData; /// 月光酒馆 case MapTileType.YueGuangJiuGuan: - return MapTileFactory.YueGuangJiuGuanData; + return this.YueGuangJiuGuanData; /// 亡命杀镇子 case MapTileType.WangMingShaZhen: - return MapTileFactory.WangMingShaZhenData; + return this.WangMingShaZhenData; /// 皇家娱乐 case MapTileType.HuangJaiYuLe: - return MapTileFactory.HuangJaiYuLeData; + return this.HuangJaiYuLeData; /// 黑暗都市 case MapTileType.HeiAnDuShi: - return MapTileFactory.HeiAnDuShiData; + return this.HeiAnDuShiData; /// 哈林的命运硬币(左边) case MapTileType.HaLinMingYunYinBi: - return MapTileFactory.HaLinMingYunYinBiData; + return this.HaLinMingYunYinBiData; /// 第九隔离区 case MapTileType.DiJiuGeLiQu: - return MapTileFactory.DiJiuGeLiQuData; + return this.DiJiuGeLiQuData; /// 决斗场 case MapTileType.JueDouChang: - return MapTileFactory.JueDouChangData; + return this.JueDouChangData; /// 腐坏街道 case MapTileType.FuHuaiJieDao: - return MapTileFactory.FuHuaiJieDaoData; + return this.FuHuaiJieDaoData; /// 溢血的地下城 case MapTileType.YiXueDeDiXiaChen: - return MapTileFactory.YiXueDeDiXiaChenData; + return this.YiXueDeDiXiaChenData; /// 普雷·伊西斯 case MapTileType.PuLeiYiXiSi: - return MapTileFactory.PuLeiYiXiSiData; + return this.PuLeiYiXiSiData; /// 沉重的礼拜堂 case MapTileType.ChenZhongDeLiBaiTang: - return MapTileFactory.ChenZhongDeLiBaiTangData; + return this.ChenZhongDeLiBaiTangData; /// 螺旋王国 case MapTileType.LuoXuanWangGuo: - return MapTileFactory.LuoXuanWangGuoData; + return this.LuoXuanWangGuoData; /// 海上列车 case MapTileType.HaiShangLieChe: - return MapTileFactory.HaiShangLieCheData; + return this.HaiShangLieCheData; /// 暗黑神殿 case MapTileType.AnHeiShenDian: - return MapTileFactory.AnHeiShenDianData; + return this.AnHeiShenDianData; /// 痛苦地下城 case MapTileType.TongKuDiXiaChen: - return MapTileFactory.TongKuDiXiaChenData; + return this.TongKuDiXiaChenData; /// 无底坑道 case MapTileType.WuDiKenDao: - return MapTileFactory.WuDiKenDaoData; + return this.WuDiKenDaoData; /// 切斯特小镇的命运硬币(右边) case MapTileType.XiaoZhenMingYunYinBi: - return MapTileFactory.XiaoZhenMingYunYinBiData; + return this.XiaoZhenMingYunYinBiData; /// 记忆之地 case MapTileType.JiYiZhiDi: - return MapTileFactory.JiYiZhiDiData; + return this.JiYiZhiDiData; } } - // 赫顿玛尔 + /** 赫顿玛尔 */ private static HeDunMaErData = new MapTileData({ location: v2(475, -448), direction: MapTileDirection.nook, @@ -256,38 +264,38 @@ export class MapTileFactory { occupyLicense: false, }); - /// 时间广场 (55,34) + /** 时间广场 (55,34) */ private static ShiJianGuangChangData = new MapTileData({ location: v2(420, -414), direction: MapTileDirection.horizontal, }); - /// 兽人峡谷 (52,34) + /** 兽人峡谷 (52,34) */ private static ShouRenXiaGuData = new MapTileData({ location: v2(368, -380), direction: MapTileDirection.horizontal, }); - /// 超时空漩涡 (53,34) + /** 超时空漩涡 (53,34) */ private static ChaoShiKongXuanWoData = new MapTileData({ location: v2(315, -346), backgroundIndex: 32, direction: MapTileDirection.horizontal, }); - /// 恐怖的栖息地 (52,34) + /** 恐怖的栖息地 (52,34) */ private static KongBuDeQiXiDiData = new MapTileData({ location: v2(262, -312), direction: MapTileDirection.horizontal, }); - /// 红色魔女之森 (52,34) + /** 红色魔女之森 (52,34) */ private static HongSeMoNvZhiSenData = new MapTileData({ location: v2(209, -278), direction: MapTileDirection.horizontal, }); - // 月光酒馆(69,44) + // 月光酒馆(69,44) */ private static YueGuangJiuGuanData = new MapTileData({ location: v2(140, -234), direction: MapTileDirection.nook, @@ -295,24 +303,24 @@ export class MapTileFactory { occupyLicense: false, }); - /// 亡命杀镇 (53,34) + /** 亡命杀镇 (53,34) */ private static WangMingShaZhenData = new MapTileData({ location: v2(209, -198), direction: MapTileDirection.vertical, }); - /// 皇家娱乐(53,34) + /** 皇家娱乐(53,34) */ private static HuangJaiYuLeData = new MapTileData({ location: v2(262, -164), direction: MapTileDirection.vertical, }); - /// 黑暗都市 + /** 黑暗都市 */ private static HeiAnDuShiData = new MapTileData({ location: v2(315, -130), direction: MapTileDirection.vertical, }); - /// 哈林的命运硬币(左边) + /** 哈林的命运硬币(左边) */ private static HaLinMingYunYinBiData = new MapTileData({ location: v2(368, -96), backgroundIndex: 34, @@ -320,13 +328,13 @@ export class MapTileFactory { duelSelectLicense: false, occupyLicense: false, }); - /// 第九隔离区 + /** 第九隔离区 */ private static DiJiuGeLiQuData = new MapTileData({ location: v2(421, -62), direction: MapTileDirection.vertical, }); - // 决斗场(54,44) + // 决斗场(54,44) */ private static JueDouChangData = new MapTileData({ location: v2(475, -18), direction: MapTileDirection.nook, @@ -334,38 +342,38 @@ export class MapTileFactory { occupyLicense: false, }); - /// 腐坏街道(53,34) + /** 腐坏街道(53,34) */ private static FuHuaiJieDaoData = new MapTileData({ location: v2(544, -62), direction: MapTileDirection.horizontal, }); - /// 溢血的地下城(53,34) + /** 溢血的地下城(53,34) */ private static YiXueDeDiXiaChenData = new MapTileData({ location: v2(597, -96), direction: MapTileDirection.horizontal, }); - /// 普雷·伊西斯 + /** 普雷·伊西斯 */ private static PuLeiYiXiSiData = new MapTileData({ location: v2(650, -130), backgroundIndex: 33, direction: MapTileDirection.horizontal, }); - /// 沉重的礼拜堂 + /** 沉重的礼拜堂 */ private static ChenZhongDeLiBaiTangData = new MapTileData({ location: v2(703, -164), direction: MapTileDirection.horizontal, }); - /// 螺旋王国 + /** 螺旋王国 */ private static LuoXuanWangGuoData = new MapTileData({ location: v2(756, -198), direction: MapTileDirection.horizontal, }); - // 海上列车(69,44) + // 海上列车(69,44) */ private static HaiShangLieCheData = new MapTileData({ location: v2(808, -234), direction: MapTileDirection.nook, @@ -374,25 +382,25 @@ export class MapTileFactory { occupyLicense: false, }); - /// 暗黑神殿 + /** 暗黑神殿 */ private static AnHeiShenDianData = new MapTileData({ location: v2(756, -278), direction: MapTileDirection.vertical, }); - /// 痛苦地下城 + /** 痛苦地下城 */ private static TongKuDiXiaChenData = new MapTileData({ location: v2(703, -312), direction: MapTileDirection.vertical, }); - /// 无底坑道 + /** 无底坑道 */ private static WuDiKenDaoData = new MapTileData({ location: v2(650, -346), direction: MapTileDirection.vertical, }); - /// 切斯特小镇的命运硬币(右边) + /** 切斯特小镇的命运硬币(右边) */ private static XiaoZhenMingYunYinBiData = new MapTileData({ location: v2(597, -380), backgroundIndex: 34, @@ -401,9 +409,11 @@ export class MapTileFactory { occupyLicense: false, }); - /// 记忆之地 + /** 记忆之地 */ private static JiYiZhiDiData = new MapTileData({ location: v2(544, -414), direction: MapTileDirection.vertical, }); + } + diff --git a/assets/Script/MapTile/MapTileData.ts.meta b/assets/Script/MapTile/MapTileType.ts.meta similarity index 100% rename from assets/Script/MapTile/MapTileData.ts.meta rename to assets/Script/MapTile/MapTileType.ts.meta diff --git a/assets/Script/MapTile/MapTitleAction.ts b/assets/Script/MapTile/MapTitleAction.ts index 893b06f..b38eed7 100644 --- a/assets/Script/MapTile/MapTitleAction.ts +++ b/assets/Script/MapTile/MapTitleAction.ts @@ -1,12 +1,12 @@ /* * @Author: WoNiu * @Date: 2024-03-26 11:36:36 - * @LastEditTime: 2024-03-27 15:55:40 + * @LastEditTime: 2024-03-29 14:03:36 * @LastEditors: WoNiu * @Description: */ -import { LuckyCoinsNode, LuckyType } from "../DialogNode/LuckyCoinsNode"; +import { LuckyCoinsNode, LuckyType } from "../DialogRoot/LuckyCoinsNode"; import { GameRootSingleton } from "../GameRootController"; /** diff --git a/assets/Script/MapTile/MapTitleDateSingleton.ts b/assets/Script/MapTile/MapTitleDateSingleton.ts index 751c13c..2a5054b 100644 --- a/assets/Script/MapTile/MapTitleDateSingleton.ts +++ b/assets/Script/MapTile/MapTitleDateSingleton.ts @@ -1,11 +1,11 @@ /* * @Author: WoNiu * @Date: 2024-03-27 15:20:29 - * @LastEditTime: 2024-03-27 15:26:21 + * @LastEditTime: 2024-03-28 21:15:43 * @LastEditors: WoNiu * @Description: */ -import { MapTileType, MapTileTypes } from "./MapTileData"; +import { MapTileType, MapTileTypes } from "./MapTileType"; import { MapTitleModel } from "./MapTitleModel"; /** diff --git a/assets/Script/MapTile/MapTitleModel.ts b/assets/Script/MapTile/MapTitleModel.ts index 49715f7..7f5b578 100644 --- a/assets/Script/MapTile/MapTitleModel.ts +++ b/assets/Script/MapTile/MapTitleModel.ts @@ -7,7 +7,7 @@ */ import { _decorator } from "cc"; -import { MapTileType } from "./MapTileData"; +import { MapTileType } from "./MapTileType"; /** * @description: 地图数据模型 diff --git a/assets/Script/StartGameNode/StartGameUINode.ts b/assets/Script/StartGameNode/StartGameUINode.ts index 190b5ea..5028af8 100644 --- a/assets/Script/StartGameNode/StartGameUINode.ts +++ b/assets/Script/StartGameNode/StartGameUINode.ts @@ -3,7 +3,6 @@ import { BaseSprite } from '../../GlobalScript/CommonComponent/BaseSprite'; import { NpkImage } from '../../Tool/NPKImage'; import { BaseButton } from '../../GlobalScript/CommonComponent/BaseButton'; import { AnimationNode } from '../../GlobalScript/Animation/AnimationNode'; -import { UIRoot } from '../UIRoot'; import {CloseButtonNode } from '../Common/CloseButtonNode'; import { GameRootSingleton } from '../GameRootController'; const { ccclass } = _decorator; @@ -61,11 +60,6 @@ export class StartGameUINode extends Node { /// 给节点添加 button 组件 const buttonComponent = startButtonNode.addComponent( BaseButton ); buttonComponent.init(NpkImage.main,1); - // buttonComponent.ImgPath = NpkImage.main; - // buttonComponent.NormalImgIndex = 1; - // buttonComponent.HoverImgIndex = 2; - // buttonComponent.PressImgIndex = 3; - // buttonComponent.DisableImgIndex = 4; startButtonNode.addComponent( Button) startButtonNode.on(Button.EventType.CLICK,this.startOnTouchEnd,this); diff --git a/assets/Script/UINode.meta b/assets/Script/UIRoot.meta similarity index 100% rename from assets/Script/UINode.meta rename to assets/Script/UIRoot.meta diff --git a/assets/Script/UIRoot.ts b/assets/Script/UIRoot.ts deleted file mode 100644 index 0cdb1f2..0000000 --- a/assets/Script/UIRoot.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { - _decorator, - Component, - Director, - director, - Node, - UITransform, -} from "cc"; -import { CharacterType, GamerNode } from "./UINode/GamerNode"; -import { BaseSprite } from "../GlobalScript/CommonComponent/BaseSprite"; -import { NpkImage } from "../Tool/NPKImage"; -import { AnimationNode } from "../GlobalScript/Animation/AnimationNode"; -import { BaseButtonState } from "../GlobalScript/CommonComponent/BaseButton"; -import { DiceButtonNode } from "./UINode/DiceButtonNode"; -import { OtherWinNode, otherWinType } from "./UINode/OtherWinNode"; -import { BoardRoot } from "./BoardRoot"; -import { StartGameUINode } from "./StartGameNode/StartGameUINode"; -import { GameRootSingleton } from "./GameRootController"; -const { ccclass } = _decorator; - -@ccclass("UIRoot") -export class UIRoot extends Component { - /// 等待玩家 - private awaitGamerNode: Node; - /// 玩家一 - private gamerOne: GamerNode; - /// 玩家二 - private gamerTwo: GamerNode; - /// 玩家三 - private gamerThree: GamerNode; - /// 投骰子按钮 - private diceButton: DiceButtonNode; - /// 其他胜利条件 - private otherWinNode: OtherWinNode; - - //* 初始化开始游戏界面的UI - initStartGameUI() { - const startGameUINode = new StartGameUINode(); - startGameUINode.addComponent(UITransform).setContentSize(1067, 600); - this.node.addChild(startGameUINode); - } - - //* 初始化游戏界面UI - initGameUI() { - /// 玩家UI - this.initGamerUI(); - /// 右下骰子操作按钮 - this.initDiceButton(); - /// 等待玩家加载 - this.initAwaitGamerUI(); - /// 其他胜利条件 - this.initOtherWinNode(); - } - - //* 初始化玩家UI - initGamerUI() { - this.gamerOne = new GamerNode("玩家一"); - this.gamerOne.setPosition(0, -540); - this.gamerOne.charchterType = CharacterType.JianHun; - this.node.addChild(this.gamerOne); - - this.gamerTwo = new GamerNode(""); - this.gamerTwo.setPosition(877, 0); - this.node.addChild(this.gamerTwo); - - this.gamerThree = new GamerNode(""); - this.node.addChild(this.gamerThree); - } - - //* 初始化等待玩家加载UI - initAwaitGamerUI() { - const node = new Node(); - node.setPosition(177.5, -244.5); - this.node.addChild(node); - - const spr = node.addComponent(BaseSprite); - spr.updateSpriteFrame(NpkImage.loading_loop, 0); - - const ani = new AnimationNode("ani/loading_loop01.ani"); - ani.setPosition(350, -110); - node.addChild(ani); - - this.awaitGamerNode = node; - - - - //todo 自动跳过,接入网络后修改 - // 1秒后 结束加载 - setTimeout(() => { - /// 这一帧结束之后销毁 - director.once(Director.EVENT_END_FRAME, () => { - // 销毁 - this.awaitGamerNode.destroy(); - - // todo 开发时跳过倒计时动画 - /// 初始化开始倒计时动画 - // this.initCountFontAni(5); - }); - - // todo 开发时跳过倒计时动画 - this.aniDone(); - }, 1000); - } - - //* 初始化倒计时动画 - initCountFontAni(index: number) { - const ani = new AnimationNode('ani/count_font.ani',()=>{ - /// 这一帧结束之后销毁 - director.once(Director.EVENT_END_FRAME, () => { - // 销毁 - ani.destroy(); - }); - /// 动画结束 - this.aniDone(); - }) - ani.setPosition(500, -200); - - this.node.addChild(ani); - } - - //* 初始化骰子节点 - initDiceButton() { - this.diceButton = new DiceButtonNode(); - this.diceButton.setPosition(849, -453); - this.node.addChild(this.diceButton); - - /// 显示其他胜利条件 - this.diceButton.winButtonBlock = () => { - this.otherWinNode.active = true; - }; - - this.diceButton.diceUpBlock = () =>{ - - } - } - - //* 初始化其他胜利条件 - initOtherWinNode() { - this.otherWinNode = new OtherWinNode(otherWinType.longRun); - this.node.addChild(this.otherWinNode); - - this.otherWinNode.active = false; - } - - //* 动画结束 显示选择顺序 - aniDone() { - /// 恢复其他胜利按钮的状态 - this.diceButton.winButtonComponent.ButtonState = BaseButtonState.Normal; - /// 显示其他胜利条件 - this.otherWinNode.active = true; - const boardNode = this.node.parent.getChildByName("BoardRoot"); - /// 显示最底层的地图块 - const board = boardNode.getComponent(BoardRoot); - board.initMapTile(); - - //* 1秒后自动关闭胜利条件显示,并显示顺序选择 - setTimeout(() => { - - //* 显示顺序选择node - this.otherWinNode.active = false; - - const select = GameRootSingleton.getInstance().DialogRoot.initSelectNumberNode(); - - select.doneFunc = ()=>{ - // todo 开发阶段在选择顺序结束后,恢复骰子按钮状态 - this.diceButton.diceButtonComponent.ButtonState = BaseButtonState.Normal; - }; - - }, 1000); - } - - start() { - this.node.addComponent(UITransform).setContentSize(1067, 600); - this.initStartGameUI(); - } - - update(deltaTime: number) {} -} diff --git a/assets/Script/UINode/DiceButtonNode.ts b/assets/Script/UIRoot/DiceButtonNode.ts similarity index 86% rename from assets/Script/UINode/DiceButtonNode.ts rename to assets/Script/UIRoot/DiceButtonNode.ts index c90ba3d..24ab202 100644 --- a/assets/Script/UINode/DiceButtonNode.ts +++ b/assets/Script/UIRoot/DiceButtonNode.ts @@ -1,7 +1,7 @@ /* * @Author: WoNiu * @Date: 2024-03-13 12:19:50 - * @LastEditTime: 2024-03-25 19:49:13 + * @LastEditTime: 2024-03-29 13:01:41 * @LastEditors: WoNiu * @Description: */ @@ -24,7 +24,7 @@ import { v2, } from "cc"; import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite"; -import { NpkImage } from "../../Tool/NPKImage"; +import { NpkImage, NpkImageTool } from "../../Tool/NPKImage"; import { BaseButton, BaseButtonState, @@ -33,6 +33,7 @@ import { BaseButtonAction } from "../../GlobalScript/CommonComponent/BaseButtonA import { ImagePack } from "../../GlobalScript/ImagePack/ImagePack"; import { GameState } from "../../GlobalScript/GlobalGameState/GameState"; import { ImgInfo } from "../../GlobalScript/GlobalInterface/GlobalInterface"; +import { GamerRoleAni, GamerRoleType } from "../Gamer/GamerRoleType"; const { ccclass } = _decorator; @ccclass("DiceButtonNode") @@ -130,7 +131,7 @@ export class DiceButtonNode extends Node { } } -// ─── 动画播放 ──────────────────────────────────────────────────────────────────── +//* ─── 动画播放 ──────────────────────────────────────────────────────────────────── export enum PlayAniState { //未播放 @@ -188,41 +189,11 @@ export class GaugeAnimation extends Component { //设置 this.sprite.trim = false; - ImagePack.getInstance().ReadNpkTable( - "sprite/" + NpkImage.gauge.toLocaleLowerCase(), - (ImgObj) => { - const Pngs = ImgObj.Png_List; - // 总数量 - this.frameCount = ImgObj.Png_Count; - - for (let i = 0; i < Pngs.length; i++) { - const png = Pngs[i]; - this.initSpriteFrame(i,png); - } - - this.InitState = true; - - } - ); - } - - /// 根据拿到的数据 初始化精灵帧 - initSpriteFrame(index:number,Png: ImgInfo) { - const spriteFrame = new SpriteFrame(); - let tex = new Texture2D(); - tex.reset({ - width: Png.Width, - height: Png.Height, - format: Texture2D.PixelFormat.RGBA8888, - mipmapLevel: 0, + NpkImageTool.GetNpkImageAll(NpkImage.gauge, (count,frameMap)=>{ + this.frameMap = frameMap; + this.frameCount = count; + this.InitState = true; }); - tex.uploadData(Png.PNGdata); - // 更新 0 级 Mipmap。 - tex.updateImage(); - spriteFrame.texture = tex; - spriteFrame.offset = v2(Png.Xpos, -Png.Ypos); - - this.frameMap.set(index, spriteFrame); } start() {} @@ -262,8 +233,6 @@ export class GaugeAnimation extends Component { if (GameState.getInstance().IsPauseState()) return; //如果初始化未完成,不播放 if (!this.InitState) return; - - // this.SetAniFrameByTime(); //如果不在播放中 if (this.playState != PlayAniState.playing && this.playState != PlayAniState.reversed) return; diff --git a/assets/Script/UINode/DiceButtonNode.ts.meta b/assets/Script/UIRoot/DiceButtonNode.ts.meta similarity index 100% rename from assets/Script/UINode/DiceButtonNode.ts.meta rename to assets/Script/UIRoot/DiceButtonNode.ts.meta diff --git a/assets/Script/UIRoot/GameMatchingProcessControl.ts b/assets/Script/UIRoot/GameMatchingProcessControl.ts new file mode 100644 index 0000000..f0e2aee --- /dev/null +++ b/assets/Script/UIRoot/GameMatchingProcessControl.ts @@ -0,0 +1,50 @@ +/* + * @Author: WoNiu + * @Date: 2024-03-29 13:20:16 + * @LastEditTime: 2024-03-29 14:16:51 + * @LastEditors: WoNiu + * @Description: 游戏匹配过程控制 + */ +import { _decorator, Component, Director, director, Node } from "cc"; +import { UIRoot } from "./UIRoot"; +import { GameRootSingleton } from "./../GameRootController"; +const { ccclass, property } = _decorator; + +@ccclass("GameMatchingProcessControl") +/** + * @description: 游戏匹配过程控制 + */ +export class GameMatchingProcessControl extends Component { + /** UIRoot 节点的 UI节点 */ + uiRoot: UIRoot; + + start() { + this.uiRoot = GameRootSingleton.getInstance().UIRoot; + + this.countDown(); + } + + //todo 自动跳过,接入网络后修改 + /** 匹配加载动画控制 */ + countDown() { + + // 1秒后 结束加载 + setTimeout(() => { + /// 这一帧结束之后销毁 + director.once(Director.EVENT_END_FRAME, () => { + // 销毁 + this.uiRoot.awaitGamerNode.destroy(); + + // todo 开发时跳过倒计时动画 + /// 初始化开始倒计时动画 + // this.initCountDownFontAni(5); + }); + + // todo 开发时跳过倒计时动画 + this.uiRoot.countDownAniDone(); + }, 1000); + + } + + update(deltaTime: number) {} +} diff --git a/assets/Script/UIRoot/GameMatchingProcessControl.ts.meta b/assets/Script/UIRoot/GameMatchingProcessControl.ts.meta new file mode 100644 index 0000000..21939d7 --- /dev/null +++ b/assets/Script/UIRoot/GameMatchingProcessControl.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "79e2c1f6-7206-4356-82a5-09f3d1039dff", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/UIRoot/GameRoleController.ts b/assets/Script/UIRoot/GameRoleController.ts new file mode 100644 index 0000000..0bf9ffc --- /dev/null +++ b/assets/Script/UIRoot/GameRoleController.ts @@ -0,0 +1,48 @@ +/* + * @Author: WoNiu + * @Date: 2024-03-29 14:04:56 + * @LastEditTime: 2024-03-29 14:14:48 + * @LastEditors: WoNiu + * @Description: 玩家角色控制 + */ +import { _decorator, Component, Node } from "cc"; +import { GamerRoleNode } from "../Gamer/GamerRoleNode"; +import { GamerRoleType } from "../Gamer/GamerRoleType"; +const { ccclass, property } = _decorator; + +@ccclass("GameRoleController") +/** + * @description: 玩家角色控制 + */ +export class GameRoleController extends Component { + /** 玩家 1 角色 */ + oneRole: GamerRoleNode; + /** 玩家 2 角色 */ + twoRole: GamerRoleNode; + /** 玩家 3 角色 */ + threeRole: GamerRoleNode; + + /** + * @description: 初始化角色 + * @param oneRoleType : 玩家 1 + * @param twoRoleType : 玩家 2 + * @param threeRoleType : 玩家 3 + */ + initRole( + oneRoleType: GamerRoleType, + twoRoleType: GamerRoleType, + threeRoleType: GamerRoleType + ) { + this.oneRole = new GamerRoleNode(oneRoleType); + this.twoRole = new GamerRoleNode(twoRoleType); + this.threeRole = new GamerRoleNode(threeRoleType); + + this.node.addChild(this.oneRole); + this.node.addChild(this.twoRole); + this.node.addChild(this.threeRole); + } + + start() {} + + update(deltaTime: number) {} +} diff --git a/assets/Script/UIRoot/GameRoleController.ts.meta b/assets/Script/UIRoot/GameRoleController.ts.meta new file mode 100644 index 0000000..c95d9b5 --- /dev/null +++ b/assets/Script/UIRoot/GameRoleController.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "80141aea-c2a5-4eab-8430-59484a333bf1", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/UINode/OtherWinNode.ts b/assets/Script/UIRoot/OtherWinNode.ts similarity index 100% rename from assets/Script/UINode/OtherWinNode.ts rename to assets/Script/UIRoot/OtherWinNode.ts diff --git a/assets/Script/UINode/OtherWinNode.ts.meta b/assets/Script/UIRoot/OtherWinNode.ts.meta similarity index 100% rename from assets/Script/UINode/OtherWinNode.ts.meta rename to assets/Script/UIRoot/OtherWinNode.ts.meta diff --git a/assets/Script/UIRoot/UIRoot.ts b/assets/Script/UIRoot/UIRoot.ts new file mode 100644 index 0000000..b681e01 --- /dev/null +++ b/assets/Script/UIRoot/UIRoot.ts @@ -0,0 +1,178 @@ +import { + _decorator, + Component, + Director, + director, + Node, + UITransform, +} from "cc"; +import { GamerCardNode } from "./../Gamer/GamerCardNode"; +import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite"; +import { NpkImage } from "../../Tool/NPKImage"; +import { AnimationNode } from "../../GlobalScript/Animation/AnimationNode"; +import { BaseButtonState } from "../../GlobalScript/CommonComponent/BaseButton"; +import { DiceButtonNode } from "../UIRoot/DiceButtonNode"; +import { OtherWinNode, otherWinType } from "../UIRoot/OtherWinNode"; +import { BoardRoot } from "../BoardRoot"; +import { StartGameUINode } from "../StartGameNode/StartGameUINode"; +import { GamerRoleType } from "../Gamer/GamerRoleType"; +import { SelectNumberNode } from "../DialogRoot/SelectNumberNode"; +const { ccclass } = _decorator; + +@ccclass("UIRoot") +/** + * @description: UIRoot节点的 UI 初始化 + */ +export class UIRoot extends Component { + /** 玩家一 */ + private gamerCardOne: GamerCardNode; + /** 玩家二 */ + private gamerCardTwo: GamerCardNode; + /** 玩家三 */ + private gamerCardThree: GamerCardNode; + + /** 等待玩家 */ + awaitGamerNode: Node; + /** 投骰子按钮 */ + diceButton: DiceButtonNode; + /** 其他胜利条件 */ + otherWinNode: OtherWinNode; + + // ─── 初始化ui ─────────────────────────────────────────────────────────────────── + + /** 初始化开始游戏界面的UI */ + initStartGameUI() { + const startGameUINode = new StartGameUINode(); + startGameUINode.addComponent(UITransform).setContentSize(1067, 600); + this.node.addChild(startGameUINode); + } + + /** 初始化游戏界面UI */ + initGameUI() { + /// 玩家UI + this.initGamerUI(); + /// 右下骰子操作按钮 + this.initDiceButton(); + /// 等待玩家加载 + this.initAwaitGamerUI(); + } + + /** 初始化玩家卡片 UI */ + private initGamerUI() { + this.gamerCardOne = new GamerCardNode("玩家一"); + this.gamerCardOne.setPosition(0, -540); + this.gamerCardOne.charchterType = GamerRoleType.JianHun; + this.node.addChild(this.gamerCardOne); + + this.gamerCardTwo = new GamerCardNode(""); + this.gamerCardTwo.setPosition(877, 0); + this.node.addChild(this.gamerCardTwo); + + this.gamerCardThree = new GamerCardNode(""); + this.node.addChild(this.gamerCardThree); + } + + /** 初始化骰子节点 */ + private initDiceButton() { + this.diceButton = new DiceButtonNode(); + this.diceButton.setPosition(849, -453); + this.node.addChild(this.diceButton); + + /// 显示其他胜利条件 + this.diceButton.winButtonBlock = () => { + this.otherWinNode.active = true; + }; + + this.diceButton.diceUpBlock = () => {}; + } + + /** 初始化其他胜利条件 */ + initOtherWinNode(type: otherWinType) { + if (!this.otherWinNode) { + this.otherWinNode = new OtherWinNode(type); + this.node.addChild(this.otherWinNode); + + this.otherWinNode.active = false; + } + } + + /** 初始化并显示顺序选择node */ + initSelectNumberNode(): SelectNumberNode { + const selectNode = new SelectNumberNode(); + this.node.addChild(selectNode); + return selectNode; + } + + // ─── 动画初始化 ────────────────────────────────────────────────────────── + + /** 初始化等待玩家加载UI */ + initAwaitGamerUI() { + const node = new Node(); + node.setPosition(177.5, -244.5); + this.node.addChild(node); + + const spr = node.addComponent(BaseSprite); + spr.updateSpriteFrame(NpkImage.loading_loop, 0); + + const ani = new AnimationNode("ani/loading_loop01.ani"); + ani.setPosition(350, -110); + node.addChild(ani); + + this.awaitGamerNode = node; + } + + /** 初始化倒计时动画 */ + initCountDownFontAni(index: number) { + const ani = new AnimationNode("ani/count_font.ani", () => { + /// 这一帧结束之后销毁 + director.once(Director.EVENT_END_FRAME, () => { + // 销毁 + ani.destroy(); + }); + /// 动画结束 + this.countDownAniDone(); + }); + ani.setPosition(500, -200); + + this.node.addChild(ani); + } + + /** 倒计时动画结束 */ + countDownAniDone() { + /// 恢复其他胜利按钮的状态 + this.diceButton.winButtonComponent.ButtonState = BaseButtonState.Normal; + + /// 显示其他胜利条件 + this.otherWinNode.active = true; + const boardNode = this.node.parent.getChildByName("BoardRoot"); + + /// 显示最底层的地图块 + const board = boardNode.getComponent(BoardRoot); + board.initMapTile(); + + // 1秒后自动关闭胜利条件显示,并显示顺序选择 + setTimeout(() => { + // 隐藏其他胜利条件 node + this.otherWinNode.active = false; + + const select = this.initSelectNumberNode(); + + select.doneFunc = () => { + // todo 开发阶段在选择顺序结束后,恢复骰子按钮状态 + this.diceButton.diceButtonComponent.ButtonState = + BaseButtonState.Normal; + }; + }, 1000); + } + + // ─── 生命周期 ──────────────────────────────────────────────────────────── + + start() { + this.node.addComponent(UITransform).setContentSize(1067, 600); + + /// 初始化 开始游戏 的 UI + this.initStartGameUI(); + } + + update(deltaTime: number) {} +} diff --git a/assets/Script/UIRoot.ts.meta b/assets/Script/UIRoot/UIRoot.ts.meta similarity index 100% rename from assets/Script/UIRoot.ts.meta rename to assets/Script/UIRoot/UIRoot.ts.meta diff --git a/assets/Tool/NPKImage.ts b/assets/Tool/NPKImage.ts index 7fa0873..2a14b89 100644 --- a/assets/Tool/NPKImage.ts +++ b/assets/Tool/NPKImage.ts @@ -1,45 +1,121 @@ -const path = 'interface2/event/chn_event_2020/200922_dnf_marble/' +/* + * @Author: WoNiu + * @Date: 2024-03-10 20:00:57 + * @LastEditTime: 2024-03-29 12:57:23 + * @LastEditors: WoNiu + * @Description: + */ + +import { SpriteFrame, Texture2D, v2 } from "cc"; +import { ImagePack } from "../GlobalScript/ImagePack/ImagePack"; +import { ImgInfo } from "../GlobalScript/GlobalInterface/GlobalInterface"; + +/** interface2/event/chn_event_2020/200922_dnf_marble/ */ +export const NpkImagePath = + "interface2/event/chn_event_2020/200922_dnf_marble/"; export enum NpkImage { - main = path + '00_main.img', - ingame = path + '01_ingame.img', - board = path + '02_board.img', - gauge = path + '03_gauge.img', - character_sd = path + '04_character_sd.img', - monsternotice = path + '05_monsternotice.img', - specialplace = path + '06_specialplace.img', - conditionsofvictory = path + '07_conditionsofvictory.img', - calendar = path + '08_calendar.img', - bankruptcy = path + 'bankruptcy.img', - character_loop = path + 'character_loop.img', - count_font = path + 'count_font.img', - dice_1x1_db = path + 'dice_1x1_db.img', - dice_1x2 = path + 'dice_1x2.img', - dice_1x3 = path + 'dice_1x3.img', - dice_2x2_db = path + 'dice_2x2_db.img', - dice_2x3 = path + 'dice_2x3.img', - dice_2x4 = path + 'dice_2x4.img', - dice_3x3_db = path + 'dice_3x3_db.img', - dice_3x4 = path + 'dice_3x4.img', - dice_3x5 = path + 'dice_3x5.img', - dice_4x4_db = path + 'dice_4x4_db.img', - dice_4x5 = path + 'dice_4x5.img', - dice_4x6 = path + 'dice_4x6.img', - dice_5x5 = path + 'dice_5x5.img', - dice_5x6 = path + 'dice_5x6.img', - dice_6x6_db = path + 'dice_6x6_db.img', - dice_font = path + 'dice_font.img', - dungeonbg = path + 'dungeonbg.img', - fire_loop = path + 'fire_loop.img', - light01 = path + 'light01.img', - light02 = path + 'light02.img', - loading_loop = path + 'loading_loop.img', - luckycoin = path + 'luckycoin.img', - luckycoin_bg = path + 'luckycoin_bg.img', - point_loop = path + 'point_loop.img', - table_back = path + 'table_back.img', - table_dodge = path + 'table_dodge.img', - table_front = path + 'table_front.img', - title_loop = path + 'title_loop.img', - win = path + 'win.img', -}; \ No newline at end of file + main = NpkImagePath + "00_main.img", + ingame = NpkImagePath + "01_ingame.img", + board = NpkImagePath + "02_board.img", + gauge = NpkImagePath + "03_gauge.img", + character_sd = NpkImagePath + "04_character_sd.img", + monsternotice = NpkImagePath + "05_monsternotice.img", + specialplace = NpkImagePath + "06_specialplace.img", + conditionsofvictory = NpkImagePath + "07_conditionsofvictory.img", + calendar = NpkImagePath + "08_calendar.img", + bankruptcy = NpkImagePath + "bankruptcy.img", + character_loop = NpkImagePath + "character_loop.img", + count_font = NpkImagePath + "count_font.img", + dice_1x1_db = NpkImagePath + "dice_1x1_db.img", + dice_1x2 = NpkImagePath + "dice_1x2.img", + dice_1x3 = NpkImagePath + "dice_1x3.img", + dice_2x2_db = NpkImagePath + "dice_2x2_db.img", + dice_2x3 = NpkImagePath + "dice_2x3.img", + dice_2x4 = NpkImagePath + "dice_2x4.img", + dice_3x3_db = NpkImagePath + "dice_3x3_db.img", + dice_3x4 = NpkImagePath + "dice_3x4.img", + dice_3x5 = NpkImagePath + "dice_3x5.img", + dice_4x4_db = NpkImagePath + "dice_4x4_db.img", + dice_4x5 = NpkImagePath + "dice_4x5.img", + dice_4x6 = NpkImagePath + "dice_4x6.img", + dice_5x5 = NpkImagePath + "dice_5x5.img", + dice_5x6 = NpkImagePath + "dice_5x6.img", + dice_6x6_db = NpkImagePath + "dice_6x6_db.img", + dice_font = NpkImagePath + "dice_font.img", + dungeonbg = NpkImagePath + "dungeonbg.img", + fire_loop = NpkImagePath + "fire_loop.img", + light01 = NpkImagePath + "light01.img", + light02 = NpkImagePath + "light02.img", + loading_loop = NpkImagePath + "loading_loop.img", + luckycoin = NpkImagePath + "luckycoin.img", + luckycoin_bg = NpkImagePath + "luckycoin_bg.img", + point_loop = NpkImagePath + "point_loop.img", + table_back = NpkImagePath + "table_back.img", + table_dodge = NpkImagePath + "table_dodge.img", + table_front = NpkImagePath + "table_front.img", + title_loop = NpkImagePath + "title_loop.img", + win = NpkImagePath + "win.img", +} + +interface NpkImageCallback{ + /** + * @param {number} frameCount:精灵帧总数量 + * @param {Map} frameMap:所有精灵帧Map + */ + (frameCount: number, frameMap: Map): void; +} + +export class NpkImageTool { + + /** + * @description: 获取Npk path路径下的所有 图片 + * @param {string} path:读取路径 + * @param {Function} callBack:回调((frameCount, frameMap)(number, Map) + */ + static GetNpkImageAll(path: string, callBack: NpkImageCallback) { + // 精灵帧总数 + let frameCount = 0; + // 精灵帧缓存 + let frameMap: Map = new Map(); + + ImagePack.getInstance().ReadNpkTable( + "sprite/" + path.toLocaleLowerCase(), + (ImgObj: { Png_List: [ImgInfo]; Png_Count: number; }) => { + const Pngs = ImgObj.Png_List; + // 总数量 + frameCount = ImgObj.Png_Count; + + for (let i = 0; i < Pngs.length; i++) { + const png = Pngs[i]; + const spriteFrame = NpkImageTool.initSpriteFrame(png); + frameMap.set(i, spriteFrame); + } + + callBack(frameCount, frameMap); + } + ); + } + + /** + * @description:根据拿到的数据 初始化精灵帧 + * @param {ImgInfo} Png: 动画数据 + */ + static initSpriteFrame(Png: ImgInfo): SpriteFrame { + const spriteFrame = new SpriteFrame(); + let tex = new Texture2D(); + tex.reset({ + width: Png.Width, + height: Png.Height, + format: Texture2D.PixelFormat.RGBA8888, + mipmapLevel: 0, + }); + tex.uploadData(Png.PNGdata); + // 更新 0 级 Mipmap。 + tex.updateImage(); + spriteFrame.texture = tex; + spriteFrame.offset = v2(Png.Xpos, -Png.Ypos); + + return spriteFrame; + } +} diff --git a/assets/scene/main.scene b/assets/scene/main.scene index ba0589f..cb25157 100644 --- a/assets/scene/main.scene +++ b/assets/scene/main.scene @@ -23,7 +23,7 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 20 + "__id__": 16 }, "_lpos": { "__type__": "cc.Vec3", @@ -54,7 +54,7 @@ }, "autoReleaseAssets": false, "_globals": { - "__id__": 21 + "__id__": 17 }, "_id": "f713b5ea-a70f-486c-8260-0338f089a5b8" }, @@ -77,13 +77,13 @@ "_active": true, "_components": [ { - "__id__": 17 + "__id__": 13 }, { - "__id__": 18 + "__id__": 14 }, { - "__id__": 19 + "__id__": 15 } ], "_prefab": null, @@ -175,7 +175,7 @@ "_priority": 0, "_fov": 45, "_fovAxis": 0, - "_orthoHeight": 509.18301104972375, + "_orthoHeight": 477.2642163661581, "_near": 0, "_far": 1000, "_color": { @@ -220,18 +220,14 @@ "__id__": 6 }, { - "__id__": 10 + "__id__": 9 }, { - "__id__": 13 + "__id__": 11 } ], "_active": true, - "_components": [ - { - "__id__": 16 - } - ], + "_components": [], "_prefab": null, "_lpos": { "__type__": "cc.Vec3", @@ -278,9 +274,6 @@ }, { "__id__": 8 - }, - { - "__id__": 9 } ], "_prefab": null, @@ -349,18 +342,6 @@ "ImgIndex": 0, "_id": "fc2gTwXM1Lq68bZxSz8rQ1" }, - { - "__type__": "51518t/LCBGQZ6rvzL2I2e5", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 6 - }, - "_enabled": true, - "__prefab": null, - "_id": "5c+WvJW35JkYzLE6SY7Dmz" - }, { "__type__": "cc.Node", "_name": "UIRoot", @@ -373,10 +354,7 @@ "_active": true, "_components": [ { - "__id__": 11 - }, - { - "__id__": 12 + "__id__": 10 } ], "_prefab": null, @@ -415,7 +393,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 10 + "__id__": 9 }, "_enabled": true, "__prefab": null, @@ -431,18 +409,6 @@ }, "_id": "6cbBeNcXdJr6bJDAOt5tLP" }, - { - "__type__": "a578c1qrTRIdaMFhEtim8LM", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 10 - }, - "_enabled": true, - "__prefab": null, - "_id": "6clS3n6E1O3Ir6YO9pV5rA" - }, { "__type__": "cc.Node", "_name": "DialogRoot", @@ -455,10 +421,7 @@ "_active": true, "_components": [ { - "__id__": 14 - }, - { - "__id__": 15 + "__id__": 12 } ], "_prefab": null, @@ -497,7 +460,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 13 + "__id__": 11 }, "_enabled": true, "__prefab": null, @@ -513,39 +476,6 @@ }, "_id": "28/iYuYk1JyqaQ0l2uDYPY" }, - { - "__type__": "11718UDzs1Cra3Z5OOr4Z4r", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 13 - }, - "_enabled": true, - "__prefab": null, - "_id": "d79jn93oZBELG9gxMlR3iL" - }, - { - "__type__": "949ea2Dmw5CAoAHxQqyzu61", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 5 - }, - "_enabled": true, - "__prefab": null, - "boardRootNode": { - "__id__": 6 - }, - "UIRootNode": { - "__id__": 10 - }, - "DialogRootNode": { - "__id__": 13 - }, - "_id": "86lITimcpDHppWjrM888+a" - }, { "__type__": "cc.UITransform", "_name": "", @@ -625,28 +555,28 @@ { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 22 + "__id__": 18 }, "shadows": { - "__id__": 23 + "__id__": 19 }, "_skybox": { - "__id__": 24 + "__id__": 20 }, "fog": { - "__id__": 25 + "__id__": 21 }, "octree": { - "__id__": 26 + "__id__": 22 }, "skin": { - "__id__": 27 + "__id__": 23 }, "lightProbeInfo": { - "__id__": 28 + "__id__": 24 }, "postSettings": { - "__id__": 29 + "__id__": 25 }, "bakedWithStationaryMainLight": false, "bakedWithHighpLightmap": false