User 相关类的同步

This commit is contained in:
Lenheart 2024-12-12 14:51:27 +08:00 committed by WONIU
parent c9dcc5ffd9
commit 172d74f091
6 changed files with 121 additions and 32 deletions

Binary file not shown.

BIN
libpng16.dll Normal file

Binary file not shown.

View File

@ -12,6 +12,8 @@ class _AssetManager_ {
CharacterInfoList = null; CharacterInfoList = null;
//地图列表 //地图列表
MapList = null; MapList = null;
//装备列表
EquipmentList = null;
function InitMapList() { function InitMapList() {
MapList = ScriptData.GetFileData("map/map.lst", function(DataTable, Data) { MapList = ScriptData.GetFileData("map/map.lst", function(DataTable, Data) {
@ -107,7 +109,16 @@ class _AssetManager_ {
}); });
CharacterInfoList.push(Info); CharacterInfoList.push(Info);
} }
}
function InitEquipmentList() {
EquipmentList = ScriptData.GetFileData("equipment/equipment.lst", function(DataTable, Data) {
while (!Data.Eof()) {
local Key = Data.Get();
DataTable.rawset(Key, Data.Get());
}
if (_DEBUG_) print("加载装备List完成, 共" + DataTable.len() + "个");
});
} }
constructor() { constructor() {
@ -115,9 +126,82 @@ class _AssetManager_ {
InitMapList(); InitMapList();
//初始化角色 //初始化角色
InitCharacter(); InitCharacter();
//初始化装备列表
InitEquipmentList();
getroottable().AssetManager <- this; getroottable().AssetManager <- this;
} }
//Public::
//获取装备信息
function GetEquipment(Idx) {
//如果没有这件装备则返回
if (!(EquipmentList.rawin(Idx))) return;
local Path = EquipmentList[Idx];
local m_data = ScriptData.GetFileData("equipment/" + Path, function(DataTable, Data) {
DataTable.DirPath <- DataTable.filepath.slice(0, DataTable.filepath.lastfind("/") + 1);
while (!Data.Eof()) {
local Pack = Data.Get();
//名称 grade 套装Id
if (Pack == "[name]" || Pack == "[part set index]" || Pack == "[grade]") {
local RealKey = Pack.slice(1, -1);
DataTable[RealKey] <- Data.Get();
}
//适用角色
else if (Pack == "[usable job]") {
DataTable.usable_job <- [];
while (true) {
local Ret = Data.Get();
if (Ret == "[/usable job]") break;
DataTable.usable_job.append(Ret.slice(1, -1).tolower());
}
}
//图标
else if (Pack == "[icon]") {
DataTable.icon <- {};
local Ret = Data.Get();
DataTable.icon.path <- Ret.tolower();
Ret = Data.Get();
DataTable.icon.index <- Ret.tointeger();
}
//装备类型
else if (Pack == "[equipment type]") {
DataTable.type <- {};
local Ret = Data.Get();
DataTable.type.path <- Ret.tolower().slice(1, -1);
Ret = Data.Get();
DataTable.type.index <- Ret.tointeger();
}
//Ani
else if (Pack == "[animation job]") {
local Job = Data.Get().slice(1, -1);
DataTable["Ani_" + Job] <- {};
Data.Get();
local Index1 = Data.Get();
local Index2 = Data.Get();
DataTable["Ani_" + Job].variation <- [Index1, Index2];
DataTable["Ani_" + Job].layer_variation <- [];
while (true) {
local Ret = Data.Get();
if (Ret == "[animation job]" || (endswith(Ret, "]") && Ret != "[equipment ani script]" && Ret != "[layer variation]")) {
Data.Pos--;
break;
} else if (Ret == "[layer variation]") {
local InfoBuf = {};
InfoBuf.Zorder <- Data.Get();
InfoBuf.Path <- Data.Get();
DataTable["Ani_" + Job].layer_variation.append(InfoBuf);
}
}
}
}
});
return m_data;
}
} }

View File

@ -171,7 +171,7 @@ class Character extends ActiveObject {
} }
SkinAni = Animation(BufInfo, Ao); SkinAni = Animation(BufInfo, Ao);
} else { } else {
local AvaInfo = ScriptData.GetEquipment(this[Type]); local AvaInfo = AssetManager.GetEquipment(this[Type]);
local JobInfo = AvaInfo["Ani_" + Info["job"]]; local JobInfo = AvaInfo["Ani_" + Info["job"]];
local BufInfo = sq_DeepCopy(ScriptData.GetAni(Src)); local BufInfo = sq_DeepCopy(ScriptData.GetAni(Src));
local Ao = { local Ao = {
@ -195,23 +195,25 @@ class Character extends ActiveObject {
//加入组 //加入组
this[AniObj].append(SkinAni); this[AniObj].append(SkinAni);
} else { } else {
//先判断类型
if (this[Type] != null) { if (this[Type] != null) {
local AvaInfo = AssetManager.GetEquipment(this[Type]);
local AvaInfo = ScriptData.GetEquipment(this[Type]); if (AvaInfo) {
local JobInfo = AvaInfo["Ani_" + Info["job"]]; local JobInfo = AvaInfo["Ani_" + Info["job"]];
foreach(_index, value in JobInfo["layer_variation"]) { foreach(_index, value in JobInfo["layer_variation"]) {
local BufInfo = sq_DeepCopy(ScriptData.GetAni(AvaInfo["DirPath"] + value["Path"] + Src.slice(Src.find("/")))); local BufInfo = sq_DeepCopy(ScriptData.GetAni(AvaInfo["DirPath"] + value["Path"] + Src.slice(Src.lastfind("/"))));
local Ao = { local Ao = {
ImgVariation = JobInfo["variation"], ImgVariation = JobInfo["variation"],
ImgFormat = function(ImgPath) { ImgFormat = function(ImgPath) {
return format(ImgPath, ImgVariation[0], ImgVariation[1]); return format(ImgPath, ImgVariation[0], ImgVariation[1]);
}
} }
local AniBuf = Animation(BufInfo, Ao);
//设置Ani类型
AniBuf.Type = Type;
AniBuf.SetZOrder(value["Zorder"]);
this[AniObj].append(AniBuf);
} }
local AniBuf = Animation(BufInfo, Ao);
//设置Ani类型
AniBuf.Type = Type;
AniBuf.SetZOrder(value["Zorder"]);
this[AniObj].append(AniBuf);
} }
} }
} }
@ -245,7 +247,7 @@ class Character extends ActiveObject {
} }
SkinAni = Animation(BufInfo, Ao); SkinAni = Animation(BufInfo, Ao);
} else { } else {
local AvaInfo = ScriptData.GetEquipment(this[Type]); local AvaInfo = AssetManager.GetEquipment(this[Type]);
local JobInfo = AvaInfo["Ani_" + Info["job"]]; local JobInfo = AvaInfo["Ani_" + Info["job"]];
local BufInfo = sq_DeepCopy(ScriptData.GetAni(Src)); local BufInfo = sq_DeepCopy(ScriptData.GetAni(Src));
local Ao = { local Ao = {
@ -265,10 +267,10 @@ class Character extends ActiveObject {
} else { } else {
if (this[Type] != null) { if (this[Type] != null) {
local AvaInfo = ScriptData.GetEquipment(this[Type]); local AvaInfo = AssetManager.GetEquipment(this[Type]);
local JobInfo = AvaInfo["Ani_" + Info["job"]]; local JobInfo = AvaInfo["Ani_" + Info["job"]];
foreach(_index, value in JobInfo["layer_variation"]) { foreach(_index, value in JobInfo["layer_variation"]) {
local BufInfo = sq_DeepCopy(ScriptData.GetAni(AvaInfo["DirPath"] + value["Path"] + Src.slice(Src.find("/")))); local BufInfo = sq_DeepCopy(ScriptData.GetAni(AvaInfo["DirPath"] + value["Path"] + Src.slice(Src.lastfind("/"))));
local Ao = { local Ao = {
ImgVariation = JobInfo["variation"], ImgVariation = JobInfo["variation"],
ImgFormat = function(ImgPath) { ImgFormat = function(ImgPath) {

View File

@ -27,7 +27,7 @@ function LoginStage() {
local T = CL_StageObject(); local T = CL_StageObject();
T.SetName("加载界面舞台"); T.SetName("加载界面舞台");
local AniTime = 100; local AniTime = 800;
//大背景 //大背景
local BackGround = CL_SpriteObject("sprite/loding.img", 0); local BackGround = CL_SpriteObject("sprite/loding.img", 0);
@ -56,7 +56,7 @@ function LoginStage() {
sp.Var.time += dt; sp.Var.time += dt;
local rate = Math.getUniformVelocity(0, 100, sp.Var.time - AniTime, AniTime); local rate = Math.getUniformVelocity(0, 100, sp.Var.time - AniTime, AniTime);
sp.SetOpacity(rate / 100.0); sp.SetOpacity(rate / 100.0);
if (rate == 100) { if (rate >= 100) {
InitGame(); InitGame();
} }
}); });

View File

@ -11,20 +11,23 @@ function TestStage() {
local Window = Sq_CreateWindow(_Login_Window, "启动界面窗口", 0, 0, 288, 512, 0); // local Window = Sq_CreateWindow(_Login_Window, "启动界面窗口", 0, 0, 288, 512, 0);
Window.ResetFocus(); // Window.ResetFocus();
// local Fontobj = Font(); // local Fontobj = Font();
// local MapObj = Map("map/cataclysm/town/elvengard/new_elvengard.map"); local MapObj = Map("map/cataclysm/town/elvengard/new_elvengard.map");
// // local MapObj = Map("map/cataclysm/town/seria_room/elvengard.map"); // local MapObj = Map("map/cataclysm/town/seria_room/elvengard.map");
// // local MapObj = Map("map/cataclysm/town/sainthorn_heaven/sainthorn_heaven_ship_rear_down.map"); // local MapObj = Map("map/cataclysm/town/sainthorn_heaven/sainthorn_heaven_ship_rear_down.map");
// T.Addchild(MapObj); T.Addchild(MapObj);
// local Charc = Character();
// Charc.Init(0); local Charc = Character();
// Charc.SetPosition(356, 430, 0); Charc.coat = 601500060;
// Charc.SetAnimation(Charc.RestAni); Charc.Init(0);
// Charc.SetZOrder(99999999); // Charc.InitBaseAni();
// MapObj.Addchild(Charc); Charc.SetPosition(356, 430, 0);
Charc.SetAnimation(Charc.RestAni);
Charc.SetZOrder(99999999);
MapObj.Addchild(Charc);
} }