Files
Main/Assets/GameAssets/Resources/Lua/Logic/Nature/NatureWeaponData.lua

228 lines
7.3 KiB
Lua
Raw Normal View History

2025-01-25 04:38:09 +08:00
--作者: xc
--日期: 2019-04-28
--文件: NatureWeaponData.lua
--模块: NatureWeaponData
--描述: 神器数据系统子类继承NatureBaseData
------------------------------------------------
local NatureBase = require "Logic.Nature.NatureBaseData"
local SkillSetDate = require "Logic.Nature.NatureSkillSetData"
local ModelData= require "Logic.Nature.NatureBaseModelData"
local FashionData = require "Logic.Nature.NatureFashionData"
local BaseItemData = require "Logic.Nature.NatureBaseItemData"
local RedPointCustomCondition = CS.Thousandto.Code.Logic.RedPointCustomCondition
local NatureWeaponData = {
Cfg = nil , --阵法配置表数据
IsMax = 0, --阵法最大等级
super = nil, --父类对象
}
function NatureWeaponData:New()
local _obj = NatureBase:New(NatureEnum.Weapon)
local _M = Utils.DeepCopy(self)
_M.super = _obj
return _M
end
--解析突破道具
function NatureWeaponData:AnalysisBreakItem(str)
self.BreakItem:Clear()
if str then
local _cs = {';','_'}
local _attr = Utils.SplitStrByTableS(str,_cs)
for i=1,#_attr do
local _data = BaseItemData:New(_attr[i][1],_attr[i][2])
self.BreakItem:Add(_data)
end
end
end
--初始化技能
function NatureWeaponData:Initialize()
DataConfig.DataNatureWeapon:Foreach(function(k, v)
if v.Skill ~= "" then
local _cs = {'_'}
local _skill = Utils.SplitStrByTable(v.Skill,_cs)
local skilllevel = tonumber(_skill[2])
if _skill and #_skill >= 2 and skilllevel == 1 then
local _data = SkillSetDate:New(v)
self.super.SkillList:Add(_data)
elseif _skill and #_skill >= 2 then
self.super.AllSkillList:Add(v)
end
end
if v.ModelID ~= 0 and v.ModelID ~= "" then
local _data = ModelData:New(v,self.super.NatureType)
self.super.ModelList:Add(_data)
end
if self.IsMax < v.Id then
self.IsMax = v.Id
end
end)
self.super.AllSkillList:Sort(
function(a,b)
return tonumber(a.Id) < tonumber(b.Id)
end
)
self.super.SkillList:Sort(
function(a,b)
if a.SkillInfo and b.SkillInfo then
return tonumber(a.SkillInfo.Id) < tonumber(b.SkillInfo.Id)
end
return true
end
)
self.super.ModelList:Sort(
function(a,b)
return tonumber(a.Stage) < tonumber(b.Stage)
end
)
--初始化化形数据
DataConfig.DataHuaxingWeapon:Foreach(function(k, v)
if v.IsIgnore == 1 and v.IfFashion == 1 then
local _data = FashionData:New(v)
self.super.FishionList:Add(_data)
end
end)
self.super.FishionList:Sort(
function(a,b)
return tonumber(a.ModelId) < tonumber(b.ModelId)
end
)
GameCenter.RegFixEventHandle(LogicEventDefine.EID_EVENT_ONLINE_ITEMINFO, self.ItemsChange, self)
GameCenter.RegFixEventHandle(LogicEventDefine.EVENT_WEAPONLV_ITEM_CHANGE, self.ItemsChange, self)
end
--反初始化
function NatureWeaponData:UnInitialize()
self.Cfg = nil
self.super = nil
self.IsMax = 0
GameCenter.UnRegFixEventHandle(LogicEventDefine.EID_EVENT_ONLINE_ITEMINFO, self.ItemsChange, self)
GameCenter.UnRegFixEventHandle(LogicEventDefine.EVENT_WEAPONLV_ITEM_CHANGE, self.ItemsChange, self)
end
function NatureWeaponData:ItemsChange()
if self.super then
self.super:UpdateLvRed(FunctionStartIdCode.NatureWeaponLevel)
end
end
--初始化服务器数据
function NatureWeaponData:InitWingInfo(msg)
if msg and msg.natureInfo then
self.Cfg = DataConfig.DataNatureWeapon[msg.natureInfo.curLevel]
self.super:UpDateSkill(msg.natureInfo.haveActiveSkill) --设置技能
self.super:UpDateModel(msg.natureInfo.haveActiveModel) --设置模型
self.super:UpDataFashionInfos(msg.natureInfo.outlineInfo) --设置化形
if self.Cfg then
self.super:AnalysisAttr(self.Cfg.Attribute)
self.super:AnalysisItem(self.Cfg.UpItem)
self.super:Parase(msg.natureType,msg.natureInfo)
local _num = self.Cfg.Progress - self.super.CurExp
self.super:UpDateLevelHit(FunctionStartIdCode.NatureWeaponLevel, self.IsMax, _num, LogicEventDefine.EVENT_WEAPONLV_ITEM_CHANGE)
end
self.super:UpDateDrugHit(FunctionStartIdCode.NatureWeaponDrag)
self.super:UpDateFashionHit(FunctionStartIdCode.NatureWeaponFashion)
if msg.natureInfo.modelId > 0 then
self:UpDateModelId(msg.natureInfo.modelId)
end
end
end
--更新技能升级
function NatureWeaponData:UpDateUpLevel(msg)
if msg.activeSkill then
self.super:UpDateSkill(msg.activeSkill)
end
self.super.Level = msg.level
self.Cfg = DataConfig.DataNatureWing[msg.level]
if self.Cfg then
self.super:AnalysisAttr(self.Cfg.Attribute)
end
if msg.activeModel then
self.super:UpDateModel(msg.activeModel)
end
self.super.CurExp = msg.curexp
self.super.Fight = msg.fight
self.super:UpDateLevelHit(FunctionStartIdCode.NatureWeaponLevel,self.IsMax, self.Cfg.Progress - msg.curexp, LogicEventDefine.EVENT_WEAPONLV_ITEM_CHANGE)
end
--更新吃果子信息
function NatureWeaponData:UpDateGrugInfo(msg)
self.super.Fight = msg.fight
self.super:UpDateDrug(msg.druginfo)
self.super:UpDateDrugHit(FunctionStartIdCode.NatureWeaponDrag)
end
--更新设置模型ID
function NatureWeaponData:UpDateModelId(model)
self.super.CurModel = model
end
--更新化形升级结果
function NatureWeaponData:UpDateFashionInfo(msg)
local _info = DataConfig.DataHuaxingWeapon[msg.id]
self.super:UpDataFashion(msg,_info)
self.super:UpDateFashionHit(FunctionStartIdCode.NatureWeaponFashion)
end
--功能函数!!!!!!!!!!!!!!!
--是否满级了
function NatureWeaponData:IsMaxLevel()
return self.IsMax <= self.super.Level
end
--获取模型相机大小
function NatureWeaponData:Get3DUICamerSize(modelid)
local _info = DataConfig.DataHuaxingWeapon[modelid]
if _info then
return _info.CameraSize
end
_info = DataConfig.DataNatureWeapon[modelid]
if _info then
return _info.CameraSize
end
return self.super:GetCameraSize(modelid)
end
function NatureWeaponData:GetModelYPosition(modelid)
local _info = DataConfig.DataHuaxingWeapon[modelid]
if _info and _info.ModelYPos then
return _info.ModelYPos
end
return 0
end
function NatureWeaponData:GetModelXPosition(modelid)
local _info = DataConfig.DataHuaxingWeapon[modelid]
if _info and _info.ModelXPos then
return _info.ModelXPos
end
return 0
end
--获取旋转参数
function NatureWeaponData:GetModelRotation(modelid)
local _info = DataConfig.DataHuaxingWeapon[modelid]
if _info and _info.CameraRotation then
local _attr = Utils.SplitNumber(_info.CameraRotation, '_')
return _attr[1], _attr[2], _attr[3]
end
return 0, 0, 0
end
--获取旋转参数
function NatureWeaponData:GetShowModelPosition(modelid)
local _info = DataConfig.DataHuaxingWeapon[modelid]
local x = 0
local y = 0
if _info and _info.ShowModelXPos then
x = _info.ShowModelXPos
end
y = _info.ShowModelYPos
return x, y, 0
end
return NatureWeaponData