神将置换

dev_chengFeng
ZhangBiao 2020-08-12 14:13:16 +08:00
parent c1c013a007
commit ed319be87e
6 changed files with 100 additions and 12 deletions

View File

@ -1448,8 +1448,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 1.1000004, y: -289.8}
m_SizeDelta: {x: 1068.6, y: -1237.5}
m_AnchoredPosition: {x: 1.1000004, y: -307.77}
m_SizeDelta: {x: 1068.6, y: -1201.6}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3494743067606759347
CanvasRenderer:
@ -4609,7 +4609,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 299.1, y: 142.2}
m_AnchoredPosition: {x: 299.1, y: 103}
m_SizeDelta: {x: 286, y: 460}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6823144165111344430
@ -4894,7 +4894,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -300, y: 620}
m_AnchoredPosition: {x: -300, y: 580}
m_SizeDelta: {x: 279, y: 411}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2450125831589095399
@ -7174,7 +7174,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -299.1, y: 142.2}
m_AnchoredPosition: {x: -299.1, y: 103}
m_SizeDelta: {x: 286, y: 460}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2389222560408060292
@ -9795,7 +9795,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 507.50006, y: -353.79004}
m_AnchoredPosition: {x: 507.50006, y: -294}
m_SizeDelta: {x: 6, y: -1214.89}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6522149741575571826
@ -10821,7 +10821,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 313}
m_AnchoredPosition: {x: 0, y: 276}
m_SizeDelta: {x: 0, y: 426}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &718382595866002436
@ -12050,7 +12050,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 300, y: 620}
m_AnchoredPosition: {x: 300, y: 580}
m_SizeDelta: {x: 279, y: 411}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3956511375649880926
@ -13546,7 +13546,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 277}
m_AnchoredPosition: {x: 0, y: 241}
m_SizeDelta: {x: 880, y: 104}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4954915313009189958

View File

@ -462,6 +462,7 @@ PanelType = {
Guild = {14, 16, 65}, -- 新法宝
TimelimitCall={87,16}, --限时召唤
QianKunBox={1002,1003,16},--乾坤包囊
HeroReplace={14,16,94},--神将置换
}

View File

@ -112,7 +112,7 @@ function this.SwitchView(index)
end
--区分显示
if index==1 then
this.upView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main})
this.upView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.HeroReplace})
elseif index==2 then
this.upView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main})
end

View File

@ -32,6 +32,12 @@ function this:InitComponent(gameObject)
this.needHero = Util.GetGameObject(gameObject, "CompoundHeroPanel_Replace/heros/needHero")
this.replaceHero = Util.GetGameObject(gameObject, "CompoundHeroPanel_Replace/heros/replacedHero")
this.needBg = Util.GetGameObject(gameObject, "CompoundHeroPanel_Replace/bg/heroPlace1")
this.replaceBg = Util.GetGameObject(gameObject, "CompoundHeroPanel_Replace/bg/heroPlace2")
this.text = Util.GetGameObject(gameObject, "CompoundHeroPanel_Replace/heros/content/Text")
this.cost = Util.GetGameObject(gameObject, "CompoundHeroPanel_Replace/heros/content/cost")
end
function this:BindEvent()
@ -40,10 +46,16 @@ function this:BindEvent()
if not not curSelectHero.id then
NetManager.SaveHeroChangeRequest(curSelectHero.dynamicId,function (msg)
HeroManager.ResetHeroChangeId(curSelectHero.dynamicId,msg.heroTempId)--改变英雄changeId
this.replaceHero:SetActive(true)
this.cancelBtn:SetActive(true)
this.replaceBtn:SetActive(false)
this.saveBtn:SetActive(true)
this.needBg:SetActive(false)
this.replaceBg:SetActive(false)
this.text:SetActive(false)
this.cost:SetActive(false)
local value = this.RebuildData(msg.heroTempId)
this.SetHero(this.replaceHero,value)
end)
@ -55,11 +67,17 @@ function this:BindEvent()
Util.AddClick(this.cancelBtn,function()
NetManager.CancelHeroChangeRequest(curSelectHero.dynamicId,function (msg)
HeroManager.ResetHeroChangeId(curSelectHero.dynamicId)--改变英雄changeId
this.replaceHero:SetActive(false)
this.needHero:SetActive(false)
this.cancelBtn:SetActive(false)
this.replaceBtn:SetActive(true)
this.saveBtn:SetActive(false)
this.needBg:SetActive(true)
this.replaceBg:SetActive(true)
this.text:SetActive(true)
this.cost:SetActive(false)
curSelectHero = {}
for i = 1, #heroDatas do
heroSelectBtn[i]:SetActive(heroDatas[i].dynamicId == curSelectHero.dynamicId)
@ -69,8 +87,14 @@ function this:BindEvent()
--保存置换
Util.AddClick(this.saveBtn,function()
NetManager.DoHeroChangeRequest(curSelectHero.dynamicId,function (msg)
this.replaceHero:SetActive(false)
this.needHero:SetActive(false)
this.needBg:SetActive(true)
this.replaceBg:SetActive(true)
this.text:SetActive(true)
this.cost:SetActive(false)
HeroManager.DeleteHeroDatas({curSelectHero.dynamicId})
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop,1,function()
this.ShowCurrPosHeroReplace(curIndex)
@ -166,16 +190,31 @@ function this.SingleHeroDataShow(_go,_heroData)
Util.GetGameObject(go.transform, "posIcon"):SetActive(false)
Util.GetGameObject(go.transform, "proIcon"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(HeroConfig[heroData.id].PropertyName))
Util.GetGameObject(go.transform, "Text"):GetComponent("Text").text = heroData.name
local formationMask = Util.GetGameObject(go.transform, "formationMask")
local formationImage = Util.GetGameObject(go.transform, "formationMask/formationImage/upImage"):GetComponent("Image")
if #heroData.formationList ~= 0 then
formationMask:SetActive(true)
formationImage.sprite = Util.LoadSprite("t_tongyong-yishangzheng")
elseif heroData.lockState == 1 then
formationMask:SetActive(true)
formationImage.sprite = Util.LoadSprite("r_hero_suodi_yisuoding")
else
formationMask:SetActive(false)
end
local starGrid = Util.GetGameObject(go.transform, "star")
SetHeroStars(starGrid, heroData.star,1,nil,nil,Vector2.New(0,1))
local cardBtn = Util.GetGameObject(go.transform, "icon")
local choosed = Util.GetGameObject(go.transform, "choosed")
choosed:SetActive(false)
this.replaceBtn:SetActive(true)
this.cancelBtn:SetActive(false)
this.saveBtn:SetActive(false)
this.needBg:SetActive(true)
this.replaceBg:SetActive(true)
this.text:SetActive(true)
this.cost:SetActive(false)
Util.AddOnceClick(cardBtn, function()
if heroData.dynamicId == curSelectHero.dynamicId then
@ -187,26 +226,48 @@ function this.SingleHeroDataShow(_go,_heroData)
this.cancelBtn:SetActive(false)
this.saveBtn:SetActive(false)
this.replaceBtn:SetActive(true)
this.needBg:SetActive(true)
this.replaceBg:SetActive(true)
this.text:SetActive(true)
this.cost:SetActive(false)
else
choosed:SetActive(true)
curSelectHero = heroData
this.needHero:SetActive(true)
this.replaceHero:SetActive(false)
this.needBg:SetActive(false)
this.replaceBg:SetActive(true)
this.text:SetActive(false)
this.cost:SetActive(true)
this.SetHero(this.needHero,curSelectHero)
--如果已经有了置换Id
if curSelectHero.changeId ~=0 then
this.cancelBtn:SetActive(true)
this.replaceBtn:SetActive(false)
this.saveBtn:SetActive(true)
this.replaceHero:SetActive(true)
this.needBg:SetActive(false)
this.replaceBg:SetActive(false)
this.text:SetActive(false)
this.cost:SetActive(false)
local data = this.RebuildData(curSelectHero.changeId)
this.SetHero(this.replaceHero,data)
else
this.cancelBtn:SetActive(false)
this.replaceBtn:SetActive(true)
this.saveBtn:SetActive(false)
this.replaceHero:SetActive(false)
this.needBg:SetActive(false)
this.replaceBg:SetActive(true)
this.text:SetActive(false)
this.cost:SetActive(true)
end
end
@ -216,6 +277,21 @@ function this.SingleHeroDataShow(_go,_heroData)
end)
Util.AddOnceClick(formationMask, function()
if #heroData.formationList ~= 0 then
local text = ""
for index, value in ipairs(heroData.formationList) do
text = HeroManager.GetHeroFormationStr(index)
end
PopupTipPanel.ShowTip(text)
return
end
if heroData.lockState == 1 then
PopupTipPanel.ShowTip("目标神将已被锁定,无法置换!")
return
end
end)
Util.AddLongPressClick(cardBtn, function()
UIManager.OpenPanel(UIName.RoleInfoPopup, heroData)
end, 0.5)

View File

@ -60,6 +60,7 @@ function this.UpdateFormation(msg)
for j = 1, #team.teamHeroInfos do
local teamHeroInfo = team.teamHeroInfos[j]
table.insert(oTeam.teamHeroInfos, teamHeroInfo)
HeroManager.SetHeroFormationList(teamHeroInfo.heroId,team.teamId,1)
end
for j = 1, #team.teamPokemonInfos do
@ -67,6 +68,7 @@ function this.UpdateFormation(msg)
table.insert(oTeam.teamPokemonInfos, teamPokemonInfo)
end
this.formationList[team.teamId] = oTeam
end
if #msg.TeamPosInfo == 0 then

View File

@ -89,7 +89,8 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook)
heroData.createTime = _msgHeroData.createTimelocal
heroData.lockState = _msgHeroData.lockState
heroData.createtype = _msgHeroData.createtype
heroData.changeId = _msgHeroData.changeId
heroData.changeId = _msgHeroData.changeId--置换id
heroData.formationList = {}--所在编队list
--本地 or 援助
local _configData = heroConfig[_id]
heroData.heroConfig = heroConfig[_id]
@ -161,6 +162,14 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook)
--ExpeditionManager.InitHeroHpValue(heroData)
end
function this.SetHeroFormationList(heroDid,teamId,isAddOrDel)
if isAddOrDel then
heroDatas[heroDid].formationList[teamId] = teamId
else
heroDatas[heroDid].formationList[teamId] = nil
end
end
function this.GetHeroEquipIdList(heroDid)
return heroDatas[heroDid].equipIdList
end