miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/SkillInfoPopup.lua

175 lines
6.8 KiB
Lua
Raw Normal View History

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")
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")
this.desGrid = Util.GetGameObject(self.transform, "Content/desGrid")
this.desList = {}
for i = 1,2 do
this.desList[i] = {}
this.desList[i].go = Util.GetGameObject(this.desGrid, "des"..i)
this.desList[i].des = Util.GetGameObject(this.desList[i].go, "Text"):GetComponent("Text")
end
2022-05-19 20:43:41 +08:00
this.hintTxt=Util.GetGameObject(self.transform,"Content/desGrid/Text"):GetComponent("Text")
this.hintTxt2=Util.GetGameObject(self.transform,"Content/desGrid/Text2"):GetComponent("Text")
this.line=Util.GetGameObject(self.transform,"Content/desGrid/line")
2020-05-09 13:31:21 +08:00
this.rect=Util.GetGameObject(self.transform,"Content"):GetComponent("RectTransform")
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
2020-05-09 13:31:21 +08:00
--界面打开时调用(用于子类重写)
function this:OnOpen(...)
this.rect=Util.GetGameObject(GameObject.Find("SkillInfoPopup").transform,"Content"):GetComponent("RectTransform")
this.curLvRect=Util.GetGameObject(self.transform,"Content"):GetComponent("RectTransform")
local args = { ... }
local curSkillData = args[1]
local openType = args[2]
local dividend = args[3] and args[3] or 10
local maxLv=1--args[4]
local skilltype =args[5]
nextCfg=args[6]
2021-11-05 17:21:18 +08:00
local soulLv=args[7]
2022-01-14 11:26:13 +08:00
local isFaBao = args[8]
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
local panel=Util.GetGameObject(GameObject.Find("RoleInfoPopup").transform,"Scroll View/Viewport/Content"):GetComponent("RectTransform")
2020-09-02 22:29:33 +08:00
this.content:DOAnchorPos(Vector3(144,panel.anchoredPosition.y-342),0)
2020-05-09 13:31:21 +08:00
end
2021-04-23 17:56:57 +08:00
if args[6] then--如果有手动设置则使用手动设置的位置
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以获取妖灵师最高等级
this.skillTypeText.gameObject:SetActive(false)
this.skillTypeImage.enabled = true
-- 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
this.skillTypeImage.sprite=this.spLoader:LoadSprite(GetSkillType(curSkillData))
-- this.cureffect.transform:DOAnchorPosY(0,0,true)
-- this.cureffect.text = GetCurrSkillConfigDesc(curSkillData.skillConfig,soulLv)
for i = 1,#this.desList do
this.desList[i].go.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
end
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
2022-05-19 20:43:41 +08:00
des1 = GetCurrSkillConfigDesc(curSkillData.skillConfig,soulLv)..isFaBao
2022-01-14 11:26:13 +08:00
else
2022-05-19 20:43:41 +08:00
des1 = GetCurrSkillConfigDesc(curSkillData.skillConfig,soulLv)
end
if curSkillData.isOpen then
if curSkillData.needStar==14 then
--this.hintTxt.text=" ".."飞升3解锁"
des1="<color=red>".."飞升3解锁".."</color>".."\n"..des1
else
--this.hintTxt.text=" "..
des1="<color=red>"..NumToSimplenessFont[curSkillData.needStar].."星解锁\n".."</color>"..des1
end
--des1=""
2020-05-09 13:31:21 +08:00
end
2022-05-19 20:43:41 +08:00
this.desList[1].des.text=des1
if nextCfg then
this.desList[2].go.gameObject:SetActive(true)
2022-05-19 20:43:41 +08:00
this.hintTxt2.gameObject:SetActive(false)
this.line:SetActive(true)
this.hintTxt2.text=" ".."11星解锁"
this.desList[2].des.text = "觉醒后效果:\n"..GetCurrSkillConfigDesc(nextCfg.skillConfig,soulLv)
2022-05-19 20:43:41 +08:00
else
this.hintTxt2.gameObject:SetActive(false)
this.line:SetActive(false)
end
if curSkillData.isOpen then
--LogError("skillList[i].needStar=="..skillList[i].needStar)
2022-05-19 20:43:41 +08:00
this.hintTxt.gameObject:SetActive(false)
if curSkillData.needStar==14 then
this.hintTxt.text=" ".."飞升3解锁"
else
this.hintTxt.text=" "..NumToSimplenessFont[curSkillData.needStar].."星解锁"
end
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
Log("鼠标点击坐标"..v2.x.." "..v2.y)
2020-05-09 13:31:21 +08:00
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)
2020-05-09 13:31:21 +08:00
if this.value1.x>this.curLvRect.sizeDelta.x and
this.value1.x<0-- and
then
return
end
this.rect=nil
this:ClosePanel()
UpdateBeat:Remove(update, this)
end
end
UpdateBeat:Add(update, this)
end
2020-08-03 21:23:16 +08:00
return SkillInfoPopup