1 文件目录结构调整

2 UIRoot 代码结构调整
3 Npk 修改替换
4 玩家角色站立动画初版
This commit is contained in:
WoNiu 2024-03-29 20:08:58 +08:00
parent 1c95e70661
commit bc32d687ee
45 changed files with 1266 additions and 626 deletions

View File

@ -21,18 +21,18 @@ export class GameState extends Component {
} }
//当前是否处于暂停状态 /** 当前是否处于暂停状态 */
PauseState: boolean = false; PauseState: boolean = false;
//改变暂停状态的回调函数 /** 改变暂停状态的回调函数 */
ResumeCallBackFunc: ResumeCallback<any>[] = []; ResumeCallBackFunc: ResumeCallback<any>[] = [];
//获取暂停状态 /** 获取暂停状态 */
IsPauseState(): boolean { IsPauseState(): boolean {
return this.PauseState; return this.PauseState;
} }
//设置暂停状态 /** 设置暂停状态 */
SetCurrentPauseState(State: boolean) { SetCurrentPauseState(State: boolean) {
//不等于时 设置一次 //不等于时 设置一次
if (State != this.PauseState) { if (State != this.PauseState) {
@ -45,7 +45,7 @@ export class GameState extends Component {
} }
} }
//注册恢复游戏的逻辑回调函数 /** 注册恢复游戏的逻辑回调函数 */
RegisterResumeCallBack(Func: ResumeCallback<any>) { RegisterResumeCallBack(Func: ResumeCallback<any>) {
this.ResumeCallBackFunc.push(Func); this.ResumeCallBackFunc.push(Func);
} }

View File

@ -2,7 +2,7 @@
"ver": "1.0.3", "ver": "1.0.3",
"importer": "buffer", "importer": "buffer",
"imported": true, "imported": true,
"uuid": "d3385675-1bcd-4592-b0f0-bf716f181429", "uuid": "6aba7d31-7435-4f59-b5aa-79256df4ede9",
"files": [ "files": [
".bin", ".bin",
".json" ".json"

View File

@ -1,12 +1,12 @@
/* /*
* @Author: WoNiu * @Author: WoNiu
* @Date: 2024-03-16 15:26:27 * @Date: 2024-03-16 15:26:27
* @LastEditTime: 2024-03-26 15:43:37 * @LastEditTime: 2024-03-28 21:13:04
* @LastEditors: WoNiu * @LastEditors: WoNiu
* @Description: Component * @Description: Component
*/ */
import { _decorator, Component, Node } from "cc"; import { _decorator, Component, Node } from "cc";
import { MapTileType, MapTileTypes } from "./MapTile/MapTileData"; import { MapTileType, MapTileTypes } from "./MapTile/MapTileType";
import { MapTileNode } from "./MapTile/MapTileNode"; import { MapTileNode } from "./MapTile/MapTileNode";
const { ccclass } = _decorator; const { ccclass } = _decorator;

View File

@ -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();
});
}
}

View File

@ -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) {}
}

View File

@ -1,7 +1,7 @@
/* /*
* @Author: WoNiu * @Author: WoNiu
* @Date: 2024-03-26 11:44:58 * @Date: 2024-03-26 11:44:58
* @LastEditTime: 2024-03-27 15:49:36 * @LastEditTime: 2024-03-29 14:02:43
* @LastEditors: WoNiu * @LastEditors: WoNiu
* @Description: * @Description:
*/ */
@ -20,30 +20,29 @@ import { AnimationNode } from "../../GlobalScript/Animation/AnimationNode";
import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite"; import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite";
import { NpkImage } from "../../Tool/NPKImage"; import { NpkImage } from "../../Tool/NPKImage";
import { CloseButtonNode } from "../Common/CloseButtonNode"; import { CloseButtonNode } from "../Common/CloseButtonNode";
import { GameRootSingleton } from "../GameRootController";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
/** /**
* @description: * @description:
*/ */
export enum LuckyType { export enum LuckyType {
// 前进三格 /** 前进三格 */
GoThree = 0, GoThree = 0,
// 移动到月光酒馆 /** 移动到月光酒馆 */
YeGuangJiuGuan, YeGuangJiuGuan,
// 移动到决斗场 /** 移动到决斗场 */
JueDouChang, JueDouChang,
// 移动到海上列车 /** 移动到海上列车 */
HaiShangLieChe, HaiShangLieChe,
// 我要双倍点数x2 /** 我要双倍点数x2 */
Double, Double,
// 这是我的钱,点数减半 /** 这是我的钱,点数减半 */
Halve, Halve,
// 骑士马战 ,点数+2w /** 骑士马战 ,点数+2w */
HorseCombat, HorseCombat,
// 装备修理, 点数-2w /** 装备修理, 点数-2w */
Servicing, Servicing,
// 收取费用,夺取其他人 2w 点数 /** 收取费用,夺取其他人 2w 点数 */
Charge, Charge,
} }
@ -51,9 +50,10 @@ export enum LuckyType {
export class LuckyCoinsNode extends Node { export class LuckyCoinsNode extends Node {
luckyType: LuckyType; luckyType: LuckyType;
// 幸运硬币的结果 /** 幸运硬币的结果节点 */
resultNode: Node; resultNode: Node;
/** 动画完成回调 */
aniDoneBack: Function; aniDoneBack: Function;
constructor(type: LuckyType,aniDone:Function) { constructor(type: LuckyType,aniDone:Function) {

View File

@ -1,22 +1,23 @@
/* /*
* @Author: WoNiu * @Author: WoNiu
* @Date: 2024-03-21 13:29:53 * @Date: 2024-03-21 13:29:53
* @LastEditTime: 2024-03-25 01:18:18 * @LastEditTime: 2024-03-29 14:21:02
* @LastEditors: WoNiu * @LastEditors: WoNiu
* @Description: * @Description:
*/ */
import { _decorator,Component, Node } from 'cc'; import { _decorator, Component, Node } from "cc";
import { BoardRoot } from './BoardRoot'; import { BoardRoot } from "./BoardRoot";
import { UIRoot } from './UIRoot'; import { UIRoot } from "./UIRoot/UIRoot";
import { DialogRoot } from './DialogRoot'; import { GameRoleController } from "./UIRoot/GameRoleController";
import { DialogRoot } from "./DialogRoot/DialogRoot";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
/** /**
* @description: * @description:
*/ */
export class GameRootSingleton { export class GameRootSingleton {
private static readonly _instance: GameRootSingleton = new GameRootSingleton(); private static readonly _instance: GameRootSingleton =
new GameRootSingleton();
private constructor() {} private constructor() {}
@ -32,22 +33,21 @@ export class GameRootSingleton {
UIRoot: UIRoot; UIRoot: UIRoot;
DialogRoot: DialogRoot; DialogRoot: DialogRoot;
/** 玩家角色控制脚本 */
gameRoleController: GameRoleController;
} }
@ccclass("GameRootController")
@ccclass('GameRootController')
/** /**
* @description: * @description:
*/ */
export class GameRootController extends Component { export class GameRootController extends Component {
@property(Node) boardRootNode: Node; @property(Node) boardRootNode: Node;
@property(Node) UIRootNode: Node; @property(Node) UIRootNode: Node;
@property(Node) DialogRootNode: Node; @property(Node) DialogRootNode: Node;
start() { start() {
/// 给三个图层添加 root 根脚本 /// 给三个图层添加 root 根脚本
const game = GameRootSingleton.getInstance(); const game = GameRootSingleton.getInstance();
game.boardRootNode = this.boardRootNode; game.boardRootNode = this.boardRootNode;
@ -59,12 +59,14 @@ export class GameRootController extends Component {
game.UIRoot = this.UIRootNode.getComponent(UIRoot); game.UIRoot = this.UIRootNode.getComponent(UIRoot);
game.DialogRoot = this.DialogRootNode.getComponent(DialogRoot); game.DialogRoot = this.DialogRootNode.getComponent(DialogRoot);
/// 在 UI 节点 添加玩家角色控制脚本
this.UIRootNode.addComponent(GameRoleController);
// 添加游戏 匹配过程控制 脚本
game.gameRoleController = this.addComponent(GameRoleController);
} }
update(deltaTime: number) { update(deltaTime: number) {}
} }
}

9
assets/Script/Gamer.meta Normal file
View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "d61e7a19-5a2c-45c6-b9c8-8efecdaafe18",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -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 { _decorator, Color, Label, Node, Size, Sprite, SpriteFrame, tween, UITransform, VerticalTextAlignment } from 'cc';
import { BaseSprite } from '../../GlobalScript/CommonComponent/BaseSprite'; import { BaseSprite } from '../../GlobalScript/CommonComponent/BaseSprite';
import { NpkImage } from '../../Tool/NPKImage'; import { NpkImage } from '../../Tool/NPKImage';
import { BaseSpriteFrame } from '../../GlobalScript/CommonComponent/BaseSpriteFrame'; import { BaseSpriteFrame } from '../../GlobalScript/CommonComponent/BaseSpriteFrame';
import { GamerRoleType } from './GamerRoleType';
const { ccclass } = _decorator; const { ccclass } = _decorator;
/// 玩家角色类型
export enum CharacterType{
/// 剑魂
JianHun = 0,
}
/// 玩家Node封装 /// 玩家Node封装
@ccclass('Gamer') @ccclass('GamerCardNode')
export class GamerNode extends Node { export class GamerCardNode extends Node {
/// 玩家角色类型 /// 玩家角色类型
private _characterType : CharacterType; private _characterType : GamerRoleType;
/// 玩家名称 /// 玩家名称
private GamerNameLabel : Label; private GamerNameLabel : Label;
@ -34,7 +37,7 @@ export class GamerNode extends Node {
private blue = new Color('00baff'); private blue = new Color('00baff');
set charchterType(type:CharacterType){ set charchterType(type:GamerRoleType){
if(!this.getChildByName('GamerCharacterNode')){ if(!this.getChildByName('GamerCharacterNode')){
this._characterType = type; this._characterType = type;
this.initCharacterNode(); this.initCharacterNode();

View File

@ -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<number, SpriteFrame> = new Map<number, SpriteFrame>();
/** 每一帧需要显示的时间 千分之一秒 */
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);
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "7b231e75-2650-4560-a447-3e3de615fdae",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -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";
}
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "150e386d-95e6-4ebc-af15-1ef927aa4788",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -11,7 +11,7 @@ import {
Vec3, Vec3,
} from "cc"; } from "cc";
import { NpkImage } from "../../Tool/NPKImage"; import { NpkImage } from "../../Tool/NPKImage";
import { MapTileDirection } from "./MapTileData"; import { MapTileDirection } from "./MapTileType";
import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite"; import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite";
import { DiamondCheck, Point } from "./../Common/InDiamondCheck"; import { DiamondCheck, Point } from "./../Common/InDiamondCheck";
const { ccclass } = _decorator; const { ccclass } = _decorator;

View File

@ -1,12 +1,12 @@
/* /*
* @Author: WoNiu * @Author: WoNiu
* @Date: 2024-03-16 16:34:19 * @Date: 2024-03-16 16:34:19
* @LastEditTime: 2024-03-27 15:27:08 * @LastEditTime: 2024-03-28 21:09:58
* @LastEditors: WoNiu * @LastEditors: WoNiu
* @Description: * @Description:
*/ */
import { _decorator, Component, } from "cc"; import { _decorator, Component, } from "cc";
import { MapTileData, MapTileFactory, MapTileType } from "./MapTileData"; import { MapTileData, MapTileType } from "./MapTileType";
const { ccclass } = _decorator; const { ccclass } = _decorator;
@ccclass("MapTileController") @ccclass("MapTileController")
@ -20,7 +20,7 @@ export class MapTileController extends Component {
private _tileType: MapTileType; private _tileType: MapTileType;
set tileType(newType: MapTileType){ set tileType(newType: MapTileType){
this._tileType = newType; this._tileType = newType;
this._tileData = MapTileFactory.getData(newType as MapTileType); this._tileData = MapTileData.getData(newType as MapTileType);
}; };
get tileType(){ return this._tileType; }; get tileType(){ return this._tileType; };

View File

@ -1,11 +1,11 @@
import { _decorator, Node } from "cc"; import { _decorator, Node } from "cc";
import { MapTileDirection, MapTileType } from "./MapTileData"; import { MapTileDirection, MapTileType } from "./MapTileType";
import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite"; import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite";
import { MapTileButtonComponent } from "./MapTileButtonComponent"; import { MapTileButtonComponent } from "./MapTileButtonComponent";
import { MapTileController } from "./MapTileController"; import { MapTileController } from "./MapTileController";
import { CloseButtonNode } from "../Common/CloseButtonNode"; import { CloseButtonNode } from "../Common/CloseButtonNode";
import { MapTitleAction } from "./MapTitleAction"; import { MapTitleAction } from "./MapTitleAction";
import { LuckyType } from "../DialogNode/LuckyCoinsNode"; import { LuckyType } from "../DialogRoot/LuckyCoinsNode";
const { ccclass } = _decorator; const { ccclass } = _decorator;
/// 地块 /// 地块

View File

@ -1,155 +1,165 @@
import { Vec2, v2 } from "cc"; import { Vec2, v2 } from "cc";
import { NpkImage } from "../../Tool/NPKImage"; import { NpkImage } from "../../Tool/NPKImage";
/// 地块类型
//* ─── 地块类型 ────────────────────────────────────────────────────────────────────
/** 地块类型 */
export enum MapTileType { export enum MapTileType {
/// 赫顿玛尔 /** 赫顿玛尔 */
HeDunMaEr = 0, HeDunMaEr = 0,
/// 时间广场 /** 时间广场 */
ShiJianGuangChang, ShiJianGuangChang,
/// 兽人峡谷 /** 兽人峡谷 */
ShouRenXiaGu, ShouRenXiaGu,
/// 超时空漩涡 /** 超时空漩涡 */
ChaoShiKongXuanWo, ChaoShiKongXuanWo,
/// 恐怖的栖息地 /** 恐怖的栖息地 */
KongBuDeQiXiDi, KongBuDeQiXiDi,
/// 红色魔女之森 /** 红色魔女之森 */
HongSeMoNvZhiSen, HongSeMoNvZhiSen,
/// 月光酒馆 /** 月光酒馆 */
YueGuangJiuGuan, YueGuangJiuGuan,
/// 亡命杀阵 /** 亡命杀阵 */
WangMingShaZhen, WangMingShaZhen,
/// 皇家娱乐 /** 皇家娱乐 */
HuangJaiYuLe, HuangJaiYuLe,
/// 黑暗都市 /** 黑暗都市 */
HeiAnDuShi, HeiAnDuShi,
/// 哈林的命运硬币(左边) /** 哈林的命运硬币(左边) */
HaLinMingYunYinBi, HaLinMingYunYinBi,
/// 第九隔离区 /** 第九隔离区 */
DiJiuGeLiQu, DiJiuGeLiQu,
/// 决斗场 /** 决斗场 */
JueDouChang, JueDouChang,
/// 腐坏街道 /** 腐坏街道 */
FuHuaiJieDao, FuHuaiJieDao,
/// 溢血的地下城 /** 溢血的地下城 */
YiXueDeDiXiaChen, YiXueDeDiXiaChen,
/// 普雷·伊西斯 /** 普雷·伊西斯 */
PuLeiYiXiSi, PuLeiYiXiSi,
/// 沉重的礼拜堂 /** 沉重的礼拜堂 */
ChenZhongDeLiBaiTang, ChenZhongDeLiBaiTang,
/// 螺旋王国 /** 螺旋王国 */
LuoXuanWangGuo, LuoXuanWangGuo,
/// 海上列车 /** 海上列车 */
HaiShangLieChe, HaiShangLieChe,
/// 暗黑神殿 /** 暗黑神殿 */
AnHeiShenDian, AnHeiShenDian,
/// 痛苦地下城 /** 痛苦地下城 */
TongKuDiXiaChen, TongKuDiXiaChen,
/// 无底坑道 /** 无底坑道 */
WuDiKenDao, WuDiKenDao,
/// 切斯特小镇的命运硬币(右边) /** 切斯特小镇的命运硬币(右边) */
XiaoZhenMingYunYinBi, XiaoZhenMingYunYinBi,
/// 记忆之地 /** 记忆之地 */
JiYiZhiDi, JiYiZhiDi,
} }
//* ─── 所有地块类型数组 ────────────────────────────────────────────────────────────────
/** 所有地块类型数组 */
export const MapTileTypes = [ export const MapTileTypes = [
/// 赫顿玛尔 /** 赫顿玛尔 */
MapTileType.HeDunMaEr, MapTileType.HeDunMaEr,
/// 时间广场 /** 时间广场 */
MapTileType.ShiJianGuangChang, MapTileType.ShiJianGuangChang,
/// 兽人峡谷 /** 兽人峡谷 */
MapTileType.ShouRenXiaGu, MapTileType.ShouRenXiaGu,
/// 超时空漩涡 /** 超时空漩涡 */
MapTileType.ChaoShiKongXuanWo, MapTileType.ChaoShiKongXuanWo,
/// 恐怖的栖息地 /** 恐怖的栖息地 */
MapTileType.KongBuDeQiXiDi, MapTileType.KongBuDeQiXiDi,
/// 红色魔女之森 /** 红色魔女之森 */
MapTileType.HongSeMoNvZhiSen, MapTileType.HongSeMoNvZhiSen,
/// 月光酒馆 /** 月光酒馆 */
MapTileType.YueGuangJiuGuan, MapTileType.YueGuangJiuGuan,
/// 亡命杀阵 /** 亡命杀阵 */
MapTileType.WangMingShaZhen, MapTileType.WangMingShaZhen,
/// 皇家娱乐 /** 皇家娱乐 */
MapTileType.HuangJaiYuLe, MapTileType.HuangJaiYuLe,
/// 黑暗都市 /** 黑暗都市 */
MapTileType.HeiAnDuShi, MapTileType.HeiAnDuShi,
/// 哈林的命运硬币(左边) /** 哈林的命运硬币(左边) */
MapTileType.HaLinMingYunYinBi, MapTileType.HaLinMingYunYinBi,
/// 第九隔离区 /** 第九隔离区 */
MapTileType.DiJiuGeLiQu, MapTileType.DiJiuGeLiQu,
/// 决斗场 /** 决斗场 */
MapTileType.JueDouChang, MapTileType.JueDouChang,
/// 腐坏街道 /** 腐坏街道 */
MapTileType.FuHuaiJieDao, MapTileType.FuHuaiJieDao,
/// 溢血的地下城 /** 溢血的地下城 */
MapTileType.YiXueDeDiXiaChen, MapTileType.YiXueDeDiXiaChen,
/// 普雷·伊西斯 /** 普雷·伊西斯 */
MapTileType.PuLeiYiXiSi, MapTileType.PuLeiYiXiSi,
/// 沉重的礼拜堂 /** 沉重的礼拜堂 */
MapTileType.ChenZhongDeLiBaiTang, MapTileType.ChenZhongDeLiBaiTang,
/// 螺旋王国 /** 螺旋王国 */
MapTileType.LuoXuanWangGuo, MapTileType.LuoXuanWangGuo,
/// 海上列车 /** 海上列车 */
MapTileType.HaiShangLieChe, MapTileType.HaiShangLieChe,
/// 暗黑神殿 /** 暗黑神殿 */
MapTileType.AnHeiShenDian, MapTileType.AnHeiShenDian,
/// 痛苦地下城 /** 痛苦地下城 */
MapTileType.TongKuDiXiaChen, MapTileType.TongKuDiXiaChen,
/// 无底坑道 /** 无底坑道 */
MapTileType.WuDiKenDao, MapTileType.WuDiKenDao,
/// 切斯特小镇的命运硬币(右边) /** 切斯特小镇的命运硬币(右边) */
MapTileType.XiaoZhenMingYunYinBi, MapTileType.XiaoZhenMingYunYinBi,
/// 记忆之地 /** 记忆之地 */
MapTileType.JiYiZhiDi, MapTileType.JiYiZhiDi,
]; ];
/// 地块方向 //* ─── 地块方向 ────────────────────────────────────────────────────────────────────
/** 地块方向 */
export enum MapTileDirection { export enum MapTileDirection {
/// 横 /** 横 */
horizontal = 24, horizontal = 24,
/// 竖 /** 竖 */
vertical = 25, vertical = 25,
/// 角落 /** 角落 */
nook = 26, 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; trainsSelectLicense: boolean;
/// 决斗场选择许可 /** 决斗场选择许可 */
duelSelectLicense: boolean; duelSelectLicense: boolean;
/// 占领许可 /** 占领许可 */
occupyLicense: boolean; occupyLicense: boolean;
constructor({ constructor({
/// 坐标 /** 坐标 */
location, location,
/// 背景index /** 背景index */
backgroundIndex, backgroundIndex,
/// 地块方向 /** 地块方向 */
direction, direction,
/// 占领许可 /** 占领许可 */
occupyLicense, occupyLicense,
/// 列车选择许可 /** 列车选择许可 */
trainsSelectLicense, trainsSelectLicense,
/// 决斗场选择许可 /** 决斗场选择许可 */
duelSelectLicense, duelSelectLicense,
}: { }: {
location: Vec2; location: Vec2;
@ -168,87 +178,85 @@ export class MapTileData {
this.duelSelectLicense = duelSelectLicense ?? true; this.duelSelectLicense = duelSelectLicense ?? true;
this.occupyLicense = occupyLicense ?? true; this.occupyLicense = occupyLicense ?? true;
} }
}
export class MapTileFactory {
static getData(type: MapTileType): MapTileData { static getData(type: MapTileType): MapTileData {
switch (type) { switch (type) {
/// 赫顿玛尔 /// 赫顿玛尔
case MapTileType.HeDunMaEr: case MapTileType.HeDunMaEr:
return MapTileFactory.HeDunMaErData; return this.HeDunMaErData;
/// 时间广场 /// 时间广场
case MapTileType.ShiJianGuangChang: case MapTileType.ShiJianGuangChang:
return MapTileFactory.ShiJianGuangChangData; return this.ShiJianGuangChangData;
/// 兽人峡谷 /// 兽人峡谷
case MapTileType.ShouRenXiaGu: case MapTileType.ShouRenXiaGu:
return MapTileFactory.ShouRenXiaGuData; return this.ShouRenXiaGuData;
/// 超时空漩涡 /// 超时空漩涡
case MapTileType.ChaoShiKongXuanWo: case MapTileType.ChaoShiKongXuanWo:
return MapTileFactory.ChaoShiKongXuanWoData; return this.ChaoShiKongXuanWoData;
/// 恐怖的栖息地 /// 恐怖的栖息地
case MapTileType.KongBuDeQiXiDi: case MapTileType.KongBuDeQiXiDi:
return MapTileFactory.KongBuDeQiXiDiData; return this.KongBuDeQiXiDiData;
/// 红色魔女之森 /// 红色魔女之森
case MapTileType.HongSeMoNvZhiSen: case MapTileType.HongSeMoNvZhiSen:
return MapTileFactory.HongSeMoNvZhiSenData; return this.HongSeMoNvZhiSenData;
/// 月光酒馆 /// 月光酒馆
case MapTileType.YueGuangJiuGuan: case MapTileType.YueGuangJiuGuan:
return MapTileFactory.YueGuangJiuGuanData; return this.YueGuangJiuGuanData;
/// 亡命杀镇子 /// 亡命杀镇子
case MapTileType.WangMingShaZhen: case MapTileType.WangMingShaZhen:
return MapTileFactory.WangMingShaZhenData; return this.WangMingShaZhenData;
/// 皇家娱乐 /// 皇家娱乐
case MapTileType.HuangJaiYuLe: case MapTileType.HuangJaiYuLe:
return MapTileFactory.HuangJaiYuLeData; return this.HuangJaiYuLeData;
/// 黑暗都市 /// 黑暗都市
case MapTileType.HeiAnDuShi: case MapTileType.HeiAnDuShi:
return MapTileFactory.HeiAnDuShiData; return this.HeiAnDuShiData;
/// 哈林的命运硬币(左边) /// 哈林的命运硬币(左边)
case MapTileType.HaLinMingYunYinBi: case MapTileType.HaLinMingYunYinBi:
return MapTileFactory.HaLinMingYunYinBiData; return this.HaLinMingYunYinBiData;
/// 第九隔离区 /// 第九隔离区
case MapTileType.DiJiuGeLiQu: case MapTileType.DiJiuGeLiQu:
return MapTileFactory.DiJiuGeLiQuData; return this.DiJiuGeLiQuData;
/// 决斗场 /// 决斗场
case MapTileType.JueDouChang: case MapTileType.JueDouChang:
return MapTileFactory.JueDouChangData; return this.JueDouChangData;
/// 腐坏街道 /// 腐坏街道
case MapTileType.FuHuaiJieDao: case MapTileType.FuHuaiJieDao:
return MapTileFactory.FuHuaiJieDaoData; return this.FuHuaiJieDaoData;
/// 溢血的地下城 /// 溢血的地下城
case MapTileType.YiXueDeDiXiaChen: case MapTileType.YiXueDeDiXiaChen:
return MapTileFactory.YiXueDeDiXiaChenData; return this.YiXueDeDiXiaChenData;
/// 普雷·伊西斯 /// 普雷·伊西斯
case MapTileType.PuLeiYiXiSi: case MapTileType.PuLeiYiXiSi:
return MapTileFactory.PuLeiYiXiSiData; return this.PuLeiYiXiSiData;
/// 沉重的礼拜堂 /// 沉重的礼拜堂
case MapTileType.ChenZhongDeLiBaiTang: case MapTileType.ChenZhongDeLiBaiTang:
return MapTileFactory.ChenZhongDeLiBaiTangData; return this.ChenZhongDeLiBaiTangData;
/// 螺旋王国 /// 螺旋王国
case MapTileType.LuoXuanWangGuo: case MapTileType.LuoXuanWangGuo:
return MapTileFactory.LuoXuanWangGuoData; return this.LuoXuanWangGuoData;
/// 海上列车 /// 海上列车
case MapTileType.HaiShangLieChe: case MapTileType.HaiShangLieChe:
return MapTileFactory.HaiShangLieCheData; return this.HaiShangLieCheData;
/// 暗黑神殿 /// 暗黑神殿
case MapTileType.AnHeiShenDian: case MapTileType.AnHeiShenDian:
return MapTileFactory.AnHeiShenDianData; return this.AnHeiShenDianData;
/// 痛苦地下城 /// 痛苦地下城
case MapTileType.TongKuDiXiaChen: case MapTileType.TongKuDiXiaChen:
return MapTileFactory.TongKuDiXiaChenData; return this.TongKuDiXiaChenData;
/// 无底坑道 /// 无底坑道
case MapTileType.WuDiKenDao: case MapTileType.WuDiKenDao:
return MapTileFactory.WuDiKenDaoData; return this.WuDiKenDaoData;
/// 切斯特小镇的命运硬币(右边) /// 切斯特小镇的命运硬币(右边)
case MapTileType.XiaoZhenMingYunYinBi: case MapTileType.XiaoZhenMingYunYinBi:
return MapTileFactory.XiaoZhenMingYunYinBiData; return this.XiaoZhenMingYunYinBiData;
/// 记忆之地 /// 记忆之地
case MapTileType.JiYiZhiDi: case MapTileType.JiYiZhiDi:
return MapTileFactory.JiYiZhiDiData; return this.JiYiZhiDiData;
} }
} }
// 赫顿玛尔 /** 赫顿玛尔 */
private static HeDunMaErData = new MapTileData({ private static HeDunMaErData = new MapTileData({
location: v2(475, -448), location: v2(475, -448),
direction: MapTileDirection.nook, direction: MapTileDirection.nook,
@ -256,38 +264,38 @@ export class MapTileFactory {
occupyLicense: false, occupyLicense: false,
}); });
/// 时间广场 (55,34) /** 时间广场 (55,34) */
private static ShiJianGuangChangData = new MapTileData({ private static ShiJianGuangChangData = new MapTileData({
location: v2(420, -414), location: v2(420, -414),
direction: MapTileDirection.horizontal, direction: MapTileDirection.horizontal,
}); });
/// 兽人峡谷 (52,34) /** 兽人峡谷 (52,34) */
private static ShouRenXiaGuData = new MapTileData({ private static ShouRenXiaGuData = new MapTileData({
location: v2(368, -380), location: v2(368, -380),
direction: MapTileDirection.horizontal, direction: MapTileDirection.horizontal,
}); });
/// 超时空漩涡 (53,34) /** 超时空漩涡 (53,34) */
private static ChaoShiKongXuanWoData = new MapTileData({ private static ChaoShiKongXuanWoData = new MapTileData({
location: v2(315, -346), location: v2(315, -346),
backgroundIndex: 32, backgroundIndex: 32,
direction: MapTileDirection.horizontal, direction: MapTileDirection.horizontal,
}); });
/// 恐怖的栖息地 (52,34) /** 恐怖的栖息地 (52,34) */
private static KongBuDeQiXiDiData = new MapTileData({ private static KongBuDeQiXiDiData = new MapTileData({
location: v2(262, -312), location: v2(262, -312),
direction: MapTileDirection.horizontal, direction: MapTileDirection.horizontal,
}); });
/// 红色魔女之森 (52,34) /** 红色魔女之森 (52,34) */
private static HongSeMoNvZhiSenData = new MapTileData({ private static HongSeMoNvZhiSenData = new MapTileData({
location: v2(209, -278), location: v2(209, -278),
direction: MapTileDirection.horizontal, direction: MapTileDirection.horizontal,
}); });
// 月光酒馆(69,44) // 月光酒馆(69,44) */
private static YueGuangJiuGuanData = new MapTileData({ private static YueGuangJiuGuanData = new MapTileData({
location: v2(140, -234), location: v2(140, -234),
direction: MapTileDirection.nook, direction: MapTileDirection.nook,
@ -295,24 +303,24 @@ export class MapTileFactory {
occupyLicense: false, occupyLicense: false,
}); });
/// 亡命杀镇 (53,34) /** 亡命杀镇 (53,34) */
private static WangMingShaZhenData = new MapTileData({ private static WangMingShaZhenData = new MapTileData({
location: v2(209, -198), location: v2(209, -198),
direction: MapTileDirection.vertical, direction: MapTileDirection.vertical,
}); });
/// 皇家娱乐(53,34) /** 皇家娱乐(53,34) */
private static HuangJaiYuLeData = new MapTileData({ private static HuangJaiYuLeData = new MapTileData({
location: v2(262, -164), location: v2(262, -164),
direction: MapTileDirection.vertical, direction: MapTileDirection.vertical,
}); });
/// 黑暗都市 /** 黑暗都市 */
private static HeiAnDuShiData = new MapTileData({ private static HeiAnDuShiData = new MapTileData({
location: v2(315, -130), location: v2(315, -130),
direction: MapTileDirection.vertical, direction: MapTileDirection.vertical,
}); });
/// 哈林的命运硬币(左边) /** 哈林的命运硬币(左边) */
private static HaLinMingYunYinBiData = new MapTileData({ private static HaLinMingYunYinBiData = new MapTileData({
location: v2(368, -96), location: v2(368, -96),
backgroundIndex: 34, backgroundIndex: 34,
@ -320,13 +328,13 @@ export class MapTileFactory {
duelSelectLicense: false, duelSelectLicense: false,
occupyLicense: false, occupyLicense: false,
}); });
/// 第九隔离区 /** 第九隔离区 */
private static DiJiuGeLiQuData = new MapTileData({ private static DiJiuGeLiQuData = new MapTileData({
location: v2(421, -62), location: v2(421, -62),
direction: MapTileDirection.vertical, direction: MapTileDirection.vertical,
}); });
// 决斗场(54,44) // 决斗场(54,44) */
private static JueDouChangData = new MapTileData({ private static JueDouChangData = new MapTileData({
location: v2(475, -18), location: v2(475, -18),
direction: MapTileDirection.nook, direction: MapTileDirection.nook,
@ -334,38 +342,38 @@ export class MapTileFactory {
occupyLicense: false, occupyLicense: false,
}); });
/// 腐坏街道(53,34) /** 腐坏街道(53,34) */
private static FuHuaiJieDaoData = new MapTileData({ private static FuHuaiJieDaoData = new MapTileData({
location: v2(544, -62), location: v2(544, -62),
direction: MapTileDirection.horizontal, direction: MapTileDirection.horizontal,
}); });
/// 溢血的地下城(53,34) /** 溢血的地下城(53,34) */
private static YiXueDeDiXiaChenData = new MapTileData({ private static YiXueDeDiXiaChenData = new MapTileData({
location: v2(597, -96), location: v2(597, -96),
direction: MapTileDirection.horizontal, direction: MapTileDirection.horizontal,
}); });
/// 普雷·伊西斯 /** 普雷·伊西斯 */
private static PuLeiYiXiSiData = new MapTileData({ private static PuLeiYiXiSiData = new MapTileData({
location: v2(650, -130), location: v2(650, -130),
backgroundIndex: 33, backgroundIndex: 33,
direction: MapTileDirection.horizontal, direction: MapTileDirection.horizontal,
}); });
/// 沉重的礼拜堂 /** 沉重的礼拜堂 */
private static ChenZhongDeLiBaiTangData = new MapTileData({ private static ChenZhongDeLiBaiTangData = new MapTileData({
location: v2(703, -164), location: v2(703, -164),
direction: MapTileDirection.horizontal, direction: MapTileDirection.horizontal,
}); });
/// 螺旋王国 /** 螺旋王国 */
private static LuoXuanWangGuoData = new MapTileData({ private static LuoXuanWangGuoData = new MapTileData({
location: v2(756, -198), location: v2(756, -198),
direction: MapTileDirection.horizontal, direction: MapTileDirection.horizontal,
}); });
// 海上列车(69,44) // 海上列车(69,44) */
private static HaiShangLieCheData = new MapTileData({ private static HaiShangLieCheData = new MapTileData({
location: v2(808, -234), location: v2(808, -234),
direction: MapTileDirection.nook, direction: MapTileDirection.nook,
@ -374,25 +382,25 @@ export class MapTileFactory {
occupyLicense: false, occupyLicense: false,
}); });
/// 暗黑神殿 /** 暗黑神殿 */
private static AnHeiShenDianData = new MapTileData({ private static AnHeiShenDianData = new MapTileData({
location: v2(756, -278), location: v2(756, -278),
direction: MapTileDirection.vertical, direction: MapTileDirection.vertical,
}); });
/// 痛苦地下城 /** 痛苦地下城 */
private static TongKuDiXiaChenData = new MapTileData({ private static TongKuDiXiaChenData = new MapTileData({
location: v2(703, -312), location: v2(703, -312),
direction: MapTileDirection.vertical, direction: MapTileDirection.vertical,
}); });
/// 无底坑道 /** 无底坑道 */
private static WuDiKenDaoData = new MapTileData({ private static WuDiKenDaoData = new MapTileData({
location: v2(650, -346), location: v2(650, -346),
direction: MapTileDirection.vertical, direction: MapTileDirection.vertical,
}); });
/// 切斯特小镇的命运硬币(右边) /** 切斯特小镇的命运硬币(右边) */
private static XiaoZhenMingYunYinBiData = new MapTileData({ private static XiaoZhenMingYunYinBiData = new MapTileData({
location: v2(597, -380), location: v2(597, -380),
backgroundIndex: 34, backgroundIndex: 34,
@ -401,9 +409,11 @@ export class MapTileFactory {
occupyLicense: false, occupyLicense: false,
}); });
/// 记忆之地 /** 记忆之地 */
private static JiYiZhiDiData = new MapTileData({ private static JiYiZhiDiData = new MapTileData({
location: v2(544, -414), location: v2(544, -414),
direction: MapTileDirection.vertical, direction: MapTileDirection.vertical,
}); });
} }

View File

@ -1,12 +1,12 @@
/* /*
* @Author: WoNiu * @Author: WoNiu
* @Date: 2024-03-26 11:36:36 * @Date: 2024-03-26 11:36:36
* @LastEditTime: 2024-03-27 15:55:40 * @LastEditTime: 2024-03-29 14:03:36
* @LastEditors: WoNiu * @LastEditors: WoNiu
* @Description: * @Description:
*/ */
import { LuckyCoinsNode, LuckyType } from "../DialogNode/LuckyCoinsNode"; import { LuckyCoinsNode, LuckyType } from "../DialogRoot/LuckyCoinsNode";
import { GameRootSingleton } from "../GameRootController"; import { GameRootSingleton } from "../GameRootController";
/** /**

View File

@ -1,11 +1,11 @@
/* /*
* @Author: WoNiu * @Author: WoNiu
* @Date: 2024-03-27 15:20:29 * @Date: 2024-03-27 15:20:29
* @LastEditTime: 2024-03-27 15:26:21 * @LastEditTime: 2024-03-28 21:15:43
* @LastEditors: WoNiu * @LastEditors: WoNiu
* @Description: * @Description:
*/ */
import { MapTileType, MapTileTypes } from "./MapTileData"; import { MapTileType, MapTileTypes } from "./MapTileType";
import { MapTitleModel } from "./MapTitleModel"; import { MapTitleModel } from "./MapTitleModel";
/** /**

View File

@ -7,7 +7,7 @@
*/ */
import { _decorator } from "cc"; import { _decorator } from "cc";
import { MapTileType } from "./MapTileData"; import { MapTileType } from "./MapTileType";
/** /**
* @description: * @description:

View File

@ -3,7 +3,6 @@ import { BaseSprite } from '../../GlobalScript/CommonComponent/BaseSprite';
import { NpkImage } from '../../Tool/NPKImage'; import { NpkImage } from '../../Tool/NPKImage';
import { BaseButton } from '../../GlobalScript/CommonComponent/BaseButton'; import { BaseButton } from '../../GlobalScript/CommonComponent/BaseButton';
import { AnimationNode } from '../../GlobalScript/Animation/AnimationNode'; import { AnimationNode } from '../../GlobalScript/Animation/AnimationNode';
import { UIRoot } from '../UIRoot';
import {CloseButtonNode } from '../Common/CloseButtonNode'; import {CloseButtonNode } from '../Common/CloseButtonNode';
import { GameRootSingleton } from '../GameRootController'; import { GameRootSingleton } from '../GameRootController';
const { ccclass } = _decorator; const { ccclass } = _decorator;
@ -61,11 +60,6 @@ export class StartGameUINode extends Node {
/// 给节点添加 button 组件 /// 给节点添加 button 组件
const buttonComponent = startButtonNode.addComponent( BaseButton ); const buttonComponent = startButtonNode.addComponent( BaseButton );
buttonComponent.init(NpkImage.main,1); 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.addComponent( Button)
startButtonNode.on(Button.EventType.CLICK,this.startOnTouchEnd,this); startButtonNode.on(Button.EventType.CLICK,this.startOnTouchEnd,this);

View File

@ -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) {}
}

View File

@ -1,7 +1,7 @@
/* /*
* @Author: WoNiu * @Author: WoNiu
* @Date: 2024-03-13 12:19:50 * @Date: 2024-03-13 12:19:50
* @LastEditTime: 2024-03-25 19:49:13 * @LastEditTime: 2024-03-29 13:01:41
* @LastEditors: WoNiu * @LastEditors: WoNiu
* @Description: * @Description:
*/ */
@ -24,7 +24,7 @@ import {
v2, v2,
} from "cc"; } from "cc";
import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite"; import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite";
import { NpkImage } from "../../Tool/NPKImage"; import { NpkImage, NpkImageTool } from "../../Tool/NPKImage";
import { import {
BaseButton, BaseButton,
BaseButtonState, BaseButtonState,
@ -33,6 +33,7 @@ import { BaseButtonAction } from "../../GlobalScript/CommonComponent/BaseButtonA
import { ImagePack } from "../../GlobalScript/ImagePack/ImagePack"; import { ImagePack } from "../../GlobalScript/ImagePack/ImagePack";
import { GameState } from "../../GlobalScript/GlobalGameState/GameState"; import { GameState } from "../../GlobalScript/GlobalGameState/GameState";
import { ImgInfo } from "../../GlobalScript/GlobalInterface/GlobalInterface"; import { ImgInfo } from "../../GlobalScript/GlobalInterface/GlobalInterface";
import { GamerRoleAni, GamerRoleType } from "../Gamer/GamerRoleType";
const { ccclass } = _decorator; const { ccclass } = _decorator;
@ccclass("DiceButtonNode") @ccclass("DiceButtonNode")
@ -130,7 +131,7 @@ export class DiceButtonNode extends Node {
} }
} }
// ─── 动画播放 ──────────────────────────────────────────────────────────────────── //* ─── 动画播放 ────────────────────────────────────────────────────────────────────
export enum PlayAniState { export enum PlayAniState {
//未播放 //未播放
@ -188,41 +189,11 @@ export class GaugeAnimation extends Component {
//设置 //设置
this.sprite.trim = false; this.sprite.trim = false;
ImagePack.getInstance().ReadNpkTable( NpkImageTool.GetNpkImageAll(NpkImage.gauge, (count,frameMap)=>{
"sprite/" + NpkImage.gauge.toLocaleLowerCase(), this.frameMap = frameMap;
(ImgObj) => { this.frameCount = count;
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; 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,
}); });
tex.uploadData(Png.PNGdata);
// 更新 0 级 Mipmap。
tex.updateImage();
spriteFrame.texture = tex;
spriteFrame.offset = v2(Png.Xpos, -Png.Ypos);
this.frameMap.set(index, spriteFrame);
} }
start() {} start() {}
@ -262,8 +233,6 @@ export class GaugeAnimation extends Component {
if (GameState.getInstance().IsPauseState()) return; if (GameState.getInstance().IsPauseState()) return;
//如果初始化未完成,不播放 //如果初始化未完成,不播放
if (!this.InitState) return; if (!this.InitState) return;
// this.SetAniFrameByTime();
//如果不在播放中 //如果不在播放中
if (this.playState != PlayAniState.playing && this.playState != PlayAniState.reversed) if (this.playState != PlayAniState.playing && this.playState != PlayAniState.reversed)
return; return;

View File

@ -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) {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "79e2c1f6-7206-4356-82a5-09f3d1039dff",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -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) {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "80141aea-c2a5-4eab-8430-59484a333bf1",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -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) {}
}

View File

@ -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 { export enum NpkImage {
main = path + '00_main.img', main = NpkImagePath + "00_main.img",
ingame = path + '01_ingame.img', ingame = NpkImagePath + "01_ingame.img",
board = path + '02_board.img', board = NpkImagePath + "02_board.img",
gauge = path + '03_gauge.img', gauge = NpkImagePath + "03_gauge.img",
character_sd = path + '04_character_sd.img', character_sd = NpkImagePath + "04_character_sd.img",
monsternotice = path + '05_monsternotice.img', monsternotice = NpkImagePath + "05_monsternotice.img",
specialplace = path + '06_specialplace.img', specialplace = NpkImagePath + "06_specialplace.img",
conditionsofvictory = path + '07_conditionsofvictory.img', conditionsofvictory = NpkImagePath + "07_conditionsofvictory.img",
calendar = path + '08_calendar.img', calendar = NpkImagePath + "08_calendar.img",
bankruptcy = path + 'bankruptcy.img', bankruptcy = NpkImagePath + "bankruptcy.img",
character_loop = path + 'character_loop.img', character_loop = NpkImagePath + "character_loop.img",
count_font = path + 'count_font.img', count_font = NpkImagePath + "count_font.img",
dice_1x1_db = path + 'dice_1x1_db.img', dice_1x1_db = NpkImagePath + "dice_1x1_db.img",
dice_1x2 = path + 'dice_1x2.img', dice_1x2 = NpkImagePath + "dice_1x2.img",
dice_1x3 = path + 'dice_1x3.img', dice_1x3 = NpkImagePath + "dice_1x3.img",
dice_2x2_db = path + 'dice_2x2_db.img', dice_2x2_db = NpkImagePath + "dice_2x2_db.img",
dice_2x3 = path + 'dice_2x3.img', dice_2x3 = NpkImagePath + "dice_2x3.img",
dice_2x4 = path + 'dice_2x4.img', dice_2x4 = NpkImagePath + "dice_2x4.img",
dice_3x3_db = path + 'dice_3x3_db.img', dice_3x3_db = NpkImagePath + "dice_3x3_db.img",
dice_3x4 = path + 'dice_3x4.img', dice_3x4 = NpkImagePath + "dice_3x4.img",
dice_3x5 = path + 'dice_3x5.img', dice_3x5 = NpkImagePath + "dice_3x5.img",
dice_4x4_db = path + 'dice_4x4_db.img', dice_4x4_db = NpkImagePath + "dice_4x4_db.img",
dice_4x5 = path + 'dice_4x5.img', dice_4x5 = NpkImagePath + "dice_4x5.img",
dice_4x6 = path + 'dice_4x6.img', dice_4x6 = NpkImagePath + "dice_4x6.img",
dice_5x5 = path + 'dice_5x5.img', dice_5x5 = NpkImagePath + "dice_5x5.img",
dice_5x6 = path + 'dice_5x6.img', dice_5x6 = NpkImagePath + "dice_5x6.img",
dice_6x6_db = path + 'dice_6x6_db.img', dice_6x6_db = NpkImagePath + "dice_6x6_db.img",
dice_font = path + 'dice_font.img', dice_font = NpkImagePath + "dice_font.img",
dungeonbg = path + 'dungeonbg.img', dungeonbg = NpkImagePath + "dungeonbg.img",
fire_loop = path + 'fire_loop.img', fire_loop = NpkImagePath + "fire_loop.img",
light01 = path + 'light01.img', light01 = NpkImagePath + "light01.img",
light02 = path + 'light02.img', light02 = NpkImagePath + "light02.img",
loading_loop = path + 'loading_loop.img', loading_loop = NpkImagePath + "loading_loop.img",
luckycoin = path + 'luckycoin.img', luckycoin = NpkImagePath + "luckycoin.img",
luckycoin_bg = path + 'luckycoin_bg.img', luckycoin_bg = NpkImagePath + "luckycoin_bg.img",
point_loop = path + 'point_loop.img', point_loop = NpkImagePath + "point_loop.img",
table_back = path + 'table_back.img', table_back = NpkImagePath + "table_back.img",
table_dodge = path + 'table_dodge.img', table_dodge = NpkImagePath + "table_dodge.img",
table_front = path + 'table_front.img', table_front = NpkImagePath + "table_front.img",
title_loop = path + 'title_loop.img', title_loop = NpkImagePath + "title_loop.img",
win = path + 'win.img', win = NpkImagePath + "win.img",
}; }
interface NpkImageCallback{
/**
* @param {number} frameCount
* @param {Map<number, SpriteFrame>} frameMapMap
*/
(frameCount: number, frameMap: Map<number, SpriteFrame>): void;
}
export class NpkImageTool {
/**
* @description: Npk path路径下的所有
* @param {string} path
* @param {Function} callBack((frameCount, frameMap)number, Map<number, SpriteFrame>
*/
static GetNpkImageAll(path: string, callBack: NpkImageCallback) {
// 精灵帧总数
let frameCount = 0;
// 精灵帧缓存
let frameMap: Map<number, SpriteFrame> = new Map<number, SpriteFrame>();
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;
}
}

View File

@ -23,7 +23,7 @@
"_active": true, "_active": true,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 20 "__id__": 16
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -54,7 +54,7 @@
}, },
"autoReleaseAssets": false, "autoReleaseAssets": false,
"_globals": { "_globals": {
"__id__": 21 "__id__": 17
}, },
"_id": "f713b5ea-a70f-486c-8260-0338f089a5b8" "_id": "f713b5ea-a70f-486c-8260-0338f089a5b8"
}, },
@ -77,13 +77,13 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 17 "__id__": 13
}, },
{ {
"__id__": 18 "__id__": 14
}, },
{ {
"__id__": 19 "__id__": 15
} }
], ],
"_prefab": null, "_prefab": null,
@ -175,7 +175,7 @@
"_priority": 0, "_priority": 0,
"_fov": 45, "_fov": 45,
"_fovAxis": 0, "_fovAxis": 0,
"_orthoHeight": 509.18301104972375, "_orthoHeight": 477.2642163661581,
"_near": 0, "_near": 0,
"_far": 1000, "_far": 1000,
"_color": { "_color": {
@ -220,18 +220,14 @@
"__id__": 6 "__id__": 6
}, },
{ {
"__id__": 10 "__id__": 9
}, },
{ {
"__id__": 13 "__id__": 11
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [],
{
"__id__": 16
}
],
"_prefab": null, "_prefab": null,
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -278,9 +274,6 @@
}, },
{ {
"__id__": 8 "__id__": 8
},
{
"__id__": 9
} }
], ],
"_prefab": null, "_prefab": null,
@ -349,18 +342,6 @@
"ImgIndex": 0, "ImgIndex": 0,
"_id": "fc2gTwXM1Lq68bZxSz8rQ1" "_id": "fc2gTwXM1Lq68bZxSz8rQ1"
}, },
{
"__type__": "51518t/LCBGQZ6rvzL2I2e5",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 6
},
"_enabled": true,
"__prefab": null,
"_id": "5c+WvJW35JkYzLE6SY7Dmz"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "UIRoot", "_name": "UIRoot",
@ -373,10 +354,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 11 "__id__": 10
},
{
"__id__": 12
} }
], ],
"_prefab": null, "_prefab": null,
@ -415,7 +393,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 10 "__id__": 9
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -431,18 +409,6 @@
}, },
"_id": "6cbBeNcXdJr6bJDAOt5tLP" "_id": "6cbBeNcXdJr6bJDAOt5tLP"
}, },
{
"__type__": "a578c1qrTRIdaMFhEtim8LM",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": null,
"_id": "6clS3n6E1O3Ir6YO9pV5rA"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "DialogRoot", "_name": "DialogRoot",
@ -455,10 +421,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 14 "__id__": 12
},
{
"__id__": 15
} }
], ],
"_prefab": null, "_prefab": null,
@ -497,7 +460,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 13 "__id__": 11
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -513,39 +476,6 @@
}, },
"_id": "28/iYuYk1JyqaQ0l2uDYPY" "_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", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@ -625,28 +555,28 @@
{ {
"__type__": "cc.SceneGlobals", "__type__": "cc.SceneGlobals",
"ambient": { "ambient": {
"__id__": 22 "__id__": 18
}, },
"shadows": { "shadows": {
"__id__": 23 "__id__": 19
}, },
"_skybox": { "_skybox": {
"__id__": 24 "__id__": 20
}, },
"fog": { "fog": {
"__id__": 25 "__id__": 21
}, },
"octree": { "octree": {
"__id__": 26 "__id__": 22
}, },
"skin": { "skin": {
"__id__": 27 "__id__": 23
}, },
"lightProbeInfo": { "lightProbeInfo": {
"__id__": 28 "__id__": 24
}, },
"postSettings": { "postSettings": {
"__id__": 29 "__id__": 25
}, },
"bakedWithStationaryMainLight": false, "bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false "bakedWithHighpLightmap": false