diff --git a/Yosin_Engine.exe b/Yosin_Engine.exe index b0dacbc..93ab618 100644 Binary files a/Yosin_Engine.exe and b/Yosin_Engine.exe differ diff --git a/libpng16.dll b/libpng16.dll new file mode 100644 index 0000000..2c99c6f Binary files /dev/null and b/libpng16.dll differ diff --git a/sqr/User/Asset/AssetManager.nut b/sqr/User/Asset/AssetManager.nut index 77781f4..3162bb0 100644 --- a/sqr/User/Asset/AssetManager.nut +++ b/sqr/User/Asset/AssetManager.nut @@ -12,6 +12,8 @@ class _AssetManager_ { CharacterInfoList = null; //地图列表 MapList = null; + //装备列表 + EquipmentList = null; function InitMapList() { MapList = ScriptData.GetFileData("map/map.lst", function(DataTable, Data) { @@ -107,7 +109,16 @@ class _AssetManager_ { }); 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() { @@ -115,9 +126,82 @@ class _AssetManager_ { InitMapList(); //初始化角色 InitCharacter(); + //初始化装备列表 + InitEquipmentList(); 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; + } } \ No newline at end of file diff --git a/sqr/User/Object/ActiveObject/CharacterObjectClass.nut b/sqr/User/Object/ActiveObject/CharacterObjectClass.nut index ac53755..2ebc757 100644 --- a/sqr/User/Object/ActiveObject/CharacterObjectClass.nut +++ b/sqr/User/Object/ActiveObject/CharacterObjectClass.nut @@ -171,7 +171,7 @@ class Character extends ActiveObject { } SkinAni = Animation(BufInfo, Ao); } else { - local AvaInfo = ScriptData.GetEquipment(this[Type]); + local AvaInfo = AssetManager.GetEquipment(this[Type]); local JobInfo = AvaInfo["Ani_" + Info["job"]]; local BufInfo = sq_DeepCopy(ScriptData.GetAni(Src)); local Ao = { @@ -195,23 +195,25 @@ class Character extends ActiveObject { //加入组 this[AniObj].append(SkinAni); } else { + //先判断类型 if (this[Type] != null) { - - local AvaInfo = ScriptData.GetEquipment(this[Type]); - local JobInfo = AvaInfo["Ani_" + Info["job"]]; - foreach(_index, value in JobInfo["layer_variation"]) { - local BufInfo = sq_DeepCopy(ScriptData.GetAni(AvaInfo["DirPath"] + value["Path"] + Src.slice(Src.find("/")))); - local Ao = { - ImgVariation = JobInfo["variation"], - ImgFormat = function(ImgPath) { - return format(ImgPath, ImgVariation[0], ImgVariation[1]); + local AvaInfo = AssetManager.GetEquipment(this[Type]); + if (AvaInfo) { + local JobInfo = AvaInfo["Ani_" + Info["job"]]; + foreach(_index, value in JobInfo["layer_variation"]) { + local BufInfo = sq_DeepCopy(ScriptData.GetAni(AvaInfo["DirPath"] + value["Path"] + Src.slice(Src.lastfind("/")))); + local Ao = { + ImgVariation = JobInfo["variation"], + ImgFormat = function(ImgPath) { + 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); } else { - local AvaInfo = ScriptData.GetEquipment(this[Type]); + local AvaInfo = AssetManager.GetEquipment(this[Type]); local JobInfo = AvaInfo["Ani_" + Info["job"]]; local BufInfo = sq_DeepCopy(ScriptData.GetAni(Src)); local Ao = { @@ -265,10 +267,10 @@ class Character extends ActiveObject { } else { if (this[Type] != null) { - local AvaInfo = ScriptData.GetEquipment(this[Type]); + local AvaInfo = AssetManager.GetEquipment(this[Type]); local JobInfo = AvaInfo["Ani_" + Info["job"]]; 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 = { ImgVariation = JobInfo["variation"], ImgFormat = function(ImgPath) { diff --git a/sqr/User/Stage/LodingStage.nut b/sqr/User/Stage/LodingStage.nut index 3d8ebf6..a2aa752 100644 --- a/sqr/User/Stage/LodingStage.nut +++ b/sqr/User/Stage/LodingStage.nut @@ -27,7 +27,7 @@ function LoginStage() { local T = CL_StageObject(); T.SetName("加载界面舞台"); - local AniTime = 100; + local AniTime = 800; //大背景 local BackGround = CL_SpriteObject("sprite/loding.img", 0); @@ -56,7 +56,7 @@ function LoginStage() { sp.Var.time += dt; local rate = Math.getUniformVelocity(0, 100, sp.Var.time - AniTime, AniTime); sp.SetOpacity(rate / 100.0); - if (rate == 100) { + if (rate >= 100) { InitGame(); } }); diff --git a/sqr/User/Stage/TestStage.nut b/sqr/User/Stage/TestStage.nut index 8a56474..50bfa00 100644 --- a/sqr/User/Stage/TestStage.nut +++ b/sqr/User/Stage/TestStage.nut @@ -11,20 +11,23 @@ function TestStage() { - local Window = Sq_CreateWindow(_Login_Window, "启动界面窗口", 0, 0, 288, 512, 0); - Window.ResetFocus(); + // local Window = Sq_CreateWindow(_Login_Window, "启动界面窗口", 0, 0, 288, 512, 0); + // Window.ResetFocus(); // local Fontobj = Font(); - // 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/sainthorn_heaven/sainthorn_heaven_ship_rear_down.map"); - // T.Addchild(MapObj); + 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/sainthorn_heaven/sainthorn_heaven_ship_rear_down.map"); + T.Addchild(MapObj); - // local Charc = Character(); - // Charc.Init(0); - // Charc.SetPosition(356, 430, 0); - // Charc.SetAnimation(Charc.RestAni); - // Charc.SetZOrder(99999999); - // MapObj.Addchild(Charc); + + local Charc = Character(); + Charc.coat = 601500060; + Charc.Init(0); + // Charc.InitBaseAni(); + Charc.SetPosition(356, 430, 0); + Charc.SetAnimation(Charc.RestAni); + Charc.SetZOrder(99999999); + MapObj.Addchild(Charc); } \ No newline at end of file