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 ( )
local select = HarmonyManager : GetUnLoadData ( )
2020-12-18 18:25:38 +08:00
HarmonyManager.SetOldPowerNum ( select )
2020-12-17 10:41:00 +08:00
NetManager.SendGongMingBox ( select , HarmonyManager.UnLoadGongMing , 2 , function ( msg )
-- body HarmonyManager.SelectId
Game.GlobalEvent : DispatchEvent ( GameEvent.HongMeng . UnLoadData , msg )
HarmonyManager : RemoveGongMingList ( select )
self : ClosePanel ( )
2020-12-18 18:25:38 +08:00
HarmonyManager.WarPowerChangeNotify ( select )
2021-09-27 17:02:43 +08:00
HeroPropManager.SetHeroDirty ( self.heroDid )
2020-12-17 10:41:00 +08:00
end )
end )
Util.AddClick ( this.BtnNo , function ( )
self : ClosePanel ( )
end )
end
--添加事件监听(用于子类重写)
function HongMengUnLoadPanel : AddListener ( )
end
--移除事件监听(用于子类重写)
function HongMengUnLoadPanel : RemoveListener ( )
end
2021-01-07 21:45:22 +08:00
local dataAdditon = nil
2021-02-20 16:45:21 +08:00
2021-01-07 21:45:22 +08:00
2020-12-17 10:41:00 +08:00
function HongMengUnLoadPanel : OnOpen ( equipSId )
2021-04-21 16:36:12 +08:00
--LogGreen("打开面板")
2020-12-17 10:41:00 +08:00
local data = HarmonyManager : GetUnLoadData ( )
2021-09-27 17:02:43 +08:00
self.heroDid = data
2020-12-17 10:41:00 +08:00
local temp_hero = HeroManager.GetSingleHeroData ( data )
2021-02-20 16:45:21 +08:00
2021-01-07 21:45:22 +08:00
dataAdditon = HarmonyManager : GetAdditions ( )
2020-12-30 14:50:38 +08:00
--print(data)
2021-02-20 16:45:21 +08:00
self.LingDegree = - 1
self.HunDegree = - 1
2021-01-26 20:21:01 +08:00
local dataRockOne = EquipTreasureManager.GetSingleTreasureByIdDyn ( temp_hero.jewels [ 2 ] )
local dataRockTwo = EquipTreasureManager.GetSingleTreasureByIdDyn ( temp_hero.jewels [ 1 ] )
2021-02-20 10:05:17 +08:00
if dataRockOne then
2021-01-26 20:21:01 +08:00
-- body
2021-03-02 16:53:12 +08:00
if dataRockOne.type == Language [ 10552 ] then
2021-02-20 16:45:21 +08:00
self.HunDegree = dataRockOne.oriLv
2021-01-26 20:21:01 +08:00
else
2021-02-20 16:45:21 +08:00
self.LingDegree = dataRockOne.oriLv
2021-01-26 20:21:01 +08:00
end
2021-02-20 10:05:17 +08:00
end
if dataRockTwo then
2021-03-02 16:53:12 +08:00
if dataRockTwo.type == Language [ 10553 ] then
2021-02-20 16:45:21 +08:00
self.LingDegree = dataRockTwo.oriLv
2021-01-26 20:21:01 +08:00
else
2021-02-20 16:45:21 +08:00
self.HunDegree = dataRockTwo.oriLv
2021-02-20 10:05:17 +08:00
end
2021-01-26 20:21:01 +08:00
end
2020-12-17 10:41:00 +08:00
this : SetItem ( this.ItemOne , HarmonyManager : GetGongMingListSingle ( data ) , 0 )
this : SetItem ( this.ItemTwo , temp_hero , 1 )
this : SetText ( this.OneAll , HarmonyManager : GetGongMingListSingle ( data ) )
this : SetTextTwo ( this.TwoAll , temp_hero )
2021-02-20 16:45:21 +08:00
2020-12-17 10:41:00 +08:00
end
function HongMengUnLoadPanel : SetItem ( go , data , index )
-- body
2021-04-21 13:12:04 +08:00
Util.GetGameObject ( go.transform , " frame " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( GetHeroQuantityImageByquality ( data.heroConfig . Quality , data.star ) )
2020-12-17 10:41:00 +08:00
if index == 0 then
-- body
2021-01-04 09:57:42 +08:00
Util.GetGameObject ( go.transform , " lv/Text " ) : GetComponent ( " Text " ) . text = string.format ( " <color=#0f0>%d</color> " , data.lv )
-- if HarmonyManager.hongmengTablet>=HarmonyManager.TowerStartLimit then
-- -- body
-- Util.GetGameObject(go.transform, "lv/Text"):GetComponent("Text").text = string.format("<color=#0f0>%d</color>",data.lv)
-- else
-- end
2020-12-18 13:39:35 +08:00
2020-12-17 10:41:00 +08:00
else
Util.GetGameObject ( go.transform , " lv/Text " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , data.oriLv )
end
2021-04-21 13:12:04 +08:00
Util.GetGameObject ( go.transform , " icon " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( data.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 ( data.heroConfig . PropertyName ) )
2020-12-17 10:41:00 +08:00
local starGrid = Util.GetGameObject ( go.transform , " star " )
2021-10-26 16:00:31 +08:00
local star , starType = data.GetStar ( 1 )
SetHeroStars ( this.spLoader , starGrid , star , starType , nil , nil , Vector2.New ( 0 , 1 ) )
2021-11-05 10:18:10 +08:00
Util.SetParticleSortLayer ( starGrid , this.sortingOrder + 1 )
2020-12-17 10:41:00 +08:00
end
2021-01-07 21:45:22 +08:00
2020-12-17 10:41:00 +08:00
function HongMengUnLoadPanel : SetTextTwo ( go , data )
2020-12-18 13:39:35 +08:00
Util.GetGameObject ( go.transform , " Textdrgee " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , data.oriLv )
2021-01-07 21:45:22 +08:00
local _Star = EquipManager.GetMinEquipStar ( data.equipIdList )
if _Star == 0 or data.harmonyGongMing then
-- body
2021-03-02 16:53:12 +08:00
Util.GetGameObject ( go.transform , " TextRank " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 10086 ] )
2021-01-07 21:45:22 +08:00
else
local equip = ConfigManager.GetConfigData ( ConfigName.EquipStarsConfig , _Star )
2021-03-04 15:16:23 +08:00
Util.GetGameObject ( go.transform , " TextRank " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 12195 ] , GetQuantityStrByquality ( equip.Quality ) , equip.Stars )
2021-01-07 21:45:22 +08:00
end
2021-02-20 16:45:21 +08:00
if self.HunDegree > 0 then
2020-12-17 10:41:00 +08:00
-- body
2021-02-20 16:45:21 +08:00
Util.GetGameObject ( go.transform , " TextHun " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , self.HunDegree )
2020-12-17 10:41:00 +08:00
else
2021-03-02 16:53:12 +08:00
Util.GetGameObject ( go.transform , " TextHun " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 10086 ] )
2020-12-17 10:41:00 +08:00
end
2021-02-20 16:45:21 +08:00
if self.LingDegree > 0 then
2020-12-17 10:41:00 +08:00
-- body
2021-02-20 16:45:21 +08:00
Util.GetGameObject ( go.transform , " TextLing " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , self.LingDegree )
2020-12-17 10:41:00 +08:00
else
2021-03-02 16:53:12 +08:00
Util.GetGameObject ( go.transform , " TextLing " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 10086 ] )
2020-12-17 10:41:00 +08:00
end
2020-12-28 10:44:31 +08:00
if data.star >= 6 then
2020-12-26 15:58:03 +08:00
-- body
2021-01-20 19:19:34 +08:00
if data.oritalismanList > 0 then
2020-12-28 10:44:31 +08:00
-- body
2021-01-20 19:19:34 +08:00
Util.GetGameObject ( go.transform , " TextFa " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , data.oritalismanList )
2020-12-28 10:44:31 +08:00
else
2021-03-02 16:53:12 +08:00
Util.GetGameObject ( go.transform , " TextFa " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 10086 ] )
2020-12-28 10:44:31 +08:00
end
2020-12-26 15:58:03 +08:00
else
2021-03-02 16:53:12 +08:00
Util.GetGameObject ( go.transform , " TextFa " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 10086 ] )
2020-12-26 15:58:03 +08:00
end
2020-12-28 10:44:31 +08:00
2020-12-17 10:41:00 +08:00
2020-12-26 15:58:03 +08:00
-- Util.GetGameObject(go.transform,"TextFa"):GetComponent("Text").text = string.format("%d",data.talismanList)
2020-12-17 10:41:00 +08:00
end
2020-12-18 13:39:35 +08:00
function HongMengUnLoadPanel : SetText ( go , _data )
2021-02-20 16:45:21 +08:00
print ( _data.heroConfig . ReadingName )
2021-01-07 21:45:22 +08:00
for i = 1 , # dataAdditon do
if dataAdditon [ i ] . additionType == 1 then
2020-12-23 17:41:31 +08:00
if HarmonyManager.hongmengTablet >= HarmonyManager.TowerStartLimit then
2020-12-18 13:39:35 +08:00
Util.GetGameObject ( go.transform , " Textdrgee " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , _data.lv )
else
2020-12-22 15:41:45 +08:00
Util.GetGameObject ( go.transform , " Textdrgee " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , _data.lv )
2020-12-18 13:39:35 +08:00
end
2020-12-17 10:41:00 +08:00
2021-01-07 21:45:22 +08:00
elseif dataAdditon [ i ] . additionType == 2 then
if dataAdditon [ i ] . value == - 1 then
2020-12-17 10:41:00 +08:00
-- body
2021-01-07 21:45:22 +08:00
local _Star = EquipManager.GetMinEquipStar ( _data.equipIdList )
if _Star == 0 then
-- body
2021-03-02 16:53:12 +08:00
Util.GetGameObject ( go.transform , " TextRank " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 10086 ] )
2021-01-07 21:45:22 +08:00
else
local equip = ConfigManager.GetConfigData ( ConfigName.EquipStarsConfig , _Star )
2021-03-04 15:16:23 +08:00
Util.GetGameObject ( go.transform , " TextRank " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 12195 ] , GetQuantityStrByquality ( equip.Quality ) , equip.Stars )
2021-01-07 21:45:22 +08:00
end
2020-12-17 10:41:00 +08:00
else
2021-01-07 21:45:22 +08:00
if _data.harmonyGongMing then
-- body
local equip = ConfigManager.GetConfigData ( ConfigName.EquipStarsConfig , dataAdditon [ i ] . value )
2021-03-04 15:16:23 +08:00
Util.GetGameObject ( go.transform , " TextRank " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 12195 ] , GetQuantityStrByquality ( equip.Quality ) , equip.Stars )
2021-01-07 21:45:22 +08:00
else
local _Star = EquipManager.GetMinEquipStar ( _data.equipIdList )
local equip = ConfigManager.GetConfigData ( ConfigName.EquipStarsConfig , _Star )
2021-03-04 15:16:23 +08:00
Util.GetGameObject ( go.transform , " TextRank " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 12195 ] , GetQuantityStrByquality ( equip.Quality ) , equip.Stars )
2021-01-07 21:45:22 +08:00
end
2020-12-17 10:41:00 +08:00
end
-- body
2021-01-07 21:45:22 +08:00
elseif dataAdditon [ i ] . additionType == 3 then
2021-02-20 16:45:21 +08:00
if dataAdditon [ i ] . value > 0 and self.HunDegree ~= - 1 then
2020-12-22 19:27:49 +08:00
-- body
2021-02-20 16:45:21 +08:00
local grade = dataAdditon [ i ] . value > self.HunDegree and dataAdditon [ i ] . value or self.HunDegree
2021-01-07 21:45:22 +08:00
Util.GetGameObject ( go.transform , " TextHun " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , grade )
-- if EquipTreasureManager.GetSingleTreasureByIdDyn(_data.jewels[2]) then
-- -- body
-- else
-- Util.GetGameObject(go.transform,"TextHun"):GetComponent("Text").text = string.format("无")
-- end
2020-12-22 19:27:49 +08:00
else
2021-02-20 16:45:21 +08:00
if self.HunDegree > 0 then
2020-12-22 19:27:49 +08:00
-- body
2021-01-07 21:45:22 +08:00
2021-01-26 20:21:01 +08:00
--local grade = dataAdditon[i].value > EquipTreasureManager.GetSingleTreasureByIdDyn(_data.jewels[2]).lv and dataAdditon[i].value or EquipTreasureManager.GetSingleTreasureByIdDyn(_data.jewels[2]).lv
2021-02-20 16:45:21 +08:00
Util.GetGameObject ( go.transform , " TextHun " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , self.HunDegree )
2020-12-22 19:27:49 +08:00
else
2021-03-02 16:53:12 +08:00
Util.GetGameObject ( go.transform , " TextHun " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 10086 ] )
2021-01-07 21:45:22 +08:00
end
2020-12-22 19:27:49 +08:00
-- Util.GetGameObject(go.transform,"TextHun"):GetComponent("Text").text = string.format("无")
end
-- Util.GetGameObject(go.transform,"TextHun"):GetComponent("Text").text = string.format("%d",data[i].value)
2020-12-17 10:41:00 +08:00
-- body
2021-01-07 21:45:22 +08:00
elseif dataAdditon [ i ] . additionType == 4 then
2021-02-20 16:45:21 +08:00
if dataAdditon [ i ] . value > 0 and self.LingDegree ~= - 1 then
local grade = dataAdditon [ i ] . value > self.LingDegree and dataAdditon [ i ] . value or self.LingDegree
2021-01-07 21:45:22 +08:00
Util.GetGameObject ( go.transform , " TextLing " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , grade )
-- if EquipTreasureManager.GetSingleTreasureByIdDyn(_data.jewels[1]) then
-- -- body
-- else
-- Util.GetGameObject(go.transform,"TextLing"):GetComponent("Text").text = string.format("无")
-- end
2020-12-22 19:27:49 +08:00
-- Util.GetGameObject(go.transform,"TextLing"):GetComponent("Text").text = string.format("%d",data[i].value)
else
2021-02-20 16:45:21 +08:00
if self.LingDegree > 0 then
2020-12-22 19:27:49 +08:00
-- body
2021-01-26 20:21:01 +08:00
--local grade = dataAdditon[i].value > EquipTreasureManager.GetSingleTreasureByIdDyn(_data.jewels[1]).lv and dataAdditon[i].value or EquipTreasureManager.GetSingleTreasureByIdDyn(_data.jewels[1]).lv
2021-02-20 16:45:21 +08:00
Util.GetGameObject ( go.transform , " TextLing " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , self.LingDegree )
2020-12-22 19:27:49 +08:00
else
2021-03-02 16:53:12 +08:00
Util.GetGameObject ( go.transform , " TextLing " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 10086 ] )
2020-12-22 19:27:49 +08:00
end
-- Util.GetGameObject(go.transform,"TextLing"):GetComponent("Text").text = string.format("无")
end
2020-12-17 10:41:00 +08:00
-- body
else
2020-12-28 10:44:31 +08:00
-- print(data[i].value)
2021-01-07 21:45:22 +08:00
if _data.star >= 6 then
2021-01-20 19:19:34 +08:00
if dataAdditon [ i ] . value > 0 and _data.oritalismanList < dataAdditon [ i ] . value then
2021-01-14 14:09:13 +08:00
2021-01-07 21:45:22 +08:00
Util.GetGameObject ( go.transform , " TextFa " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , dataAdditon [ i ] . value )
else
2021-01-20 19:19:34 +08:00
if _data.oritalismanList >= dataAdditon [ i ] . value then
2021-01-07 21:45:22 +08:00
-- body
2021-01-20 19:19:34 +08:00
Util.GetGameObject ( go.transform , " TextFa " ) : GetComponent ( " Text " ) . text = string.format ( " %d " , _data.oritalismanList )
2021-01-07 21:45:22 +08:00
else
2021-03-02 16:53:12 +08:00
Util.GetGameObject ( go.transform , " TextFa " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 10086 ] )
2021-01-07 21:45:22 +08:00
end
end
2020-12-26 15:58:03 +08:00
else
2021-03-02 16:53:12 +08:00
Util.GetGameObject ( go.transform , " TextFa " ) : GetComponent ( " Text " ) . text = string.format ( Language [ 10086 ] )
2021-01-07 21:45:22 +08:00
end
2020-12-17 10:41:00 +08:00
end
end
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