未完成基本框架

This commit is contained in:
Lenheart 2024-03-06 22:06:49 +08:00
parent e5f8f3412e
commit dc99ae4775
85 changed files with 30378 additions and 71 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@ local/
build/
profiles/
native
assets/ImagePacks
#//////////////////////////
# NPM
#//////////////////////////

9
assets/GlobalScript.meta Normal file
View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "5208f390-cc46-487e-ab55-1158ca41e9fe",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "822d6861-f210-4760-bd10-0fd9fc2cae86",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,50 @@
import { _decorator, Component, Node, Animation, Sprite, resources, SpriteFrame, CCString, CCInteger, Vec2 } from 'cc';
import { MyAnimation } from './MyAnimation';
const { ccclass, property, requireComponent, executeInEditMode } = _decorator;
@ccclass('BaseMyAnimation')
@requireComponent(Sprite)//依赖组件 精灵
export default class BaseMyAnimation extends MyAnimation {
@property({ type: CCInteger, displayName: 'Ani帧数', tooltip: "Ani总共有多少帧" })
AnimationFrameCount: number = 0;
NowSettingCount = 0;
@property({ type: CCString, displayName: '默认img路径', tooltip: "img路径" })
DefaultImgPath: string = "";
@property({ type: [CCString], displayName: 'img路径', tooltip: "img路径" })
ImgPath: string[] = Array<string>();
@property({ type: [CCInteger], displayName: 'img编号', tooltip: "img编号" })
ImgIndex: number[] = Array<number>();
@property({ type: [CCInteger], displayName: '每帧时间', tooltip: "每一帧的持续时间" })
FrameDelay: Array<number> = Array<number>();
ChangeArr(Aobj, Bobj, FillData) {
if (Aobj.length < Bobj) {
for (let index = 0; index < (Bobj - Aobj.length); index++) {
Aobj.push(FillData);
}
} else if (Aobj.length > Bobj) {
for (let index = 0; index < (Aobj.length - Bobj); index++) {
Aobj.pop();
}
}
}
onAnimationFrameCountChanged() {
//如果更改了设置
if (this.NowSettingCount != this.AnimationFrameCount) {
this.ChangeArr(this.ImgPath, this.AnimationFrameCount, '`NoImgPath`0');
this.ChangeArr(this.FrameDelay, this.AnimationFrameCount, 0);
this.NowSettingCount = this.AnimationFrameCount;
}
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "46191008-0f8c-41fa-916e-29c656c36c99",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,172 @@
import {
_decorator, Component, math, Node, resources, Sprite, SpriteFrame, Texture2D, UITransform, v2, v3, Vec2, Vec3,
} from "cc";
import { GameState } from "../GlobalGameState/GameState";
import { ImagePack } from "../ImagePack/ImagePack";
import { Ani_Frame, Img, ScriptAni } from "../GlobalInterface/GlobalInterface";
import { GameScript } from "../GameScript/GameScript";
const { ccclass, property, requireComponent } = _decorator;
@ccclass("MyAnimation")
@requireComponent(Sprite)
export class MyAnimation extends Component {
//Ani加载精灵帧初始化状态
InitState: boolean = false;
SpriteObj: Sprite = null;
//Ani帧数
AnimationFrameCount: number = 1;
//默认img路径
DefaultImgPath: string = "";
//img路径的数组
ImgPath: string[] = Array<string>();
ImgIndex: number[] = Array<number>();
//img帧的数组
FrameArr: Array<Ani_Frame> = [];
//实际用到的Img路径数组 可能用于以后的释放NPK
RealUseImgPath: string[] = Array<string>();
//播放计时器时间
PlayTimer: number = 0;
//每帧延迟时间
FrameDelay: number[] = Array<number>();
//当前帧
NowFrame: number = 0;
//Ani播放状态 0未播放 1播放中 2暂停中 3播放完成
PlayState = 0;
//Ani对象
AniObject: ScriptAni;
//初始化路径
InitPath() {
//首先push默认路径
this.RealUseImgPath.push(this.DefaultImgPath);
//遍历img路径数组
this.ImgPath.forEach((Path, index) => {
//如果没填写说明为空
if (Path == "") {
Path = this.DefaultImgPath;
} else {
if (!this.RealUseImgPath.includes(Path)) {
this.RealUseImgPath.push(Path);
}
}
this.FrameArr.push({
Img_Path: Path,
Img_Index: this.ImgIndex[index],
Delay: this.FrameDelay[index],
Frame: null,
});
});
}
LoadSuccessImgCount: number = 0;
ImgTable: Map<string, Img> = new Map<string, Img>();
//读取Img
InitImg() {
//遍历img路径数组
this.RealUseImgPath.forEach((Path, index) => {
ImagePack.getInstance().ReadNpkTable(Path, (ImgObj) => {
this.LoadSuccessImgCount++;
//记录路径对应的Img对象
this.ImgTable.set(Path, ImgObj);
//如果已加载数量等于总数量 说明Img初始化完成
if (this.LoadSuccessImgCount == this.RealUseImgPath.length) {
//都加载完成以后 把精灵帧初始化出来
this.FrameArr.forEach((FrameObj, Index) => {
const Png = this.ImgTable.get(FrameObj.Img_Path)
.Png_List[FrameObj.Img_Index];
let 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, 0);
// 更新 0 级 Mipmap。
tex.updateImage();
spriteFrame.texture = tex;
spriteFrame.offset = v2(Png.Xpos, -Png.Ypos);
this.FrameArr[Index].Frame = spriteFrame;
});
this.InitState = true;
}
});
});
}
Init() {
this.InitPath();
this.InitImg();
}
start() {
//判断是否有精灵 如果没有 就给他搞一个
if (this.node.getComponent(Sprite))
this.SpriteObj = this.node.getComponent(Sprite);
else
this.SpriteObj = this.node.addComponent(Sprite);
//初始化构造内容
this.Init();
//设置节点锚点为左上角
this.node.getComponent(UITransform).anchorPoint = v2(0, 1);
//设置类型
this.SpriteObj.sizeMode = Sprite.SizeMode.RAW;
//设置
this.SpriteObj.trim = false;
}
update(deltaTime: number) {
//如果游戏世界处于暂停的模式下 不再继续播放
if (GameState.getInstance().IsPauseState()) return;
//如果初始化未完成,不播放
if (!this.InitState) return;
//如果不在播放中
if (this.PlayState != 1) return;
let FrameObj = this.FrameArr[this.NowFrame];
if (FrameObj) {
//当前帧播放时间大于本帧延迟时间时
if (this.PlayTimer > FrameObj.Delay) {
//帧数加1
this.NowFrame++;
//Ani播放完了
if (this.NowFrame >= this.FrameArr.length) {
if (this.AniObject && this.AniObject.Flag && this.AniObject.Flag.get("LOOP"))
this.NowFrame = 0;
else this.PlayState = 3;
}
//设置精灵对象更换图片
this.SpriteObj.spriteFrame = FrameObj.Frame;
// console.log(this.node);
//设置坐标
this.node.setPosition(FrameObj.Pos);
//重置计时器
this.PlayTimer = 0;
}
}
this.PlayTimer += deltaTime * 1000;
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "7134a119-c41c-4947-9191-d7def689bdd4",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,85 @@
import { _decorator, CCString, Component, Node, Sprite, SpriteFrame, Texture2D, UITransform, v2 } from 'cc';
import { MyAnimation } from './MyAnimation';
import { GameScript } from '../GameScript/GameScript';
import { ImagePack } from '../ImagePack/ImagePack';
import { ScriptAni } from '../GlobalInterface/GlobalInterface';
const { ccclass, property, requireComponent } = _decorator;
@ccclass('ScriptMyAnimation')
@requireComponent(Sprite)//依赖组件 精灵
export class ScriptMyAnimation extends MyAnimation {
@property({ type: CCString, displayName: 'Ani路径', tooltip: "Ani在PVF中的路径" })
AnimationPath: string = "";
//是否有替换符
Replace: Array<string>;
//读取Img
InitImg() {
//遍历img路径数组
this.AniObject.Img_List.forEach((Path, index) => {
ImagePack.getInstance().ReadNpkTable("sprite/" + Path.toLocaleLowerCase(), (ImgObj) => {
this.LoadSuccessImgCount++;
//记录路径对应的Img对象
this.ImgTable.set(Path, ImgObj);
//如果已加载数量等于总数量 说明Img初始化完成
if (this.LoadSuccessImgCount == this.AniObject.Img_List.length) {
//都加载完成以后 把精灵帧初始化出来
this.FrameArr.forEach((FrameObj, Index) => {
const Png = this.ImgTable.get(FrameObj.Img_Path).Png_List[FrameObj.Img_Index];
let 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.FrameArr[Index].Frame = spriteFrame;
});
this.InitState = true;
//开始播放
this.PlayState = 1;
}
});
});
}
//通过路径初始化Ani对象
InitAnimotionObject() {
this.AniObject = GameScript.getInstance().GetDataByPath(this.AnimationPath);
}
Init() {
if (!this.AniObject) this.InitAnimotionObject();
//如果有替换符则替换
if (this.Replace) {
this.AniObject.Frame.forEach((FrameObj, Index) => {
this.AniObject.Frame[Index].Img_Path = FrameObj.Img_Path.replace(this.Replace[0], this.Replace[1]);
});
}
this.FrameArr = this.AniObject.Frame;
this.InitImg();
}
start() {
super.start();
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "da8cb249-923c-42fa-a55d-a66f7ffbc2d3",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "f4d1fffa-ecc3-491b-8125-0f4a41ba705a",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,838 @@
import {
_decorator,
Asset,
assetManager,
BufferAsset,
Component,
Node,
resources,
TextAsset,
v2,
v3,
Vec2,
} from "cc";
import { ReadStream } from "../Tool/ReadStream";
import { Ani_Frame, ScriptAni, ScriptFile } from "../GlobalInterface/GlobalInterface";
import { GlobalTool } from "../Tool/GlobalTool";
const { ccclass, property } = _decorator;
class ScriptTree {
//PVF文件头数据
Index_Header_Data: Uint8Array;
//PVF原始数据
Script_Data_Buffer: Uint8Array;
//文件头读取流
Index_Header_Read_Object: ReadStream;
//树Map
TreeMap: Map<string, ScriptFile> = new Map<string, ScriptFile>();
constructor(gIndex_Header_Data, gScript_Data_Buffer) {
this.Index_Header_Data = gIndex_Header_Data;
this.Script_Data_Buffer = gScript_Data_Buffer;
this.Index_Header_Read_Object = new ReadStream(this.Index_Header_Data);
}
ReadTree(currPos, startPos, Index) {
this.Index_Header_Read_Object.Seekg(currPos);
const FileNumber = this.Index_Header_Read_Object.GetInt();
const FilePathLength = this.Index_Header_Read_Object.GetInt();
const FilePath = this.Index_Header_Read_Object.GetBufferByLength(FilePathLength);
const FileLength = this.Index_Header_Read_Object.GetInt();
const Cre32 = this.Index_Header_Read_Object.GetInt();
//数据偏移
const RelativeOffset = this.Index_Header_Read_Object.GetInt();
if (FileLength > 0) {
//数据长度
const RealFileLength = (FileLength + 3) & 4294967292;
//文件路径
const RealFilePath = GlobalTool.uint8ArrayToString(FilePath).replace("\\", "/");
//建立索引Map
this.TreeMap.set(RealFilePath, { Cre32: Cre32, StartPos: startPos, Offset: RelativeOffset, Length: RealFileLength });
}
return FilePathLength + 20;
}
//原数据
StringtableBaseBuf;
//CRE key
StringtableCre32;
//读取Bin文件
StringTable: Map<number, string> = new Map<number, string>();
//当前索引位置
StringtableCurrentIndex: number = 0;
//当前读取索引位置
StringtableReadCurrentIndex: number = 0;
//本类用的特殊解密 分段解密
CrcDecodeSpecial(): boolean {
const num: number = 2175242257; // 2175242257L in hexadecimal
const dataView = new DataView(
this.StringtableBaseBuf.buffer,
this.StringtableBaseBuf.byteOffset,
this.StringtableBaseBuf.byteLength,
);
//开始时间
const StartTime = new Date().getTime();
//死循环读取树文件数据 但是每一次最多只读15毫秒 为了保证UI线程刷新
while (true) {
// Ensure we don't read beyond the end of the data //如果当前索引位置加上4大于数组长度 说明读取完毕 返回true
if (this.StringtableCurrentIndex >= this.StringtableBaseBuf.length) return true;
//当前时间减去开始时间
const NowTime = new Date().getTime();
//如果本轮循环已经读取了15毫秒了 就先返回刷新ui
if (NowTime - StartTime >= 15) return false;
// Read a 32-bit integer (little endian) from the buffer
let anInt = dataView.getUint32(this.StringtableCurrentIndex, true);
// Perform the XOR operations
let val = anInt ^ num ^ this.StringtableCre32;
// Rotate right 6 bits
let jiemi = (val >>> 6) | (val << (32 - 6));
// Write the result back into the buffer
dataView.setUint32(this.StringtableCurrentIndex, jiemi, true);
this.StringtableCurrentIndex = this.StringtableCurrentIndex + 4;
}
}
InitStringBin() {
//如果这个是空就读取一下
if (this.StringtableBaseBuf == undefined) {
const FileObject = this.TreeMap.get("stringtable.bin");
this.StringtableBaseBuf = this.Script_Data_Buffer.slice(
FileObject.StartPos + FileObject.Offset,
FileObject.StartPos + FileObject.Offset + FileObject.Length
);
this.StringtableCre32 = FileObject.Cre32;
}
const Flag = this.CrcDecodeSpecial();
if (Flag) {
let Ro = new ReadStream(this.StringtableBaseBuf);
const Count = Ro.GetInt();
//开始时间
const StartTime = new Date().getTime();
while (true) {
//当前时间减去开始时间
const NowTime = new Date().getTime();
//如果本轮循环已经读取了15毫秒了 就先返回刷新ui
if (NowTime - StartTime >= 15) return false;
if (this.StringtableReadCurrentIndex < Count) {
Ro.Seekg(this.StringtableReadCurrentIndex * 4 + 4);
const StartPos = Ro.GetInt();
const EndPos = Ro.GetInt();
const Len = EndPos - StartPos;
Ro.Seekg(StartPos + 4);
const Str = Ro.GetString(Len);
this.StringTable.set(this.StringtableReadCurrentIndex, Str);
this.StringtableReadCurrentIndex++;
} else {
return true;
}
}
}
return false;
}
//读取字符串索引
Load_StringTable: Map<string, string> = new Map<string, string>();
InitLoad_String() {
const FileObject = this.TreeMap.get("n_string.lst");
let RealBuf = this.Script_Data_Buffer.slice(
FileObject.StartPos + FileObject.Offset,
FileObject.StartPos + FileObject.Offset + FileObject.Length
);
GlobalTool.CrcDecode(RealBuf, FileObject.Cre32);
let Ro = new ReadStream(RealBuf);
const Count = Ro.GetUShort();
if (Count != 53424) return;
let i = 2;
while (i < Ro.len()) {
if (Ro.len() - i >= 10) {
Ro.Seekg(i + 6);
const Key = this.StringTable.get(Ro.GetInt());
if (Key) {
const File = this.TreeMap.get(Key.toLocaleLowerCase());
let FileBuf = this.Script_Data_Buffer.slice(
File.StartPos + File.Offset,
File.StartPos + File.Offset + File.Length
);
GlobalTool.CrcDecode(FileBuf, File.Cre32);
let Str = GlobalTool.uint8ArrayToString(FileBuf, 'big5');
let StrArr = Str.split('\r\n');
StrArr.forEach((strobj, index) => {
if (strobj.indexOf('>')) {
let strobjarr = strobj.split('>', 2);
this.Load_StringTable.set(strobjarr[0], strobjarr[1]);
}
});
}
}
else break;
i += 10;
}
}
//Pvf文件数据
ScriptFileData = new Map();
GetFileData(Path: string) {
//检查路径是否存在
const FileObject = this.TreeMap.get(Path);
if (FileObject == undefined) return false;
//如果读过直接返回数据
const FileData = this.ScriptFileData.get(Path);
if (FileData != undefined) return FileData;
//获取文件数据字节数组
let RealBuf = this.Script_Data_Buffer.slice(
FileObject.StartPos + FileObject.Offset,
FileObject.StartPos + FileObject.Offset + FileObject.Length
);
GlobalTool.CrcDecode(RealBuf, FileObject.Cre32);
//Ani的处理逻辑
if (Path.indexOf(".ani") != -1) {
// try {
let Buf = this.Decompile_ani(RealBuf);
this.ScriptFileData.set(Path, Buf);
return Buf;
// } catch (error) {
// console.log(Path);
// }
}
else {
try {
let Buf = this.Decompile_script(RealBuf);
this.ScriptFileData.set(Path, Buf);
return Buf;
} catch (error) {
// console.log(RealFilePath);
}
}
}
Decompile_script(RealBuf: any) {
const Ro = new ReadStream(RealBuf);
let out: string = "";
if (Ro.len() >= 7) {
//以5为单步从第二位开始遍历字节
let i = 2;
while (i < Ro.len()) {
//到最后了就不处理了防止内存越界
if (Ro.len() - i >= 5) {
Ro.Seekg(i); //内容指示位
let currentByte = Number(Ro.GetBufferByLength(1)); //内容指示位
let after = Ro.GetInt();
switch (currentByte) {
case 10:
{
Ro.Seekg(i - 4);
const Before = Ro.GetInt();
let Buf = this.StringTable.get(after);
if (!Buf) {
Buf = "";
} else {
Buf = "<" + Before + "::" + Buf + "`" + this.Load_StringTable.get(Buf) + "`>";
}
Buf = Buf + "\r\n";
out += Buf;
break;
}
case 2:
{
out += after + '\t';
break;
}
case 4:
{
const buffer = new ArrayBuffer(4);
const view = new DataView(buffer);
view.setInt32(0, after, true);
const Buf = view.getFloat32(0);
out += after + '\t';
break;
}
case 6:
case 8:
case 7:
case 5:
{
let Buf = this.StringTable.get(after);
if (!Buf) Buf = "";
if (currentByte == 5) {
Buf = "\r\n" + Buf + "\r\n";
}
else if (currentByte == 7) {
Buf = "`" + Buf + "`\r\n";
}
else if (currentByte == 6 || currentByte == 8) {
Buf = "{{" + currentByte + "=`" + Buf + "`}}\r\n";
}
out += Buf;
break;
}
default:
out += "";
break;
}
}
i += 5;
}
}
return out;
}
//解包数据
Unpack_Chr(pvfData, curr: number, after: number, before: number): string {
switch (curr) {
case 2:
return after.toString(); //整数型
case 4:
// return new Float32Array([after]).buffer.slice(0, 4).readFloatLE().toString();
case 5:
case 6:
case 7:
case 8:
if (pvfData.str_bin_map.has(after)) {
return pvfData.str_bin_map.get(after);
} else {
return "";
}
case 10:
if (!pvfData.str_bin_map.has(after)) {
return "";
}
let tempstr = pvfData.str_bin_map.get(after);
// return `<${before}::\`${tempstr}\`${_getNString(pvfData, before, tempstr)}.toString()}>`;
default:
return "";
}
}
//读取Ani
Decompile_ani(RealBuf: any): any {
let AniObject: ScriptAni = {
Img_List: new Array<string>(),
Flag: new Map<string, number>(),
Frame: new Array<Ani_Frame>(),
};
const Ro = new ReadStream(RealBuf);
//总帧数
const Frame_Max = Ro.GetUShort();
//总共调用了多少个Img
const Img_Count = Ro.GetUShort();
//Img的路径读取 存入数组
for (let index = 0; index < Img_Count; index++) {
const Buf = Ro.GetInt();
//有可能Img有空路径
AniObject.Img_List.push(Ro.GetString(Buf));
}
//Ani头部标签数量
const Ani_H_Item_Count = Ro.GetUShort();
//处理标签
for (let index = 0; index < Ani_H_Item_Count; index++) {
//标签类型
const Type = Ro.GetUShort();
switch (Type) {
case 0:
case 1: {
const Key = this.Get_Ani_Flag(Type);
const Value = Number(Ro.GetBufferByLength(1));
AniObject.Flag.set(Key, Value);
break;
}
case 3:
case 28: {
const Key = this.Get_Ani_Flag(Type);
const Value = Ro.GetUShort();
AniObject.Flag.set(Key, Value);
break;
}
case 18:
//此处无解析 暂时先保证运行 残影功能暂时用不上
Ro.GetBufferByLength(1);
Ro.GetInt();
Ro.GetInt();
Ro.GetInt();
Ro.Get256();
Ro.Get256();
Ro.Get256();
Ro.Get256();
Ro.GetUShort();
break;
default:
break;
}
}
//读取每一个Img
for (let index = 0; index < Frame_Max; index++) {
//帧结构体对象
let FrameObject: Ani_Frame = {
Box: new Map<number, Array<number>>(),
Img_Path: null,
Img_Index: null,
Pos: null,
Flag: new Map<string, any>(),
Delay: null,
};
//碰撞框项目数量
const Ani_Box_Item_Count = Ro.GetUShort();
for (let _i = 0; _i < Ani_Box_Item_Count; _i++) {
const Box_Type = Ro.GetUShort();
let D_Box_b = [];
for (let _k = 0; _k < 6; _k++) {
D_Box_b.push(Ro.GetInt());
}
//0是攻击框 1是受击框
FrameObject.Box.set(15 - Box_Type, D_Box_b);
}
//调用的第几个Img
const Index_Buf = Ro.GetShort();
//如果等于-1说明是img路径为空
if (Index_Buf >= 0) {
FrameObject.Img_Path = AniObject.Img_List[Index_Buf];
//Img中的PNG下标
FrameObject.Img_Index = Ro.GetUShort();
}
else {
FrameObject.Img_Path = "";
FrameObject.Img_Index = 0;
}
//坐标
FrameObject.Pos = v3(Ro.GetInt(), -Ro.GetInt(), 0);
//Img中的项目数量
const Img_Flag_Count = Ro.GetUShort();
for (let _o = 0; _o < Img_Flag_Count; _o++) {
const Img_Flag_Type = Ro.GetUShort();
let Key;
let Value;
switch (Img_Flag_Type) {
case 0:
case 1:
case 10:
Key = this.Get_Ani_Flag(Img_Flag_Type);
Value = Number(Ro.GetBufferByLength(1));
FrameObject.Flag.set(Key, Value);
break;
case 3:
Key = "COORD";
Value = Ro.GetUShort();
FrameObject.Flag.set(Key, Value);
break;
case 17:
Key = "PRELOAD";
Value = 1;
FrameObject.Flag.set(Key, Value);
break;
case 7:
Key = "IMAGE_RATE";
Value = { x: Ro.GetFloat(), y: Ro.GetFloat() };
FrameObject.Flag.set(Key, Value);
break;
case 8:
Key = "IMAGE_ROTATE";
Value = Ro.GetFloat();
FrameObject.Flag.set(Key, Value);
break;
case 9:
Key = "RGBA";
Value = [
Ro.Get256(),
Ro.Get256(),
Ro.Get256(),
Ro.Get256(),
];
FrameObject.Flag.set(Key, Value);
break;
case 11:
const Effect_Type = Ro.GetUShort();
Key = "GRAPHIC_EFFECT_" + this.Get_Ani_Effect_Type(Effect_Type);
switch (Effect_Type) {
case 5:
Value = [Ro.Get256(), Ro.Get256(), Ro.Get256()];
break;
case 6:
Value = [Ro.GetShort(), Ro.GetShort()];
break;
}
FrameObject.Flag.set(Key, Value);
break;
case 12:
Value = Ro.GetInt();
FrameObject.Delay = Value;
break;
case 13:
Key = "DAMAGE_TYPE";
Value = this.Get_Ani_Damage_Type(Ro.GetUShort());
FrameObject.Flag.set(Key, Value);
break;
case 16:
const SoundTempSize = Ro.GetInt();
Key = "PLAY_SOUND";
Value = Ro.GetString(SoundTempSize);
FrameObject.Flag.set(Key, Value);
break;
case 23:
Key = "SET_FLAG";
Value = Ro.GetInt();
FrameObject.Flag.set(Key, Value);
break;
case 24:
Key = "FLIP_TYPE";
Value = this.Get_Ani_Flip_Type(Ro.GetUShort());
FrameObject.Flag.set(Key, Value);
break;
case 25:
Key = "LOOP_START";
FrameObject.Flag.set(Key, 1);
break;
case 26:
Key = "LOOP_END";
Value = Ro.GetInt();
FrameObject.Flag.set(Key, Value);
break;
case 27:
Key = "CLIP";
Value = [
Ro.GetShort(),
Ro.GetShort(),
Ro.GetShort(),
Ro.GetShort(),
];
FrameObject.Flag.set(Key, Value);
break;
default:
break;
}
}
//每一帧都是一个结构体 存入数组中
AniObject.Frame.push(FrameObject);
}
return AniObject;
}
Get_Ani_Flip_Type(data: number): string {
switch (data) {
case 1:
return "HORIZON";
case 2:
return "VERTICAL";
case 3:
return "ALL";
default:
return "";
}
}
Get_Ani_Effect_Type(data: number): string {
switch (data) {
case 0:
return "NONE";
case 1:
return "DODGE";
case 2:
return "LINEARDODGE";
case 3:
return "DARK";
case 4:
return "XOR";
case 5:
return "MONOCHROME";
case 6:
return "SPACEDISTORT";
default:
return "";
}
}
Get_Ani_Damage_Type(data: number): any {
switch (data) {
case 0:
return "NORMAL";
case 1:
return "SUPERARMOR";
case 2:
return "UNBREAKABLE";
default:
return "";
}
}
Get_Ani_Flag(data: number): string {
switch (data) {
case 0:
return "LOOP";
case 1:
return "SHADOW";
case 3:
return "COORD";
case 7:
return "IMAGE_RATE";
case 8:
return "IMAGE_ROTATE";
case 9:
return "RGBA";
case 10:
return "INTERPOLATION";
case 11:
return "GRAPHIC_EFFECT";
case 12:
return "DELAY";
case 13:
return "DAMAGE_TYPE";
case 14:
return "DAMAGE_BOX";
case 15:
return "ATTACK_BOX";
case 16:
return "PLAY_SOUND";
case 17:
return "PRELOAD";
case 18:
return "SPECTRUM";
case 23:
return "SET_FLAG";
case 24:
return "FLIP_TYPE";
case 25:
return "LOOP_START";
case 26:
return "LOOP_END";
case 27:
return "CLIP";
case 28:
return "OPERATION";
default:
return "";
}
}
}
class ScriptData {
//Pvf数据
ScriptDataBuffer;
//读取UUID的长度
UUID_LENGTH;
//UUID 读 1 - 36位 构造 UTF8 string
UUID;
//版本号
Version;
// 文件路径数据的大小
AlignedIndexHeaderSize;
// 解密密钥
IndexHeaderCrc;
// 文件数量
IndexSize;
// 存放文件路径数据
Index_Header_Data;
//Pvf解密出的数据
ScriptDataObject: ScriptTree = null;
constructor(
public buffer: Uint8Array,
public uuidLength: number,
public uuid: string,
public version: number,
public alignedIndexHeaderSize: number,
public indexHeaderCrc: number,
public indexSize: number,
public indexHeaderData: Uint8Array
) {
//Pvf数据
this.ScriptDataBuffer = buffer;
//读取UUID的长度
this.UUID_LENGTH = uuidLength;
//UUID 读 1 - 36位 构造 UTF8 string
this.UUID = uuid;
//版本号
this.Version = version;
// 文件路径数据的大小
this.AlignedIndexHeaderSize = alignedIndexHeaderSize;
// 解密密钥
this.IndexHeaderCrc = indexHeaderCrc;
// 文件数量
this.IndexSize = indexSize;
// 存放文件路径数据
this.Index_Header_Data = indexHeaderData;
}
//初始化路径树 把所有文件路径建立起来还没有读
InitPathTree() {
//先进行Crc解密
GlobalTool.CrcDecode(this.Index_Header_Data, this.IndexHeaderCrc);
//构造PVF数据类
this.ScriptDataObject = new ScriptTree(
//文件数据
this.Index_Header_Data,
//整个Pvf的原始数据
this.ScriptDataBuffer
);
}
//当期读取树数据的Pos
CurrentTreePos = 0;
//当前读取文件下标
CurrentIndex = 0;
ReadPathTree() {
//开始时间
const StartTime = new Date().getTime();
//死循环读取树文件数据 但是每一次最多只读15毫秒 为了保证UI线程刷新
while (true) {
//当前时间减去开始时间
const NowTime = new Date().getTime();
if ((NowTime - StartTime) >= 15) break;
//当前读取的下标小于总数量
if (this.CurrentIndex < this.IndexSize) {
const Length = this.ScriptDataObject.ReadTree(
this.CurrentTreePos,
this.AlignedIndexHeaderSize + 56,
this.CurrentIndex
);
this.CurrentTreePos += Length;
this.CurrentIndex++;
}
//如果不小于 说明读完了
else {
//读取bin文件 bin Map
const Flag = this.ScriptDataObject.InitStringBin();
if (Flag) {
//读取字符串索引
this.ScriptDataObject.InitLoad_String();
return true;
}
return false;
}
}
return false;
}
GetDataByPath(Path: string) {
return this.ScriptDataObject.TreeMap.get(Path);
}
}
@ccclass("GameScript")
export class GameScript extends Component {
//全局单例类
private static instance: GameScript;
private constructor() {
super();
}
public static getInstance(): GameScript {
if (!GameScript.instance) {
GameScript.instance = new GameScript();
}
return GameScript.instance;
}
//Pvf对象
PvfData: ScriptData;
//加载完成后的回调函数
LoadCallBack: Function;
//初始化Pvf
Init(Func: Function) {
//储存回调
this.LoadCallBack = Func;
//读取Pvf
this.ReadPvf();
}
//读取原始数据
ReadPvf() {
resources.load("Script/Rindro_Script", BufferAsset, (err, content) => {
//转化原始数据为Uint8数组
const Buf = new Uint8Array(content.buffer());
//构造一个 读取流对象
const ScriptObj = new ReadStream(Buf);
//读取UUID的长度
const UUID_LENGTH = ScriptObj.GetInt();
//UUID 读 1 - 36位 构造 UTF8 string
const UUID = ScriptObj.GetString(UUID_LENGTH);
//版本号
const Version = ScriptObj.GetInt();
// 文件路径数据的大小
const AlignedIndexHeaderSize = ScriptObj.GetInt();
// 解密密钥
const IndexHeaderCrc = ScriptObj.GetInt();
// 文件数量
const IndexSize = ScriptObj.GetInt();
// 存放文件路径数据
const Index_Header_Data = ScriptObj.GetBufferByLength(AlignedIndexHeaderSize);
this.PvfData = new ScriptData(
Buf,
UUID_LENGTH,
UUID,
Version,
AlignedIndexHeaderSize,
IndexHeaderCrc,
IndexSize,
Index_Header_Data
);
//建立文件索引树
this.PvfData.InitPathTree();
//可以开始读取PVF数据
this.StartInitFlag = true;
});
}
//可以开始读取PVF数据
StartInitFlag = false;
//是否已经读取完成
InitFlag = false;
Update() {
if (!this.InitFlag && this.StartInitFlag) {
const Flag = this.PvfData.ReadPathTree();
if (Flag) {
this.LoadCallBack();
this.InitFlag = true;
}
}
}
GetDataByPath(Path: string) {
const Ret = this.PvfData.ScriptDataObject.GetFileData(Path);
if (Ret) return Ret;
else console.error("索引路径不存在: " + Path);
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "00363c32-9301-40ae-9cec-bfbeabf44c51",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "42592cb2-3cce-4c2b-a354-ba95a624d365",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,56 @@
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
type ResumeCallback<T> = (arg: T) => void;
@ccclass('GameState')
export class GameState extends Component {
private static instance: GameState;
private constructor() {
super();
}
public static getInstance(): GameState {
if (!GameState.instance) {
GameState.instance = new GameState();
}
return GameState.instance;
}
//当前是否处于暂停状态
PauseState: boolean = false;
//改变暂停状态的回调函数
ResumeCallBackFunc: ResumeCallback<any>[] = [];
//获取暂停状态
IsPauseState(): boolean {
return this.PauseState;
}
//设置暂停状态
SetCurrentPauseState(State: boolean) {
//不等于时 设置一次
if (State != this.PauseState) {
this.PauseState = State;
//调用恢复游戏的逻辑回调函数
this.ResumeCallBackFunc.forEach(callback => {
callback(State);
});
}
}
//注册恢复游戏的逻辑回调函数
RegisterResumeCallBack(Func: ResumeCallback<any>) {
this.ResumeCallBackFunc.push(Func);
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "d9a7592d-eb74-437b-a38e-e3381e9965a2",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "d3628f81-a33c-4562-a26a-218f4c193c6c",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,27 @@
export enum ENUM_CHARACTER {
SWORDMAN = 0,
FIGHTER = 1,
GUNNER = 2,
MAGE = 3,
PRIEST = 4,
ATGUNNER = 5,
THIEF = 6,
ATFIGHTER = 7,
ATMAGE = 8,
DEMONICSWORDMAN = 9,
CREATORMAGE = 10
}
export enum ENUM_SKIN_ANIMATION_JOB {
SWORDMAN = "Character/Swordman/Equipment/Avatar/skin/sm_body%04d.img",
FIGHTER = 1,
GUNNER = 2,
MAGE = 3,
PRIEST = 4,
ATGUNNER = 5,
THIEF = 6,
ATFIGHTER = 7,
ATMAGE = 8,
DEMONICSWORDMAN = 9,
CREATORMAGE = 10
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "40479425-c3f8-43b0-a879-1b8aa1e9f619",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,63 @@
import { SpriteFrame, Vec2, Vec3 } from "cc";
//PNG结构体
export interface ImgInfo {
Type?: number; //图片格式
CmpType?: number; //压缩类型
Width?: number; //宽度
Height?: number; //高度
Size?: number; //大小
Xpos?: number; //Xpos
Ypos?: number; //Ypos
FrameXpos?: number; //帧域X
FrameYpos?: number; //帧域Y
Offset?: number; //偏移
PNGdata?: Uint8Array; //Png位图数据
QuoteIndex?: number;//引用贴图编号
}
//NPK结构体
export interface NpkInfo {
Offset: number;
Length: number;
Path: string;
}
//Img结构体
export interface Img {
ImgName: string; //img文件的路径
Img_Index: number; //img文件在npk文件里的序号
ImgOffset: number; //img偏移
ImgSize: number; //img大小
BelongsFile: string; //img属于哪个文件
Png_Count: number; //img有多少张png文件
Png_List: ImgInfo[] | null; //img的Png文件数组
}
//Ani_Frame结构体
export interface Ani_Frame {
Box?: Map<number, Array<number>>; //碰撞框
Img_Path?: string;//Img路径
Img_Index?: number; //调用的Png下标 去Img中索引
Pos?: Vec3; //坐标
Flag?: Map<string, any>; //标签数组
Delay?: number;//帧延时
Frame?: SpriteFrame; //精灵帧
}
//Ani结构体
export interface ScriptAni {
Img_List: Array<string>; //调用的Img路径数组
Flag: Map<string, number>; //标签数组
Frame: Array<Ani_Frame>; //帧对象
}
//Pvf文件结构图
export interface ScriptFile {
StartPos?: number;//开始位置
Cre32?: number;//校验数据
Offset?: number; //数据偏移
Length?: number; //数据长度
Data?: any; //数据
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "a1cdc96d-640e-43ca-bab1-410318f5a83b",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "efd7a226-b044-490c-ba21-d6a508f5e54e",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,303 @@
import { _decorator, Asset, assetManager, BufferAsset, Component, error, Node, resources, TextAsset, Texture2D } from 'cc';
import { ReadStream } from '../Tool/ReadStream';
import * as pako from 'pako';
import { Img, ImgInfo, NpkInfo } from '../GlobalInterface/GlobalInterface';
const { ccclass, property } = _decorator;
type NewType = Img;
@ccclass('ImagePack')
export class ImagePack extends Component {
//全局单例类
private static instance: ImagePack;
private constructor() {
super();
}
public static getInstance(): ImagePack {
if (!ImagePack.instance) {
ImagePack.instance = new ImagePack();
}
return ImagePack.instance;
}
Key: Array<number> = [112, 117, 99, 104, 105, 107, 111, 110, 64, 110, 101, 111, 112, 108, 101, 32, 100, 117, 110, 103, 101, 111, 110, 32, 97, 110, 100, 32, 102, 105, 103, 104, 116, 101, 114, 32, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 68, 78, 70, 0];
//NPK加载完成后的回调函数
LoadCallBack = undefined;
//NPK文件数量
private NpkCount = 0;
//已加载NPK文件数量
private LoadNpkCount = 0;
//Img的map Key:img路径 Value:Img结构体
private Map_Img: Map<string, NewType> = new Map<string, Img>();
//NPK的本地路径 对应的 NPK名字
private Npk_URL_Table: Map<string, string> = new Map<string, string>();
start() {
}
update(deltaTime: number) {
}
initSuccess(): void {
if (this.LoadCallBack) this.LoadCallBack();
}
BundleObject;
init(Func: Function): void {
//储存回调
this.LoadCallBack = Func;
assetManager.loadBundle('ImagePacks', (err, bundle) => {
this.BundleObject = bundle;
this.LoadNpk();
});
}
LoadNpk(): void {
this.BundleObject.loadDir("", BufferAsset, (err, contents: Array<BufferAsset>) => {
//记录NPK文件数量
this.NpkCount = contents.length;
console.log(this.NpkCount);
contents.forEach(content => {
const Buf = new Uint8Array(content.buffer());
const Ro = new ReadStream(Buf);
//文件头
const Header = Ro.GetString();
if (Header == "NeoplePack_Bill") {
//读取img数量
const ImageCount = Ro.GetInt();
let ImgList: NpkInfo[] = new Array<NpkInfo>(ImageCount);
for (let i = 0; i < ImageCount; i++) {
ImgList[i] = {
Offset: Ro.GetInt(),
Length: Ro.GetInt(),
Path: Ro.ReadInfo(this.Key),
}
}
for (let i = 0; i < ImageCount; i++) {
let Buf: Img = {
ImgOffset: ImgList[i].Offset,
ImgSize: ImgList[i].Length,
Img_Index: i,
BelongsFile: content.nativeUrl,
ImgName: ImgList[i].Path,
Png_List: null,
Png_Count: 0
}
this.Map_Img.set(ImgList[i].Path, Buf);
}
}
//完成一个加载
this.LoadNpkCount = this.LoadNpkCount + 1;
//加载完成
if (this.LoadNpkCount == this.NpkCount) {
this.initSuccess();
}
//把本地路径和NPK名称挂钩一下
this.Npk_URL_Table.set(content.nativeUrl, content.name);
//载入完成以后需要释放
assetManager.releaseAsset(content);
});
});
}
LoadImgToMem(ImgObj: Img, func: Function) {
//获取路径 如果不存在直接返回
const Path = this.Npk_URL_Table.get(ImgObj.BelongsFile);
if (!Path) return;
this.BundleObject.load(Path, BufferAsset, (err, content) => {
const Buf = new Uint8Array(content.buffer());
const Ro = new ReadStream(Buf);
Ro.Seekg(ImgObj.ImgOffset);
//Img头
const Header = Ro.GetString();
//开始读图片
if (Header == "Neople Img File") {
//索引表大小
const TableLength = Ro.GetLongInt();
//img 版本 4字节
const ver = Ro.GetInt();
//img 帧数
const IndexCount = Ro.GetInt();
ImgObj.Png_Count = IndexCount;
let PngArr: ImgInfo[] = [];
for (let index = 0; index < IndexCount; index++) {
let ImgBuf: ImgInfo = {};
//图片格式
ImgBuf.Type = Ro.GetInt();
if (ImgBuf.Type == 17) {
//引用贴图
const IndexBuf = Ro.GetInt();
ImgBuf.Offset = PngArr[index - 1].Offset;
ImgBuf.Type = 17;
ImgBuf.QuoteIndex = IndexBuf;
ImgBuf.Size = PngArr[index - 1].Size;
PngArr.push(ImgBuf);
continue;
}
//压缩类型
ImgBuf.CmpType = Ro.GetInt();
//宽度
ImgBuf.Width = Ro.GetInt();
//高度
ImgBuf.Height = Ro.GetInt();
//大小
ImgBuf.Size = Ro.GetInt();
//Xpos
ImgBuf.Xpos = Ro.GetInt();
//Ypos
ImgBuf.Ypos = Ro.GetInt();
//帧域X
ImgBuf.FrameXpos = Ro.GetInt();
//帧域Y
ImgBuf.FrameYpos = Ro.GetInt();
if (index == 0) {
ImgBuf.Offset = 0 + ImgObj.ImgOffset + Number(TableLength) + 32;
} else {
ImgBuf.Offset = PngArr[index - 1].Offset + PngArr[index - 1].Size;
}
PngArr.push(ImgBuf);
}
for (let index = 0; index < IndexCount; index++) {
let PngObj = PngArr[index];
//引用贴图
if (PngObj.Type == 17) {
const QuoteIndexBuf = PngObj.QuoteIndex;
PngArr[index] = PngArr[QuoteIndexBuf];
}
}
for (let index = 0; index < IndexCount; index++) {
let PngObj = PngArr[index];
Ro.Seekg(PngObj.Offset);
//PNG压缩原始数据
let DataBuf = Ro.GetBufferByLength(PngObj.Size);
//图片数据应有大小
let PngBufSize = PngObj.Width * PngObj.Height * 4;
// 使用pako 解压 zlib的inflate函数解压缩数据
let Bsf;
try {
Bsf = pako.inflate(DataBuf);
}
catch (error) {
Bsf = DataBuf;
}
if (PngObj.Type != 16) {
let PngByteSize = Bsf.length * 2;
PngObj.PNGdata = new Uint8Array(PngByteSize);
for (let e = 0; e < PngByteSize; e += 4) {
let BarBuf = new Uint8Array(2);
let Pos = (e / 4) * 2;
BarBuf[0] = Bsf[Pos];
BarBuf[1] = Bsf[Pos + 1];
this.ReadColor(BarBuf, PngObj, e);
}
}
else {
PngObj.PNGdata = new Uint8Array(Bsf.length);
for (let index = 0; index < Bsf.length; index += 4) {
PngObj.PNGdata[index] = Bsf[index + 2];
PngObj.PNGdata[index + 1] = Bsf[index + 1];
PngObj.PNGdata[index + 2] = Bsf[index];
PngObj.PNGdata[index + 3] = Bsf[index + 3];
}
}
}
ImgObj.Png_List = PngArr;
func(ImgObj);
}
//载入完成以后需要释放
assetManager.releaseAsset(content);
});
}
ReadColor(Bar: Uint8Array, PngObj: ImgInfo, Offset: number) {
let a: number = 0;
let r: number = 0;
let g: number = 0;
let b: number = 0;
switch (PngObj.Type) {
case 0x0e:
a = Bar[1] >> 7;
r = (Bar[1] >> 2) & 0x1f;
g = (Bar[0] >> 5) | ((Bar[1] & 3) << 3);
b = Bar[0] & 0x1f;
a = a * 0xff;
r = (r << 3) | (r >> 2);
g = (g << 3) | (g >> 2);
b = (b << 3) | (b >> 2);
break;
case 0x0f:
a = Bar[1] & 0xf0;
r = (Bar[1] & 0xf) << 4;
g = Bar[0] & 0xf0;
b = (Bar[0] & 0xf) << 4;
break;
default:
console.log(PngObj.Type);
break;
}
PngObj.PNGdata[Offset + 0] = r;
PngObj.PNGdata[Offset + 1] = g;
PngObj.PNGdata[Offset + 2] = b;
PngObj.PNGdata[Offset + 3] = a;
}
//读取Img数据
ReadNpkTable(imgname: string, func: Function): boolean {
let ImgObj: Img = this.Map_Img.get(imgname);
if (ImgObj) {
//没有图片数据 需要加载
if (ImgObj.Png_List == null) {
//加载Img进内存
this.LoadImgToMem(ImgObj, func);
return true;
}
else {
func(ImgObj);
return true;
}
}
return false;
}
ReleaseNpkTable(p: Img): void {
// implementation
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "f7d818a6-8209-4350-9000-21ecbb294559",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "e8cc263d-e946-466c-946c-cc228badc633",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,42 @@
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('GlobalTool')
export class GlobalTool {
public static CrcDecode(data: Uint8Array, crc32: number): void {
const num: number = 2175242257; // 2175242257L in hexadecimal
const dataView = new DataView(
data.buffer,
data.byteOffset,
data.byteLength
);
for (let i = 0; i < data.length; i += 4) {
// Ensure we don't read beyond the end of the data
if (i + 4 > data.length) break;
// Read a 32-bit integer (little endian) from the buffer
let anInt = dataView.getUint32(i, true);
// Perform the XOR operations
let val = anInt ^ num ^ crc32;
// Rotate right 6 bits
let jiemi = (val >>> 6) | (val << (32 - 6));
// Write the result back into the buffer
dataView.setUint32(i, jiemi, true);
}
}
//字节数组转string
public static uint8ArrayToString(data: Uint8Array, Code?: string): string {
if (!Code) Code = 'utf-8';
const decoder = new TextDecoder(Code); // 默认使用 'utf-8' 编码
return decoder.decode(data);
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "7ceba3e6-9582-4e7c-b045-63cb904ed4a3",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,127 @@
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('ReadStream')
export class ReadStream {
Buffer: Uint8Array;
//当前读取位置
Pos: number = 0;
constructor(public buffer: Uint8Array) {
this.Buffer = buffer;
}
//string转字节数组
static StringToUint8Array(str) {
const encoder = new TextEncoder();
return encoder.encode(str);
}
//字节数组转string
static Uint8ArrayToString(data: Uint8Array): string {
const decoder = new TextDecoder(); // 默认使用 'utf-8' 编码
return decoder.decode(data);
}
Seekg(Pos: number) {
this.Pos = Pos;
}
//读取数字 默认小端序读取
GetShort(littleEndian: boolean = true) {
//读2个字节
const Buf = new DataView(this.GetBufferByLength(2).buffer);
const view = new DataView(Buf.buffer);
return Number(view.getInt16(0, true));
}
GetUShort(littleEndian: boolean = true) {
//读2个字节
const Buf = new DataView(this.GetBufferByLength(2).buffer);
const view = new DataView(Buf.buffer);
return Number(view.getUint16(0, true));
}
//读取数字 默认小端序读取
GetInt(littleEndian: boolean = true) {
//读4个字节
const Buf = new DataView(this.GetBufferByLength(4).buffer);
return Buf.getInt32(0, littleEndian);
}
//读取浮点数 默认小端序读取
GetFloat(littleEndian: boolean = true) {
//读4个字节
const Buf = new DataView(this.GetBufferByLength(4).buffer);
return Buf.getFloat32(0, littleEndian);
}
//特殊方法
Get256(): any {
const Buf = Number(this.GetBufferByLength(1));
return (256.0 + Buf) % 256.0;
}
//读取数字 默认小端序
GetLongInt(littleEndian: boolean = true) {
//读8个字节
const Buf = this.GetBufferByLength(8);
const view = new DataView(Buf.buffer);
return Number(view.getBigInt64(0, true));
}
//读取字符串
GetString(Length?: number) {
if (Length) {
//读指定字节
const Buf = this.GetBufferByLength(Length);
return ReadStream.Uint8ArrayToString(Buf);
}
else {
for (let i = 0; i < this.Buffer.length - this.Pos; i++) {
if (this.Buffer[i + this.Pos] == 0) {
const truncatedArray = this.Buffer.subarray(this.Pos, i + this.Pos);
this.Pos += i + 1;
return ReadStream.Uint8ArrayToString(truncatedArray);
}
}
}
}
//读取指定长度流
GetBufferByLength(Length: number) {
const Buf = this.Buffer.slice(this.Pos, this.Pos + Length);
this.Pos += Length;
return Buf;
}
//读取信息 通过Key
ReadInfo(Key): string {
let PathUA: Uint8Array = new Uint8Array(256);
for (let i = 0; i < 256; i++) {
PathUA[i] = this.Buffer[i + this.Pos] ^ Key[i];
}
// let Spos = 0;
// for (let i = 0; i < PathUA.length; i++) {
// if (PathUA[i] == 0) Spos = i;
// }
// const truncatedArray = PathUA.subarray(0, Spos);
this.Pos += 256;
let str = ReadStream.Uint8ArrayToString(PathUA);
str = str.substring(0, str.indexOf(".img") + 4);
return str;
}
len() {
return this.Buffer.length;
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "4ec26641-bab8-41b3-aedc-0c51a9499a03",
"files": [],
"subMetas": {},
"userData": {}
}

9
assets/ImagePack.meta Normal file
View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "5b32215f-78d7-4705-baaa-53792dcadf16",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"ver": "1.0.3",
"importer": "buffer",
"imported": true,
"uuid": "dc61d9f4-8a5e-4540-8a2c-dc318bb9f198",
"files": [
".bin",
".json"
],
"subMetas": {},
"userData": {}
}

14
assets/resources.meta Normal file
View File

@ -0,0 +1,14 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "1a5386cd-3ddb-462a-9c19-ff556d1cd2ea",
"files": [],
"subMetas": {},
"userData": {
"isBundle": true,
"bundleConfigID": "default",
"bundleName": "resources",
"priority": 8
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "a5e0b202-9a49-4cf5-9ae0-3856f1cc580e",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"ver": "1.0.1",
"importer": "ttf-font",
"imported": true,
"uuid": "396f4401-3605-4be1-ab85-ec9140abf115",
"files": [
".json",
"Gasinamu.ttf"
],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"ver": "1.0.1",
"importer": "ttf-font",
"imported": true,
"uuid": "5ebfd5b0-a054-4349-b69f-f850a1e1fbcd",
"files": [
".json",
"GasinamuNew.ttf"
],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"ver": "1.0.1",
"importer": "ttf-font",
"imported": true,
"uuid": "dabba3a9-011d-47f5-a27e-e9545f595608",
"files": [
".json",
"MSungPRC-Xbold.ttf"
],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"ver": "1.0.1",
"importer": "ttf-font",
"imported": true,
"uuid": "74d91028-0e80-438e-aae0-3fd0e9d206ee",
"files": [
".json",
"ShinGoPr6-Medium.ttf"
],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"ver": "1.0.1",
"importer": "ttf-font",
"imported": true,
"uuid": "97d72755-84b0-4b6f-bd6e-103dcaa86442",
"files": [
".json",
"calibri.ttf"
],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"ver": "1.0.1",
"importer": "ttf-font",
"imported": true,
"uuid": "11c929a2-b8ad-4f92-85e9-615ba086f91a",
"files": [
".json",
"msjh.ttf"
],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "cb4d14ad-a13b-4826-a1c3-4ac9b1572296",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 KiB

View File

@ -0,0 +1,135 @@
{
"ver": "1.0.26",
"importer": "image",
"imported": true,
"uuid": "5d2f08be-ea45-4fcf-a87b-95a6b8ca82e3",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "5d2f08be-ea45-4fcf-a87b-95a6b8ca82e3@6c48a",
"displayName": "LoadingBackGround",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "5d2f08be-ea45-4fcf-a87b-95a6b8ca82e3",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "5d2f08be-ea45-4fcf-a87b-95a6b8ca82e3@f9941",
"displayName": "LoadingBackGround",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "none",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1600,
"height": 900,
"rawWidth": 1600,
"rawHeight": 900,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-800,
-450,
0,
800,
-450,
0,
-800,
450,
0,
800,
450,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
900,
1600,
900,
0,
0,
1600,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-800,
-450,
0
],
"maxPos": [
800,
450,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "5d2f08be-ea45-4fcf-a87b-95a6b8ca82e3@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "5d2f08be-ea45-4fcf-a87b-95a6b8ca82e3@f9941",
"flipGreenChannel": false
}
}

View File

@ -0,0 +1,32 @@
import { _decorator, color, Component, Node, Sprite, tween, Vec3 } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('loading_game')
export class loading_game extends Component {
start() {
//线性减淡
const RD = this.node.getComponent(Sprite).getMaterialInstance(0);
RD.overridePipelineStates({
blendState: {
isA2C: true,
isIndepend: true,
targets: [{
blend: true,
blendSrc: 1,
blendDst: 1,
blendSrcAlpha: 1,
blendDstAlpha: 1,
}]
},
}, 0);
//旋转缓动
tween(this.node).by(1.5, { angle: -360 },).repeatForever().start();
}
update(deltaTime: number) {
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "1bfeb383-563f-4994-834c-d37398b3f7fd",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

View File

@ -0,0 +1,134 @@
{
"ver": "1.0.26",
"importer": "image",
"imported": true,
"uuid": "57c513c3-4af0-4635-b194-366750e95610",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "57c513c3-4af0-4635-b194-366750e95610@6c48a",
"displayName": "loading_start_circle",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "57c513c3-4af0-4635-b194-366750e95610",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "57c513c3-4af0-4635-b194-366750e95610@f9941",
"displayName": "loading_start_circle",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 45,
"height": 45,
"rawWidth": 45,
"rawHeight": 45,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-22.5,
-22.5,
0,
22.5,
-22.5,
0,
-22.5,
22.5,
0,
22.5,
22.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
45,
45,
45,
0,
0,
45,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-22.5,
-22.5,
0
],
"maxPos": [
22.5,
22.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "57c513c3-4af0-4635-b194-366750e95610@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "57c513c3-4af0-4635-b194-366750e95610@f9941"
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "0b953f25-458d-4660-90e9-3c0afa219a59",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "a44f1cd4-7acd-4c83-bf82-90c9d02ae81f",
"files": [
".json",
".ogg"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

View File

@ -0,0 +1,11 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "c08f1ef0-a4f7-4d5c-aadc-b42b266d87da",
"files": [],
"subMetas": {},
"userData": {
"bundleName": "GameScript"
}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"ver": "1.0.3",
"importer": "buffer",
"imported": true,
"uuid": "ccfefd50-bee9-4800-8e73-adef62fcba59",
"files": [
".bin",
".json"
],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"ver": "1.0.3",
"importer": "buffer",
"imported": true,
"uuid": "30fded4d-d8c1-490f-a102-d46539e22698",
"files": [
".bin",
".json"
],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"ver": "1.0.1",
"importer": "*",
"imported": true,
"uuid": "074ff146-b817-4b1a-bbbd-48e81ee228fa",
"files": [
".json",
".pvf"
],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "906eb65c-afa6-495c-8087-68ebafd92a93",
"files": [],
"subMetas": {},
"userData": {}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
{
"ver": "2.0.1",
"importer": "json",
"imported": true,
"uuid": "c16b1013-5b26-4f92-9c2c-c2bf5405f141",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "7b7da28c-69bf-430f-be5b-183935b918b2",
"files": [
".json",
".ogg"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "a4263b00-6ff6-484f-b581-78864d08eeae",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "c7b4109b-5f6b-4700-b4a6-0be52b00e752",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,18 @@
import { _decorator, Component, Node } from 'cc';
import { GlobalAudio } from '../../../GlobalScript/GlobalAudio/GlobalAudio';
const { ccclass, property } = _decorator;
@ccclass('Login_BackGround_Logic')
export class Login_BackGround_Logic extends Component {
start() {
GlobalAudio.getInstance().play("Music/gran_seria", 0.5);
}
update(deltaTime: number) {
// GlobalAudio.inst.playOneShot("Sound/list_click");
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "db789b25-7959-4d93-b171-7f6172a55273",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"ver": "1.0.0",
"importer": "video-clip",
"imported": true,
"uuid": "0e188136-e298-4e88-b121-87975cf87fdb",
"files": [
".json",
".mp4"
],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "c0a7604e-53b6-4aa4-a3f2-9f5eb23e040a",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"ver": "1.0.0",
"importer": "video-clip",
"imported": true,
"uuid": "595de7d6-2828-4cff-b93b-6026f8db0250",
"files": [
".json",
".mp4"
],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,22 @@
import { _decorator, Component, director, Node, sys, view } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('LogoLogic')
export class LogoLogic extends Component {
start() {
if (sys.platform === "WIN32") {
director.loadScene("LoadingGame");
}
}
StartGame(videoplayer, eventType, customEventData) {
//播放完成后跳转
if (eventType == 'completed') {
director.loadScene("LoadingGame");
}
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "1f193574-39ec-4385-b74c-6495a2133891",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -23,7 +23,7 @@
"_active": true,
"_components": [],
"_prefab": {
"__id__": 23
"__id__": 27
},
"_lpos": {
"__type__": "cc.Vec3",
@ -54,7 +54,7 @@
},
"autoReleaseAssets": false,
"_globals": {
"__id__": 24
"__id__": 28
},
"_id": "f713b5ea-a70f-486c-8260-0338f089a5b8"
},
@ -77,13 +77,13 @@
"_active": true,
"_components": [
{
"__id__": 20
"__id__": 24
},
{
"__id__": 21
"__id__": 25
},
{
"__id__": 22
"__id__": 26
}
],
"_prefab": null,
@ -175,7 +175,7 @@
"_priority": 0,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 300,
"_orthoHeight": 363.7690494893952,
"_near": 0,
"_far": 1000,
"_color": {
@ -220,13 +220,13 @@
"__id__": 6
},
{
"__id__": 9
"__id__": 13
}
],
"_active": true,
"_components": [
{
"__id__": 19
"__id__": 23
}
],
"_prefab": null,
@ -267,14 +267,18 @@
"_parent": {
"__id__": 5
},
"_children": [],
"_children": [
{
"__id__": 7
}
],
"_active": true,
"_components": [
{
"__id__": 7
"__id__": 11
},
{
"__id__": 8
"__id__": 12
}
],
"_prefab": null,
@ -307,6 +311,128 @@
},
"_id": "15jnF2IOpHl7U589UpZ7wK"
},
{
"__type__": "cc.Node",
"_name": "Test",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 6
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 8
},
{
"__id__": 9
},
{
"__id__": 10
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": -397.219,
"y": -95,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "58nLsryTdISqQKID5Hb4CI"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "e3PWU61UNEv7dpgCI4tyOQ"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": null,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": null,
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "2fzSKdC4tJv4cl+tDLmGI9"
},
{
"__type__": "da8cbJJkjxC+qVdpm9/+8LT",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": null,
"AnimationPath": "",
"_id": "86S/B40YdJLqyx40ueYpvW"
},
{
"__type__": "cc.UITransform",
"_name": "",
@ -378,25 +504,25 @@
},
"_children": [
{
"__id__": 10
"__id__": 14
}
],
"_active": true,
"_components": [
{
"__id__": 14
},
{
"__id__": 15
},
{
"__id__": 16
},
{
"__id__": 17
},
{
"__id__": 18
},
{
"__id__": 19
},
{
"__id__": 20
},
{
"__id__": 21
},
{
"__id__": 22
}
],
"_prefab": null,
@ -435,19 +561,19 @@
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 9
"__id__": 13
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 11
"__id__": 15
},
{
"__id__": 12
"__id__": 16
},
{
"__id__": 13
"__id__": 17
}
],
"_prefab": null,
@ -486,7 +612,7 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
"__id__": 14
},
"_enabled": true,
"__prefab": null,
@ -508,7 +634,7 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
"__id__": 14
},
"_enabled": true,
"__prefab": null,
@ -547,7 +673,7 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
"__id__": 14
},
"_enabled": true,
"__prefab": null,
@ -577,7 +703,7 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
"__id__": 13
},
"_enabled": true,
"__prefab": null,
@ -599,7 +725,7 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
"__id__": 13
},
"_enabled": true,
"__prefab": null,
@ -638,7 +764,7 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
"__id__": 13
},
"_enabled": true,
"__prefab": null,
@ -661,7 +787,7 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
"__id__": 13
},
"_enabled": true,
"__prefab": null,
@ -673,7 +799,7 @@
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
"__id__": 13
},
"_enabled": true,
"__prefab": null,
@ -788,29 +914,29 @@
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 25
},
"shadows": {
"__id__": 26
},
"_skybox": {
"__id__": 27
},
"fog": {
"__id__": 28
},
"octree": {
"__id__": 29
},
"skin": {
"shadows": {
"__id__": 30
},
"lightProbeInfo": {
"_skybox": {
"__id__": 31
},
"postSettings": {
"fog": {
"__id__": 32
},
"octree": {
"__id__": 33
},
"skin": {
"__id__": 34
},
"lightProbeInfo": {
"__id__": 35
},
"postSettings": {
"__id__": 36
},
"bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false
},

View File

@ -8,13 +8,13 @@ const { ccclass, property } = _decorator;
// }
// update(deltaTime: number) {
// }
// }
export class dice_dd{
export class dice_dd {
static getNode():Node{
public static getNode(): Node {
let node = new Node();
@ -26,18 +26,18 @@ export class dice_dd{
let sprite = node.addComponent(Sprite);
return node;
}
}
export class dice_node extends Node {
/// 构造函数
dice_node(){
constructor() {
console.log("sadnhjsanjkdbasjkdbnasjkbdhjasd");
super();
this.layer = Layers.Enum.UI_2D;//不添加不显示
// 创建并添加脚本组件
@ -50,20 +50,20 @@ export class dice_node extends Node {
sprite.color = Color.RED;
sprite.spriteFrame = spriteFrame;
});
}
}
@ccclass('dice_node')
export class dice_domponent extends Component{
export class dice_domponent extends Component {
start() {
const uiTf = this.node.getComponent(UITransform);
uiTf.setContentSize(200,400);
uiTf.setContentSize(200, 400);
// resources.load('internal/default_ui/default_sprite.png/spriteFrame', (err, newSpriteFrame) => {
// const sprite = this.node.getComponent(Sprite);
@ -75,7 +75,7 @@ export class dice_domponent extends Component{
}
update(deltaTime: number) {
}
}

View File

@ -1,17 +1,18 @@
import { _decorator, Component, Node } from 'cc';
import { dice_domponent , dice_node , dice_dd } from './dice_animation';
import { dice_domponent, dice_node, dice_dd } from './dice_animation';
const { ccclass, property } = _decorator;
@ccclass('game_root')
export class game_root extends Component {
start() {
const dice = new dice_domponent();
this.node.addChild(new dice_node());
this.node.addChild( dice_dd.getNode() );
this.node.addChild(dice_dd.getNode());
}
update(deltaTime: number) {
}
}

222
package-lock.json generated Normal file
View File

@ -0,0 +1,222 @@
{
"name": "NewProject",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "NewProject",
"dependencies": {
"minizlib": "^2.1.2",
"pako": "^2.1.0",
"xml2js": "^0.6.2",
"zlib": "^1.0.5"
},
"devDependencies": {
"@types/minizlib": "^2.1.7",
"@types/node": "^20.11.0",
"@types/pako": "^2.0.3",
"@types/xml2js": "^0.4.14"
}
},
"node_modules/@types/minizlib": {
"version": "2.1.7",
"resolved": "https://registry.npmjs.org/@types/minizlib/-/minizlib-2.1.7.tgz",
"integrity": "sha512-oKlyUX7bfj3zG6AM8rMleBHnr1X+gEx4XlQ5zByKS39gbtQmnu4nyQ3w2Agv7qinU+v8ChhFxtDUAySkCexQ+Q==",
"dev": true,
"dependencies": {
"@types/node": "*",
"minipass": "^3.3.5"
}
},
"node_modules/@types/node": {
"version": "20.11.24",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz",
"integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
}
},
"node_modules/@types/pako": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@types/pako/-/pako-2.0.3.tgz",
"integrity": "sha512-bq0hMV9opAcrmE0Byyo0fY3Ew4tgOevJmQ9grUhpXQhYfyLJ1Kqg3P33JT5fdbT2AjeAjR51zqqVjAL/HMkx7Q==",
"dev": true
},
"node_modules/@types/xml2js": {
"version": "0.4.14",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.14.tgz",
"integrity": "sha512-4YnrRemBShWRO2QjvUin8ESA41rH+9nQGLUGZV/1IDhi3SL9OhdpNC/MrulTWuptXKwhx/aDxE7toV0f/ypIXQ==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/minipass": {
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
"integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/minizlib": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
"integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
"dependencies": {
"minipass": "^3.0.0",
"yallist": "^4.0.0"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/pako": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz",
"integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug=="
},
"node_modules/sax": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz",
"integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA=="
},
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"dev": true
},
"node_modules/xml2js": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz",
"integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==",
"dependencies": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
},
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/xmlbuilder": {
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==",
"engines": {
"node": ">=4.0"
}
},
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/zlib": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/zlib/-/zlib-1.0.5.tgz",
"integrity": "sha512-40fpE2II+Cd3k8HWTWONfeKE2jL+P42iWJ1zzps5W51qcTsOUKM5Q5m2PFb0CLxlmFAaUuUdJGc3OfZy947v0w==",
"hasInstallScript": true,
"engines": {
"node": ">=0.2.0"
}
}
},
"dependencies": {
"@types/minizlib": {
"version": "2.1.7",
"resolved": "https://registry.npmjs.org/@types/minizlib/-/minizlib-2.1.7.tgz",
"integrity": "sha512-oKlyUX7bfj3zG6AM8rMleBHnr1X+gEx4XlQ5zByKS39gbtQmnu4nyQ3w2Agv7qinU+v8ChhFxtDUAySkCexQ+Q==",
"dev": true,
"requires": {
"@types/node": "*",
"minipass": "^3.3.5"
}
},
"@types/node": {
"version": "20.11.24",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz",
"integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==",
"dev": true,
"requires": {
"undici-types": "~5.26.4"
}
},
"@types/pako": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@types/pako/-/pako-2.0.3.tgz",
"integrity": "sha512-bq0hMV9opAcrmE0Byyo0fY3Ew4tgOevJmQ9grUhpXQhYfyLJ1Kqg3P33JT5fdbT2AjeAjR51zqqVjAL/HMkx7Q==",
"dev": true
},
"@types/xml2js": {
"version": "0.4.14",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.14.tgz",
"integrity": "sha512-4YnrRemBShWRO2QjvUin8ESA41rH+9nQGLUGZV/1IDhi3SL9OhdpNC/MrulTWuptXKwhx/aDxE7toV0f/ypIXQ==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"minipass": {
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
"integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
"requires": {
"yallist": "^4.0.0"
}
},
"minizlib": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
"integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
"requires": {
"minipass": "^3.0.0",
"yallist": "^4.0.0"
}
},
"pako": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz",
"integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug=="
},
"sax": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz",
"integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA=="
},
"undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"dev": true
},
"xml2js": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz",
"integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==",
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
}
},
"xmlbuilder": {
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"zlib": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/zlib/-/zlib-1.0.5.tgz",
"integrity": "sha512-40fpE2II+Cd3k8HWTWONfeKE2jL+P42iWJ1zzps5W51qcTsOUKM5Q5m2PFb0CLxlmFAaUuUdJGc3OfZy947v0w=="
}
}
}

View File

@ -3,5 +3,17 @@
"uuid": "9bd900fd-b3d1-4de7-a223-11ff43423fad",
"creator": {
"version": "3.8.2"
},
"devDependencies": {
"@types/minizlib": "^2.1.7",
"@types/node": "^20.11.0",
"@types/pako": "^2.0.3",
"@types/xml2js": "^0.4.14"
},
"dependencies": {
"minizlib": "^2.1.2",
"pako": "^2.1.0",
"xml2js": "^0.6.2",
"zlib": "^1.0.5"
}
}
}

View File

@ -7,7 +7,7 @@
"enable": true,
"customSplash": {
"complete": false,
"form": "https://creator-api.cocos.com/api/form/show?sid=713f3d658f5b15c1ab406d720b890938"
"form": "https://creator-api.cocos.com/api/form/show?sid=9ca4a815f78c9bcd01d30320bbf2f99b"
}
},
"removeSplash": {
@ -16,7 +16,7 @@
"enable": true,
"removeSplash": {
"complete": false,
"form": "https://creator-api.cocos.com/api/form/show?sid=713f3d658f5b15c1ab406d720b890938"
"form": "https://creator-api.cocos.com/api/form/show?sid=9ca4a815f78c9bcd01d30320bbf2f99b"
}
}
}

View File

@ -4,6 +4,7 @@
/* Add your custom configuration here. */
"compilerOptions": {
"target": "esnext",
"strict": false
}
}