读取v1 npk成功 加载人物时装显示Test成功
This commit is contained in:
		
							parent
							
								
									647303ff21
								
							
						
					
					
						commit
						d859701ab5
					
				
							
								
								
									
										
											BIN
										
									
								
								Yosin_Engine.exe
								
								
								
								
							
							
						
						
									
										
											BIN
										
									
								
								Yosin_Engine.exe
								
								
								
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -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; | ||||
|     } | ||||
| } | ||||
|  | @ -172,7 +172,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 = { | ||||
|  | @ -196,23 +196,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); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | @ -246,7 +248,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 = { | ||||
|  | @ -266,10 +268,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) { | ||||
|  |  | |||
|  | @ -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(); | ||||
|         } | ||||
|     }); | ||||
|  |  | |||
|  | @ -21,8 +21,11 @@ function TestStage() { | |||
|     // local MapObj = Map("map/cataclysm/town/sainthorn_heaven/sainthorn_heaven_ship_rear_down.map"); | ||||
|     T.Addchild(MapObj); | ||||
| 
 | ||||
| 
 | ||||
|     local Charc = Character(); | ||||
|     Charc.coat = 601500060; | ||||
|     Charc.Init(0); | ||||
|     // Charc.InitBaseAni(); | ||||
|     Charc.SetPosition(356, 430, 0); | ||||
|     Charc.SetAnimation(Charc.RestAni); | ||||
|     Charc.SetZOrder(99999999); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue