miduo_client/Assets/ManagedResources/~Lua/Modules/Harmony/Panel/HongMengEnvoyUnloadPanel.lua

113 lines
3.8 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
require("Base/BasePanel")
2020-12-17 10:41:00 +08:00
HongMengUnLoadPanel = Inherit(BasePanel)
local this = HongMengUnLoadPanel
local curSelectHeroList={}
local heroDataList={}
local curNeedRoleNum
local openThisPanel
local curHeroData = {}
local TempData = nil;
local SelectHero = nil
--初始化组件(用于子类重写)
function HongMengUnLoadPanel:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-12-17 10:41:00 +08:00
this.BtnBack = Util.GetGameObject(self.transform, "btnBack")
this.BtnYes = Util.GetGameObject(self.transform, "YesBtn")
this.BtnNo = Util.GetGameObject(self.transform,"NoBtn")
this.OneAll = Util.GetGameObject(self.transform,"TextOneAll")
this.TwoAll = Util.GetGameObject(self.transform,"TextTwoAll")
this.ItemOne = Util.GetGameObject(self.transform,"grid/Item")
this.ItemTwo = Util.GetGameObject(self.transform,"grid/Item1")
end
--绑定事件(用于子类重写)
function HongMengUnLoadPanel:BindEvent()
Util.AddClick(this.BtnBack, function()
self:ClosePanel()
end)
Util.AddClick(this.BtnYes, function()
2020-12-17 11:29:16 +08:00
-- Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.UnLoadHongMengEnvoy,self.data)
2020-12-17 10:41:00 +08:00
self:ClosePanel()
-- local select = HarmonyManager:GetUnLoadData()
NetManager.SendGongMingBox(self.data.heroId,self.data.gridId ,3,function (msg)
self.data.time = msg.leftTime
Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.UnLoadHongMengEnvoy,self.data)
-- HarmonyManager:RemoveGongMingList(select)
2021-01-14 14:09:13 +08:00
--
2020-12-17 10:41:00 +08:00
self:ClosePanel()
end)
end)
Util.AddClick(this.BtnNo, function()
self:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function HongMengUnLoadPanel:AddListener()
end
--移除事件监听(用于子类重写)
function HongMengUnLoadPanel:RemoveListener()
end
function HongMengUnLoadPanel:OnOpen(data)
self.data = data
this:SetItem(this.ItemOne,data,0)
this:SetItem(this.ItemTwo,data,1)
end
function HongMengUnLoadPanel:SetItem(go,data,index)
-- body
local heroSingleData = HeroManager.GetSingleHeroData(data.heroId)
2021-04-21 13:12:04 +08:00
Util.GetGameObject(go.transform, "frame"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroSingleData.heroConfig.Quality,heroSingleData.star))
2020-12-17 10:41:00 +08:00
if index == 0 then
-- body
2021-01-25 15:14:45 +08:00
local data = HarmonyManager.GetSingleAdditions(HarmonyAddType.AddLv)
if heroSingleData.lv == data then
-- body
Util.GetGameObject(go.transform, "lv/Text"):GetComponent("Text").text = string.format("<color=#ffbe22>%d</color>",heroSingleData.lv)
else
Util.GetGameObject(go.transform, "lv/Text"):GetComponent("Text").text = string.format("<color=red>%d</color>",heroSingleData.lv)
end
--LUtil.GetGameObject(go.transform, "lv/Text"):GetComponent("Text").text = string.format("<color=#ffbe22>%d</color>",heroSingleData.lv)
2020-12-17 10:41:00 +08:00
else
Util.GetGameObject(go.transform, "lv/Text"):GetComponent("Text").text = string.format("%d",heroSingleData.oriLv)
end
2021-04-21 13:12:04 +08:00
Util.GetGameObject(go.transform, "icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(heroSingleData.icon)
2020-12-17 10:41:00 +08:00
2021-04-21 13:12:04 +08:00
Util.GetGameObject(go.transform, "proIcon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(heroSingleData.heroConfig.PropertyName))
2020-12-17 10:41:00 +08:00
local starGrid = Util.GetGameObject(go.transform, "star")
2021-04-21 13:12:04 +08:00
SetHeroStars(this.spLoader, starGrid, heroSingleData.star,1,nil,nil,Vector2.New(0,1))
2020-12-17 10:41:00 +08:00
end
--界面关闭时调用(用于子类重写)
function HongMengUnLoadPanel:OnClose()
end
--界面销毁时调用(用于子类重写)
function HongMengUnLoadPanel:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-12-17 10:41:00 +08:00
end
2021-04-21 13:12:04 +08:00
return HongMengUnLoadPanel