176 lines
7.5 KiB
Lua
176 lines
7.5 KiB
Lua
local SmallSoldierUpFigthInfoPanel = quick_class("SmallSoldierInfoPanel", BasePanel)
|
|
local itemData = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
local gemConfig = ConfigManager.GetConfig(ConfigName.GemConfigNew)
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
local lotteryConfig = ConfigManager.GetConfig(ConfigName.SoldiersLotteryConfig)
|
|
local specialConfig = ConfigManager.GetConfigData(ConfigName.SpecialConfig, 178).Value
|
|
local aaa = string.split(specialConfig, "#")
|
|
local oldWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
|
|
|
local state
|
|
local quaName = { Language[10992], Language[10349], Language[10993], Language[10994], Language[10995], Language[10996],
|
|
Language[10997], Language[10391] }
|
|
|
|
function SmallSoldierUpFigthInfoPanel:InitComponent()
|
|
self.spLoader = SpriteLoader.New()
|
|
self.btn_close = Util.GetGameObject(self.gameObject, "mask")
|
|
self.topObj = Util.GetGameObject(self.gameObject, "bg/topBar")
|
|
self.newObj = Util.GetGameObject(self.gameObject, "bg/newBar")
|
|
self.btnObj = Util.GetGameObject(self.gameObject, "bg/bottomBar")
|
|
self.btn_up = Util.GetGameObject(self.gameObject, "bg/bottomBar/btnUp")
|
|
self.btn_change = Util.GetGameObject(self.gameObject, "bg/bottomBar/btnChange")
|
|
self.btn_remove = Util.GetGameObject(self.gameObject, "bg/bottomBar/btnRemove")
|
|
self.btn_skip = Util.GetGameObject(self.gameObject, "bg/newBar/jumpFight/btn")
|
|
self.skipImg = Util.GetGameObject(self.gameObject, "bg/newBar/jumpFight/Image")
|
|
Util.GetGameObject(self.gameObject, "bg/newBar/jumpFight/Text"):GetComponent("Text").text = Language[11004]
|
|
end
|
|
|
|
function SmallSoldierUpFigthInfoPanel:BindEvent()
|
|
Util.AddClick(self.btn_close, function()
|
|
self:ClosePanel()
|
|
end)
|
|
end
|
|
|
|
function SmallSoldierUpFigthInfoPanel:AddListener()
|
|
|
|
end
|
|
|
|
function SmallSoldierUpFigthInfoPanel:RemoveListener()
|
|
|
|
end
|
|
|
|
local type = 0
|
|
local oldData = nil
|
|
local newData = nil
|
|
--待功能扩展(试图打开某个状态)
|
|
function SmallSoldierUpFigthInfoPanel:OnOpen(...)
|
|
local args = { ... }
|
|
type = args[1]
|
|
--data=args[2]
|
|
-- newData=args[3]
|
|
end
|
|
|
|
function SmallSoldierUpFigthInfoPanel:OnSortingOrderChange()
|
|
|
|
end
|
|
|
|
local itemList = {}
|
|
function SmallSoldierUpFigthInfoPanel:OnShow()
|
|
oldData = SmallSoldierManager.soldierList[type]
|
|
|
|
if oldData then
|
|
--LogError("显示上面的")
|
|
self.topObj:SetActive(true)
|
|
self:ShwoSoliderInfo(self.topObj, oldData, 1)
|
|
else
|
|
self.topObj:SetActive(false)
|
|
end
|
|
end
|
|
|
|
--显示小兵信息
|
|
function SmallSoldierUpFigthInfoPanel:ShwoSoliderInfo(go, data, _type)
|
|
if go == nil or data == nil then
|
|
--LogError("111111111111111111111111111111111111")
|
|
return
|
|
end
|
|
local title = Util.GetGameObject(go, "infoObj/title"):GetComponent("Text")
|
|
local frame = Util.GetGameObject(go, "infoObj/frame"):GetComponent("Image")
|
|
local icon = Util.GetGameObject(go, "infoObj/icon"):GetComponent("Image")
|
|
local quaImg = Util.GetGameObject(go, "infoObj/quaImg"):GetComponent("Image")
|
|
local name = Util.GetGameObject(go, "infoObj/name"):GetComponent("Text")
|
|
local lv = Util.GetGameObject(go, "infoObj/lv"):GetComponent("Text")
|
|
local proPre = Util.GetGameObject(go, "infoObj/proPre")
|
|
local grid = Util.GetGameObject(go, "infoObj/proGrid")
|
|
local skillObj = Util.GetGameObject(go, "skillObj")
|
|
local skillinfo = Util.GetGameObject(go, "skillObj/Text"):GetComponent("Text")
|
|
local skillBg = Util.GetGameObject(go, "skillObj/skillBG"):GetComponent("Image")
|
|
local skillIcon = Util.GetGameObject(go, "skillObj/skillBG/skillIcon"):GetComponent("Image")
|
|
local config = ConfigManager.GetConfigData(ConfigName.SoldiersSetting, data.id)
|
|
skillBg.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(config.Quality))
|
|
skillIcon.sprite = self.spLoader:LoadSprite(GetResourcePath(config.SkillImage))
|
|
if _type == 1 then
|
|
title.text = GetLanguageStrById(config.Name)
|
|
elseif _type == 2 then
|
|
title.text = Language[11007]
|
|
end
|
|
frame.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(config.Quality))
|
|
icon.sprite = self.spLoader:LoadSprite(GetResourcePath(config.ResourceID))
|
|
quaImg.sprite = self.spLoader:LoadSprite(GetHeroQualityStr(config.Quality))
|
|
name.text = GetLanguageStrById(config.Name)
|
|
lv.text = data.level
|
|
local skillStr = ""
|
|
if config.PropertyName and #config.PropertyName > 0 and tonumber(config.PropertyName[1][1]) ~= nil then
|
|
for i = 1, #config.PropertyName do
|
|
local aa = config.PropertyName[i]
|
|
if aa[2] and aa[2] > 0 and aa[1] then
|
|
skillStr = skillStr .. PropertyType2[aa[1]] .. "+" .. aa[2] / 100 .. Language[11008]
|
|
end
|
|
end
|
|
end
|
|
if config.Profession and #config.Profession > 0 and tonumber(config.Profession[1][1]) ~= nil then
|
|
for i = 1, #config.Profession do
|
|
local aa = config.Profession[i]
|
|
if aa[2] and aa[2] > 0 and aa[1] then
|
|
skillStr = skillStr .. ProfessionType2[aa[1]] .. "+" .. aa[2] / 100 .. Language[11008]
|
|
end
|
|
end
|
|
end
|
|
skillinfo.text = skillStr
|
|
--LogError("data.attributes len============="..#data.attributes)
|
|
local lvConfig = ConfigManager.GetConfigData(ConfigName.SoldiersLotteryConfig, SmallSoldierManager.level)
|
|
local addPro = lvConfig.SoldiersUP / 10000
|
|
for i = 1, 4 do
|
|
local go = Util.GetGameObject(grid, "proPre (" .. i .. ")")
|
|
if i > #data.attributes then
|
|
go:SetActive(false)
|
|
else
|
|
go:SetActive(true)
|
|
local proName = Util.GetGameObject(go, "name"):GetComponent("Text")
|
|
local value = Util.GetGameObject(go, "value"):GetComponent("Text")
|
|
local img = Util.GetGameObject(go, "Image"):GetComponent("Image")
|
|
proName.text = GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PropertyConfig,
|
|
data.attributes[i].id).Info)
|
|
local addValue = math.floor(data.attributes[i].value * (1 + addPro) + 0.5)
|
|
value.text = addValue --..string.format(Language[11014],addPro*100)
|
|
if oldData and newData then
|
|
img.gameObject:SetActive(true)
|
|
local imgStr = nil
|
|
if _type == 1 then
|
|
LogError("判断上面的标")
|
|
if oldData.attributes[i].value > newData.attributes[i].value then
|
|
imgStr = "r_hero_zhanlishangsheng_png"
|
|
elseif oldData.attributes[i].value < newData.attributes[i].value then
|
|
imgStr = "r_hero_zhanlixiajiang_png"
|
|
end
|
|
else
|
|
--LogError("判断下面的标 data.attributes[i].value=="..data.attributes[i].value.." newData.attributes[i].value=="..newData.attributes[i].value)
|
|
if oldData.attributes[i].value > newData.attributes[i].value then
|
|
imgStr = "r_hero_zhanlixiajiang_png"
|
|
elseif oldData.attributes[i].value < newData.attributes[i].value then
|
|
imgStr = "r_hero_zhanlishangsheng_png"
|
|
end
|
|
end
|
|
if imgStr then
|
|
img.sprite = self.spLoader:LoadSprite(imgStr)
|
|
end
|
|
else
|
|
img.gameObject:SetActive(false)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function SmallSoldierUpFigthInfoPanel:OnClose()
|
|
|
|
end
|
|
|
|
function SmallSoldierUpFigthInfoPanel:OnDestroy()
|
|
self.spLoader:Destroy()
|
|
if self.timer then
|
|
self.timer:Stop()
|
|
self.timer = nil
|
|
end
|
|
end
|
|
|
|
return SmallSoldierUpFigthInfoPanel
|