227 lines
7.1 KiB
Lua
227 lines
7.1 KiB
Lua
------------------------------------------------
|
||
--作者:gzg
|
||
--日期:2021-03-05
|
||
--文件:RoleVEquipTool.lua
|
||
--模块:RoleVEquipTool
|
||
--描述:角色可视化装备工具 -- 对应的CS.Thousandto.Code.Logic.RoleVEquipTool
|
||
------------------------------------------------
|
||
local FPlayerAnimRelation = CS.Thousandto.Code.Logic.FPlayerAnimRelation;
|
||
|
||
local RoleVEquipTool = {}
|
||
local self = RoleVEquipTool;
|
||
|
||
--获取主角当前装备的身体模型ID
|
||
function RoleVEquipTool.GetLPBodyModel()
|
||
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer();
|
||
if _lp then
|
||
if(_lp.FashionBodyID > 0)then
|
||
return self.GetFashionBodyModelID(_lp.IntOcc, _lp.FashionBodyID);
|
||
end
|
||
return self.GetLingTiBodyID(_lp.IntOcc, _lp.LingTiDegree);
|
||
end
|
||
return 0;
|
||
end
|
||
|
||
--获取主角当前装备的武器模型ID
|
||
function RoleVEquipTool.GetLPWeaponModel()
|
||
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer();
|
||
if _lp then
|
||
return self.GetFashionWeaponModelID(_lp.IntOcc, _lp.FashionWeaponID);
|
||
end
|
||
return 0;
|
||
end
|
||
--获取主角当前装备的光环
|
||
function RoleVEquipTool.GetLPHaloModel()
|
||
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer();
|
||
if _lp then
|
||
return self.GetFashionHaloModelID(_lp.FashionHaloID);
|
||
end
|
||
return 0;
|
||
end
|
||
|
||
--获取主角当前装备的法阵
|
||
function RoleVEquipTool.GetLPMatrixModel()
|
||
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer();
|
||
if _lp then
|
||
return self.GetFashionMatrixModelID(_lp.FashionMatrixID);
|
||
end
|
||
return 0;
|
||
end
|
||
|
||
--获取主角当前装备的翅膀模型ID
|
||
function RoleVEquipTool.GetLPWingModel()
|
||
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer();
|
||
if _lp then
|
||
return self.GetFashionModelID(_lp.IntOcc, _lp.WingID);
|
||
end
|
||
return 0;
|
||
end
|
||
|
||
|
||
--获取主角当前的魂甲模型
|
||
function RoleVEquipTool.GetLPSoulEquipModel()
|
||
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer();
|
||
if _lp then
|
||
local _vi = GameCenter.PlayerVisualSystem:GetVisualInfo(_lp.ID);
|
||
if _vi then
|
||
return _vi.SoulEquipID;
|
||
end
|
||
end
|
||
return 0;
|
||
end
|
||
|
||
--获取主角当前飞剑模型
|
||
function RoleVEquipTool.GetLPFlySwordModel()
|
||
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer();
|
||
if _lp then
|
||
return self.GetFlySwordModelID(_lp.CurStateLevel);
|
||
end
|
||
return 0;
|
||
end
|
||
|
||
--获取空身体的模型
|
||
function RoleVEquipTool.GetNullBodyModel(occInt)
|
||
|
||
if occInt == Occupation.XianJian then
|
||
return 3099999;
|
||
elseif occInt == Occupation.MoQiang then
|
||
return 3199999
|
||
elseif occInt == Occupation.DiZang then
|
||
return 3299999
|
||
elseif occInt == Occupation.LuoCha then
|
||
return 3399999
|
||
end
|
||
return 0;
|
||
end
|
||
--获取灵体身体ID
|
||
function RoleVEquipTool.GetLingTiBodyID(occInt, degree)
|
||
|
||
local _cfg = DataConfig.DataEquipCollectionModel[occInt * 100 + degree];
|
||
if _cfg then
|
||
return _cfg.Model;
|
||
else
|
||
if occInt == Occupation.XianJian then
|
||
return 10102000;
|
||
elseif occInt == Occupation.MoQiang then
|
||
return 10112000
|
||
elseif occInt == Occupation.DiZang then
|
||
return 10122000
|
||
elseif occInt == Occupation.LuoCha then
|
||
return 10112010
|
||
end
|
||
end
|
||
return 0;
|
||
end
|
||
|
||
--获取时装模型ID,由时装配置决定
|
||
function RoleVEquipTool.GetFashionModelID(occInt, cfgId)
|
||
local _cfg = DataConfig.DataFashionTotal[cfgId];
|
||
if _cfg then
|
||
local _cs = {';','_'}
|
||
local _attrs = Utils.SplitStrByTableS(_cfg.Res,_cs)
|
||
local _occint = occInt;
|
||
for i=1,#_attrs do
|
||
local _occRes = _attrs[i]
|
||
if _occRes[1] == _occint then
|
||
return _occRes[2]
|
||
end
|
||
end
|
||
end
|
||
return 0;
|
||
end
|
||
|
||
--获取时装翅膀模型ID
|
||
function RoleVEquipTool.GetFashionWingModelID(occInt, cfgId)
|
||
local _result = self.GetFashionModelID(occInt, cfgId);
|
||
return _result;
|
||
end
|
||
|
||
--获取时装身体模型ID
|
||
function RoleVEquipTool.GetFashionBodyModelID( occInt, cfgId)
|
||
local _result = self.GetFashionModelID(occInt, cfgId);
|
||
if(_result <= 0)then
|
||
if occInt == Occupation.XianJian then
|
||
_result = 10102000;
|
||
elseif occInt == Occupation.MoQiang then
|
||
_result = 10112000
|
||
elseif occInt == Occupation.DiZang then
|
||
_result = 10122000
|
||
elseif occInt == Occupation.LuoCha then
|
||
_result = 10112010
|
||
end
|
||
end
|
||
return _result;
|
||
end
|
||
--获取时装武器模型ID
|
||
function RoleVEquipTool.GetFashionWeaponModelID( occInt, cfgId)
|
||
local _result = self.GetFashionModelID(occInt, cfgId);
|
||
if (_result <= 0)then
|
||
if occInt == Occupation.XianJian then
|
||
_result = 10101000;
|
||
elseif occInt == Occupation.MoQiang then
|
||
_result = 10111000
|
||
elseif occInt == Occupation.DiZang then
|
||
_result = 10121000
|
||
elseif occInt == Occupation.LuoCha then
|
||
_result = 10112020
|
||
end
|
||
end
|
||
return _result;
|
||
end
|
||
--获取时装光环模型ID
|
||
function RoleVEquipTool.GetFashionHaloModelID( cfgId)
|
||
local _cfg = DataConfig.DataEquip[cfgId];
|
||
if _cfg then
|
||
return _cfg.ModelId;
|
||
end
|
||
return 0;
|
||
end
|
||
--获取时装法阵模型ID
|
||
function RoleVEquipTool.GetFashionMatrixModelID( cfgId)
|
||
local _cfg = DataConfig.DataEquip[cfgId];
|
||
if _cfg then
|
||
return _cfg.ModelId;
|
||
end
|
||
return 0;
|
||
end
|
||
--获取魂甲模型ID
|
||
function RoleVEquipTool.GetSoulEquipModelID( cfgId)
|
||
local _cfg = DataConfig.DataSoulArmorBreach[cfgId];
|
||
if _cfg then
|
||
return _cfg.Model;
|
||
end
|
||
return 0;
|
||
end
|
||
--获取飞剑模型ID
|
||
function RoleVEquipTool.GetFlySwordModelID( stateLevel)
|
||
local _cfg = DataConfig.DataStatePower[stateLevel];
|
||
if _cfg then
|
||
return _cfg.FlySwordModele;
|
||
end
|
||
return 0;
|
||
end
|
||
|
||
--刷新skin的模型数据
|
||
function RoleVEquipTool.RefreshPlayerSkinModel(skin, occInt, info, anims)
|
||
if anims == nil then
|
||
anims = FPlayerAnimRelation.LoginAnims;
|
||
end
|
||
skin:SetSkinPartFromCfgID(FSkinPartCode.Body, info:GetBodyModelID(occInt), anims);
|
||
skin:SetSkinPartFromCfgID(FSkinPartCode.GodWeaponHead, info:GetFashionWeaponModelID(occInt), anims);
|
||
skin:SetSkinPartFromCfgID(FSkinPartCode.XianjiaHuan, info:GetFashionHaloModelID());
|
||
skin:SetSkinPartFromCfgID(FSkinPartCode.XianjiaZhen, info:GetFashionMatrixModelID());
|
||
skin:SetSkinPartFromCfgID(FSkinPartCode.Wing, info:GetFashionWingModelID(occInt));
|
||
end
|
||
|
||
--刷新player的模型数据
|
||
function RoleVEquipTool.RefreshPlayerModel(player,info)
|
||
local _visualInfo = player.VisualInfo;
|
||
local _occ = player.IntOcc
|
||
player:EquipWithType(FSkinPartCode.Body, _visualInfo:GetBodyModelID(_occ));
|
||
player:EquipWithType(FSkinPartCode.GodWeaponHead, _visualInfo:GetFashionWeaponModelID(_occ));
|
||
player:EquipWithType(FSkinPartCode.XianjiaHuan, _visualInfo:GetFashionHaloModelID());
|
||
player:EquipWithType(FSkinPartCode.XianjiaZhen, _visualInfo:GetFashionMatrixModelID());
|
||
player:EquipWithType(FSkinPartCode.Wing, _visualInfo:GetFashionWingModelID(_occ));
|
||
end
|
||
|
||
return RoleVEquipTool |