探索提交

dev_chengFeng
jiaoyangna 2021-12-28 13:30:27 +08:00
parent 4a9792363d
commit 9dafa85858
12 changed files with 296 additions and 1729 deletions

View File

@ -425,7 +425,7 @@ function SetHeroStars(spLoader, starGrid, star, type,_starSize,_scale,_pivot,rot
local starSize
if not _starSize and type == 3 then
--第一个值代表缩放第二个值代表y轴移动到的y轴的位置
starSize = Vector3.New(1,-15.6)
starSize = Vector3.New(1,-15.6)
elseif not _starSize and star >= 10 then
starSize = Vector2(60,57)
else

View File

@ -79,6 +79,9 @@ function ExploreMainPanel:InitComponent()
lasty = 0
setPosFunc(d.delta)
end
self.trigger.onPointerUp = self.trigger.onPointerUp + function()
self:SetTip(self.tipRoot,self.mapId)
end
end
--绑定事件(用于子类重写)

View File

@ -74,7 +74,6 @@ end
--刷新编队
function this.UpdateFormationData(team)
LogGreen("team.teamId:"..team.teamId.." team.hp:"..team.hp.." team.exploreTime:"..team.exploreTime)
if this.FormationData[team.teamId] then
this.FormationData[team.teamId].hp = team.hp
this.FormationData[team.teamId].exploreTime = team.exploreTime
@ -102,7 +101,6 @@ function this.UpdateFormationData(team)
else
LogGreen(string.format("%s编队不属于探索玩法",team.teamId))
end
LogGreen("this.FormationData[team.teamId].state:"..this.FormationData[team.teamId].state.." team.exploreTime - GetTimeStamp():"..team.exploreTime - GetTimeStamp())
CheckRedPointStatus(RedPointType.ExploreFunc)
end
@ -115,6 +113,8 @@ function this.ResetTeamByTeamId(teamId)
this.UpdateMapFormationData(this.FormationData[teamId].mapId,teamId,-1)
this.FormationData[teamId].mapId = 0
end
Game.GlobalEvent:DispatchEvent(GameEvent.Explore.UpdateFormation)
CheckRedPointStatus(RedPointType.ExploreFunc)
end
-- 刷新地图编队
@ -163,6 +163,7 @@ end
function this.InitMapUserInfosData(data,mapId)
local datas = {}
local myData
for i = 1,#data do
local singleUserData = {}
singleUserData.userName = data[i].name
@ -171,19 +172,32 @@ function this.InitMapUserInfosData(data,mapId)
singleUserData.userSkin = data[i].userSkin
singleUserData.userTitle = data[i].userTitle
singleUserData.userMount = data[i].userMount
singleUserData.precticelevel = data[i].practiceLevel
singleUserData.practiceLevel = data[i].practiceLevel
singleUserData.lv = data[i].level
singleUserData.formationId = i
singleUserData.hp = 0
table.insert(datas,singleUserData)
end
for k,v in pairs(this.ExploreMapData[mapId].formations) do
for i = 1,#datas do
if datas[i].uid == PlayerManager.uid then
datas[i].formationId = k
end
singleUserData.hp = 0
LogGreen("data[i].uid:"..data[i].uid.." PlayerManager.uid:"..PlayerManager.uid)
if singleUserData.uid == PlayerManager.uid then
myData = singleUserData
else
table.insert(datas,singleUserData)
end
end
for k,v in pairs(this.ExploreMapData[mapId].formations) do
local singleUserData = {}
singleUserData.userName = myData.userName
singleUserData.sex = myData.sex
singleUserData.uid = myData.uid
singleUserData.userSkin = myData.userSkin
singleUserData.userTitle = myData.userTitle
singleUserData.userMount = myData.userMount
singleUserData.practiceLevel = myData.practiceLevel
singleUserData.lv = myData.lv
singleUserData.formationId = k
singleUserData.hp = this.FormationData[k].hp
table.insert(datas,singleUserData)
end
return datas
end

View File

@ -8,15 +8,6 @@ local mapIconConfig = ConfigManager.GetConfig(ConfigName.MainMapIconConfig)
local iconAction = require("Modules/Fight/View/FightMapIconShowView")
local this = {}
--地图id
local mapIdList = {
[1] = 5002,
[2] = 5003,
[3] = 5005,
[4] = 4002,
[5] = 5004,
}
-- 临时可生成怪的区域
local monsterArea = {
@ -146,13 +137,6 @@ function this:LoadMapData()
this.mapRoot.transform.position = Vector3.New(0, 0, -100)
TileMapView.fogSize = 2
local curChapter = FightPointPassManager.GetCurChapterIndex()
local index = 1
index = math.floor((curChapter - 1) % 5 + 1)
-- --Log(curChapter)
-- --Log(index)
m_parent.mapData.exploreMapId = mapIdList[index]
-- LogPink("#mapIdList:"..#mapIdList.." m_parent.mapData.exploreMapId:"..m_parent.mapData.exploreMapId.." curChapter:"..curChapter.." index:"..index.." State:"..tostring(FightPointPassManager.isOpenNewChapter))
TileMapView.AwakeInit(this.mapRoot, m_parent.mapData.exploreMapId, nil, Vector2.New(180, 180))
TileMapView.isShowFog = false
TileMapController.IsShieldDrag = function()

View File

@ -618,7 +618,9 @@ end
--设置英雄列表数据
function this.SetRoleList(_roleDatas, isTop,isAni)
if this.opView.SortHeroDatas then
if panelType == FORMATION_TYPE.ExploreFunc then
_roleDatas = this.opView.SortHeroDatas(_roleDatas)
elseif this.opView.SortHeroDatas then
this.opView.SortHeroDatas(_roleDatas)
else
this.SortHeroDatas(_roleDatas)
@ -639,7 +641,7 @@ function this.SetRoleList(_roleDatas, isTop,isAni)
end, not isTop,not isAni)
end
--排序英雄数据
function this.SortHeroDatas(_heroDatas)
local choosed = {}

View File

@ -76,6 +76,11 @@ function this.SortHeroDatas(_roleDatas)
return a.sort < b.sort
end
end)
local data2 = {}
for k,v in ipairs(datas1) do
table.insert(data2,v.herodata)
end
return data2
end
function this.GetHeroTeam(did)

View File

@ -133,7 +133,16 @@ function this:Refresh(_data,_item)
_item.heroList[j].hero:SetActive(true)
_item.heroList[j].levelText.text = heroData.lv
local star,starType = heroData.GetStar(1)
SetHeroStars(this.spLoader, _item.heroList[j].starGrid, star,starType)
local starSize = Vector2.New(25,25)
local starScale = -12.3
if starType == 3 then
starSize = Vector2.New(0.7,-25)
starScale = -23.75
elseif starType == 2 then
starSize = Vector2.New(36.868,39.76)
end
SetHeroStars(this.spLoader, _item.heroList[j].starGrid, star,starType,starSize,starScale)
Util.SetParticleSortLayer( _item.heroList[j].starGrid,sortingOrder + 1)
local demonId = heroData.id
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, demonId)
_item.heroList[j].frame.sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(heroConfig.Quality,heroData.star))
@ -195,7 +204,7 @@ function this:TimeCountDown()
this.timer:Stop()
this.timer = nil
end
this.timer = Timer.New(function()
local s = function()
for i = 1,#this.itemList do
if this.itemList[i].data and this.itemList[i].data.state > 0 then
local time = this.itemList[i].data.exploreTime - GetTimeStamp()
@ -208,7 +217,9 @@ function this:TimeCountDown()
end
end
end
end,1,-1,true)
end
s()
this.timer = Timer.New(s,1,-1,true)
this.timer:Start()
end

View File

@ -5,7 +5,7 @@ local sortingOrder
local SpecialConfig = ConfigManager.GetConfigData(ConfigName.SpecialConfig,142)
local Explore = ConfigManager.GetConfig(ConfigName.Explore)
local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
--红 fe5757 黄 f3e168 绿 58f567
--初始化组件(用于子类重写)
function this:InitComponent(gameObject)
this.spLoader = SpriteLoader.New()
@ -33,6 +33,9 @@ function this:InitComponent(gameObject)
this.gameObject = gameObject
this.transform = this.gameObject.transform
this.formationList = {}
this.mapTipLayer = this.mapTip:GetComponent("Canvas")
this.mapTimeTipLayer = this.mapTimeTip:GetComponent("Canvas")
end
--绑定事件(用于子类重写)
@ -63,16 +66,16 @@ function this:BindEvent()
end
function this:OnSortingOrderChange()
end
--添加事件监听(用于子类重写)
function this:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Explore.UpdateFormation,this.OnShow)
end
--移除事件监听(用于子类重写)
function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Explore.UpdateFormation,this.OnShow)
end
--界面打开时调用(用于子类重写)
@ -85,10 +88,14 @@ function this:OnOpen(_parent,...)
this.mapDatas = args[2] --地图数据
this.formationList = {} --formationId 为索引 预设index,mapId,exploreTime,formationId
this.formationId,this.mapId,this.exploreTime = 0,0,0
this.mapTipLayer.overrideSorting = true
this.mapTipLayer.sortingOrder = sortingOrder + 1
this.mapTimeTipLayer.overrideSorting = true
this.mapTimeTipLayer.sortingOrder = sortingOrder + 1
end
--界面打开时调用(用于子类重写)
function this:OnShow(_parent,...)
function this:OnShow()
this.icon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(Explore[1].Cost[1]))
--队伍
for i = 1,math.max(#this.itemList,#this.data) do
@ -148,10 +155,9 @@ function this:OnShow(_parent,...)
this.mapTipPreList[k].des.text = v.name
this.mapTipPreList[k].data = v
Util.AddOnceClick(this.mapTipPreList[k].go,function()
this.mapTip.gameObject:SetActive(false)
LogGreen("this.formationId:"..this.formationId)
this.formationList[this.formationId].mapId = v.mapId
this.SetMapName()
this.SetPos(this.mapTip,nil,this.formationId)
end)
end
--时间下拉框
@ -168,36 +174,65 @@ function this:OnShow(_parent,...)
this.mapTimeTipPreList[i].des.text = this.timeList[i].."小时"
this.mapTimeTipPreList[i].data = this.timeList[i]
Util.AddOnceClick(this.mapTimeTipPreList[i].go,function()
this.mapTimeTip.gameObject:SetActive(false)
this.formationList[this.formationId].exploreTime = this.timeList[i]
this.SetExploreTime()
this.SetPos(this.mapTimeTip,nil,this.formationId)
end)
end
end
this:TimeCountDown()
end
function this.RefreshMapNameColor()
--红 fe5757 黄 f3e168 绿 58f567
for k,v in pairs(this.mapDatas) do
if FormationManager.GetFormationPower(this.formationId)/v.force < 0.8 then
this.mapTipPreList[k].des.text = string.format("<color=#%s>%s</color>","fe5757", v.name)
elseif FormationManager.GetFormationPower(this.formationId)/v.force >= 0.8 and FormationManager.GetFormationPower(this.formationId)/v.force < 1 then
this.mapTipPreList[k].des.text = string.format("<color=#%s>%s</color>","f3e168", v.name)
else
this.mapTipPreList[k].des.text = string.format("<color=#%s>%s</color>","58f567", v.name)
end
end
end
function this.SetMapName(id)
local forId = id or this.formationId
this.itemList[this.formationList[forId].index].targgetBtnText.text = Explore[this.formationList[forId].mapId].Name
local forId = id or this.formationId
if FormationManager.GetFormationPower(forId)/Explore[this.formationList[forId].mapId].Force < 0.8 then
this.itemList[this.formationList[forId].index].targgetBtnText.text = string.format("<color=#%s>%s</color>","fe5757", Explore[this.formationList[forId].mapId].Name)
elseif FormationManager.GetFormationPower(forId)/Explore[this.formationList[forId].mapId].Force >= 0.8 and FormationManager.GetFormationPower(forId)/Explore[this.formationList[forId].mapId].Force < 1 then
this.itemList[this.formationList[forId].index].targgetBtnText.text = string.format("<color=#%s>%s</color>","f3e168", Explore[this.formationList[forId].mapId].Name)
else
this.itemList[this.formationList[forId].index].targgetBtnText.text = string.format("<color=#%s>%s</color>","58f567", Explore[this.formationList[forId].mapId].Name)
end
this.SetExploreCost(forId)
end
function this.SetExploreTime(id)
local forId = id or this.formationId
this.itemList[this.formationList[forId].index].targgetTimeBtnText.text = this.formationList[forId].exploreTime.."小时"
if this.formationList[forId].select == -1 then
this.itemList[this.formationList[forId].index].cost.gameObject:SetActive(false)
else
this.itemList[this.formationList[forId].index].cost.gameObject:SetActive(true)
this.itemList[this.formationList[forId].index].targgetTimeBtnText.text = this.formationList[forId].exploreTime.."小时"
end
this.SetExploreCost(forId)
end
function this.SetExploreCost(forId)
this.haveNum = BagManager.GetItemCountById(Explore[1].Cost[1])
if forId then
if this.formationList[forId].select == -1 then
this.formationList[forId].cost.gameObject:SetActive(false)
this.itemList[this.formationList[forId].index].cost.gameObject:SetActive(false)
else
this.formationList[forId].cost.gameObject:SetActive(true)
this.itemList[this.formationList[forId].index].cost.gameObject:SetActive(true)
this.itemList[this.formationList[forId].index].costIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(Explore[this.formationList[forId].mapId].Cost[1]))
this.formationList[forId].costNum = Explore[this.formationList[forId].mapId].Cost[2] * (this.formationList[forId].exploreTime * 60)
this.itemList[this.formationList[forId].index].costNum.text = this.formationList[forId].costNum
if this.formationList[forId].costNum >= this.haveNum then
this.itemList[this.formationList[forId].index].costNum.text = string.format("<color=#%s>%s</color>","00ff00",this.formationList[forId].costNum)
else
this.itemList[this.formationList[forId].index].costNum.text = this.formationList[forId].costNum
end
end
end
local num = 0
@ -206,13 +241,11 @@ function this.SetExploreCost(forId)
num = num + v.costNum
end
end
this.haveNum = BagManager.GetItemCountById(Explore[1].Cost[1])
if num < this.haveNum then
this.num.text = string.format("<color=#%s>%s</color>/%s","00ff00",num,this.haveNum)
this.num.text = string.format("<color=#%s>%s/%s</color>","00ff00",num,this.haveNum)
else
this.num.text = string.format("<color=#%s>%s</color>/%s","ff0000",num,this.haveNum)
this.num.text = string.format("<color=#%s>%s/%s</color>","ffddbb",num,this.haveNum)
end
this.formationId = 0
end
function this.SetPos(gobj,pos,formationId)
@ -225,6 +258,7 @@ function this.SetPos(gobj,pos,formationId)
else
gobj.gameObject:SetActive(false)
gobj.transform:SetParent(this.transform)
this.formationId = 0
end
end
@ -237,6 +271,20 @@ function this:Refresh(_data,_item,index)
_item.heroList[j].frame.sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(1))
_item.heroList[j].hero:SetActive(false)
_item.heroList[j].frame.gameObject:GetComponent("Button").onClick:RemoveAllListeners()
_item.heroList[j].heroData = nil
Util.AddOnceClick(_item.heroList[j].frame.gameObject,function()
if _data.state < 1 then
ExploreManager.curFormationIndex = _data.formationId
UIManager.OpenPanel(UIName.FormationPanelV2,FORMATION_TYPE.ExploreFunc)
else
PopupTipPanel.ShowTip(string.format("队伍正在探索%s无法进行调整",ExploreManager.ExploreMapData[_data.mapId].name))
end
end)
Util.AddLongPressClick(_item.heroList[j].frame.gameObject, function()
if _item.heroList[j].heroData then
UIManager.OpenPanel(UIName.RoleGetInfoPopup,false,_item.heroList[j].heroData.id,_item.heroList[j].heroData.star)
end
end, 0.5)
end
local formation = FormationManager.GetFormationByID(_data.formationId)
for j, hero in ipairs(formation.teamHeroInfos) do
@ -244,25 +292,22 @@ function this:Refresh(_data,_item,index)
_item.heroList[j].hero:SetActive(true)
_item.heroList[j].levelText.text = heroData.lv
local star,starType = heroData.GetStar(1)
SetHeroStars(this.spLoader, _item.heroList[j].starGrid, star,starType)
local star,starType = heroData.GetStar(1)
local starSize = Vector2.New(25,25)
local starScale = -12.3
if starType == 3 then
starSize = Vector2.New(0.7,-25)
starScale = -23.75
elseif starType == 2 then
starSize = Vector2.New(36.868,39.76)
end
SetHeroStars(this.spLoader, _item.heroList[j].starGrid, star,starType,starSize,starScale)
local demonId = heroData.id
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, demonId)
_item.heroList[j].frame.sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(heroConfig.Quality,heroData.star))
_item.heroList[j].icon.sprite = this.spLoader:LoadSprite(heroData.icon)
_item.heroList[j].proIcon.sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
Util.AddOnceClick(_item.heroList[j].frame.gameObject,function()
if _data.state < 1 then
ExploreManager.curFormationIndex = _data.formationId
UIManager.OpenPanel(UIName.FormationPanelV2,FORMATION_TYPE.ExploreFunc)
else
PopupTipPanel.ShowTip(string.format("队伍正在探索%s无法进行调整",ExploreManager.ExploreMapData[_data.mapId].name))
end
end)
Util.AddLongPressClick(_item.heroList[j].frame.gameObject, function()
if this.typeIndex ~= 0 then
UIManager.OpenPanel(UIName.RoleGetInfoPopup,false,demonId,hero.star)
end
end, 0.5)
_item.heroList[j].heroData = heroData
end
this.formationList[_data.formationId] = {} --formationId 为索引 预设index,mapId,exploreTime,formationId
@ -285,10 +330,11 @@ function this:Refresh(_data,_item,index)
else
_item.exploring.gameObject:SetActive(true)
this.formationList[_data.formationId].select = -1
this.formationList[_data.formationId].mapId = this.mapDatas[1].mapId
this.formationList[_data.formationId].mapId = _data.mapId
this.formationList[_data.formationId].exploreTime = this.mapDatas[1].exploreTime
_item.targgetTimeBtn.gameObject:SetActive(false)
end
LogGreen("_data.formationId:".._data.formationId.." this.formationList[_data.formationId].mapId:"..this.formationList[_data.formationId].mapId)
this.SetMapName(_data.formationId)
this.SetExploreTime(_data.formationId)
_item.selectIma.gameObject:SetActive(this.formationList[_data.formationId].select == 1)
@ -303,9 +349,14 @@ function this:Refresh(_data,_item,index)
end)
Util.AddOnceClick(_item.targgetBtn,function()
this.SetPos(this.mapTip,_item.targgetRoot,_data.formationId)
if _data.state < 1 then
this.SetPos(this.mapTimeTip,nil,this.formationId)
this.SetPos(this.mapTip,_item.targgetRoot,_data.formationId)
this.RefreshMapNameColor()
end
end)
Util.AddOnceClick(_item.targgetTimeBtn,function()
this.SetPos(this.mapTip,nil,this.formationId)
this.SetPos(this.mapTimeTip,_item.targgetTimeRoot,_data.formationId)
end)
@ -359,6 +410,8 @@ end
function this:OnDestroy()
this.spLoader:Destroy()
this.itemList = {}
this.mapTipPreList = {}
this.mapTimeTipPreList = {}
end
return this

View File

@ -1083,7 +1083,6 @@ function this.LingMaiIndication(buffer)
LingMaiMiJingManager.curPage = 0
Game.GlobalEvent:DispatchEvent(GameEvent.LingMaiMiJing.RefreshPanel)
end)
end
--刷新探索编队
@ -1092,6 +1091,7 @@ function NetManager.ExplorerMapIndicationResponse(buffer)
local msg = PlayerInfoProto_pb.ExplorerMapIndicationResponse()
msg:ParseFromString(data)
ExploreManager.UpdateFormationData(msg.exploreInfo)
Game.GlobalEvent:DispatchEvent(GameEvent.Explore.UpdateFormation)
end
return this

View File

@ -6357,7 +6357,8 @@ function NetManager.ExplorerMapRewardRequest(typeId,teamId,fun)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.ExplorerMapRewardResponse()
msg:ParseFromString(data)
ExploreManager.ResetTeamByTeamId(teamId)
ExploreManager.UpdateFormationData(msg.exploreInfo)
Game.GlobalEvent:DispatchEvent(GameEvent.Explore.UpdateFormation)
if fun then
fun(msg.drop)
end

View File

@ -147,7 +147,7 @@ function SingleExplorePlayerView:SetData(u,v,isSelf,data)
if isSelf then
self.ui:GetComponent("Canvas").worldCamera = TileMapView.GetCamera()
end
self.isSelf = isSelf or data.formationId > 3100
self.isSelf = isSelf
local v3 = TileMapView.GetLiveTilePos(u, v)
self.gameObject.transform.localPosition = Vector3(v3.x, v3.y, v3.z - 10)
@ -159,7 +159,7 @@ function SingleExplorePlayerView:SetData(u,v,isSelf,data)
end
local npc,scale
if self.isSelf then
if data.formationId > 3100 then
npc = NameManager.roleSex == ROLE_SEX.BOY and npc1 or npc2
scale = NameManager.roleSex == ROLE_SEX.BOY and 1 or 0.5
self.userId = PlayerManager.uid
@ -230,7 +230,7 @@ function SingleExplorePlayerView:SetData(u,v,isSelf,data)
end
function SingleExplorePlayerView:RefreshHp()
if self.isSelf then
if self.data.formationId > 3100 then
self.blood:SetActive(true)
local hp = ExploreManager.GetHpById(self.data.formationId)
if hp <= 0 then