2021-04-21 13:12:04 +08:00
|
|
|
|
require("Base/BasePanel")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
require("Modules/RoleInfo/RoleInfoPanel")
|
|
|
|
|
|
SkillInfoPopup = Inherit(BasePanel)
|
|
|
|
|
|
local this = SkillInfoPopup
|
2022-05-19 20:43:41 +08:00
|
|
|
|
local nextCfg
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
|
function this:InitComponent()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader = SpriteLoader.New()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
|
this.content = Util.GetGameObject(self.transform, "Content"):GetComponent("RectTransform")
|
|
|
|
|
|
this.backBtn = Util.GetGameObject(self.transform, "Button")
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.skillTypeImage = Util.GetGameObject(self.transform, "Content/SkillTypeImage"):GetComponent("Image")
|
|
|
|
|
|
this.skillTypeText = Util.GetGameObject(this.skillTypeImage.transform, "Text")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.icon = Util.GetGameObject(self.transform, "Content/IconBG/Icon"):GetComponent("Image")
|
|
|
|
|
|
this.skillName = Util.GetGameObject(self.transform, "Content/Title/Text"):GetComponent("Text")
|
2022-01-11 11:09:44 +08:00
|
|
|
|
this.desGrid = Util.GetGameObject(self.transform, "Content/desGrid")
|
|
|
|
|
|
this.desList = {}
|
2024-09-06 10:38:56 +08:00
|
|
|
|
for i = 1, 2 do
|
2022-01-11 11:09:44 +08:00
|
|
|
|
this.desList[i] = {}
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.desList[i].go = Util.GetGameObject(this.desGrid, "des" .. i)
|
2022-01-11 11:09:44 +08:00
|
|
|
|
this.desList[i].des = Util.GetGameObject(this.desList[i].go, "Text"):GetComponent("Text")
|
|
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.hintTxt = Util.GetGameObject(self.transform, "Content/desGrid/des1/Text1"):GetComponent("Text")
|
|
|
|
|
|
this.hintTxt2 = Util.GetGameObject(self.transform, "Content/desGrid/des2/Text2"):GetComponent("Text")
|
|
|
|
|
|
this.line = Util.GetGameObject(self.transform, "Content/desGrid/line")
|
|
|
|
|
|
this.rect = Util.GetGameObject(self.transform, "Content"):GetComponent("RectTransform")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
|
function this:BindEvent()
|
|
|
|
|
|
Util.AddClick(this.backBtn, function()
|
|
|
|
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
|
end)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
|
function this:AddListener()
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
|
function this:RemoveListener()
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this:OnShow()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
|
function this:OnOpen(...)
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.rect = Util.GetGameObject(GameObject.Find("SkillInfoPopup").transform, "Content"):GetComponent("RectTransform")
|
|
|
|
|
|
this.curLvRect = Util.GetGameObject(self.transform, "Content"):GetComponent("RectTransform")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local args = { ... }
|
|
|
|
|
|
local curSkillData = args[1]
|
|
|
|
|
|
local openType = args[2]
|
|
|
|
|
|
local dividend = args[3] and args[3] or 10
|
2024-09-06 10:38:56 +08:00
|
|
|
|
local maxLv = 1 --args[4]
|
|
|
|
|
|
local skilltype = args[5]
|
|
|
|
|
|
nextCfg = nil --args[6]
|
|
|
|
|
|
local soulLv = args[7]
|
2022-01-14 11:26:13 +08:00
|
|
|
|
local isFaBao = args[8]
|
2024-09-06 10:38:56 +08:00
|
|
|
|
local trainingDta = args[9]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if openType == 1 then
|
|
|
|
|
|
this.content.anchoredPosition = Vector2.New(0, 0)
|
|
|
|
|
|
elseif openType == 2 then
|
2020-09-02 22:29:33 +08:00
|
|
|
|
this.content.anchoredPosition = Vector2.New(144, -281.98)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif openType == 3 then
|
|
|
|
|
|
this.content.anchoredPosition = Vector2.New(0, 135)
|
|
|
|
|
|
elseif openType == 4 then
|
2024-09-06 10:38:56 +08:00
|
|
|
|
local panel = Util.GetGameObject(GameObject.Find("RoleInfoPopup").transform, "Scroll View/Viewport/Content")
|
|
|
|
|
|
:GetComponent("RectTransform")
|
|
|
|
|
|
this.content:DOAnchorPos(Vector3(144, panel.anchoredPosition.y - 342), 0)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
if args[6] then --如果有手动设置则使用手动设置的位置
|
2021-04-23 17:56:57 +08:00
|
|
|
|
this.content.anchoredPosition = args[6]
|
|
|
|
|
|
end
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.icon.sprite = this.spLoader:LoadSprite(GetResourcePath(curSkillData.skillConfig.Icon))
|
2021-01-26 17:08:39 +08:00
|
|
|
|
this.skillName.text = GetLanguageStrById(curSkillData.skillConfig.Name)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
|
--获取RoleInfoPanel的curUpStarData,以获取妖灵师最高等级
|
2022-01-11 11:09:44 +08:00
|
|
|
|
this.skillTypeText.gameObject:SetActive(false)
|
|
|
|
|
|
this.skillTypeImage.enabled = true
|
2022-05-19 16:38:52 +08:00
|
|
|
|
-- if curSkillData.skillConfig.Type == SkillType.Pu then
|
|
|
|
|
|
-- this.skillTypeImage.sprite=this.spLoader:LoadSprite(SkillIconType[SkillType.Pu])--普技
|
|
|
|
|
|
-- elseif curSkillData.skillConfig.Type == SkillType.Jue then
|
|
|
|
|
|
-- this.skillTypeImage.sprite=this.spLoader:LoadSprite(SkillIconType[SkillType.Jue])--绝技
|
|
|
|
|
|
-- elseif curSkillData.skillConfig.Type == SkillType.Bei then
|
|
|
|
|
|
-- this.skillTypeImage.sprite=this.spLoader:LoadSprite(SkillIconType[SkillType.Bei])--被动技
|
|
|
|
|
|
-- end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.skillTypeImage.sprite = this.spLoader:LoadSprite(GetSkillType(curSkillData))
|
2022-01-11 11:09:44 +08:00
|
|
|
|
-- this.cureffect.transform:DOAnchorPosY(0,0,true)
|
|
|
|
|
|
-- this.cureffect.text = GetCurrSkillConfigDesc(curSkillData.skillConfig,soulLv)
|
2024-09-06 10:38:56 +08:00
|
|
|
|
for i = 1, #this.desList do
|
2022-01-11 11:09:44 +08:00
|
|
|
|
this.desList[i].go.gameObject:SetActive(false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2022-01-11 11:09:44 +08:00
|
|
|
|
this.desList[1].go.gameObject:SetActive(true)
|
2022-05-19 20:43:41 +08:00
|
|
|
|
local des1
|
2022-01-14 11:26:13 +08:00
|
|
|
|
if isFaBao then
|
2024-09-06 10:38:56 +08:00
|
|
|
|
des1 = GetCurrSkillConfigDesc(curSkillData.skillConfig, soulLv) .. isFaBao
|
2022-01-14 11:26:13 +08:00
|
|
|
|
else
|
2024-09-06 10:38:56 +08:00
|
|
|
|
des1 = GetCurrSkillConfigDesc(curSkillData.skillConfig, soulLv)
|
2022-05-19 20:43:41 +08:00
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
if curSkillData.needStar and curSkillData.needStar ~= 1 then
|
|
|
|
|
|
LogError("urSkillData.needStar==" .. curSkillData.needStar)
|
|
|
|
|
|
if curSkillData.needStar == 15 then
|
2022-05-19 20:43:41 +08:00
|
|
|
|
--this.hintTxt.text=" ".."飞升3解锁"
|
2024-09-06 10:38:56 +08:00
|
|
|
|
des1 = "<color=red>" .. Language[12243] .. "</color>" .. "\n" .. des1
|
|
|
|
|
|
elseif curSkillData.needStar == 13 then
|
|
|
|
|
|
des1 = "<color=red>" .. Language[12244] .. "</color>" .. "\n" .. des1
|
2022-05-19 20:43:41 +08:00
|
|
|
|
else
|
|
|
|
|
|
--this.hintTxt.text=" "..
|
2024-09-06 10:38:56 +08:00
|
|
|
|
des1 = "<color=red>" .. NumToSimplenessFont[curSkillData.needStar] .. Language[12245] .. "</color>" .. des1
|
2022-05-19 20:43:41 +08:00
|
|
|
|
end
|
|
|
|
|
|
--des1=""
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.desList[1].des.text = des1
|
|
|
|
|
|
if nextCfg and nextCfg.skillConfig then
|
2022-05-18 20:00:57 +08:00
|
|
|
|
this.desList[2].go.gameObject:SetActive(true)
|
2022-05-19 20:43:41 +08:00
|
|
|
|
this.hintTxt2.gameObject:SetActive(false)
|
|
|
|
|
|
this.line:SetActive(true)
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.hintTxt2.text = " " .. Language[12246]
|
|
|
|
|
|
this.desList[2].des.text = Language[12247] .. GetCurrSkillConfigDesc(nextCfg.skillConfig, soulLv)
|
|
|
|
|
|
elseif trainingDta then
|
2023-12-21 20:20:16 +08:00
|
|
|
|
this.desList[2].go.gameObject:SetActive(true)
|
|
|
|
|
|
this.hintTxt2.gameObject:SetActive(false)
|
|
|
|
|
|
this.line:SetActive(true)
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.hintTxt2.text = " " .. Language[12248]
|
|
|
|
|
|
this.desList[2].des.text = string.format(Language[12249], NumToChinese[trainingDta.Level]) ..
|
|
|
|
|
|
GetCurrSkillConfigDesc(
|
|
|
|
|
|
ConfigManager.GetConfigData(ConfigName.PassiveSkillConfig, trainingDta.PassiveSkill[1]),
|
|
|
|
|
|
soulLv)
|
2022-05-19 20:43:41 +08:00
|
|
|
|
else
|
|
|
|
|
|
this.hintTxt2.gameObject:SetActive(false)
|
|
|
|
|
|
this.line:SetActive(false)
|
2022-05-18 20:00:57 +08:00
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
|
2022-05-19 16:38:52 +08:00
|
|
|
|
if curSkillData.isOpen then
|
|
|
|
|
|
--LogError("skillList[i].needStar=="..skillList[i].needStar)
|
2022-05-19 20:43:41 +08:00
|
|
|
|
this.hintTxt.gameObject:SetActive(false)
|
2024-09-06 10:38:56 +08:00
|
|
|
|
if curSkillData.needStar == 13 then
|
|
|
|
|
|
this.hintTxt.text = " " .. Language[12244]
|
2022-05-19 20:43:41 +08:00
|
|
|
|
else
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.hintTxt.text = " " .. NumToSimplenessFont[curSkillData.needStar] .. Language[10648]
|
2022-05-19 20:43:41 +08:00
|
|
|
|
end
|
2022-05-19 16:38:52 +08:00
|
|
|
|
else
|
|
|
|
|
|
this.hintTxt.gameObject:SetActive(false)
|
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
|
function this:OnClose()
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
|
function this:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader:Destroy()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this.CheckPointer()
|
|
|
|
|
|
local update
|
|
|
|
|
|
update = function()
|
|
|
|
|
|
if Input.GetMouseButtonDown(0) then
|
|
|
|
|
|
local v2 = Input.mousePosition
|
2024-09-06 10:38:56 +08:00
|
|
|
|
Log("鼠标点击坐标" .. v2.x .. " " .. v2.y)
|
|
|
|
|
|
this.value0, this.value1 = RectTransformUtility.ScreenPointToLocalPointInRectangle(this.rect, v2,
|
|
|
|
|
|
UIManager.camera, nil)
|
|
|
|
|
|
Log("对应UI坐标" .. this.value1.x .. " " .. this.value1.y)
|
|
|
|
|
|
Log("面板位置坐标" .. this.rect.localPosition.x .. " " .. this.rect.localPosition.y)
|
|
|
|
|
|
Log("面板大小" .. this.curLvRect.sizeDelta.x .. " " .. this.curLvRect.sizeDelta.y)
|
|
|
|
|
|
|
|
|
|
|
|
if this.value1.x > this.curLvRect.sizeDelta.x and
|
|
|
|
|
|
this.value1.x < 0 -- and
|
2020-05-09 13:31:21 +08:00
|
|
|
|
then
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.rect = nil
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this:ClosePanel()
|
|
|
|
|
|
UpdateBeat:Remove(update, this)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
UpdateBeat:Add(update, this)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2024-09-06 10:38:56 +08:00
|
|
|
|
return SkillInfoPopup
|