Compare commits
No commits in common. "Lenheart" and "main" have entirely different histories.
|
|
@ -1,2 +0,0 @@
|
||||||
[InternetShortcut]
|
|
||||||
URL=https://docs.cocos.com/creator/manual/en/scripting/setup.html#custom-script-template
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"image": {
|
|
||||||
"type": "sprite-frame"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
|
|
||||||
#///////////////////////////
|
|
||||||
# Cocos Creator 3D Project
|
|
||||||
#///////////////////////////
|
|
||||||
library/
|
|
||||||
temp/
|
|
||||||
local/
|
|
||||||
build/
|
|
||||||
profiles/
|
|
||||||
native
|
|
||||||
assets/ImagePacks
|
|
||||||
#//////////////////////////
|
|
||||||
# NPM
|
|
||||||
#//////////////////////////
|
|
||||||
node_modules/
|
|
||||||
|
|
||||||
#//////////////////////////
|
|
||||||
# VSCode
|
|
||||||
#//////////////////////////
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
#//////////////////////////
|
|
||||||
# WebStorm
|
|
||||||
#//////////////////////////
|
|
||||||
.idea/
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "5208f390-cc46-487e-ab55-1158ca41e9fe",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "822d6861-f210-4760-bd10-0fd9fc2cae86",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "46191008-0f8c-41fa-916e-29c656c36c99",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,173 +0,0 @@
|
||||||
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);
|
|
||||||
|
|
||||||
//设置坐标
|
|
||||||
if (FrameObj.Pos) this.node.setPosition(FrameObj.Pos);
|
|
||||||
|
|
||||||
//重置计时器
|
|
||||||
this.PlayTimer = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.PlayTimer += deltaTime * 1000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "7134a119-c41c-4947-9191-d7def689bdd4",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//判断是否有Als
|
|
||||||
CheckAnimotionAls() {
|
|
||||||
|
|
||||||
let Ret = GameScript.getInstance().GetDataByPath("ani/001_1x2.ani.als");
|
|
||||||
if (Ret) {
|
|
||||||
console.log(Ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//通过路径初始化Ani对象
|
|
||||||
InitAnimotionObject() {
|
|
||||||
this.CheckAnimotionAls();
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "da8cb249-923c-42fa-a55d-a66f7ffbc2d3",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "f177f8e4-aca5-4209-ab04-8be793eaeb16",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,124 +0,0 @@
|
||||||
import { _decorator, CCInteger, CCString, Component, Node, Sprite, SpriteFrame, input, Input, __private, NodeEventType, EventTouch, EventMouse } from 'cc';
|
|
||||||
import { BaseSpriteFrame } from './BaseSpriteFrame';
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
@ccclass('BaseButton')
|
|
||||||
export class BaseButton extends Component {
|
|
||||||
|
|
||||||
@property({ type: CCString, displayName: 'img路径', tooltip: "img路径" })
|
|
||||||
ImgPath: string;
|
|
||||||
|
|
||||||
@property({ type: [CCInteger], displayName: '普通img编号', tooltip: "普通img编号" })
|
|
||||||
NormalImgIndex: number;
|
|
||||||
|
|
||||||
@property({ type: [CCInteger], displayName: '悬停img编号', tooltip: "悬停img编号" })
|
|
||||||
HoverImgIndex: number;
|
|
||||||
|
|
||||||
@property({ type: [CCInteger], displayName: '按下img编号', tooltip: "按下img编号" })
|
|
||||||
PressImgIndex: number;
|
|
||||||
|
|
||||||
@property({ type: [CCInteger], displayName: '失效img编号', tooltip: "失效img编号" })
|
|
||||||
DisableImgIndex: number;
|
|
||||||
|
|
||||||
//普通精灵帧
|
|
||||||
NormalImgSpriteFrame: SpriteFrame;
|
|
||||||
|
|
||||||
//悬停精灵帧
|
|
||||||
HoverImgSpriteFrame: SpriteFrame;
|
|
||||||
|
|
||||||
//按下精灵帧
|
|
||||||
PressImgSpriteFrame: SpriteFrame;
|
|
||||||
|
|
||||||
//失效精灵帧
|
|
||||||
DisableImgSpriteFrame: SpriteFrame;
|
|
||||||
|
|
||||||
//精灵对象
|
|
||||||
SpriteObj: Sprite;
|
|
||||||
|
|
||||||
//初始化状态
|
|
||||||
InitState = false;
|
|
||||||
|
|
||||||
//按钮状态
|
|
||||||
ButtonState = 0; // 0 普通 1悬停 2按下 8失效
|
|
||||||
|
|
||||||
start() {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//判断是否有精灵 如果没有 就给他搞一个
|
|
||||||
if (this.node.getComponent(Sprite))
|
|
||||||
this.SpriteObj = this.node.getComponent(Sprite);
|
|
||||||
else
|
|
||||||
this.SpriteObj = this.node.addComponent(Sprite);
|
|
||||||
|
|
||||||
new BaseSpriteFrame(this.ImgPath, this.NormalImgIndex, _SpriteFrame => { this.NormalImgSpriteFrame = _SpriteFrame });
|
|
||||||
new BaseSpriteFrame(this.ImgPath, this.HoverImgIndex, _SpriteFrame => { this.HoverImgSpriteFrame = _SpriteFrame });
|
|
||||||
new BaseSpriteFrame(this.ImgPath, this.PressImgIndex, _SpriteFrame => { this.PressImgSpriteFrame = _SpriteFrame });
|
|
||||||
new BaseSpriteFrame(this.ImgPath, this.DisableImgIndex, _SpriteFrame => { this.DisableImgSpriteFrame = _SpriteFrame });
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
UploadSpriteFrame(_SpriteFrame) {
|
|
||||||
if (this.SpriteObj.spriteFrame != _SpriteFrame) {
|
|
||||||
this.SpriteObj.spriteFrame = _SpriteFrame;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
update(deltaTime: number) {
|
|
||||||
if (!this.InitState) {
|
|
||||||
if (this.NormalImgSpriteFrame && this.HoverImgSpriteFrame && this.PressImgSpriteFrame) {
|
|
||||||
this.InitState = true;
|
|
||||||
this.UploadSpriteFrame(this.NormalImgSpriteFrame);
|
|
||||||
|
|
||||||
// this.node.on(Input.EventType.TOUCH_START, this.OnPress, this);
|
|
||||||
// this.node.on(Input.EventType.TOUCH_END, this.OnEnd, this);
|
|
||||||
this.node.on(Node.EventType.MOUSE_ENTER, this.OnHever, this);
|
|
||||||
this.node.on(Node.EventType.MOUSE_LEAVE, this.OffHever, this);
|
|
||||||
this.node.on(Node.EventType.MOUSE_DOWN, this.OnPress, this);
|
|
||||||
this.node.on(Node.EventType.MOUSE_UP, this.OnEnd, this);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (this.ButtonState) {
|
|
||||||
case 0:
|
|
||||||
this.UploadSpriteFrame(this.NormalImgSpriteFrame);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
this.UploadSpriteFrame(this.HoverImgSpriteFrame);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
this.UploadSpriteFrame(this.PressImgSpriteFrame);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
this.UploadSpriteFrame(this.DisableImgSpriteFrame);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
OffHever(event) {
|
|
||||||
this.ButtonState = 0;
|
|
||||||
// this.UploadSpriteFrame(this.NormalImgSpriteFrame);
|
|
||||||
}
|
|
||||||
OnHever(event) {
|
|
||||||
this.ButtonState = 1;
|
|
||||||
// this.UploadSpriteFrame(this.HoverImgSpriteFrame);
|
|
||||||
}
|
|
||||||
OnEnd(event: EventTouch) {
|
|
||||||
this.ButtonState = 0;
|
|
||||||
// this.UploadSpriteFrame(this.NormalImgSpriteFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
OnPress(event: EventMouse) {
|
|
||||||
//必须是鼠标左键
|
|
||||||
if (event.getButton() != 0) return;
|
|
||||||
|
|
||||||
|
|
||||||
this.ButtonState = 2;
|
|
||||||
// this.UploadSpriteFrame(this.PressImgSpriteFrame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "227e9de9-da6c-4457-9ce3-bc6d687c990b",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
import { _decorator, CCInteger, CCString, Component, Node, Sprite, SpriteFrame, Texture2D, v2 } from 'cc';
|
|
||||||
import { ImagePack } from '../ImagePack/ImagePack';
|
|
||||||
import { BaseSpriteFrame } from './BaseSpriteFrame';
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
@ccclass('BaseSprite')
|
|
||||||
export class BaseSprite extends Component {
|
|
||||||
|
|
||||||
@property({ type: CCString, displayName: 'img路径', tooltip: "img路径" })
|
|
||||||
ImgPath = "";
|
|
||||||
|
|
||||||
@property({ type: CCInteger, displayName: 'img编号', tooltip: "img编号" })
|
|
||||||
ImgIndex = 0;
|
|
||||||
|
|
||||||
//精灵对象
|
|
||||||
SpriteObj: Sprite;
|
|
||||||
|
|
||||||
start() {
|
|
||||||
//判断是否有精灵 如果没有 就给他搞一个
|
|
||||||
if (this.node.getComponent(Sprite))
|
|
||||||
this.SpriteObj = this.node.getComponent(Sprite);
|
|
||||||
else
|
|
||||||
this.SpriteObj = this.node.addComponent(Sprite);
|
|
||||||
|
|
||||||
new BaseSpriteFrame(this.ImgPath.toLocaleLowerCase(), this.ImgIndex, (_SpriteFrame) => {
|
|
||||||
this.SpriteObj.spriteFrame = _SpriteFrame;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
update(deltaTime: number) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "a8046df1-6c92-4ce6-a53c-1548472bce1e",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
import { _decorator, Component, Node, SpriteFrame, Texture2D, v2 } from 'cc';
|
|
||||||
import { ImagePack } from '../ImagePack/ImagePack';
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
@ccclass('BaseSpriteFrame')
|
|
||||||
export class BaseSpriteFrame {
|
|
||||||
|
|
||||||
//初始化状态
|
|
||||||
InitState: boolean = false;
|
|
||||||
//精灵帧
|
|
||||||
_SpriteFrame: SpriteFrame;
|
|
||||||
//回调函数
|
|
||||||
CallBackFunc: Function;
|
|
||||||
|
|
||||||
constructor(ImgPath: string, ImgIndex: number, CallBack?: Function) {
|
|
||||||
if (CallBack) this.CallBackFunc = CallBack;
|
|
||||||
ImagePack.getInstance().ReadNpkTable("sprite/" + ImgPath.toLocaleLowerCase(), (ImgObj) => {
|
|
||||||
const Png = ImgObj.Png_List[ImgIndex];
|
|
||||||
this._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();
|
|
||||||
this._SpriteFrame.texture = tex;
|
|
||||||
this._SpriteFrame.offset = v2(Png.Xpos, -Png.Ypos);
|
|
||||||
this.CallBackFunc(this._SpriteFrame);
|
|
||||||
this.InitState = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "ab5b488b-feb1-48e2-a426-d0ce0d4b59b7",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "f4d1fffa-ecc3-491b-8125-0f4a41ba705a",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,841 +0,0 @@
|
||||||
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");
|
|
||||||
if (FileObject == undefined) return true;
|
|
||||||
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");
|
|
||||||
if (FileObject == undefined) return;
|
|
||||||
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 && Path.indexOf(".als") == -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "00363c32-9301-40ae-9cec-bfbeabf44c51",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "f264c8dc-cc2a-4860-871b-18e75f0a85f6",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,152 +0,0 @@
|
||||||
import { Node, AudioSource, AudioClip, resources, director, _decorator, TextAsset, error, JsonAsset } from 'cc';
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @en
|
|
||||||
* this is a sington class for audio play, can be easily called from anywhere in you project.
|
|
||||||
* @zh
|
|
||||||
* 这是一个用于播放音频的单件类,可以很方便地在项目的任何地方调用。
|
|
||||||
*/
|
|
||||||
export class GlobalAudio {
|
|
||||||
|
|
||||||
AudioManager: object;
|
|
||||||
|
|
||||||
//@zh 创建一个节点作为 GlobalAudio
|
|
||||||
private static instance: GlobalAudio;
|
|
||||||
|
|
||||||
public static getInstance(): GlobalAudio {
|
|
||||||
if (!GlobalAudio.instance) {
|
|
||||||
GlobalAudio.instance = new GlobalAudio();
|
|
||||||
}
|
|
||||||
return GlobalAudio.instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private _audioSource: AudioSource;
|
|
||||||
constructor() {
|
|
||||||
//@en create a node as GlobalAudio
|
|
||||||
//@zh 创建一个节点作为 GlobalAudio
|
|
||||||
let GlobalAudio = new Node();
|
|
||||||
GlobalAudio.name = '__GlobalAudio__';
|
|
||||||
|
|
||||||
//@en add to the scene.
|
|
||||||
//@zh 添加节点到场景
|
|
||||||
director.getScene().addChild(GlobalAudio);
|
|
||||||
|
|
||||||
//@en make it as a persistent node, so it won't be destroied when scene change.
|
|
||||||
//@zh 标记为常驻节点,这样场景切换的时候就不会被销毁了
|
|
||||||
director.addPersistRootNode(GlobalAudio);
|
|
||||||
|
|
||||||
//@en add AudioSource componrnt to play audios.
|
|
||||||
//@zh 添加 AudioSource 组件,用于播放音频。
|
|
||||||
this._audioSource = GlobalAudio.addComponent(AudioSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//初始化完成以后的回调方法
|
|
||||||
LoadCallBack: Function;
|
|
||||||
Init(Func: Function) {
|
|
||||||
//储存回调
|
|
||||||
this.LoadCallBack = Func;
|
|
||||||
this.LoadAudioXml();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//加载音频Map
|
|
||||||
LoadAudioXml() {
|
|
||||||
resources.load("Sound/audio", (err, json: JsonAsset) => {
|
|
||||||
if (err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
this.AudioManager = json.json!;
|
|
||||||
this.LoadCallBack();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PlaySound(sound: string, volume: number = 1.0) {
|
|
||||||
if (this.AudioManager.hasOwnProperty(sound)) {
|
|
||||||
this.playOneShot(this.AudioManager[sound], volume);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.error("音频不存在,路径: " + sound);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public get audioSource() {
|
|
||||||
return this._audioSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @en
|
|
||||||
* play short audio, such as strikes,explosions
|
|
||||||
* @zh
|
|
||||||
* 播放短音频,比如 打击音效,爆炸音效等
|
|
||||||
* @param sound clip or url for the audio
|
|
||||||
* @param volume
|
|
||||||
*/
|
|
||||||
playOneShot(sound: AudioClip | string, volume: number = 1.0) {
|
|
||||||
if (sound instanceof AudioClip) {
|
|
||||||
this._audioSource.playOneShot(sound, volume);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resources.load(sound, (err, clip: AudioClip) => {
|
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this._audioSource.playOneShot(clip, volume);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @en
|
|
||||||
* play long audio, such as the bg music
|
|
||||||
* @zh
|
|
||||||
* 播放长音频,比如 背景音乐
|
|
||||||
* @param sound clip or url for the sound
|
|
||||||
* @param volume
|
|
||||||
*/
|
|
||||||
play(sound: AudioClip | string, volume: number = 1.0) {
|
|
||||||
if (sound instanceof AudioClip) {
|
|
||||||
this._audioSource.clip = sound;
|
|
||||||
this._audioSource.play();
|
|
||||||
this.audioSource.volume = volume;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resources.load(sound, (err, clip: AudioClip) => {
|
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this._audioSource.clip = clip;
|
|
||||||
this._audioSource.play();
|
|
||||||
this.audioSource.volume = volume;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* stop the audio play
|
|
||||||
*/
|
|
||||||
stop() {
|
|
||||||
this._audioSource.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pause the audio play
|
|
||||||
*/
|
|
||||||
pause() {
|
|
||||||
this._audioSource.pause();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* resume the audio play
|
|
||||||
*/
|
|
||||||
resume() {
|
|
||||||
this._audioSource.play();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "558c9b23-b4be-4a87-8017-8c41659d1a14",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "42592cb2-3cce-4c2b-a354-ba95a624d365",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "d9a7592d-eb74-437b-a38e-e3381e9965a2",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "d3628f81-a33c-4562-a26a-218f4c193c6c",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "40479425-c3f8-43b0-a879-1b8aa1e9f619",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
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; //数据
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "a1cdc96d-640e-43ca-bab1-410318f5a83b",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "efd7a226-b044-490c-ba21-d6a508f5e54e",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,303 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "f7d818a6-8209-4350-9000-21ecbb294559",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "e8cc263d-e946-466c-946c-cc228badc633",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "7ceba3e6-9582-4e7c-b045-63cb904ed4a3",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "4ec26641-bab8-41b3-aedc-0c51a9499a03",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "5b32215f-78d7-4705-baaa-53792dcadf16",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"isBundle": true,
|
|
||||||
"bundleName": "ImagePacks"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.0.3",
|
|
||||||
"importer": "buffer",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "dc61d9f4-8a5e-4540-8a2c-dc318bb9f198",
|
|
||||||
"files": [
|
|
||||||
".bin",
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "a5e0b202-9a49-4cf5-9ae0-3856f1cc580e",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"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.
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"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.
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"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.
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"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.
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"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.
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.0.1",
|
|
||||||
"importer": "ttf-font",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "11c929a2-b8ad-4f92-85e9-615ba086f91a",
|
|
||||||
"files": [
|
|
||||||
".json",
|
|
||||||
"msjh.ttf"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "cb4d14ad-a13b-4826-a1c3-4ac9b1572296",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 458 KiB |
|
|
@ -1,135 +0,0 @@
|
||||||
{
|
|
||||||
"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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
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) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "1bfeb383-563f-4994-834c-d37398b3f7fd",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 711 B |
|
|
@ -1,134 +0,0 @@
|
||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "0b953f25-458d-4660-90e9-3c0afa219a59",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.0.0",
|
|
||||||
"importer": "audio-clip",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "a44f1cd4-7acd-4c83-bf82-90c9d02ae81f",
|
|
||||||
"files": [
|
|
||||||
".json",
|
|
||||||
".ogg"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"downloadMode": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "c08f1ef0-a4f7-4d5c-aadc-b42b266d87da",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"bundleName": "GameScript"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.0.3",
|
|
||||||
"importer": "buffer",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "30fded4d-d8c1-490f-a102-d46539e22698",
|
|
||||||
"files": [
|
|
||||||
".bin",
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.0.1",
|
|
||||||
"importer": "*",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "a278bd5f-126a-4884-ab22-ebcacc1ec17c",
|
|
||||||
"files": [
|
|
||||||
".json",
|
|
||||||
".pvf"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"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
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "2.0.1",
|
|
||||||
"importer": "json",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "c16b1013-5b26-4f92-9c2c-c2bf5405f141",
|
|
||||||
"files": [
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.0.0",
|
|
||||||
"importer": "audio-clip",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "7b7da28c-69bf-430f-be5b-183935b918b2",
|
|
||||||
"files": [
|
|
||||||
".json",
|
|
||||||
".ogg"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {
|
|
||||||
"downloadMode": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "a4263b00-6ff6-484f-b581-78864d08eeae",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "c7b4109b-5f6b-4700-b4a6-0be52b00e752",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
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");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "db789b25-7959-4d93-b171-7f6172a55273",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.0.0",
|
|
||||||
"importer": "video-clip",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "0e188136-e298-4e88-b121-87975cf87fdb",
|
|
||||||
"files": [
|
|
||||||
".json",
|
|
||||||
".mp4"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "c0a7604e-53b6-4aa4-a3f2-9f5eb23e040a",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.0.0",
|
|
||||||
"importer": "video-clip",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "595de7d6-2828-4cff-b93b-6026f8db0250",
|
|
||||||
"files": [
|
|
||||||
".json",
|
|
||||||
".mp4"
|
|
||||||
],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "1f193574-39ec-4385-b74c-6495a2133891",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "1324e172-c1d1-4d25-aed2-4df091873819",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
import { _decorator, Component, director, Node } from 'cc';
|
|
||||||
import { GlobalAudio } from '../../GlobalScript/GlobalAudio/GlobalAudio';
|
|
||||||
import { ImagePack } from '../../GlobalScript/ImagePack/ImagePack';
|
|
||||||
import { GameScript } from '../../GlobalScript/GameScript/GameScript';
|
|
||||||
const { ccclass, property } = _decorator;
|
|
||||||
|
|
||||||
|
|
||||||
@ccclass('LodingLogic')
|
|
||||||
export class LodingLogic extends Component {
|
|
||||||
|
|
||||||
//Logo播放完成状态
|
|
||||||
LogoFlag = true;
|
|
||||||
//InitFlag
|
|
||||||
InitFlag = false;
|
|
||||||
//音频管理器初始化状态
|
|
||||||
AudioManage: boolean = false;
|
|
||||||
//NPK管理器初始化状态
|
|
||||||
NpkManage: boolean = false;
|
|
||||||
//Pvf管理器初始化状态
|
|
||||||
PvfManage: boolean = false;
|
|
||||||
start() {
|
|
||||||
//初始化音频Map
|
|
||||||
GlobalAudio.getInstance().Init(() => {
|
|
||||||
this.AudioManage = true;
|
|
||||||
});
|
|
||||||
//初始化Npk
|
|
||||||
ImagePack.getInstance().init(() => {
|
|
||||||
this.NpkManage = true;
|
|
||||||
});
|
|
||||||
//初始化Pvf
|
|
||||||
GameScript.getInstance().Init(() => {
|
|
||||||
this.PvfManage = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckInitState() {
|
|
||||||
if (!this.NpkManage
|
|
||||||
|| !this.PvfManage)
|
|
||||||
return false;
|
|
||||||
else return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
update(deltaTime: number) {
|
|
||||||
if (this.CheckInitState() && !this.InitFlag && this.LogoFlag) {
|
|
||||||
|
|
||||||
this.scheduleOnce(function () {
|
|
||||||
// director.loadScene("LoginGame");
|
|
||||||
director.loadScene("main");
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
this.InitFlag = true;
|
|
||||||
} else {
|
|
||||||
//每帧调用
|
|
||||||
GameScript.getInstance().Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "be02c91c-2774-40f6-ac7b-47b9b9e5d166",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 MiB |
|
|
@ -1,134 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.0.26",
|
|
||||||
"importer": "image",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "1105e4dc-6a6d-4d18-9487-2d7965fa555f",
|
|
||||||
"files": [
|
|
||||||
".json",
|
|
||||||
".png"
|
|
||||||
],
|
|
||||||
"subMetas": {
|
|
||||||
"6c48a": {
|
|
||||||
"importer": "texture",
|
|
||||||
"uuid": "1105e4dc-6a6d-4d18-9487-2d7965fa555f@6c48a",
|
|
||||||
"displayName": "{56D8769E-2637-4fb4-A1AC-BDF8249F32C1}",
|
|
||||||
"id": "6c48a",
|
|
||||||
"name": "texture",
|
|
||||||
"userData": {
|
|
||||||
"wrapModeS": "clamp-to-edge",
|
|
||||||
"wrapModeT": "clamp-to-edge",
|
|
||||||
"imageUuidOrDatabaseUri": "1105e4dc-6a6d-4d18-9487-2d7965fa555f",
|
|
||||||
"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": "1105e4dc-6a6d-4d18-9487-2d7965fa555f@f9941",
|
|
||||||
"displayName": "{56D8769E-2637-4fb4-A1AC-BDF8249F32C1}",
|
|
||||||
"id": "f9941",
|
|
||||||
"name": "spriteFrame",
|
|
||||||
"userData": {
|
|
||||||
"trimType": "auto",
|
|
||||||
"trimThreshold": 1,
|
|
||||||
"rotated": false,
|
|
||||||
"offsetX": 0,
|
|
||||||
"offsetY": 0,
|
|
||||||
"trimX": 0,
|
|
||||||
"trimY": 0,
|
|
||||||
"width": 1920,
|
|
||||||
"height": 532,
|
|
||||||
"rawWidth": 1920,
|
|
||||||
"rawHeight": 532,
|
|
||||||
"borderTop": 0,
|
|
||||||
"borderBottom": 0,
|
|
||||||
"borderLeft": 0,
|
|
||||||
"borderRight": 0,
|
|
||||||
"packable": true,
|
|
||||||
"pixelsToUnit": 100,
|
|
||||||
"pivotX": 0.5,
|
|
||||||
"pivotY": 0.5,
|
|
||||||
"meshType": 0,
|
|
||||||
"vertices": {
|
|
||||||
"rawPosition": [
|
|
||||||
-960,
|
|
||||||
-266,
|
|
||||||
0,
|
|
||||||
960,
|
|
||||||
-266,
|
|
||||||
0,
|
|
||||||
-960,
|
|
||||||
266,
|
|
||||||
0,
|
|
||||||
960,
|
|
||||||
266,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
2,
|
|
||||||
1,
|
|
||||||
3
|
|
||||||
],
|
|
||||||
"uv": [
|
|
||||||
0,
|
|
||||||
532,
|
|
||||||
1920,
|
|
||||||
532,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1920,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"nuv": [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
],
|
|
||||||
"minPos": [
|
|
||||||
-960,
|
|
||||||
-266,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"maxPos": [
|
|
||||||
960,
|
|
||||||
266,
|
|
||||||
0
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"isUuid": true,
|
|
||||||
"imageUuidOrDatabaseUri": "1105e4dc-6a6d-4d18-9487-2d7965fa555f@6c48a",
|
|
||||||
"atlasUuid": ""
|
|
||||||
},
|
|
||||||
"ver": "1.0.12",
|
|
||||||
"imported": true,
|
|
||||||
"files": [
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"userData": {
|
|
||||||
"type": "sprite-frame",
|
|
||||||
"hasAlpha": true,
|
|
||||||
"fixAlphaTransparencyArtifacts": false,
|
|
||||||
"redirect": "1105e4dc-6a6d-4d18-9487-2d7965fa555f@f9941"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "194984c5-bb91-4982-bb36-d837df3084c1",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.2.0",
|
|
||||||
"importer": "directory",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "8aa6842a-91d7-4a26-9faf-7086795e1aa1",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 71 KiB |
|
|
@ -1,134 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.0.26",
|
|
||||||
"importer": "image",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "41a61acc-9791-441f-a37d-7d91a4283d02",
|
|
||||||
"files": [
|
|
||||||
".json",
|
|
||||||
".png"
|
|
||||||
],
|
|
||||||
"subMetas": {
|
|
||||||
"6c48a": {
|
|
||||||
"importer": "texture",
|
|
||||||
"uuid": "41a61acc-9791-441f-a37d-7d91a4283d02@6c48a",
|
|
||||||
"displayName": "(18)nowloading",
|
|
||||||
"id": "6c48a",
|
|
||||||
"name": "texture",
|
|
||||||
"userData": {
|
|
||||||
"wrapModeS": "clamp-to-edge",
|
|
||||||
"wrapModeT": "clamp-to-edge",
|
|
||||||
"imageUuidOrDatabaseUri": "41a61acc-9791-441f-a37d-7d91a4283d02",
|
|
||||||
"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": "41a61acc-9791-441f-a37d-7d91a4283d02@f9941",
|
|
||||||
"displayName": "(18)nowloading",
|
|
||||||
"id": "f9941",
|
|
||||||
"name": "spriteFrame",
|
|
||||||
"userData": {
|
|
||||||
"trimType": "auto",
|
|
||||||
"trimThreshold": 1,
|
|
||||||
"rotated": false,
|
|
||||||
"offsetX": 0,
|
|
||||||
"offsetY": 0,
|
|
||||||
"trimX": 0,
|
|
||||||
"trimY": 0,
|
|
||||||
"width": 210,
|
|
||||||
"height": 213,
|
|
||||||
"rawWidth": 210,
|
|
||||||
"rawHeight": 213,
|
|
||||||
"borderTop": 0,
|
|
||||||
"borderBottom": 0,
|
|
||||||
"borderLeft": 0,
|
|
||||||
"borderRight": 0,
|
|
||||||
"packable": true,
|
|
||||||
"pixelsToUnit": 100,
|
|
||||||
"pivotX": 0.5,
|
|
||||||
"pivotY": 0.5,
|
|
||||||
"meshType": 0,
|
|
||||||
"vertices": {
|
|
||||||
"rawPosition": [
|
|
||||||
-105,
|
|
||||||
-106.5,
|
|
||||||
0,
|
|
||||||
105,
|
|
||||||
-106.5,
|
|
||||||
0,
|
|
||||||
-105,
|
|
||||||
106.5,
|
|
||||||
0,
|
|
||||||
105,
|
|
||||||
106.5,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
2,
|
|
||||||
1,
|
|
||||||
3
|
|
||||||
],
|
|
||||||
"uv": [
|
|
||||||
0,
|
|
||||||
213,
|
|
||||||
210,
|
|
||||||
213,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
210,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"nuv": [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
],
|
|
||||||
"minPos": [
|
|
||||||
-105,
|
|
||||||
-106.5,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"maxPos": [
|
|
||||||
105,
|
|
||||||
106.5,
|
|
||||||
0
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"isUuid": true,
|
|
||||||
"imageUuidOrDatabaseUri": "41a61acc-9791-441f-a37d-7d91a4283d02@6c48a",
|
|
||||||
"atlasUuid": ""
|
|
||||||
},
|
|
||||||
"ver": "1.0.12",
|
|
||||||
"imported": true,
|
|
||||||
"files": [
|
|
||||||
".json"
|
|
||||||
],
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"userData": {
|
|
||||||
"type": "sprite-frame",
|
|
||||||
"hasAlpha": true,
|
|
||||||
"fixAlphaTransparencyArtifacts": false,
|
|
||||||
"redirect": "41a61acc-9791-441f-a37d-7d91a4283d02@f9941"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
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) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "4.0.23",
|
|
||||||
"importer": "typescript",
|
|
||||||
"imported": true,
|
|
||||||
"uuid": "ed7e42d9-f7e0-4647-a5ea-c72d4aefd294",
|
|
||||||
"files": [],
|
|
||||||
"subMetas": {},
|
|
||||||
"userData": {}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue