2021-09-10 16:25:38 +08:00
|
|
|
|
-- 编队动作
|
|
|
|
|
FORMATION_ACTION = {
|
|
|
|
|
DOWN = 0, -- 下阵神将
|
|
|
|
|
UP = 1 -- 上阵神将
|
|
|
|
|
}
|
|
|
|
|
require("Base/BasePanel")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
FormationPanelV2 = Inherit(BasePanel)
|
|
|
|
|
local this = FormationPanelV2
|
|
|
|
|
local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig)
|
|
|
|
|
local elementalResonanceConfig = ConfigManager.GetConfig(ConfigName.ElementalResonanceConfig)
|
|
|
|
|
|
2020-06-03 19:09:01 +08:00
|
|
|
|
local roleConfig=ConfigManager.GetConfig(ConfigName.RoleConfig)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local orginLayer
|
|
|
|
|
local curFormation --打开面板编队信息
|
|
|
|
|
this.choosedList={}--选择上阵列表 临时数据
|
|
|
|
|
this.curFormationIndex = 1 --当前编队索引
|
|
|
|
|
this.trigger={}
|
|
|
|
|
|
|
|
|
|
local bgListGo={} --上阵背景预设
|
|
|
|
|
local heroListGo = {}--英雄上阵预设列表
|
|
|
|
|
local maskListGo={} --上阵遮罩
|
|
|
|
|
local dragViewListGo={}--dragView预设列表
|
|
|
|
|
|
|
|
|
|
local effectList = {}--特效列表
|
|
|
|
|
local tabs = {}--筛选按钮
|
|
|
|
|
local proId=0--0 全部 1 火 2风 3 水 4 地
|
|
|
|
|
|
|
|
|
|
local sortType = 1 -- 1:品阶 2:等级
|
|
|
|
|
|
|
|
|
|
local chooseIndex=0
|
|
|
|
|
local chooseHeroObj --当前选中英雄
|
|
|
|
|
|
|
|
|
|
this.formationPower = 0--战力
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local oldPowerNum = 0 --旧战力
|
|
|
|
|
local tempPowerNum=0 --临时战力
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2020-06-03 19:09:01 +08:00
|
|
|
|
-- local liveNodes={}--立绘容器
|
|
|
|
|
-- local liveNames={}--立绘名容器
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2020-07-25 13:21:30 +08:00
|
|
|
|
local panelType
|
2021-05-20 16:46:26 +08:00
|
|
|
|
local parameter --透传参数
|
2022-03-28 18:18:19 +08:00
|
|
|
|
local tabsImg = {"z_icon_01_zh", "r_hero_huo 1_zh", "r_hero_feng 1_zh", "r_hero_shui 1_zh", "r_hero_dadi 1_zh","z_icon_qingjinbao"}
|
2021-10-28 18:32:21 +08:00
|
|
|
|
local isPress = false
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 各个类型编队系统逻辑列表
|
|
|
|
|
this.PanelOptionView = {
|
|
|
|
|
[FORMATION_TYPE.CARBON] = "Modules/Formation/View/CarbonFormation",
|
|
|
|
|
[FORMATION_TYPE.STORY] = "Modules/Formation/View/StoryFormation",
|
|
|
|
|
[FORMATION_TYPE.MAIN] = "Modules/Formation/View/MainFormation",
|
|
|
|
|
[FORMATION_TYPE.ARENA_DEFEND] = "Modules/Formation/View/ArenaDefendFormation",
|
|
|
|
|
[FORMATION_TYPE.ARENA_ATTACK] = "Modules/Formation/View/ArenaAttackFormation",
|
|
|
|
|
[FORMATION_TYPE.ARENA_TOP_MATCH] = "Modules/Formation/View/ArenaTopMatchFormation",
|
|
|
|
|
[FORMATION_TYPE.ADVENTURE] = "Modules/Formation/View/AdventureFormation",
|
|
|
|
|
[FORMATION_TYPE.ADVENTURE_BOSS] = "Modules/Formation/View/AdventureBossFormation",
|
|
|
|
|
[FORMATION_TYPE.ELITE_MONSTER] = "Modules/Formation/View/EliteMonsterFormation",
|
|
|
|
|
[FORMATION_TYPE.GUILD_DEFEND] = "Modules/Formation/View/GuildFightDefendFormation",
|
|
|
|
|
[FORMATION_TYPE.GUILD_ATTACK] = "Modules/Formation/View/GuildFightAttackFormation",
|
|
|
|
|
[FORMATION_TYPE.GUILD_BOSS] = "Modules/Formation/View/GuildBossFormation",
|
|
|
|
|
[FORMATION_TYPE.MONSTER_CAMP] = "Modules/Formation/View/MonsterCampFormation",
|
|
|
|
|
[FORMATION_TYPE.BLOODY_BATTLE] = "Modules/Formation/View/FormFightFormation",
|
|
|
|
|
[FORMATION_TYPE.PLAY] = "Modules/Formation/View/PlayWithSBFormation",
|
|
|
|
|
[FORMATION_TYPE.EXPEDITION] = "Modules/Formation/View/ExpeditionFormation",
|
|
|
|
|
[FORMATION_TYPE.SAVE_FORMATION]="Modules/Formation/View/SaveFormation",
|
|
|
|
|
[FORMATION_TYPE.GUILD_CAR_DELEAY]="Modules/Formation/View/GuildCarDeleayFormation",
|
2020-05-15 16:52:35 +08:00
|
|
|
|
[FORMATION_TYPE.GUILD_DEATHPOS]="Modules/Formation/View/GuildDeathPosFormation",
|
2020-07-20 19:46:08 +08:00
|
|
|
|
[FORMATION_TYPE.XUANYUAN_MIRROR]="Modules/Formation/View/XuanYuanMirrorFormation",
|
2020-08-19 17:28:17 +08:00
|
|
|
|
[FORMATION_TYPE.GUILD_TRANSCRIPT]="Modules/Formation/View/GuildTranscriptFormation",
|
2020-12-21 20:24:36 +08:00
|
|
|
|
[FORMATION_TYPE.FOUR_ELEMENT]="Modules/Formation/View/FourElementFormation",
|
2021-05-11 16:58:01 +08:00
|
|
|
|
[FORMATION_TYPE.FIGHTLEVEL]="Modules/Formation/View/FightLevelFormation",
|
2021-06-15 20:08:14 +08:00
|
|
|
|
[FORMATION_TYPE.JUMPSERVER_HIGHTLADDER]="Modules/Formation/View/JumpServerHightLadderFormation",
|
2021-08-27 13:45:09 +08:00
|
|
|
|
[FORMATION_TYPE.WORLDARENA]="Modules/Formation/View/WorldArenaFormation",
|
2021-09-10 10:30:50 +08:00
|
|
|
|
[FORMATION_TYPE.QIJIESHILIAN]="Modules/Formation/View/QiJieFormation",
|
2021-11-16 17:34:37 +08:00
|
|
|
|
[FORMATION_TYPE.LINGMAIMIJING]="Modules/Formation/View/LingMaiFormation",
|
2021-12-23 17:23:02 +08:00
|
|
|
|
[FORMATION_TYPE.ExploreFunc]="Modules/Formation/View/ExploreFormation",
|
2022-04-18 18:48:06 +08:00
|
|
|
|
[FORMATION_TYPE.ChallengeCopy_1]="Modules/Formation/View/ChallengeCopyFormation",
|
|
|
|
|
[FORMATION_TYPE.ChallengeCopy_2]="Modules/Formation/View/ChallengeCopyFormation",
|
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
|
|
|
|
orginLayer=0
|
|
|
|
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft })
|
|
|
|
|
this.bg = Util.GetGameObject(this.gameObject, "Bg")
|
|
|
|
|
this.backBtn = Util.GetGameObject(this.gameObject, "BackBtn")
|
|
|
|
|
this.exampleBtn=Util.GetGameObject(this.gameObject,"ExampleBtn")
|
|
|
|
|
this.effect = Util.GetGameObject(this.gameObject, "effect")
|
|
|
|
|
this.power = Util.GetGameObject(this.gameObject, "Power/Value"):GetComponent("Text")
|
|
|
|
|
this.root=Util.GetGameObject(this.gameObject,"Root")
|
2021-04-22 18:26:48 +08:00
|
|
|
|
Util.GetGameObject(this.gameObject, "Power"):GetComponent("Image").sprite = this.spLoader:LoadSprite("t_tongyong-zhanli_zh")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
this.roleGrid=Util.GetGameObject(this.gameObject,"RoleGrid")
|
|
|
|
|
this.line=Util.GetGameObject(this.gameObject,"RoleGrid/Line")
|
|
|
|
|
for i = 1, 6 do
|
|
|
|
|
bgListGo[i]=Util.GetGameObject(this.gameObject,"RoleGrid/Bg"..i)
|
|
|
|
|
heroListGo[i] = Util.GetGameObject(this.gameObject,"RoleGrid/Bg"..i.."/Hero"..i)
|
|
|
|
|
maskListGo[i]=Util.GetGameObject(this.gameObject,"RoleGrid/Mask"..i)
|
|
|
|
|
if not dragViewListGo[i] then
|
|
|
|
|
dragViewListGo[i] = SubUIManager.Open(SubUIConfig.DragView, bgListGo[i].transform)
|
|
|
|
|
end
|
|
|
|
|
dragViewListGo[i].gameObject.name="DragView"..i
|
|
|
|
|
dragViewListGo[i].gameObject:SetActive(false)
|
|
|
|
|
dragViewListGo[i]:SetScrollMouse(false)
|
|
|
|
|
this.trigger[i]=Util.GetEventTriggerListener(dragViewListGo[i].gameObject)
|
|
|
|
|
this.trigger[i].onPointerDown= this.trigger[i].onPointerDown+this.OnPointerDown
|
|
|
|
|
this.trigger[i].onPointerUp= this.trigger[i].onPointerUp+this.OnPointerUp
|
|
|
|
|
this.trigger[i].onEndDrag= this.trigger[i].onEndDrag+this.OnEndDrag
|
|
|
|
|
this.trigger[i].onDrag=this.trigger[i].onDrag+this.OnDrag
|
|
|
|
|
dragViewListGo[i]:SetDragGO(heroListGo[i])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--滚动条
|
|
|
|
|
this.heroPre = Util.GetGameObject(this.gameObject, "Scroll/HeroPre")
|
|
|
|
|
this.empty=Util.GetGameObject(this.gameObject,"Scroll/Empty")
|
|
|
|
|
this.scroll = Util.GetGameObject(this.gameObject, "Scroll")
|
|
|
|
|
this.scrollBar = Util.GetGameObject(this.gameObject, "Scrollbar"):GetComponent("Scrollbar")
|
|
|
|
|
this.scrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView,this.scroll.transform,
|
2022-01-20 17:58:57 +08:00
|
|
|
|
this.heroPre, this.scrollBar, Vector2.New(1010, 490), 1, 5, Vector2.New(40, 35))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.scrollView.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, 0)
|
|
|
|
|
this.scrollView.gameObject:GetComponent("RectTransform").anchorMin = Vector2.New(0.5, 0.5)
|
|
|
|
|
this.scrollView.gameObject:GetComponent("RectTransform").anchorMax = Vector2.New(0.5, 0.5)
|
|
|
|
|
this.scrollView.gameObject:GetComponent("RectTransform").pivot = Vector2.New(0.5, 0.5)
|
|
|
|
|
this.scrollView.moveTween.MomentumAmount = 1
|
|
|
|
|
this.scrollView.moveTween.Strength = 2
|
|
|
|
|
|
|
|
|
|
--筛选按钮
|
2022-03-28 18:18:19 +08:00
|
|
|
|
for i = 0, 5 do
|
2020-05-09 13:31:21 +08:00
|
|
|
|
tabs[i] = Util.GetGameObject(this.gameObject, "Tabs/Grid/Btn" .. i)
|
2021-04-22 18:26:48 +08:00
|
|
|
|
if tabsImg[i + 1] then
|
|
|
|
|
Util.GetGameObject(tabs[i], "Image"):GetComponent("Image").sprite = this.spLoader:LoadSprite(tabsImg[i + 1])
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
this.selectBtn = Util.GetGameObject(this.gameObject, "Tabs/SelectBtn")
|
|
|
|
|
|
|
|
|
|
--副本扫荡
|
|
|
|
|
this.mopUpGo = Util.GetGameObject(self.transform, "root/showMopUp")
|
|
|
|
|
this.btnMpoUpBack = Util.GetGameObject(self.transform, "showMopUp/bg/btnBack")
|
|
|
|
|
this.Slider = Util.GetGameObject(self.transform, "showMopUp/bg/Slider")
|
|
|
|
|
this.numText = Util.GetGameObject(self.transform, "showMopUp/bg/Slider/numText"):GetComponent("Text")
|
|
|
|
|
this.btnMpoUpSure = Util.GetGameObject(self.transform, "showMopUp/bg/btnSure")
|
|
|
|
|
this.buyGoNumTex = Util.GetGameObject(self.transform, "showMopUp/bg/buyGo/numText"):GetComponent("Text")
|
|
|
|
|
-- 购买次数
|
|
|
|
|
this.btnBuyCount = Util.GetGameObject(self.transform, "showMopUp/bg/buyGo/addBtn/GameObject")
|
|
|
|
|
|
|
|
|
|
-- 底部panel
|
|
|
|
|
this.bottom = Util.GetGameObject(self.gameObject, "bottom")
|
|
|
|
|
-- 获取按钮
|
|
|
|
|
this.btn_1 = Util.GetGameObject(self.gameObject, "bottom/btnbox/btn_1")
|
|
|
|
|
this.btn_1_lab = Util.GetGameObject(self.gameObject, "bottom/btnbox/btn_1/btnLab"):GetComponent("Text")
|
|
|
|
|
this.btn_2 = Util.GetGameObject(self.gameObject, "bottom/btnbox/btn_2")
|
|
|
|
|
this.btn_2_lab = Util.GetGameObject(self.gameObject, "bottom/btnbox/btn_2/btnLab"):GetComponent("Text")
|
|
|
|
|
-- tip
|
|
|
|
|
this.mobTip = Util.GetGameObject(self.gameObject, "bottom/mobtip")
|
|
|
|
|
this.costTip = Util.GetGameObject(self.gameObject, "bottom/costtip")
|
|
|
|
|
this.failText = Util.GetGameObject(self.gameObject, "bottom/costtip/fail")
|
|
|
|
|
-- 精英副本扫荡提示
|
|
|
|
|
this.eliteTip = Util.GetGameObject(self.gameObject, "bottom/eliTip")
|
|
|
|
|
this.eliteNumNeed = Util.GetGameObject(this.eliteTip, "condition"):GetComponent("Text")
|
|
|
|
|
-- 跳过战斗
|
|
|
|
|
this.passBattle0 = Util.GetGameObject(self.transform, "bottom/passBattle0")
|
|
|
|
|
this.passBattle1 = Util.GetGameObject(self.transform, "bottom/passBattle1")
|
|
|
|
|
|
|
|
|
|
-- 上阵等级提示
|
2020-09-04 11:33:33 +08:00
|
|
|
|
this.formTip = Util.GetGameObject(self.transform, "formTip")
|
2020-07-20 19:46:08 +08:00
|
|
|
|
-- 上阵元素提示
|
2021-11-11 14:59:15 +08:00
|
|
|
|
this.tips = Util.GetGameObject(self.transform, "bottom/tips")
|
|
|
|
|
this.tip = Util.GetGameObject(self.transform, "bottom/tips/tip")
|
|
|
|
|
this.tips.gameObject:SetActive(false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
this.mopUpGo.transform:SetParent(self.gameObject.transform)
|
|
|
|
|
this.mopUpGo:SetActive(false)
|
|
|
|
|
|
|
|
|
|
--元素共鸣
|
|
|
|
|
this.ElementalResonanceView = SubUIManager.Open(SubUIConfig.ElementalResonanceView, this.gameObject.transform)
|
2021-08-27 13:45:09 +08:00
|
|
|
|
--玉虚论道(3队)切换
|
|
|
|
|
this.switchBar = Util.GetGameObject(self.transform, "SwitchBar")
|
|
|
|
|
this.switchBar:SetActive(false)
|
2021-09-10 15:23:15 +08:00
|
|
|
|
--七界试炼
|
|
|
|
|
this.conditionBar = Util.GetGameObject(self.transform, "ConditionBar")
|
|
|
|
|
this.conditionBar:SetActive(false)
|
2021-11-02 16:24:01 +08:00
|
|
|
|
--山河社稷图
|
|
|
|
|
this.fightlevelconditionBar = Util.GetGameObject(self.transform, "FightLevelConditionBar")
|
|
|
|
|
this.fightlevelconditionBar:SetActive(false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-09-28 16:32:59 +08:00
|
|
|
|
function this:BindEvent()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--返回按钮
|
2021-10-19 09:38:05 +08:00
|
|
|
|
Util.AddOnceClick(this.backBtn, function()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
--筛选按钮
|
2022-04-02 16:03:18 +08:00
|
|
|
|
for i = 0, 5 do
|
2021-10-19 09:38:05 +08:00
|
|
|
|
Util.AddOnceClick(tabs[i], function()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if i == proId then
|
|
|
|
|
proId=ProIdConst.All
|
|
|
|
|
else
|
|
|
|
|
proId=i
|
|
|
|
|
end
|
2021-02-26 14:52:59 +08:00
|
|
|
|
this.OnClickTabBtn(proId, true,true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
--推荐阵容
|
2021-10-19 09:38:05 +08:00
|
|
|
|
Util.AddOnceClick(this.exampleBtn,function()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.FormationExamplePopup)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
--通用逻辑调用
|
2021-10-19 09:38:05 +08:00
|
|
|
|
Util.AddOnceClick(this.btn_1, function()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if this.opView and this.opView.On_Btn1_Click then
|
|
|
|
|
this.opView.On_Btn1_Click(this.curFormationIndex)
|
|
|
|
|
end
|
|
|
|
|
end)
|
2021-10-19 09:38:05 +08:00
|
|
|
|
Util.AddOnceClick(this.btn_2, function()
|
2021-10-28 18:32:21 +08:00
|
|
|
|
if isPress then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
isPress = true
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if this.opView and this.opView.On_Btn2_Click then
|
|
|
|
|
this.opView.On_Btn2_Click(this.curFormationIndex)
|
|
|
|
|
end
|
2021-10-28 18:56:59 +08:00
|
|
|
|
Timer.New(function()
|
|
|
|
|
isPress = false
|
|
|
|
|
end,1):Start()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:AddListener()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Formation.OnFormationChange, this.RefreshPower)
|
2021-09-18 19:19:05 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Formation.OnFormationChange1, this.OnShow)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:RemoveListener()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Formation.OnFormationChange, this.RefreshPower)
|
2021-09-18 19:19:05 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Formation.OnFormationChange1, this.OnShow)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-09-28 16:32:59 +08:00
|
|
|
|
function this:OnSortingOrderChange()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 设置特效
|
|
|
|
|
Util.AddParticleSortLayer(this.effect, self.sortingOrder - orginLayer)
|
2020-07-28 16:54:38 +08:00
|
|
|
|
for _,o in pairs(heroListGo) do
|
2021-11-05 10:24:32 +08:00
|
|
|
|
Util.AddParticleSortLayer(o, self.sortingOrder - orginLayer)
|
2020-07-28 16:54:38 +08:00
|
|
|
|
end
|
2021-11-03 18:11:08 +08:00
|
|
|
|
this.scrollView:ForeachItemGO(function (index, go)
|
2021-11-05 13:37:29 +08:00
|
|
|
|
Util.SetParticleSortLayer(go, self.sortingOrder + 1)
|
2021-11-03 18:11:08 +08:00
|
|
|
|
end)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
orginLayer = self.sortingOrder
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnOpen(_panelType,...)
|
2022-04-18 18:48:06 +08:00
|
|
|
|
Log("panelType:".._panelType)
|
2020-07-25 13:21:30 +08:00
|
|
|
|
panelType = _panelType
|
2020-09-02 13:35:29 +08:00
|
|
|
|
if panelType == FORMATION_TYPE.EXPEDITION or panelType == FORMATION_TYPE.CARBON then
|
2020-07-25 13:21:30 +08:00
|
|
|
|
for k,v in pairs(bgListGo) do
|
2021-04-21 13:12:04 +08:00
|
|
|
|
v:GetComponent("Image").sprite = this.spLoader:LoadSprite("bd_xinkapaifan")
|
2020-07-27 14:13:31 +08:00
|
|
|
|
this.line:GetComponent("RectTransform").sizeDelta = Vector2.New(294.2,439.48)
|
2020-07-25 13:21:30 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
for k,v in pairs(bgListGo) do
|
2021-04-21 13:12:04 +08:00
|
|
|
|
v:GetComponent("Image").sprite = this.spLoader:LoadSprite("t_chengyuankuang_kuang")
|
2020-07-27 14:13:31 +08:00
|
|
|
|
this.line:GetComponent("RectTransform").sizeDelta = Vector2.New(294.2,414.87)
|
2020-07-25 13:21:30 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-24 11:05:40 +08:00
|
|
|
|
-- tempPowerNum=0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.selectBtn:SetActive(false)
|
|
|
|
|
this.passBattle0:SetActive(false)
|
|
|
|
|
this.passBattle1:SetActive(false)
|
|
|
|
|
this.btn_1:SetActive(false)
|
|
|
|
|
this.btn_1:GetComponent("Button").enabled = true
|
|
|
|
|
Util.SetColor(this.btn_1, Color.New(1, 1, 1, 1))
|
|
|
|
|
this.btn_2:SetActive(false)
|
|
|
|
|
this.mobTip:SetActive(false)
|
|
|
|
|
this.costTip:SetActive(false)
|
|
|
|
|
this.eliteTip:SetActive(false)
|
|
|
|
|
this.failText:SetActive(false)
|
|
|
|
|
this.formTip:SetActive(false)
|
2021-11-11 14:59:15 +08:00
|
|
|
|
this.tips:SetActive(false)
|
2020-08-18 10:10:49 +08:00
|
|
|
|
this.empty:SetActive(false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.opView = require(this.PanelOptionView[_panelType])
|
2022-04-02 16:03:18 +08:00
|
|
|
|
LogError("paneltype==".._panelType)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.opView.Init(this, ...)
|
2021-05-13 20:30:10 +08:00
|
|
|
|
parameter = ...
|
2021-09-10 16:25:38 +08:00
|
|
|
|
this.SetCurFormationIndex(this.opView:GetFormationIndex())
|
2020-05-09 13:31:21 +08:00
|
|
|
|
SoundManager.PlaySound(SoundConfig.Sound_BattleStart_01)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnShow()
|
2021-10-28 18:32:21 +08:00
|
|
|
|
isPress = false
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.ElementalResonanceView:OnOpen({sortOrder=self.sortingOrder})
|
|
|
|
|
this.SetDrawLevel()
|
2021-11-02 16:24:01 +08:00
|
|
|
|
--部分界面有特殊条件显示,集体管理
|
|
|
|
|
this.CheckCondition()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2022-01-03 02:17:03 +08:00
|
|
|
|
-- update方法
|
|
|
|
|
function this:Update()
|
|
|
|
|
if this.opView.Update then
|
|
|
|
|
this.opView.Update()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function this:OnClose()
|
2021-10-28 18:32:21 +08:00
|
|
|
|
isPress = false
|
2020-06-28 17:48:49 +08:00
|
|
|
|
tempPowerNum = 0
|
2020-07-24 11:05:40 +08:00
|
|
|
|
this.formationPower = 0
|
|
|
|
|
oldPowerNum = 0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
proId=0--面板关闭时 重置筛选按钮为全部
|
|
|
|
|
for i = 1, #this.choosedList do
|
|
|
|
|
local pos=this.choosedList[i].position
|
|
|
|
|
local o=heroListGo[pos]
|
2020-06-03 19:09:01 +08:00
|
|
|
|
-- if liveNodes[o] then
|
|
|
|
|
-- poolManager:UnLoadLive(liveNames[o], liveNodes[o])
|
|
|
|
|
-- liveNames[o] = nil
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2021-06-01 16:53:08 +08:00
|
|
|
|
if this.curFormationIndex == FormationTypeDef.FORMATION_ENDLESS_MAP then
|
|
|
|
|
EndLessMapManager.SetCanUseHeroNew()
|
|
|
|
|
CheckRedPointStatus(RedPointType.wujinBianDui)
|
2021-06-02 11:08:03 +08:00
|
|
|
|
CheckRedPointStatus(RedPointType.EndlessPanel)
|
2021-06-01 16:53:08 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader:Destroy()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
SubUIManager.Close(this.UpView)
|
|
|
|
|
SubUIManager.Close(this.ElementalResonanceView)
|
|
|
|
|
dragViewListGo={}
|
|
|
|
|
this.scrollView = nil
|
|
|
|
|
end
|
|
|
|
|
|
2021-09-10 16:25:38 +08:00
|
|
|
|
function this.SetCurFormationIndex(_index)
|
|
|
|
|
this.curFormationIndex = _index
|
|
|
|
|
FormationManager.currentFormationIndex = _index
|
|
|
|
|
-- 刷新显示
|
|
|
|
|
this.RefreshFormation(true,true)
|
2021-09-09 11:48:09 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--刷新编队
|
2021-02-26 14:52:59 +08:00
|
|
|
|
function this.RefreshFormation(isTop,isAni)
|
2021-09-10 16:25:38 +08:00
|
|
|
|
proId= ProIdConst.All
|
|
|
|
|
if this.opView.GetCurFormation then
|
|
|
|
|
curFormation = this.opView.GetCurFormation()
|
|
|
|
|
else
|
|
|
|
|
--获取当前编队数据
|
|
|
|
|
if this.curFormationIndex == FormationTypeDef.FORMATION_ENDLESS_MAP then
|
|
|
|
|
this.opView:RrefreshFormation()
|
|
|
|
|
elseif this.curFormationIndex == FormationTypeDef.FORMATION_ENDLESS_MAP then
|
|
|
|
|
EndLessMapManager.RrefreshFormation()
|
|
|
|
|
elseif this.curFormationIndex == FormationTypeDef.EXPEDITION then
|
|
|
|
|
ExpeditionManager.ExpeditionRrefreshFormation()--刷新编队
|
|
|
|
|
elseif this.curFormationIndex == FormationTypeDef.FIGHT_ASSISTANTLEVEL then
|
|
|
|
|
FightLevelManager.RrefreshFormation(parameter)--刷新编队
|
|
|
|
|
end
|
|
|
|
|
curFormation = FormationManager.GetFormationByID(this.curFormationIndex)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--上阵列表赋值
|
|
|
|
|
this.choosedList ={}
|
2021-09-10 16:25:38 +08:00
|
|
|
|
if curFormation.teamHeroInfos then
|
|
|
|
|
for j = 1, #curFormation.teamHeroInfos do
|
|
|
|
|
local teamInfo = curFormation.teamHeroInfos[j]
|
|
|
|
|
-- 加空判断避免不知名错误
|
|
|
|
|
if teamInfo then
|
|
|
|
|
table.insert(this.choosedList, {heroId = teamInfo.heroId, position = teamInfo.position})
|
|
|
|
|
end
|
2020-07-31 18:24:13 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2021-09-10 16:25:38 +08:00
|
|
|
|
-- 刷新显示
|
|
|
|
|
this.RefreshShow(isTop,isAni)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2021-09-10 16:25:38 +08:00
|
|
|
|
function this.RefreshShow(isTop,isAni)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--设置上阵英雄信息
|
|
|
|
|
this.SetCardsData()
|
|
|
|
|
--显示英雄列表
|
2021-09-10 16:25:38 +08:00
|
|
|
|
this.OnClickTabBtn(proId, isTop, isAni)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
--战力
|
2021-09-13 14:11:48 +08:00
|
|
|
|
if this.curFormationIndex~=2001 and this.curFormationIndex~=2002 and this.curFormationIndex~=2003 then
|
|
|
|
|
this.RefreshPower()
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-09-10 16:25:38 +08:00
|
|
|
|
|
2021-09-07 17:05:46 +08:00
|
|
|
|
function this.RefreshHeroList()
|
|
|
|
|
this.OnClickTabBtn(proId,false,false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-09-07 17:05:46 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--设置编队上阵英雄信息
|
|
|
|
|
function this.SetCardsData()
|
2020-08-11 09:48:21 +08:00
|
|
|
|
if this.curFormationIndex == FormationTypeDef.PEOPLE_MIRROR
|
|
|
|
|
or this.curFormationIndex == FormationTypeDef.BUDDHIST_MIRROR
|
|
|
|
|
or this.curFormationIndex == FormationTypeDef.MAGIC_MIRROR
|
|
|
|
|
or this.curFormationIndex == FormationTypeDef.TAOIST_MIRROR then
|
|
|
|
|
this.opView.RefreshFormation(this.choosedList)
|
|
|
|
|
end
|
2021-01-22 14:24:24 +08:00
|
|
|
|
|
|
|
|
|
LogGreen("刷新编队·············· ")
|
2021-09-29 17:34:20 +08:00
|
|
|
|
FormationManager.UpdateTemporaryFormation(FormationTypeDef.FORMATION_TEMPORARY, this.choosedList)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.formationPower = 0--战力
|
2021-09-16 13:35:33 +08:00
|
|
|
|
this.formationPowerOld = 0--战力
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--元素共鸣
|
|
|
|
|
this.ElementalResonanceView:GetElementalType(this.choosedList,1)
|
|
|
|
|
this.ElementalResonanceView:SetPosition(1)
|
|
|
|
|
|
|
|
|
|
this.InitArmPos()
|
2020-07-14 14:49:15 +08:00
|
|
|
|
this.InitArmData()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
|
|
|
|
|
--编队为0显示0战力
|
|
|
|
|
if #this.choosedList<=0 then
|
|
|
|
|
this.formationPower=0
|
2021-09-16 13:35:33 +08:00
|
|
|
|
this.formationPowerOld = 0
|
2020-05-25 19:16:23 +08:00
|
|
|
|
end
|
|
|
|
|
this.power.text=this.formationPower
|
|
|
|
|
|
|
|
|
|
--飘战力
|
|
|
|
|
local newPowerNum = this.formationPower
|
2020-06-28 17:48:49 +08:00
|
|
|
|
if tempPowerNum ~= newPowerNum and tempPowerNum ~= 0 then
|
2020-05-25 19:16:23 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = tempPowerNum,newValue = newPowerNum,pos=Vector3.New(-467,837.2),duration=0.7,isShowBg=false,isShowOldNum=false,pivot=Vector2.New(0,0.5)})
|
|
|
|
|
end
|
|
|
|
|
tempPowerNum = this.formationPower
|
2021-11-02 16:24:01 +08:00
|
|
|
|
--部分界面有特殊条件显示,集体管理
|
|
|
|
|
this.CheckCondition()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
-- 设置编队上阵位置显隐
|
|
|
|
|
function this.InitArmPos()
|
|
|
|
|
for i = 1, 6 do
|
|
|
|
|
local mask =maskListGo[i]
|
|
|
|
|
local info= heroListGo[i]
|
|
|
|
|
local limitStr = Util.GetGameObject(mask, "lvLimit"):GetComponent("Text")
|
|
|
|
|
local armNum = ActTimeCtrlManager.MaxArmyNum()--最大上阵人数
|
|
|
|
|
local canOn = i<= armNum--能上阵
|
|
|
|
|
limitStr.text = ActTimeCtrlManager.UnLockCondition(i)
|
|
|
|
|
|
|
|
|
|
-- 显示解锁条件
|
|
|
|
|
mask:SetActive(not canOn)
|
|
|
|
|
if #this.choosedList==0 then
|
|
|
|
|
info:SetActive(false)
|
|
|
|
|
dragViewListGo[i].gameObject:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
-- 显示上阵的英雄
|
|
|
|
|
local heroData
|
|
|
|
|
for j = 1, #this.choosedList do
|
|
|
|
|
if i== this.choosedList[j].position then
|
|
|
|
|
heroData = HeroManager.GetSingleHeroData(this.choosedList[j].heroId)
|
|
|
|
|
if not heroData then
|
|
|
|
|
LogError("heroData is not exist! error Did:" .. this.choosedList[j].heroId)
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
info:SetActive(true)
|
|
|
|
|
dragViewListGo[i].gameObject:SetActive(true)
|
|
|
|
|
break
|
|
|
|
|
else
|
|
|
|
|
info:SetActive(false)
|
|
|
|
|
dragViewListGo[i].gameObject:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- 设置编队上阵数据
|
2020-07-14 14:49:15 +08:00
|
|
|
|
function this.InitArmData()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--为每个英雄添加拖动组件
|
|
|
|
|
for n = 1, #this.choosedList do
|
2020-07-14 14:49:15 +08:00
|
|
|
|
local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(this.choosedList,this.choosedList[n].heroId)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--已上阵操作
|
|
|
|
|
local pos=this.choosedList[n].position
|
|
|
|
|
|
|
|
|
|
-- LogBlue("源数据位置信息"..pos.." "..HeroManager.GetSingleHeroData(this.choosedList[n].heroId).id.." "..this.choosedList[n].position)
|
|
|
|
|
local heroId = this.choosedList[n].heroId
|
|
|
|
|
local heroData = HeroManager.GetSingleHeroData(heroId)
|
|
|
|
|
|
|
|
|
|
--设置单个上阵英雄信息
|
2020-06-08 13:57:30 +08:00
|
|
|
|
this.SetCardSingleData(heroListGo[pos],heroId,tonumber(pos), heroData)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--战力计算
|
|
|
|
|
this.CalculateAllHeroPower(heroData,allHeroTeamAddProVal)
|
|
|
|
|
--英雄长按
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local heroClick=Util.GetGameObject(bgListGo[pos],"DragView"..pos)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.AddLongPressClick(heroClick, function()
|
2020-11-28 17:13:01 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.RoleInfoPopup, heroData,nil,this.choosedList,#this.choosedList)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end, 0.5)
|
|
|
|
|
end
|
2022-03-21 17:46:30 +08:00
|
|
|
|
this.formationPower=this.formationPower+PracticeManager.GetPracticeAddPower()
|
2021-03-10 17:33:13 +08:00
|
|
|
|
if this.curFormationIndex == FormationTypeDef.EXPEDITION then-- 远征加圣物战力
|
|
|
|
|
this.formationPower = math.floor(this.formationPower * (1 + ExpeditionManager.CalculateallHolyWarPower()/10000))
|
|
|
|
|
-- Log("所有圣物战力万分比 "..ExpeditionManager.CalculateallHolyWarPower())
|
2021-05-29 16:34:00 +08:00
|
|
|
|
elseif this.curFormationIndex == FormationTypeDef.FORMATION_ENDLESS_MAP then-- 远征加圣物战力
|
|
|
|
|
local id,lv = EndLessMapManager.GetShiQiValue()
|
|
|
|
|
if lv > 0 then
|
|
|
|
|
local config = ConfigManager.GetConfigData(ConfigName.endlessMorale,id)
|
|
|
|
|
this.formationPower = math.floor(this.formationPower * (1 + config.FightUp/100))
|
|
|
|
|
end
|
2021-03-10 17:33:13 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--设置单个上阵英雄信息
|
2020-06-08 13:57:30 +08:00
|
|
|
|
function this.SetCardSingleData(o, heroId, _pos, _heroData)
|
2020-06-03 19:09:01 +08:00
|
|
|
|
local bg=Util.GetGameObject(o,"Bg1"):GetComponent("Image")
|
2020-12-22 15:41:45 +08:00
|
|
|
|
|
2020-07-25 13:21:30 +08:00
|
|
|
|
local lv=Util.GetGameObject(o,"lv/Text"):GetComponent("Text")
|
|
|
|
|
local hp = Util.GetGameObject(o,"hpProgress/hp"):GetComponent("Image")
|
|
|
|
|
local hpPass = Util.GetGameObject(o,"hpProgress/hpPass"):GetComponent("Image")
|
|
|
|
|
local rage = Util.GetGameObject(o,"rageProgress/rage"):GetComponent("Image")
|
2020-07-27 14:13:31 +08:00
|
|
|
|
|
2020-06-03 19:09:01 +08:00
|
|
|
|
local fg=Util.GetGameObject(o,"Bg2"):GetComponent("Image")
|
|
|
|
|
-- local live=Util.GetGameObject(o,"Mask/Live")
|
2020-07-25 13:21:30 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local pro=Util.GetGameObject(o,"Pro/Image"):GetComponent("Image")
|
|
|
|
|
local starGrid=Util.GetGameObject(o,"StarGrid")
|
2021-01-28 11:42:05 +08:00
|
|
|
|
local nameParent = Util.GetGameObject(o,"Name")
|
|
|
|
|
local name=Util.GetGameObject(nameParent,"Text"):GetComponent("Text")
|
2020-06-03 19:09:01 +08:00
|
|
|
|
-- local pos=Util.GetGameObject(o,"Pos"):GetComponent("Image")
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local yuanImage=Util.GetGameObject(o,"yuanImage")
|
2022-01-17 16:53:26 +08:00
|
|
|
|
--local flyImg=Util.GetGameObject(o,"flyImg"):GetComponent("Image")
|
2021-05-14 19:11:40 +08:00
|
|
|
|
local heroData = HeroManager.GetSingleHeroData(heroId)
|
2022-01-21 17:09:14 +08:00
|
|
|
|
local kaPaiEffect=Util.GetGameObject(o,"UI_Effect_jinkuang_KaPai")
|
2020-06-03 19:09:01 +08:00
|
|
|
|
local live = Util.GetGameObject(o, "Mask/icon"):GetComponent("RawImage")
|
2022-03-28 18:18:19 +08:00
|
|
|
|
|
2020-11-04 16:51:45 +08:00
|
|
|
|
local liveName = heroData.live
|
2020-11-06 10:51:41 +08:00
|
|
|
|
local roleConfig = {}
|
2021-11-30 20:43:56 +08:00
|
|
|
|
local toward=0
|
2022-01-21 17:09:14 +08:00
|
|
|
|
if panelType == FORMATION_TYPE.EXPEDITION or panelType == FORMATION_TYPE.CARBON then
|
|
|
|
|
bg.sprite = this.spLoader:LoadSprite(GetFormationHeroCardStarBg[_heroData.star])
|
|
|
|
|
Util.GetGameObject(o,"hpProgress").gameObject:SetActive(true)
|
|
|
|
|
Util.GetGameObject(o,"rageProgress").gameObject:SetActive(false)
|
|
|
|
|
kaPaiEffect.transform.localScale=Vector3.New(1,1.1,1)
|
|
|
|
|
kaPaiEffect.transform.localPosition=Vector3.New(-8,-16,0)
|
|
|
|
|
else
|
|
|
|
|
bg.sprite = this.spLoader:LoadSprite(GetHeroCardStarBg[_heroData.star])
|
|
|
|
|
Util.GetGameObject(o,"hpProgress").gameObject:SetActive(false)
|
|
|
|
|
Util.GetGameObject(o,"rageProgress").gameObject:SetActive(false)
|
|
|
|
|
kaPaiEffect.transform.localScale=Vector3.New(1,1,1)
|
|
|
|
|
kaPaiEffect.transform.localPosition=Vector3.New(-8,0,0)
|
|
|
|
|
end
|
2020-11-06 10:51:41 +08:00
|
|
|
|
if heroData.skinId == 0 then
|
|
|
|
|
roleConfig = ConfigManager.GetConfigData(ConfigName.RoleConfig, heroData.heroConfig.Id)
|
2021-11-30 20:43:56 +08:00
|
|
|
|
toward=heroData.heroConfig.Toward
|
2020-11-06 10:51:41 +08:00
|
|
|
|
else
|
|
|
|
|
roleConfig = ConfigManager.GetConfigData(ConfigName.RoleConfig, heroData.skinId)
|
2021-11-30 20:43:56 +08:00
|
|
|
|
toward=roleConfig.Toward
|
2020-11-06 10:51:41 +08:00
|
|
|
|
end
|
2022-03-28 18:18:19 +08:00
|
|
|
|
|
2020-06-03 19:09:01 +08:00
|
|
|
|
local scale = roleConfig.play_liveScale
|
2020-06-13 11:47:13 +08:00
|
|
|
|
local livePos = Vector3.New(roleConfig.offset[1], roleConfig.offset[2], 0)
|
2020-07-08 21:21:49 +08:00
|
|
|
|
live.texture = CardRendererManager.GetSpineTexture(_pos, liveName, Vector3.one * scale, livePos, true)
|
2021-11-30 20:43:56 +08:00
|
|
|
|
SetHEeroLiveToward(live,toward,heroData.heroConfig.Position)
|
2020-06-13 11:47:13 +08:00
|
|
|
|
live.transform.localScale = Vector3.one
|
|
|
|
|
live.transform.localPosition = Vector3.zero
|
2020-06-03 19:09:01 +08:00
|
|
|
|
|
|
|
|
|
local zs = Util.GetGameObject(o, "zs")
|
|
|
|
|
local zsName = GetHeroCardStarZs[heroData.star]
|
|
|
|
|
if zsName == "" then
|
|
|
|
|
zs:SetActive(false)
|
|
|
|
|
else
|
|
|
|
|
zs:SetActive(true)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
zs:GetComponent("Image").sprite = this.spLoader:LoadSprite(zsName)
|
2020-06-03 19:09:01 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-05-25 19:16:23 +08:00
|
|
|
|
yuanImage:SetActive(heroData.createtype == 1)
|
2020-12-22 15:41:45 +08:00
|
|
|
|
if HarmonyManager.IsChangeColor(heroData.dynamicId) then
|
|
|
|
|
lv.text="<color=#0f0>"..heroData.lv.."</color>"
|
2021-01-15 15:44:43 +08:00
|
|
|
|
elseif HarmonyManager:IsEnvoy(heroData.dynamicId) and HarmonyManager:HongMengTowerUpLimit() >= HarmonyManager.TowerStartLimit then
|
|
|
|
|
lv.text="<color=#ffbe22>"..heroData.lv.."</color>"
|
2020-12-22 15:41:45 +08:00
|
|
|
|
else
|
|
|
|
|
lv.text=heroData.lv
|
|
|
|
|
end
|
2020-07-25 13:21:30 +08:00
|
|
|
|
|
|
|
|
|
|
2021-04-21 13:12:04 +08:00
|
|
|
|
fg.sprite = this.spLoader:LoadSprite(GetHeroCardStarFg[heroData.star])
|
2022-04-07 15:09:04 +08:00
|
|
|
|
pro.sprite=this.spLoader:LoadSprite(GetProStrImageByProNum(heroData.property))
|
2021-10-27 12:50:15 +08:00
|
|
|
|
local star,starType = heroData.GetStar()
|
2021-10-27 15:24:46 +08:00
|
|
|
|
if starType == 3 then
|
2022-01-20 17:58:57 +08:00
|
|
|
|
if heroData.star>11 then
|
|
|
|
|
fg.sprite = this.spLoader:LoadSprite("t_zhandoukuang_lanjin02")
|
|
|
|
|
else
|
|
|
|
|
fg.sprite = this.spLoader:LoadSprite("t_zhandoukuang_zhuangshi006")
|
|
|
|
|
end
|
2021-10-27 15:24:46 +08:00
|
|
|
|
end
|
2021-10-27 12:50:15 +08:00
|
|
|
|
SetCardStars(starGrid,star,starType)
|
2020-07-28 16:54:38 +08:00
|
|
|
|
if heroData.star > 9 then
|
2022-01-21 17:09:14 +08:00
|
|
|
|
kaPaiEffect:SetActive(true)
|
2020-07-28 16:54:38 +08:00
|
|
|
|
else
|
2022-01-21 17:09:14 +08:00
|
|
|
|
kaPaiEffect:SetActive(false)
|
2020-07-28 16:54:38 +08:00
|
|
|
|
end
|
2022-01-21 17:09:14 +08:00
|
|
|
|
SetHeroFormationFlyEffect(o,this.spLoader,kaPaiEffect,heroData.star,orginLayer)
|
|
|
|
|
|
2021-01-26 17:08:39 +08:00
|
|
|
|
name.text=GetLanguageStrById(heroData.heroConfig.ReadingName)
|
|
|
|
|
SetTextVerTial(name.gameObject,Vector3.New(29.24,-7.45,0),nil,nil,8)
|
2020-06-08 13:57:30 +08:00
|
|
|
|
|
|
|
|
|
local curHeroHpVal = FormationManager.GetFormationHeroHp(this.curFormationIndex,_heroData.dynamicId)
|
|
|
|
|
hp.fillAmount = curHeroHpVal or 1
|
|
|
|
|
hpPass.fillAmount = curHeroHpVal or 1
|
|
|
|
|
rage.fillAmount = 0.5
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
--战力计算
|
|
|
|
|
function this.CalculateAllHeroPower(curHeroData,allHeroTeamAddProVal)
|
2021-01-22 14:24:24 +08:00
|
|
|
|
-- HeroPowerManager.GetHeroPower(dId, formationId)
|
2021-09-23 16:16:57 +08:00
|
|
|
|
-- local allEquipAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal, nil, FormationTypeDef.FORMATION_TEMPORARY)
|
|
|
|
|
-- this.formationPowerOld = this.formationPowerOld + allEquipAddProVal[HeroProType.WarPower]
|
|
|
|
|
-- LogPink("OLD TEAM POWER:"..this.formationPowerOld)
|
2021-01-22 14:24:24 +08:00
|
|
|
|
local allEquipAddProVal = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_TEMPORARY)--HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal)
|
|
|
|
|
this.formationPower = this.formationPower + allEquipAddProVal--[HeroProType.WarPower]
|
2021-09-16 13:35:33 +08:00
|
|
|
|
LogPink("NEW TEAM POWER:"..this.formationPower)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--点击筛选
|
2021-02-26 14:52:59 +08:00
|
|
|
|
function this.OnClickTabBtn(_proId, isTop,isAni)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.selectBtn:SetActive(proId ==_proId)
|
|
|
|
|
this.selectBtn.transform:SetParent(tabs[_proId].transform)
|
|
|
|
|
this.selectBtn.transform:DOAnchorPos(Vector3.zero,0)
|
|
|
|
|
this.selectBtn.transform:DOScale(Vector3.one,0)
|
2021-09-10 16:25:38 +08:00
|
|
|
|
-- 定制显示
|
|
|
|
|
local heros = {}
|
|
|
|
|
if this.opView.GetHeroList then
|
|
|
|
|
heros = this.opView.GetHeroList(_proId)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2020-05-25 19:16:23 +08:00
|
|
|
|
if _proId == ProIdConst.All then
|
2021-09-10 16:25:38 +08:00
|
|
|
|
heros = HeroManager.GetAllHeroDatas()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
else
|
2021-09-10 16:25:38 +08:00
|
|
|
|
heros = HeroManager.GetHeroDataByProperty(_proId)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
this.empty:SetActive(#heros<=0)
|
2021-02-26 14:52:59 +08:00
|
|
|
|
this.SetRoleList(heros, isTop,isAni)
|
2021-09-23 16:16:57 +08:00
|
|
|
|
|
2021-09-23 16:05:18 +08:00
|
|
|
|
if this.opView.SetCampIconByCurType then
|
2021-03-11 15:26:57 +08:00
|
|
|
|
this.opView.SetCampIconByCurType(tabs,this.selectBtn)
|
|
|
|
|
else
|
|
|
|
|
for i = 0 , #tabs do
|
|
|
|
|
Util.SetGray(tabs[i],false)
|
|
|
|
|
tabs[i]:GetComponent("Button").enabled = true
|
|
|
|
|
end
|
|
|
|
|
this.selectBtn:SetActive(proId ==_proId)
|
|
|
|
|
this.selectBtn.transform:SetParent(tabs[_proId].transform)
|
|
|
|
|
this.selectBtn.transform:DOAnchorPos(Vector3.zero,0)
|
|
|
|
|
this.selectBtn.transform:DOScale(Vector3.one,0)
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--设置英雄列表数据
|
2021-02-26 14:52:59 +08:00
|
|
|
|
function this.SetRoleList(_roleDatas, isTop,isAni)
|
2021-12-28 13:30:27 +08:00
|
|
|
|
if panelType == FORMATION_TYPE.ExploreFunc then
|
|
|
|
|
_roleDatas = this.opView.SortHeroDatas(_roleDatas)
|
|
|
|
|
elseif this.opView.SortHeroDatas then
|
2021-03-01 20:05:31 +08:00
|
|
|
|
this.opView.SortHeroDatas(_roleDatas)
|
|
|
|
|
else
|
|
|
|
|
this.SortHeroDatas(_roleDatas)
|
|
|
|
|
end
|
2021-10-13 15:26:12 +08:00
|
|
|
|
|
|
|
|
|
--刷新玉虚论道缓存的阵容数据
|
2021-09-10 21:34:45 +08:00
|
|
|
|
if this.curFormationIndex==2001 or this.curFormationIndex==2002 or this.curFormationIndex==2003 then
|
|
|
|
|
this.opView.RemoveTeamByIndex(this.curFormationIndex)
|
2021-10-13 15:26:12 +08:00
|
|
|
|
for i,v in pairs(this.choosedList) do
|
|
|
|
|
--LogError("刷新添加=== id=="..v.heroId.." pos=="..v.position)
|
|
|
|
|
this.opView.AddHeroToTeam(v.heroId,v.position,this.curFormationIndex)
|
|
|
|
|
end
|
2021-09-10 21:34:45 +08:00
|
|
|
|
end
|
2021-10-13 15:26:12 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- local curFormation = FormationManager.formationList[this.curFormationIndex]
|
|
|
|
|
this.scrollView:SetData(_roleDatas, function(index, go)
|
2022-01-03 02:17:03 +08:00
|
|
|
|
-- 基础显示
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.SingleHeroDataShow(go, _roleDatas[index])
|
2022-01-03 02:17:03 +08:00
|
|
|
|
-- 神将列表单个神将内容显示定制
|
|
|
|
|
if this.opView.HeroItemAdapter then
|
|
|
|
|
this.opView.HeroItemAdapter(go, _roleDatas[index])
|
|
|
|
|
else
|
|
|
|
|
Util.GetGameObject(go, "specialType"):SetActive(false)
|
2022-01-07 16:40:31 +08:00
|
|
|
|
Util.GetGameObject(go, "posCha"):SetActive(false)
|
2022-01-03 02:17:03 +08:00
|
|
|
|
end
|
2021-02-26 14:52:59 +08:00
|
|
|
|
end, not isTop,not isAni)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2021-03-01 20:05:31 +08:00
|
|
|
|
|
2021-12-28 13:30:27 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--排序英雄数据
|
|
|
|
|
function this.SortHeroDatas(_heroDatas)
|
|
|
|
|
local choosed = {}
|
|
|
|
|
local dieHeros = {}
|
2021-05-15 18:25:45 +08:00
|
|
|
|
local notExisted = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local curFormation = FormationManager.GetFormationByID(this.curFormationIndex)
|
|
|
|
|
for i = 1, #_heroDatas do
|
|
|
|
|
local heroHp = FormationManager.GetFormationHeroHp(this.curFormationIndex, _heroDatas[i].dynamicId)
|
|
|
|
|
if heroHp then
|
|
|
|
|
if heroHp <= 0 then
|
|
|
|
|
dieHeros[_heroDatas[i].dynamicId] = _heroDatas[i].dynamicId
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-05-15 18:25:45 +08:00
|
|
|
|
for i = 1, #_heroDatas do
|
|
|
|
|
if _heroDatas[i].exist and _heroDatas[i].exist == 0 then
|
|
|
|
|
notExisted[_heroDatas[i].dynamicId] = _heroDatas[i].dynamicId
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
for j = 1, #curFormation.teamHeroInfos do
|
|
|
|
|
local teamInfo = curFormation.teamHeroInfos[j]
|
2020-08-26 11:26:32 +08:00
|
|
|
|
if teamInfo then
|
|
|
|
|
choosed[teamInfo.heroId] = j
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
table.sort(_heroDatas, function(a, b)
|
|
|
|
|
if (choosed[a.dynamicId] and choosed[b.dynamicId]) or
|
|
|
|
|
(not choosed[a.dynamicId] and not choosed[b.dynamicId])
|
|
|
|
|
then
|
2021-05-15 18:25:45 +08:00
|
|
|
|
if (notExisted[a.dynamicId] and notExisted[b.dynamicId]) or
|
|
|
|
|
(not notExisted[a.dynamicId] and not notExisted[b.dynamicId])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
then
|
2021-05-15 18:25:45 +08:00
|
|
|
|
if (dieHeros[a.dynamicId] and dieHeros[b.dynamicId]) or
|
|
|
|
|
(not dieHeros[a.dynamicId] and not dieHeros[b.dynamicId])
|
|
|
|
|
then
|
|
|
|
|
return this.NaturalSort(sortType == SortTypeConst.Natural,a,b)
|
|
|
|
|
else
|
|
|
|
|
return not dieHeros[a.dynamicId] and dieHeros[b.dynamicId]
|
|
|
|
|
end
|
|
|
|
|
else
|
2021-05-18 11:44:17 +08:00
|
|
|
|
return not notExisted[a.dynamicId] and notExisted[b.dynamicId]
|
2021-05-15 18:25:45 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return choosed[a.dynamicId] and not choosed[b.dynamicId]
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.NaturalSort(isNature,a,b)
|
|
|
|
|
if isNature then
|
|
|
|
|
if a.heroConfig.Natural == b.heroConfig.Natural then
|
|
|
|
|
if a.heroConfig.Quality == b.heroConfig.Quality then
|
2021-11-08 15:04:53 +08:00
|
|
|
|
local aGodLv = GodSoulManager.GetGodSoulLv(a.dynamicId)
|
|
|
|
|
local bGodLv = GodSoulManager.GetGodSoulLv(b.dynamicId)
|
|
|
|
|
if aGodLv == bGodLv then
|
|
|
|
|
if a.star == b.star then
|
|
|
|
|
if a.lv == b.lv then
|
|
|
|
|
if a.warPower == b.warPower then
|
|
|
|
|
if a.id == b.id then
|
2022-04-07 15:09:04 +08:00
|
|
|
|
if a.property==b.property then
|
|
|
|
|
return a.property<b.property
|
2022-03-31 18:11:08 +08:00
|
|
|
|
else
|
|
|
|
|
return a.sortId > b.sortId
|
|
|
|
|
end
|
2021-11-08 15:04:53 +08:00
|
|
|
|
else
|
|
|
|
|
return a.id > b.id
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2021-11-08 15:04:53 +08:00
|
|
|
|
return a.warPower > b.warPower
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
2021-11-08 15:04:53 +08:00
|
|
|
|
return a.lv > b.lv
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
2021-11-08 15:04:53 +08:00
|
|
|
|
return a.star > b.star
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
2021-11-08 15:04:53 +08:00
|
|
|
|
return aGodLv > bGodLv
|
2021-05-15 18:25:45 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.heroConfig.Quality > b.heroConfig.Quality
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.heroConfig.Natural > b.heroConfig.Natural
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if a.lv == b.lv then
|
|
|
|
|
if a.heroConfig.Quality == b.heroConfig.Quality then
|
2021-11-08 15:04:53 +08:00
|
|
|
|
local aGodLv = GodSoulManager.GetGodSoulLv(a.dynamicId)
|
|
|
|
|
local bGodLv = GodSoulManager.GetGodSoulLv(b.dynamicId)
|
|
|
|
|
if aGodLv == bGodLv then
|
|
|
|
|
if a.star == b.star then
|
|
|
|
|
if a.heroConfig.Natural == b.heroConfig.Natural then
|
|
|
|
|
if a.warPower == b.warPower then
|
|
|
|
|
if a.id == b.id then
|
|
|
|
|
return a.sortId > b.sortId
|
|
|
|
|
else
|
|
|
|
|
return a.id > b.id
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2021-11-08 15:04:53 +08:00
|
|
|
|
return a.warPower > b.warPower
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
2021-11-08 15:04:53 +08:00
|
|
|
|
return a.heroConfig.Natural > b.heroConfig.Natural
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
2021-11-08 15:04:53 +08:00
|
|
|
|
return a.star > b.star
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2021-05-15 18:25:45 +08:00
|
|
|
|
else
|
2021-11-08 15:04:53 +08:00
|
|
|
|
return aGodLv > bGodLv
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
2021-05-15 18:25:45 +08:00
|
|
|
|
return a.heroConfig.Quality > b.heroConfig.Quality
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
2021-05-15 18:25:45 +08:00
|
|
|
|
return a.lv > b.lv
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2021-05-15 18:25:45 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
--设置每条英雄数据
|
|
|
|
|
function this.SingleHeroDataShow(_go, _heroData)
|
|
|
|
|
local go=_go
|
|
|
|
|
local heroData=_heroData
|
|
|
|
|
local frame=Util.GetGameObject(go,"frame"):GetComponent("Image")
|
|
|
|
|
local icon=Util.GetGameObject(go, "icon"):GetComponent("Image")
|
|
|
|
|
local lv= Util.GetGameObject(go, "lv/Text"):GetComponent("Text")
|
|
|
|
|
local pro= Util.GetGameObject(go, "proIcon"):GetComponent("Image")
|
2021-05-18 15:17:05 +08:00
|
|
|
|
local pos= Util.GetGameObject(go, "posIcon"):GetComponent("Image")
|
2021-09-14 10:10:57 +08:00
|
|
|
|
local teamList={}
|
|
|
|
|
for i = 1, 3 do
|
|
|
|
|
table.insert(teamList,Util.GetGameObject(go, "yxteamName/Image"..i))
|
|
|
|
|
end
|
2021-09-07 17:05:46 +08:00
|
|
|
|
local yxInfo=Util.GetGameObject(go, "yxteamName")
|
2021-09-14 10:10:57 +08:00
|
|
|
|
--local yxTeamName=Util.GetGameObject(go, "yxteamName/Text"):GetComponent("Text")
|
2021-09-10 16:25:38 +08:00
|
|
|
|
yxInfo:SetActive(false)
|
2021-09-10 16:39:43 +08:00
|
|
|
|
Util.GetGameObject(go, "posIcon"):SetActive(this.curFormationIndex == FormationTypeDef.FIGHT_LEVEL or this.curFormationIndex == FormationTypeDef.FIGHT_ASSISTANTLEVEL or
|
2021-09-10 10:30:50 +08:00
|
|
|
|
this.curFormationIndex == FormationTypeDef.FORMATION_QIJIESHILIAN)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local starGrid = Util.GetGameObject(go, "star")
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local yuanImage = Util.GetGameObject(go, "yuanImage")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local choosedObj = Util.GetGameObject(go, "choosed")
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local hpExp = Util.GetGameObject(go, "hpExp")
|
2021-06-01 16:53:08 +08:00
|
|
|
|
local redPot = Util.GetGameObject(go, "redpoint")
|
2022-03-28 18:18:19 +08:00
|
|
|
|
local changeProBtn=Util.GetGameObject(go,"proMaskObj")
|
2021-06-01 16:53:08 +08:00
|
|
|
|
if heroData.isNew and heroData.isNew == 1 then
|
|
|
|
|
redPot.gameObject:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
redPot.gameObject:SetActive(false)
|
|
|
|
|
end
|
2022-04-07 15:09:04 +08:00
|
|
|
|
if _heroData.property then
|
|
|
|
|
changeProBtn:SetActive(_heroData.property>=5)
|
|
|
|
|
pro.sprite= this.spLoader:LoadSprite(GetProStrImageByProNum(heroData.property))
|
|
|
|
|
else
|
|
|
|
|
changeProBtn:SetActive(false)
|
|
|
|
|
LogError("+++++++")
|
|
|
|
|
pro.sprite= this.spLoader:LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName))
|
|
|
|
|
end
|
2021-04-21 13:12:04 +08:00
|
|
|
|
frame.sprite=this.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality,heroData.star))
|
|
|
|
|
icon.sprite=this.spLoader:LoadSprite(heroData.icon)
|
2020-12-22 15:41:45 +08:00
|
|
|
|
if HarmonyManager.IsChangeColor(heroData.dynamicId) then
|
|
|
|
|
-- body
|
|
|
|
|
lv.text="<color=#0f0>"..heroData.lv.."</color>"
|
2021-01-15 15:44:43 +08:00
|
|
|
|
elseif HarmonyManager:IsEnvoy(heroData.dynamicId) and HarmonyManager:HongMengTowerUpLimit() >= HarmonyManager.TowerStartLimit then
|
2020-12-22 15:41:45 +08:00
|
|
|
|
-- bod
|
|
|
|
|
lv.text="<color=#ffbe22>"..heroData.lv.."</color>"
|
|
|
|
|
else
|
|
|
|
|
lv.text=heroData.lv
|
|
|
|
|
end
|
|
|
|
|
|
2022-04-07 15:09:04 +08:00
|
|
|
|
|
2021-05-19 14:12:37 +08:00
|
|
|
|
pos.sprite = this.spLoader:LoadSprite(heroData.professionIcon)
|
2021-10-26 16:00:31 +08:00
|
|
|
|
local star,starType = heroData.GetStar(1)
|
2021-10-27 12:50:15 +08:00
|
|
|
|
local starSize = Vector2.New(30,30)
|
|
|
|
|
local starScale = -8
|
|
|
|
|
if starType == 3 then
|
2021-11-03 18:38:13 +08:00
|
|
|
|
starSize = Vector2.New(1,-15.65)
|
|
|
|
|
starScale = -13
|
2021-11-03 10:13:44 +08:00
|
|
|
|
elseif starType == 2 then
|
|
|
|
|
starSize = Vector2.New(60,57)
|
2021-10-27 12:50:15 +08:00
|
|
|
|
end
|
|
|
|
|
SetHeroStars(this.spLoader, starGrid, star,starType,starSize,starScale)
|
2022-01-19 16:57:17 +08:00
|
|
|
|
local effect=SetHeroFlyEffect(go,this.spLoader,heroData.star,this.sortingOrder,1,4)
|
2022-01-07 10:08:55 +08:00
|
|
|
|
if effect then
|
|
|
|
|
local meshs2=effect:GetComponentsInChildren(typeof(UnityEngine.SkinnedMeshRenderer))
|
|
|
|
|
for key, value in pairs(meshs2:ToTable()) do
|
|
|
|
|
if value.material.shader.name=="YXZ/Effect/TransparentRim" then
|
|
|
|
|
value.material.shader=poolManager:LoadAsset("YXZ_Effect_TransparentRim_1",poolManager.AssetType.Other)
|
|
|
|
|
end
|
|
|
|
|
end
|
2022-01-19 15:29:47 +08:00
|
|
|
|
local particles=effect:GetComponentsInChildren(typeof(UnityEngine.ParticleSystem))
|
|
|
|
|
for key, value in pairs(particles:ToTable()) do
|
|
|
|
|
local mat=value:GetComponent(typeof(UnityEngine.Renderer))
|
|
|
|
|
if mat.material.shader.name=="YXZ/Effect/Mix Masking(Without Moving)_alphablend" then
|
|
|
|
|
mat.material.shader=poolManager:LoadAsset("YXZ_MixMaskingWithoutMoving_alphablend_1",poolManager.AssetType.Other)
|
|
|
|
|
end
|
|
|
|
|
end
|
2022-01-07 10:08:55 +08:00
|
|
|
|
end
|
2022-01-12 16:41:51 +08:00
|
|
|
|
local meshs1=starGrid:GetComponentsInChildren(typeof(UnityEngine.ParticleSystem))
|
|
|
|
|
for key, value in pairs(meshs1:ToTable()) do
|
|
|
|
|
local mat=value:GetComponent(typeof(UnityEngine.Renderer))
|
|
|
|
|
if mat.material.shader.name=="UI Particles/Additive" then
|
|
|
|
|
mat.material.shader=poolManager:LoadAsset("UI-Particle-Add_1",poolManager.AssetType.Other)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-11-05 10:18:10 +08:00
|
|
|
|
Util.SetParticleSortLayer(go, this.sortingOrder + 1)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
--血量显示
|
|
|
|
|
local curHeroHpVal = FormationManager.GetFormationHeroHp(this.curFormationIndex,_heroData.dynamicId)
|
2020-06-30 18:59:44 +08:00
|
|
|
|
yuanImage:SetActive(heroData.createtype == 1)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
if not curHeroHpVal then
|
|
|
|
|
Util.SetGray(go,false)
|
|
|
|
|
hpExp:SetActive(false)
|
|
|
|
|
else
|
|
|
|
|
hpExp:SetActive(true)
|
|
|
|
|
hpExp:GetComponent("Slider").value = curHeroHpVal
|
|
|
|
|
if curHeroHpVal <= 0 then
|
|
|
|
|
Util.SetGray(go,true)
|
|
|
|
|
else
|
2021-05-18 11:44:17 +08:00
|
|
|
|
if heroData.exist and heroData.exist == 0 then
|
|
|
|
|
Util.SetGray(go,true)
|
|
|
|
|
else
|
|
|
|
|
Util.SetGray(go,false)
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
choosedObj:SetActive(false)
|
|
|
|
|
for i,v in pairs(this.choosedList) do
|
|
|
|
|
if(heroData.dynamicId==v.heroId) then
|
|
|
|
|
choosedObj:SetActive(true)
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-10 16:25:38 +08:00
|
|
|
|
if panelType == FORMATION_TYPE.WORLDARENA then
|
|
|
|
|
if this.opView.GetHeroTeam then
|
|
|
|
|
local index = this.opView.GetHeroTeam(heroData.dynamicId)
|
|
|
|
|
if index and index ~= this.curFormationIndex then
|
|
|
|
|
yxInfo:SetActive(true)
|
2021-09-14 10:10:57 +08:00
|
|
|
|
for i = 1, 3 do
|
|
|
|
|
teamList[i]:SetActive(false)
|
2021-09-10 16:25:38 +08:00
|
|
|
|
end
|
2021-09-14 10:10:57 +08:00
|
|
|
|
teamList[index-2000]:SetActive(true)
|
2021-09-10 16:25:38 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2021-12-24 00:14:32 +08:00
|
|
|
|
local exploreTeamList = {}
|
|
|
|
|
local exploreTeam = Util.GetGameObject(go, "exploreTeamName")
|
|
|
|
|
exploreTeam.gameObject:SetActive(false)
|
|
|
|
|
for i = 1,exploreTeam.transform.childCount do
|
|
|
|
|
table.insert(exploreTeamList,exploreTeam.transform:GetChild(i-1))
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #exploreTeamList do
|
|
|
|
|
exploreTeamList[i].gameObject:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
if panelType == FORMATION_TYPE.ExploreFunc then
|
|
|
|
|
exploreTeam.gameObject:SetActive(true)
|
|
|
|
|
if this.opView.GetHeroTeam then
|
|
|
|
|
local index = this.opView.GetHeroTeam(heroData.dynamicId)
|
2021-12-29 10:02:22 +08:00
|
|
|
|
if index and index ~= 0 and index ~= 100 and this.opView.CheckIsExploring(index) then
|
|
|
|
|
exploreTeamList[#exploreTeamList].gameObject:SetActive(true)
|
|
|
|
|
elseif index and index ~= 0 and index ~= 100 then
|
2021-12-24 00:14:32 +08:00
|
|
|
|
exploreTeamList[index].gameObject:SetActive(true)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-10 16:25:38 +08:00
|
|
|
|
-- 点击事件
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.AddOnceClick(go, function()
|
2022-04-07 15:09:04 +08:00
|
|
|
|
if heroData.property and heroData.property>=5 then
|
2022-03-28 18:18:19 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.ChangeHeroPro,heroData,function()
|
|
|
|
|
LogError("刷新界面数据")
|
|
|
|
|
this.RefreshShow(false,false)
|
|
|
|
|
end)
|
|
|
|
|
return
|
|
|
|
|
end
|
2021-09-10 16:25:38 +08:00
|
|
|
|
-- 判断是上阵还是下阵
|
|
|
|
|
local formationAction = FORMATION_ACTION.UP
|
|
|
|
|
for k, v in ipairs(this.choosedList) do
|
|
|
|
|
if v.heroId == heroData.dynamicId then
|
|
|
|
|
formationAction = FORMATION_ACTION.DOWN
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- 检测失败方法
|
|
|
|
|
local CheckFail = function(tip)
|
|
|
|
|
PopupTipPanel.ShowTip(tip)
|
|
|
|
|
end
|
|
|
|
|
-- 检测成功方法
|
|
|
|
|
local CheckSuccess = function(params)
|
|
|
|
|
if params.action == FORMATION_ACTION.UP then
|
|
|
|
|
if curHeroHpVal and curHeroHpVal <= 0 then
|
|
|
|
|
PopupTipPanel.ShowTip(Language[10688])
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if heroData.exist and heroData.exist == 0 then
|
|
|
|
|
PopupTipPanel.ShowTip("激活神将图鉴后才可使用!")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
-- 当前可选的最大上阵人数
|
|
|
|
|
local maxNum = ActTimeCtrlManager.MaxArmyNum()
|
|
|
|
|
if LengthOfTable(this.choosedList) >= maxNum then
|
|
|
|
|
PopupTipPanel.ShowTip(Language[10689])
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
--判断是否上阵相同猎妖师
|
|
|
|
|
for k, v in pairs(this.choosedList) do
|
|
|
|
|
if HeroManager.GetSingleHeroData(v.heroId).id == heroData.id then
|
|
|
|
|
PopupTipPanel.ShowTip(Language[10690])
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--自动计算位置 并赋值pos
|
|
|
|
|
local curPos=this.GetPos()
|
|
|
|
|
if curPos == 0 then
|
|
|
|
|
PopupTipPanel.ShowTip(Language[10689])
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
-- 上阵生效
|
|
|
|
|
table.insert(this.choosedList, {heroId = heroData.dynamicId, position=curPos})
|
|
|
|
|
-- 刷新显示
|
|
|
|
|
this.RefreshShow(false, false)
|
|
|
|
|
return curPos
|
|
|
|
|
|
|
|
|
|
elseif params.action == FORMATION_ACTION.DOWN then
|
|
|
|
|
for k, v in ipairs(this.choosedList) do
|
|
|
|
|
if v.heroId == heroData.dynamicId then
|
|
|
|
|
table.remove(this.choosedList,k)
|
|
|
|
|
-- 刷新显示
|
|
|
|
|
this.RefreshShow(false, false)
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
local curPos=this.GetPos()
|
|
|
|
|
if formationAction == FORMATION_ACTION.UP then
|
2020-07-08 15:02:16 +08:00
|
|
|
|
if curHeroHpVal and curHeroHpVal <= 0 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10688])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2021-05-18 11:44:17 +08:00
|
|
|
|
if heroData.exist and heroData.exist == 0 then
|
|
|
|
|
PopupTipPanel.ShowTip("激活神将图鉴后才可使用!")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2020-07-08 15:02:16 +08:00
|
|
|
|
-- 当前可选的最大上阵人数
|
|
|
|
|
local maxNum = ActTimeCtrlManager.MaxArmyNum()
|
|
|
|
|
if LengthOfTable(this.choosedList) >= maxNum then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10689])
|
2020-07-08 15:02:16 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
--判断是否上阵相同猎妖师
|
|
|
|
|
for k, v in pairs(this.choosedList) do
|
|
|
|
|
if HeroManager.GetSingleHeroData(v.heroId).id == heroData.id then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10690])
|
2020-07-08 15:02:16 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--自动计算位置 并赋值pos
|
2021-09-10 16:25:38 +08:00
|
|
|
|
if curPos == 0 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10689])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2021-09-10 16:25:38 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 判断是否有编队上阵条件
|
|
|
|
|
local params = {
|
|
|
|
|
action = formationAction,
|
|
|
|
|
heroData = heroData,
|
|
|
|
|
choosedList = this.choosedList,
|
|
|
|
|
position = curPos
|
|
|
|
|
}
|
|
|
|
|
if this.opView.HeroUpDownCheck then
|
|
|
|
|
this.opView.HeroUpDownCheck(params, CheckFail, CheckSuccess)
|
2020-07-24 09:36:19 +08:00
|
|
|
|
else
|
2021-09-10 16:25:38 +08:00
|
|
|
|
CheckSuccess(params)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
Util.AddLongPressClick(go, function()
|
2020-11-28 17:20:44 +08:00
|
|
|
|
--
|
|
|
|
|
local isChoosed = false
|
|
|
|
|
for i = 1, #this.choosedList do
|
|
|
|
|
if this.choosedList[i] and this.choosedList[i].heroId then
|
|
|
|
|
if this.choosedList[i].heroId == heroData.dynamicId then
|
|
|
|
|
isChoosed = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if isChoosed then
|
|
|
|
|
UIManager.OpenPanel(UIName.RoleInfoPopup, heroData,nil,this.choosedList,#this.choosedList)
|
|
|
|
|
else
|
|
|
|
|
UIManager.OpenPanel(UIName.RoleInfoPopup, heroData)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end, 0.5)
|
2022-01-03 02:17:03 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--计算上阵空余位置 返回最小位置
|
|
|
|
|
function this.GetPos()
|
|
|
|
|
local data={}
|
|
|
|
|
for i = 1, 6 do
|
|
|
|
|
if heroListGo[i].gameObject.activeSelf then
|
|
|
|
|
table.insert(data,i,i)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
for j = 1, 6 do
|
|
|
|
|
if data[j]==nil then
|
|
|
|
|
return j
|
|
|
|
|
end
|
|
|
|
|
if LengthOfTable(data) ==6 then
|
|
|
|
|
return 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--计算上阵空余位置 返回所有位置列表
|
|
|
|
|
function this.GetPosList()
|
|
|
|
|
local data={}
|
2020-08-24 23:38:17 +08:00
|
|
|
|
-- for i = 1, 6 do
|
|
|
|
|
-- if heroListGo[i].gameObject.activeSelf then
|
|
|
|
|
-- table.insert(data,i,i)
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local list={}
|
|
|
|
|
for j = 1, 6 do
|
2020-09-11 23:07:45 +08:00
|
|
|
|
if not list[j] then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
table.insert(list,j)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--拖拽
|
|
|
|
|
function this.OnPointerDown(Pointgo,data)--按下
|
|
|
|
|
local _j=tonumber(string.sub(Pointgo.transform.name,-1))
|
|
|
|
|
local heroObj=Util.GetTransform(Pointgo.transform.parent,"Hero".._j)
|
|
|
|
|
heroObj:DOScale(Vector3.one * 1.2, 0.15)
|
|
|
|
|
heroObj.transform:SetParent(this.root.transform)
|
|
|
|
|
heroObj:GetComponent("Image").raycastTarget = false
|
|
|
|
|
end
|
|
|
|
|
function this.OnPointerUp(Pointgo,data)--抬起
|
|
|
|
|
local _j=tonumber(string.sub(Pointgo.transform.name,-1))
|
|
|
|
|
Util.Peer(Pointgo.transform,"Pos").transform:SetAsFirstSibling()
|
|
|
|
|
local heroObj=Util.GetTransform(this.gameObject,"Hero".._j)
|
|
|
|
|
heroObj:DOScale(Vector3.one * 1, 0.15)
|
|
|
|
|
heroObj.transform:SetParent(bgListGo[_j].transform)
|
|
|
|
|
heroObj.transform:SetSiblingIndex(1)--SetAsFirstSibling()
|
|
|
|
|
heroObj:GetComponent("Image").raycastTarget = false
|
|
|
|
|
end
|
|
|
|
|
function this.OnEndDrag(Pointgo,data)--结束拖动
|
|
|
|
|
local _j=tonumber(string.sub(Pointgo.transform.name,-1))
|
|
|
|
|
local heroObj=Util.GetGameObject(this.gameObject,"Hero".._j)
|
|
|
|
|
if data.pointerEnter==nil then--防止拖到屏幕外
|
|
|
|
|
heroObj.transform:DOAnchorPos(Vector3.one,0)
|
|
|
|
|
heroObj.transform:SetParent(bgListGo[_j].transform)
|
|
|
|
|
heroObj.transform:SetSiblingIndex(1)
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
-- Log("<color=blue>被拖动名。。。</color><color=red>"..Pointgo.transform.name.."</color> ".." <color=blue>进入的UI名。。。</color><color=red>"..data.pointerEnter.gameObject.name.."</color>")
|
|
|
|
|
local _i=tonumber(string.sub(data.pointerEnter.gameObject.name,-1))
|
|
|
|
|
local nameIn=data.pointerEnter.gameObject.name --进入的UI名
|
|
|
|
|
local _num=string.sub(nameIn,5,-1)
|
|
|
|
|
local itemName="item".._num
|
|
|
|
|
|
|
|
|
|
local heroObj=Util.GetGameObject(this.gameObject,"Hero".._j)
|
|
|
|
|
heroObj:GetComponent("Image").raycastTarget = true
|
|
|
|
|
heroObj.transform:DOScale(Vector3.one * 1, 0.15)
|
|
|
|
|
heroObj.transform:DOAnchorPos(Vector3.one,0)
|
|
|
|
|
heroObj.transform:SetParent(bgListGo[_j].transform)
|
|
|
|
|
heroObj.transform:SetSiblingIndex(1)
|
|
|
|
|
|
|
|
|
|
if _i==nil then
|
|
|
|
|
_i=tonumber(string.sub(Pointgo.transform.name,-1))
|
|
|
|
|
end
|
|
|
|
|
if nameIn=="DragView".._i then --有人
|
|
|
|
|
-- Log("有人")
|
|
|
|
|
local curData
|
|
|
|
|
local tarData
|
|
|
|
|
for i, v in ipairs(this.choosedList) do
|
|
|
|
|
if _j==v.position then
|
|
|
|
|
curData=v.heroId
|
|
|
|
|
end
|
|
|
|
|
if _i==v.position then
|
|
|
|
|
tarData=v.heroId
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
for i, v in ipairs(this.choosedList) do
|
|
|
|
|
if _j==v.position then
|
|
|
|
|
this.choosedList[i].heroId=tarData
|
|
|
|
|
end
|
|
|
|
|
if _i==v.position then
|
|
|
|
|
this.choosedList[i].heroId=curData
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif nameIn=="Bg".._i then --没人
|
|
|
|
|
-- Log("没人")
|
|
|
|
|
local did
|
|
|
|
|
for i, v in ipairs(this.choosedList) do
|
|
|
|
|
if _j==v.position then
|
|
|
|
|
did=v.heroId
|
|
|
|
|
table.remove(this.choosedList,i)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
table.insert(this.choosedList, {heroId = did, position=_i})
|
2020-12-23 14:32:59 +08:00
|
|
|
|
elseif nameIn=="ScrollCycleView" or nameIn==itemName or nameIn == "MaskClick" or nameIn == "btnLab"
|
|
|
|
|
or nameIn == "Btn0" or nameIn == "Btn1" or nameIn == "Btn2" or nameIn == "Btn3" or nameIn == "Btn4" or nameIn == "ExampleBtn" then
|
2020-07-08 15:02:16 +08:00
|
|
|
|
if not this.opView.NoUpOrDownFormation then
|
|
|
|
|
for i, v in ipairs(this.choosedList) do
|
|
|
|
|
if _j==v.position then
|
|
|
|
|
table.remove(this.choosedList,i)
|
|
|
|
|
dragViewListGo[_j].gameObject:SetActive(false)
|
|
|
|
|
break
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-08-18 21:54:30 +08:00
|
|
|
|
else
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10691])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
this.line.gameObject:SetActive(false)
|
|
|
|
|
this.SetCardsData()
|
|
|
|
|
this.OnClickTabBtn(proId)
|
|
|
|
|
end
|
|
|
|
|
function this.OnDrag(Pointgo,data)--拖动中
|
|
|
|
|
if data.pointerEnter==nil then--拖到屏幕外
|
|
|
|
|
this.line.transform:SetParent(this.roleGrid.transform)
|
|
|
|
|
this.line.gameObject:SetActive(false)
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local _i=tonumber(string.sub(data.pointerEnter.gameObject.name,-1))
|
|
|
|
|
if _i==nil then _i=0 end
|
|
|
|
|
local nameIn=data.pointerEnter.gameObject.name --进入的UI名
|
|
|
|
|
this.line:SetActive(nameIn=="DragView".._i or nameIn=="Bg".._i)
|
|
|
|
|
if nameIn=="DragView".._i then
|
|
|
|
|
this.line.transform:SetParent(bgListGo[_i].transform)
|
|
|
|
|
elseif nameIn=="Bg".._i then
|
|
|
|
|
this.line.transform:SetParent(bgListGo[_i].transform)
|
|
|
|
|
else
|
|
|
|
|
this.line.transform:SetParent(this.roleGrid.transform)
|
|
|
|
|
this.line.gameObject:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
this.line.transform:SetAsFirstSibling()
|
2020-09-02 13:35:29 +08:00
|
|
|
|
if panelType == FORMATION_TYPE.EXPEDITION or panelType == FORMATION_TYPE.CARBON then
|
2021-09-10 16:25:38 +08:00
|
|
|
|
this.line.transform:DOAnchorPos(Vector3.New(0,15,0),0)
|
2020-07-27 14:13:31 +08:00
|
|
|
|
else
|
|
|
|
|
this.line.transform:DOAnchorPos(Vector3.New(0,30,0),0)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-05-25 19:16:23 +08:00
|
|
|
|
--战力刷新
|
|
|
|
|
function this.RefreshPower()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local newPowerNum = this.formationPower
|
|
|
|
|
if oldPowerNum ~= newPowerNum and oldPowerNum ~= 0 then
|
|
|
|
|
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldPowerNum,newValue = newPowerNum})
|
|
|
|
|
end
|
|
|
|
|
oldPowerNum = this.formationPower
|
2020-05-25 19:16:23 +08:00
|
|
|
|
-- this.power.text =this.formationPower
|
|
|
|
|
-- this.RefreshFormation()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 设置扫荡显示的层级
|
|
|
|
|
function this.SetDrawLevel()
|
|
|
|
|
local go = this.ElementalResonanceView.gameObject
|
|
|
|
|
local canvas = go:GetComponent("Canvas")
|
|
|
|
|
canvas.overrideSorting = false
|
|
|
|
|
end
|
|
|
|
|
|
2021-11-02 16:24:01 +08:00
|
|
|
|
--部分界面有特殊条件显示,集体管理
|
|
|
|
|
function this.CheckCondition()
|
2021-09-10 15:23:15 +08:00
|
|
|
|
if this.curFormationIndex == FormationTypeDef.FORMATION_QIJIESHILIAN then
|
|
|
|
|
this.opView.RefreshConditon(this.choosedList)
|
2021-11-02 16:24:01 +08:00
|
|
|
|
elseif this.curFormationIndex == FormationTypeDef.FIGHT_LEVEL or this.curFormationIndex == FormationTypeDef.FIGHT_ASSISTANTLEVEL then
|
|
|
|
|
--山河社稷图不随阵容变化儿变化,不用写
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2021-09-10 15:23:15 +08:00
|
|
|
|
end
|
2021-02-05 17:57:59 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--设置一键上阵
|
|
|
|
|
function this.SetOneKeyGo()
|
2020-11-19 17:37:13 +08:00
|
|
|
|
--获取需要上阵的位置
|
|
|
|
|
local posArr=this.GetPosList()
|
|
|
|
|
if #posArr==0 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10689])
|
2020-11-19 17:37:13 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2021-09-10 16:25:38 +08:00
|
|
|
|
-- 获取数据
|
2021-05-17 19:34:23 +08:00
|
|
|
|
local heros = {}
|
2021-09-10 16:25:38 +08:00
|
|
|
|
if this.opView.GetOneKeyUpHeroList then
|
|
|
|
|
heros = this.opView.GetOneKeyUpHeroList()
|
2021-05-17 19:34:23 +08:00
|
|
|
|
else
|
2021-09-10 16:25:38 +08:00
|
|
|
|
heros = HeroManager.GetAllHeroDatas()
|
2021-05-17 19:34:23 +08:00
|
|
|
|
end
|
2021-09-10 16:25:38 +08:00
|
|
|
|
if not heros or #heros <= 0 then
|
|
|
|
|
PopupTipPanel.ShowTip("未找到符合条件得神将")
|
|
|
|
|
return
|
2021-02-05 17:57:59 +08:00
|
|
|
|
end
|
2020-11-19 17:37:13 +08:00
|
|
|
|
--按战力从大到小排序
|
|
|
|
|
table.sort(heros,function(a,b)
|
|
|
|
|
if a.warPower == b.warPower then
|
|
|
|
|
return a.id>b.id
|
|
|
|
|
else
|
|
|
|
|
return a.warPower > b.warPower
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
--修改 upHeroSidTable 静态id 存储 有则跳过
|
|
|
|
|
local upHeroSidTable = {}
|
|
|
|
|
this.choosedList = {}
|
2021-09-10 16:25:38 +08:00
|
|
|
|
if this.opView.RemoveTeamByIndex then
|
|
|
|
|
this.opView.RemoveTeamByIndex(this.curFormationIndex)
|
2020-11-19 17:37:13 +08:00
|
|
|
|
end
|
2021-02-05 17:57:59 +08:00
|
|
|
|
for k, v in ipairs(heros) do
|
2020-12-24 15:13:03 +08:00
|
|
|
|
local curSingleherodata = HeroManager.GetSingleHeroData(v.dynamicId)
|
2022-04-07 15:09:04 +08:00
|
|
|
|
if curSingleherodata.property~=5 then
|
2022-04-02 16:03:18 +08:00
|
|
|
|
if not upHeroSidTable[curSingleherodata.id] then
|
|
|
|
|
if #this.choosedList < 6 then
|
|
|
|
|
for n = 1, #posArr do
|
|
|
|
|
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
|
|
|
|
|
table.insert(this.choosedList, {heroId = v.dynamicId, position=posArr[n]})
|
|
|
|
|
if this.opView.AddHeroToTeam then
|
|
|
|
|
this.opView.AddHeroToTeam(v.dynamicId, posArr[n], this.curFormationIndex)
|
|
|
|
|
end
|
|
|
|
|
table.remove(posArr,n)
|
|
|
|
|
break
|
2021-09-10 16:25:38 +08:00
|
|
|
|
end
|
2021-08-27 13:45:09 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-12-24 15:13:03 +08:00
|
|
|
|
end
|
2022-04-02 16:03:18 +08:00
|
|
|
|
|
2020-12-24 15:13:03 +08:00
|
|
|
|
end
|
|
|
|
|
this.SetCardsData()
|
2021-09-10 16:25:38 +08:00
|
|
|
|
this.OnClickTabBtn(proId,false,false)
|
2020-12-24 15:13:03 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2021-04-21 13:12:04 +08:00
|
|
|
|
return FormationPanelV2
|
|
|
|
|
|