四灵提交

dev_chengFeng
jiaoyangna 2021-02-05 17:57:59 +08:00
parent d5c6d690b0
commit a0df277601
19 changed files with 1438 additions and 1321 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c2908d27a23ffb5449de1f25e08f30e2
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -381,4 +381,5 @@ SubUIConfig = {
-- HorseRaceLampView = { name = "HorseRaceLampView", assetName = "HorseRaceLamp", script = "View/HorseRaceLampView" }, -- 跑马灯
ChatTipView = { name = "ChatTipView", assetName = "ChatTipView", script = "View/ChatTipView" }, -- 聊天Tip
PlayerLiveView = { name = "PlayerLiveView", assetName = "PlayerLiveView", script = "View/PlayerLiveView" }, -- 玩家动态例会(小人)
FourTrailSingleHelpHero = { name = "FourTrailSingleHelpHero", assetName = "FourTrailSingleHelpHero", script = "View/FourTrailSingleHelpHero" }, -- 玩家动态例会(小人)
}

View File

@ -421,6 +421,7 @@ GameEvent = {
UpdateSkin="Role.UpdateSkin",-- 刷新皮肤
},
FourEle={
UpdatePri="FourEle.UpdatePri",-- 刷新皮肤
}
UpdatePri="FourEle.UpdatePri",-- 刷新特权
RefreshView="FourEle.RefreshView",-- 刷新特权
},
}

File diff suppressed because one or more lines are too long

View File

@ -696,6 +696,7 @@ function this.SingleHeroDataShow(_go, _heroData)
PopupTipPanel.ShowTip(Language[10692])
return
end
LogGreen("heroData.dynamicId:"..heroData.dynamicId)
table.insert(this.choosedList, {heroId = heroData.dynamicId, position=this.GetPos()})
this.SetCardsData(this.choosedList)
else
@ -892,63 +893,29 @@ function this.SetDrawLevel()
end
--设置一键上阵
function this.SetOneKeyGo()
--获取需要上阵的位置
local posArr=this.GetPosList()
if #posArr==0 then
PopupTipPanel.ShowTip(Language[10692])
return
function this.SetOneKeyGo(rules1,rules2)
local rulesType = 0
if rules1 then
rulesType = rules1
end
local heros = HeroManager.GetAllHeroDatas(limitLevel)
--按战力从大到小排序
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.order = 0
this.choosedList = {}
for j = 1, #this.choosedList do
local curSingleherodata = HeroManager.GetSingleHeroData(this.choosedList[j].heroId)
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
local rulesNum = 0
if rules2 then
rulesNum = rules2
end
for k, v in ipairs(heros) do
local curSingleherodata = HeroManager.GetSingleHeroData(v.dynamicId)
if not upHeroSidTable[curSingleherodata.id] then
LogGreen("this.choosedList "..#this.choosedList)
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]})
table.remove(posArr,n)
this.order = this.order + 1
break
end
end
end
end
this.SetCardsData()
this.OnClickTabBtn(proId)
end
--设置轩辕宝镜一键上阵
function this.SetOneKeyGoWithCondition(Rules)
local rulesType = Rules[1][1]
local rulesNum = Rules[1][2]
local curNum = 0
--获取需要上阵的位置
local posArr=this.GetPosList()
if #posArr==0 then
PopupTipPanel.ShowTip(Language[10692])
return
end
local heros = HeroManager.GetAllHeroDatas(limitLevel)
if panelType == FORMATION_TYPE.EXPEDITION then
heros = ExpeditionManager.GetAllHeroDatas(heros,limitLevel)
elseif panelType == FORMATION_TYPE.FOUR_ELEMENT then
heros = MonsterCampManager.GetFriendHelpHero(limitLevel,heros)
end
--按战力从大到小排序
table.sort(heros,function(a,b)
if a.warPower == b.warPower then
@ -961,86 +928,34 @@ function this.SetOneKeyGoWithCondition(Rules)
local upHeroSidTable = {}
this.order = 0
this.choosedList = {}
for j = 1, #this.choosedList do
local curSingleherodata = HeroManager.GetSingleHeroData(this.choosedList[j].heroId)
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
end
for k, v in ipairs(heros) do
local curSingleherodata = HeroManager.GetSingleHeroData(v.dynamicId)
if not upHeroSidTable[curSingleherodata.id] then
-- LogGreen("this.choosedList "..#this.choosedList)
if #this.choosedList < 6 then
for n = 1, #posArr do
if rulesType == v.heroConfig.PropertyName and curNum < rulesNum then
curNum = curNum + 1
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
table.insert(this.choosedList, {heroId = v.dynamicId, position=posArr[n]})
table.remove(posArr,n)
this.order = this.order + 1
break
end
end
end
end
end
for k, v in ipairs(heros) do
local curSingleherodata = HeroManager.GetSingleHeroData(v.dynamicId)
if not upHeroSidTable[curSingleherodata.id] then
-- LogGreen("this.choosedList "..#this.choosedList)
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]})
table.remove(posArr,n)
this.order = this.order + 1
break
end
end
end
end
this.SetCardsData()
this.OnClickTabBtn(proId)
end
--设置大闹天宫一键上阵
function this.SetOneKeyGoExpedition()
--获取需要上阵的位置
local posArr=this.GetPosList()
if #posArr==0 then
PopupTipPanel.ShowTip(Language[10692])
return
end
local theros = HeroManager.GetAllHeroDatas(limitLevel)
theros = ExpeditionManager.GetAllHeroDatas(theros,limitLevel)
--按战力从大到小排序
table.sort(theros,function(a,b)
if a.warPower == b.warPower then
return a.id>b.id
else
return a.warPower > b.warPower
local index = 1
while(curNum < rulesNum and index <= #heros)
do
if #this.choosedList < 6 then
local curSingleherodata = HeroManager.GetSingleHeroData(heros[index].dynamicId)
if not upHeroSidTable[curSingleherodata.id] then
if rulesType == heros[index].heroConfig.PropertyName then
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
table.insert(this.choosedList, {heroId = heros[index].dynamicId, position=posArr[1]})
table.remove(posArr,1)
this.order = this.order + 1
curNum = curNum + 1
end
end
end
end)
--修改 upHeroSidTable 静态id 存储 有则跳过
local upHeroSidTable = {}
this.order = 0
this.choosedList = {}
for j = 1, #this.choosedList do
local curSingleherodata = HeroManager.GetSingleHeroData(this.choosedList[j].heroId)
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
index = index + 1
end
for k, v in ipairs(theros) do
for k, v in ipairs(heros) do
if #this.choosedList >= 6 then
break
end
local curSingleherodata = HeroManager.GetSingleHeroData(v.dynamicId)
if not upHeroSidTable[curSingleherodata.id] then
LogGreen("this.choosedList "..#this.choosedList)
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]})
table.remove(posArr,n)
this.order = this.order + 1
break
end
end
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
table.insert(this.choosedList, {heroId = v.dynamicId, position=posArr[1]})
table.remove(posArr,1)
this.order = this.order + 1
end
end
this.SetCardsData()

View File

@ -20,7 +20,7 @@ end
--- btn1点击回调事件
function this.On_Btn1_Click()
this.root.SetOneKeyGoExpedition()
this.root.SetOneKeyGo()
end
function this.On_Btn2_Click()

View File

@ -51,9 +51,20 @@ function this.SetCampIconByCurType(tabs,selectBtn)
end
function this.GetHeros(limitLevel)
return HeroManager.GetHeroDataByProperty(curType, limitLevel)
local heros = HeroManager.GetHeroDataByProperty(curType, limitLevel)
if MonsterCampManager.GetFriendHelpHero(curType) then
local hero = MonsterCampManager.GetFriendHelpHero(curType).hero
table.insert(heros,1,hero)
end
return heros
end
--- btn1点击回调事件
function this.On_Btn1_Click()
this.root.SetOneKeyGo(curType,6)
end
-- 进入地图
function this.On_Btn2_Click()
LogGreen(this.root.curFormationIndex)

View File

@ -37,7 +37,7 @@ end
--- btn1点击回调事件
function this.On_Btn1_Click()
this.root.SetOneKeyGoWithCondition(data.teamRules)
this.root.SetOneKeyGo(data.teamRules[1][1],data.teamRules[1][2])
end
-- 进入地图

View File

@ -53,9 +53,6 @@ function this:BtnClick(i)
this.selectBtn:GetComponent("RectTransform").localPosition = Vector3.zero
this.selectBtn.transform:SetAsFirstSibling()
curIndex = i
if i == 1 then
friendHelpHeros = MonsterCampManager.GetFriendHelpHeros(curType)
end
for k,v in pairs(itemList) do
v.gameObject:SetActive(false)
end
@ -74,7 +71,8 @@ function this:OnShow(_parent,...)
local args = {...}
waveId = args[1]
curType = args[2]
myHeros = HeroManager.GetHeroDataByProperty(curType,0)
friendHelpHeros = args[3]
myHeros = args[4]
this:SetMyHeightPower()
configData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.CampTowerConfig,"FloorId",waveId,"CampId",curType)
this.titleText.text = FourElementName[curType]
@ -113,16 +111,23 @@ function this:RefreshItemData()
this.empty:SetActive(true)
return
end
LogGreen(#data)
this.empty:SetActive(false)
this:SortHeros(data)
for k,v in pairs(itemList) do
v.gameObject:SetActive(false)
end
this.ScrollView:SetData(data,function(index,go)
--this:SetSingleData(index,go,data[index])
LogGreen(go.name)
go.gameObject:SetActive(true)
local tempData = FourTrailSingleHelpHero:New(go)
tempData:OnOpen(curIndex,data[index],curType,heightPower)
local tempId = curIndex == 1 and data[index].hero.dynamicId or data[index].dynamicId
itemList[tempId] = tempData
if not itemList then
itemList = {}
end
if not itemList[go] then
itemList[go] = SubUIManager.Open(SubUIConfig.FourTrailSingleHelpHero,go.transform)
end
itemList[go].gameObject:SetActive(true)
LogGreen(tostring(data[index]))
itemList[go]:OnShow(curIndex,data[index],curType,heightPower)
end)
end
@ -131,6 +136,9 @@ end
function this:OnDestroy()
tabs = {}
for k,v in pairs(itemList) do
SubUIManager.Close(v)
end
if this.ScrollView then
SubUIManager.Close(this.ScrollView)
this.ScrollView = nil

View File

@ -619,8 +619,13 @@ end
function this.GetSingleHeroData(heroDId)
if heroDatas[heroDId] then
return heroDatas[heroDId]
else
elseif ExpeditionManager.GetSingleHeroData(heroDId) then
return ExpeditionManager.GetSingleHeroData(heroDId)
elseif MonsterCampManager.GetSingleHeroData(heroDId) then
LogGreen(heroDId)
return MonsterCampManager.GetSingleHeroData(heroDId)
else
return nil
end
end
@ -1778,7 +1783,7 @@ function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upSt
-- end
-- end
--end
local heroSkinSingleProVal, heroSkinAllHeroProVal = HeroSkinManager.CaculateSkinProVal(curHeroData.dynamicId)
local heroSkinSingleProVal, heroSkinAllHeroProVal = HeroSkinManager.CaculateSkinProVal(curHeroData)
this.DoubleTableCompound(allAddProVal, heroSkinSingleProVal)
this.DoubleTableCompound(allAddProVal, heroSkinAllHeroProVal)

View File

@ -75,10 +75,10 @@ function this.GetSkins(id)
end
end
function this.CaculateSkinProVal(_heroId)
function this.CaculateSkinProVal(heroData)
local heroSkinSingleProVal = {}
local heroSkinAllHeroProVal = {}
local heroData = HeroManager.GetSingleHeroData(_heroId)
local heroData = heroData
if heroData.skinId ~= 0 then
if this.skinDatas[heroData.skinId] and this.skinDatas[heroData.skinId].MonomerProperty and #this.skinDatas[heroData.skinId].MonomerProperty > 0 then
for _,v in ipairs(this.skinDatas[heroData.skinId].MonomerProperty) do

View File

@ -69,7 +69,10 @@ function FourElementMonsterCampPanel:BindEvent()
UIManager.OpenPanel(UIName.RankingSingleListPanel,rankKingList[curType+14])
end)
Util.AddClick(this.btnHelpFight, function ()
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.FourElementHelpFight,trailData.monsterWave + 1,curType)
local MyHeroData = HeroManager.GetHeroDataByProperty(curType,0)
MonsterCampManager.GetFriendHelpHeros(curType,function(data)
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.FourElementHelpFight,trailData.monsterWave + 1,curType,data,MyHeroData)
end)
end)
end
@ -85,22 +88,28 @@ end
--添加事件监听(用于子类重写)
function FourElementMonsterCampPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.FourEle.UpdatePri, this.UpdatePrivilage)
Game.GlobalEvent:AddEvent(GameEvent.FourEle.RefreshView, this.OnShow)
end
--移除事件监听(用于子类重写)
function FourElementMonsterCampPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.FourEle.UpdatePri, this.UpdatePrivilage)
Game.GlobalEvent:RemoveEvent(GameEvent.FourEle.RefreshView, this.OnShow)
end
--界面打开时调用(用于子类重写)
function FourElementMonsterCampPanel:OnOpen(index)
curType = index
trailData = MonsterCampManager.GetCurFourElementMonsterInfo(index)
curType = index
this.UpView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.MonsterCamp })
end
--界面打开时调用(用于子类重写)
function FourElementMonsterCampPanel:OnShow()
trailData = MonsterCampManager.GetCurFourElementMonsterInfo(curType)
if trailData.openState == 0 then
self:ClosePanel()
return
end
storeDataId,itemId,costNum = MonsterCampManager.GetCost(curType)
this.titleText.text = FourElementName[curType]
this.canFightWaves.text = "可挑战层数:"..trailData.canFightTime

View File

@ -43,12 +43,12 @@ end
--添加事件监听(用于子类重写)
function MonsterCampMainPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.FourEle.RefreshView, this.OnShow)
end
--移除事件监听(用于子类重写)
function MonsterCampMainPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.FourEle.RefreshView, this.OnShow)
end

View File

@ -40,18 +40,13 @@ function this.InitFourMonsterData(msg)
this.fourMonsterData[index].canFightTime = msg.info[i].remainTimes
this.fourMonsterData[index].openState = msg.info[i].overTime
end
Game.GlobalEvent:DispatchEvent(GameEvent.FourEle.RefreshView)
end
--设置扫荡剩余次数
function this.GetTimeTip(campId)
-- LogBlue("购买总次数:"..PrivilegeManager.GetPrivilegeNumber(this.fourMonsterData[campId].buyTimeId))
-- LogBlue("购买使用的次数:"..PrivilegeManager.GetPrivilegeUsedTimes(this.fourMonsterData[campId].buyTimeId))
-- LogBlue("免费总次数:"..PrivilegeManager.GetPrivilegeNumber(this.fourMonsterData[campId].freeTimeId))
-- LogBlue("免费使用次数:"..PrivilegeManager.GetPrivilegeUsedTimes(this.fourMonsterData[campId].freeTimeId))
this.fourMonsterData[campId].buyTime = PrivilegeManager.GetPrivilegeRemainValue(this.fourMonsterData[campId].buyTimeId)
--LogBlue("购买剩余次数:"..this.fourMonsterData[campId].buyTime)
this.fourMonsterData[campId].freeTime= PrivilegeManager.GetPrivilegeRemainValue(this.fourMonsterData[campId].freeTimeId) --免费次数
--LogBlue("免费剩余次数:"..this.fourMonsterData[campId].buyTime)
return this.fourMonsterData[campId].freeTime,this.fourMonsterData[campId].buyTime
end
@ -177,7 +172,8 @@ function this.ExecuteFightBattle(id,type,func,curType)
UIManager.OpenPanel(UIName.MonsterCampMainPanel)
end
elseif result.result == 1 then
this.fourMonsterData[curType].wave = id
LogGreen(tostring(this.fourMonsterData[curType].monsterWave))
this.fourMonsterData[curType].monsterWave = id
this.fourMonsterData[curType].canFightTime = this.fourMonsterData[curType].canFightTime - 1
if this.fourMonsterData[curType].openState ~= 0 then
UIManager.OpenPanel(UIName.FourElementMonsterCampPanel,curType)
@ -255,6 +251,7 @@ function this.UpdateHeroDatas(_msgHeroData)
end
heroData.soulPrintList= soulPrintList
end
heroData.heroConfig = heroViewConfig[_id]
heroData.skillIdList={}--主动技
HeroManager.UpdateSkillIdList(heroData)
heroData.passiveSkillList = {}--被动技
@ -274,11 +271,8 @@ function this.UpdateHeroDatas(_msgHeroData)
end
heroData.name = _configData.ReadingName
heroData.property = _configData.PropertyName
this.SetEquipUpHeroDid(heroData.equipIdList,heroData.dynamicId)
this.SetEquipTreasureUpHeroDid(heroData.jewels,heroData.dynamicId)
this.SetTalismanLv(heroData.dynamicId,heroData.talismanList)
heroData.warPower = HeroManager.CalculateHeroAllProValList(1, heroData, false)[HeroProType.WarPower]
heroData.warPower = 1000--HeroManager.CalculateHeroAllProValList(1, heroData, false)[HeroProType.WarPower]
heroData.createtype = 1
return heroData
end
@ -286,6 +280,7 @@ end
function this.GetFriendHelpHeros(trailType,func)
this.friendHelpHeros = {}
local x = function(msg)
--LogGreen("HelpFightListRequest".." trailType:"..tostring(trailType).." #msg.helpHeros:"..#msg.helpHeros)
for k,v in ipairs(msg.helpHeros) do
if not this.friendHelpHeros[v.trailType] then
this.friendHelpHeros[v.trailType] = {}
@ -294,31 +289,37 @@ function this.GetFriendHelpHeros(trailType,func)
tempdata.player = v
tempdata.hero = this.UpdateHeroDatas(v.hero)
table.insert(this.friendHelpHeros[v.trailType],tempdata)
--LogGreen("this.friendHelpHeros[v.trailType]".." trailType:"..tostring(v.trailType).." #this.friendHelpHeros[v.trailType]:"..#this.friendHelpHeros[v.trailType])
end
if func then
func(this.friendHelpHeros[trailType])
end
end
--发消息获取信息 然后调用回调函数x
if trailType and trailType > 0 then
NetManager.HelpFightListRequest(trailType,x)
elseif not trailType then
for i = 1, 4 do
NetManager.HelpFightListRequest(i,x)
end
-- elseif not trailType then
-- for i = 1, 4 do
-- NetManager.HelpFightListRequest(i,x)
-- end
end
if trailType and this.friendHelpHeros[trailType] then
return this.friendHelpHeros[trailType]
end
if func then
func()
end
return nil
-- LogGreen("this.friendHelpHeros[trailType]"..#this.friendHelpHeros[trailType])
-- if trailType and this.friendHelpHeros[trailType] then
-- return this.friendHelpHeros[trailType]
-- end
-- if func then
-- func()
-- end
end
--设置好友帮助我的英雄 以试炼类型为键
function this.SetFriendHelpHero(helpFightList,trailType)
if not trailType then
this.friendHelpHero = {}
--LogGreen("helpFightList"..#helpFightList)
for k,v in ipairs(helpFightList) do
--LogGreen("this.friendHelpHero[v.trailType]".." trailType:"..tostring(v.trailType).." v.hero.dynamicId:" ..v.hero.id)
if not this.friendHelpHero[v.trailType] then
this.friendHelpHero[v.trailType] = {}
end
@ -342,9 +343,20 @@ function this.SetFriendHelpHero(helpFightList,trailType)
end
--获取当前试炼我选取的好友的助战
function this.GetFriendHelpHero(trailType)
if this.friendHelpHero[trailType] then
return this.friendHelpHero[trailType]
function this.GetFriendHelpHero(trailType,heros)
if heros then
local lvLimit = 0
if trailType then lvLimit = trailType end
for i, v in pairs(this.friendHelpHero) do
if v and v.hero and v.hero.lv > lvLimit then
table.insert(heros,v.hero)
end
end
return heros
else
if this.friendHelpHero[trailType] then
return this.friendHelpHero[trailType]
end
end
return nil
end
@ -358,6 +370,7 @@ function this.SetMyHelpHeroData(trail,_data,func)
if not this.myHelpHeroData[v.trailType] then
this.myHelpHeroData[v.trailType] = {}
end
--LogGreen("v.hero.id:"..v.hero.id)
this.myHelpHeroData[v.trailType] = HeroManager.GetSingleHeroData(v.hero.id)
end
end
@ -378,14 +391,25 @@ function this.SetMyHelpHeroData(trail,_data,func)
end
--获取我的助战
function this.GetFriendHelpHero(trailType)
function this.GetMyHelpHero(trailType)
if this.myHelpHeroData[trailType] then
LogGreen(this.myHelpHeroData[trailType].dynamicId)
--LogGreen(this.myHelpHeroData[trailType].dynamicId)
return this.myHelpHeroData[trailType]
end
LogGreen("没有选择助战")
return nil
end
--获取一个英雄信息
function this.GetSingleHeroData(did)
for k,v in pairs(this.friendHelpHero) do
if v and v.hero and v.hero.dynamicId == did then
return v.hero
end
end
return nil
end
------------------------------四灵试炼 红点---------------------------------------
function this.CheckTrailRedPoint()

View File

@ -119,8 +119,19 @@ function this.RegisterMessage(network)
--跨服天梯信息推送
-- socket:RegistNetMessage(MessageTypeProto_pb.HERO_SKIN_USE_INDICATION, this.GetWorldArenaInfoIndication)
socket:RegistNetMessage(MessageTypeProto_pb.WorldLevelIndication, this.WorldLevelIndication)
socket:RegistNetMessage(MessageTypeProto_pb.SendFourChallengeInfoIndication, this.SendFourChallengeInfoIndication)
end
function this.SendFourChallengeInfoIndication(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.FourChallengeGetInfoResponse()
msg:ParseFromString(data)
LogGreen("刷新四灵")
MonsterCampManager.InitFourMonsterData(msg)
MonsterCampManager.SetFriendHelpHero({},nil)
MonsterCampManager.SetMyHelpHeroData(nil)
end
function this.HeroSkinUseIndication(buffer)
local data = buffer:DataByte()
local msg = HeroInfoProto_pb.GetSkinIndication()

View File

@ -4864,9 +4864,6 @@ function NetManager.UseHelpHeroRequest(heroId,type,status,func)
data.status = status
local msg = data:SerializeToString()
Network:SendMessageWithCallBack(MessageTypeProto_pb.UseHelpHeroRequest, MessageTypeProto_pb.UseHelpHeroResponse, msg, function(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.UseHelpHeroResponse()
msg:ParseFromString(data)
if func then
func(msg)
end

View File

@ -6,12 +6,12 @@ function FourTrailSingleHelpHero:New(gameObject)
b.gameObject = gameObject
b.transform = gameObject.transform
setmetatable(b, { __index = FourTrailSingleHelpHero })
self:InitComponent(b.gameObject)
return b
end
--初始化组件(用于子类重写)
function FourTrailSingleHelpHero:InitComponent(go)
function FourTrailSingleHelpHero:InitComponent()
local go = Util.GetGameObject(self.gameObject, "GameObject")
self.hero = Util.GetGameObject(go, "HeroPre")
self.frame = Util.GetGameObject(self.hero, "frame"):GetComponent("Image")
self.icon = Util.GetGameObject(go, "icon"):GetComponent("Image")
@ -26,8 +26,18 @@ function FourTrailSingleHelpHero:InitComponent(go)
self.selectText = Util.GetGameObject(go,"Button/Text"):GetComponent("Text")
self.btn = Util.GetGameObject(go,"Button")
end
--绑定事件(用于子类重写)
function FourTrailSingleHelpHero:BindEvent()
end
function FourTrailSingleHelpHero:OnOpen(curType,...)
--添加事件监听(用于子类重写)
function FourTrailSingleHelpHero:AddListener()
end
--移除事件监听(用于子类重写)
function FourTrailSingleHelpHero:RemoveListener()
end
function FourTrailSingleHelpHero:OnShow(curType,...)
local args = {...}
local player = {}
local heroData = {}
@ -107,7 +117,7 @@ end
function FourTrailSingleHelpHero:SetIcon2(heroData)
LogGreen(heroData.dynamicId)
local tempData = MonsterCampManager.GetFriendHelpHero(self.curType)
local tempData = MonsterCampManager.GetMyHelpHero(self.curType)
LogGreen(heroData.dynamicId)
if tempData and heroData.dynamicId == tempData.dynamicId then
self.select.sprite = Util.LoadSprite("s_silingshilian_zhiyuanzhong")
@ -133,9 +143,10 @@ function FourTrailSingleHelpHero:SetIcon2(heroData)
end
end
--界面销毁时调用(用于子类重写)
function FourTrailSingleHelpHero:OnClose()
end
function FourTrailSingleHelpHero:OnDestroy()
self = nil
end