一键探索修改提交

dev_chengFeng
jiaoyangna 2021-12-24 11:18:03 +08:00
parent 708a4bdef9
commit 7f0e684bc0
8 changed files with 23680 additions and 116 deletions

View File

@ -11,7 +11,7 @@ GameObject:
- component: {fileID: 1209305863515043212}
- component: {fileID: 114728435147945542}
m_Layer: 0
m_Name: SingleFightPlayerView
m_Name: SingleExplorePlayerView
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -81353,7 +81353,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &6552475919043407751
RectTransform:
m_ObjectHideFlags: 0

View File

@ -6159,8 +6159,8 @@ MonoBehaviour:
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: 999
--- !u!1 &971532537699919563

View File

@ -90,6 +90,7 @@ function this.UpdateFormationData(team)
this.UpdateMapFormationData(this.FormationData[team.teamId].mapId,team.teamId,-1)
this.FormationData[team.teamId].mapId = 0
else
this.FormationData[team.teamId].mapId = team.mapId
this.FormationData[team.teamId].state = 1
if this.FormationData[team.teamId].hp <= 0 then
this.FormationData[team.teamId].state = 2
@ -104,6 +105,17 @@ function this.UpdateFormationData(team)
CheckRedPointStatus(RedPointType.ExploreFunc)
end
function this.ResetTeamByTeamId(teamId)
if this.FormationData[teamId] then
this.FormationData[teamId].hp = 0
this.FormationData[teamId].exploreTime = 0
this.FormationData[teamId].dropReward = {}
this.FormationData[teamId].state = 0
this.UpdateMapFormationData(this.FormationData[teamId].mapId,teamId,-1)
this.FormationData[teamId].mapId = 0
end
end
-- 刷新地图编队
function this.UpdateMapFormationData(mapId,teamId,updateType)
if not this.ExploreMapData[mapId] then
@ -148,8 +160,30 @@ function this.GetExploreMapTipData(mapId)
return data1
end
function this.InitMapUserInfosData(data)
function this.InitMapUserInfosData(data,mapId)
local datas = {}
for i = 1,#data do
local singleUserData = {}
singleUserData.userName = data[i].name
singleUserData.sex = data[i].gender
singleUserData.uid = data[i].uid
singleUserData.userSkin = data[i].userSkin
singleUserData.userTitle = data[i].userTitle
singleUserData.userMount = data[i].userMount
singleUserData.precticelevel = 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.Id].formations) do
for i = 1,#datas do
if datas[i].uid == PlayerManager.uid then
datas[i].formationId = k
end
end
end
return datas
end
--index 1 有未开启的返回一个未开启的 0返回 所有已开启的

View File

@ -66,7 +66,6 @@ local m_parent
this.isClose = false
--root FightPointPassMainPanel.gameObject FightPointPassMainPanel脚本
function this:InitComponent(root, parent)
Log("初始化地图资源")
m_orginLayer = 0
m_parent = parent
-- 地图点击拖动
@ -74,8 +73,6 @@ function this:InitComponent(root, parent)
this.dragCtrl = Util.GetGameObject(root, "Ctrl")
this.effectRoot = Util.GetGameObject(root, "effectRoot")
this.buffTip = Util.GetGameObject(this.effectRoot, "money")
-- 箱子
this.boxEffect = Util.GetGameObject(root, "boxRoot/UI_effect_GuaJi_Box_BaoDian")
this.playerViews = {}
local str = ConfigManager.GetConfigData(ConfigName.SpecialConfig,111).Value
@ -101,28 +98,29 @@ function this:Init()
this:LoadMapData()
-- 加载一个小人
local tempconfig = ConfigManager.GetConfigData(ConfigName.ChallengeMapConfig,m_curMapId)
NetManager.ExplorerMapPlayerInfoRequest(this.mapData.mapId,function(msg)
local NPCList = ExploreManager.InitMapUserInfosData(msg,this.mapData.mapId)
local area = monsterArea[m_curMapId]
local suv = startUV[m_curMapId]
for k,v in pairs(NPCList) do
local index1 = math.random(area.x_pos.min,suv.u - 3)
local index2 = math.random(suv.u + 3,area.x_pos.max)
local index3 = math.random(1,2)
local index4 = math.random(area.y_pos.min,area.y_pos.max)
this.playerViews[v.formationId] = SubUIManager.Open(SubUIConfig.SingleExplorePlayerView,this.mapRoot.transform,this)
this.playerViews[v.formationId]:SetData((index3 == 1 and index1 or index2),index4,false,v)
if v.formationId > 3000 then
this.playerViews
end
end
end)
if not this.playerViews[0] then
--Log(m_curMapId)
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.guajigongneng) then
iconNum = 20
local randomNum = 8--math.random(2,3)
PlayerManager.GetFightMapPlayerNPCData(randomNum,function(NPCList)
if this.isClose then
return
end
--Log("NPCList:"..LengthOfTable(NPCList))
local index = 1
local area = monsterArea[m_curMapId]
local suv = startUV[m_curMapId]
for k,v in pairs(NPCList) do
local index1 = math.random(area.x_pos.min,suv.u - 3)
local index2 = math.random(suv.u + 3,area.x_pos.max)
local index3 = math.random(1,2)
local index4 = math.random(area.y_pos.min,area.y_pos.max)
this.playerViews[index] = SubUIManager.Open(SubUIConfig.SingleExplorePlayerView,this.mapRoot.transform,this)
this.playerViews[index]:SetData((index3 == 1 and index1 or index2),index4,false,v)
index = index + 1
end
end)
else
iconNum = 4
@ -173,18 +171,7 @@ function this:LoadMapData()
-- 设置不点击
this.dragCtrl:SetActive(false)
-- 挂机特效
this.moneyEffect = poolManager:LoadAsset(effectPath, PoolManager.AssetType.GameObject)
this.moneyEffect.transform:SetParent(this.effectRoot.transform)
this.moneyEffect.transform.localScale = Vector3.one
this.moneyEffect.transform.localPosition = Vector3.New(0, 0, 0)
this.moneyEffect:SetActive(false)
Util.AddParticleSortLayer(this.moneyEffect, m_parent.sortingOrder - m_orginLayer)
Util.AddParticleSortLayer(this.boxEffect, m_parent.sortingOrder - m_orginLayer)
m_orginLayer = m_parent.sortingOrder
this.boxEffect:SetActive(false)
end
--加载图标icon
@ -374,8 +361,6 @@ end
---------------------------------------------------------------------------------------------设置特效层级
function this:OnSortingOrderChange(orginLayer)
if this.moneyEffect then
Util.AddParticleSortLayer(this.moneyEffect, m_parent.sortingOrder - m_orginLayer)
Util.AddParticleSortLayer(this.boxEffect, m_parent.sortingOrder - m_orginLayer)
for k,v in pairs(this.playerViews) do
v:OnSortingOrderChange(m_parent.sortingOrder)
end

View File

@ -45,7 +45,6 @@ function this:OnOpen(_parent,...)
end
function this:OnShow()
LogGreen("刷新编队的请求")
for i = 1,math.max(#this.itemList,#this.data) do
if not this.data[i] then
if this.itemList[i] then
@ -99,6 +98,24 @@ function this:Refresh(_data,_item)
_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 this.typeIndex == 0 and _item.heroList[j].heroData then
UIManager.OpenPanel(UIName.RoleGetInfoPopup,false,_item.heroList[j].heroData.id,_item.heroList[j].heroData.star)
else
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
end)
Util.AddLongPressClick(_item.heroList[j].frame.gameObject, function()
if this.typeIndex ~= 0 and _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
@ -112,23 +129,7 @@ function this:Refresh(_data,_item)
_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 this.typeIndex == 0 then
UIManager.OpenPanel(UIName.RoleGetInfoPopup,false,demonId,hero.star)
else
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
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
_item.exploring.gameObject:SetActive(false)
_item.updateFormationBtn.gameObject:SetActive(false)
@ -144,7 +145,14 @@ function this:Refresh(_data,_item)
end
Util.AddOnceClick(_item.exploring,function()
NetManager.ExplorerMapRewardRequest(0,_data.formationId,function(drop)
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1,function()
_data.state = 0
_data.exploreTime = 0
_data.mapId = 0
self:Refresh(_data,_item)
end)
end)
end)
Util.AddOnceClick(_item.updateFormationBtn,function()
ExploreManager.curFormationIndex = _data.formationId

View File

@ -48,7 +48,13 @@ function this:BindEvent()
elseif num > this.haveNum then
PopupTipPanel.ShowTip(string.format("%s不足请重新选择队伍和探索时间",ItemConfig[Explore[1].Cost[1]].Name))
else
NetManager.ExplorerMapSendRequest(this.formationList,function()
local datas = {}
for k,v in pairs(this.formationList) do
if v.select == 1 then
table.insert(datas,v)
end
end
NetManager.ExplorerMapSendRequest(datas,function()
PopupTipPanel.ShowTip("一键探索成功!")
end)
end

View File

@ -6266,9 +6266,8 @@ function NetManager.ExplorerMapPlayerInfoRequest(mapId,fun)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.ExplorerMapPlayerInfoResponse()
msg:ParseFromString(data)
ExploreManager.InitMapUserInfosData(msg.playerInfo)
if fun then
fun()
fun(msg.playerInfo)
end
end)
end
@ -6298,15 +6297,16 @@ function NetManager.ExplorerMapSendRequest(_data,fun)
end
--typeId 0:停止探索 1:领取奖励
function NetManager.ExplorerMapRewardRequest(typeId,mapId,teamId,time,fun)
function NetManager.ExplorerMapRewardRequest(typeId,teamId,fun)
local data = PlayerInfoProto_pb.ExplorerMapRewardRequest()
data.type = typeId
data.time = time
data.teamId = teamId
local msg = data:SerializeToString()
Network:SendMessageWithCallBack(MessageTypeProto_pb.ExplorerMapRewardRequest, MessageTypeProto_pb.ExplorerMapRewardResponse, msg, function(buffer)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.ExplorerMapRewardResponse()
msg:ParseFromString(data)
ExploreManager.ResetTeamByTeamId(teamId)
if fun then
fun(msg.drop)
end