特训提交

wangzhenxing 2023-11-21 17:26:43 +08:00
parent d7c45359bb
commit 5f191e29cb
16 changed files with 496992 additions and 52 deletions

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -819,10 +819,10 @@ RectTransform:
m_Father: {fileID: 2562817607428992190}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 194, y: -33.6}
m_SizeDelta: {x: 288, y: 64.400024}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 155, y: 0}
m_SizeDelta: {x: 0, y: 64.400024}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2845478241211625418
CanvasRenderer:
@ -853,7 +853,7 @@ MonoBehaviour:
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 4b73e9e4512d17e4daeea351e090d33c, type: 3}
m_Font: {fileID: 12800000, guid: be22547d075a3fa439f78ce38cdb4beb, type: 3}
m_FontSize: 32
m_FontStyle: 0
m_BestFit: 0
@ -988,10 +988,10 @@ RectTransform:
m_Father: {fileID: 2562817607428992190}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 25, y: -33.6}
m_SizeDelta: {x: 50, y: 50}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 59, y: 48}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8315433955612078822
CanvasRenderer:
@ -1021,7 +1021,7 @@ MonoBehaviour:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: ad08503fa5d65df40a15bcb3243b28f1, type: 3}
m_Sprite: {fileID: 21300000, guid: 7117fcc712b12fa41bd56e7599891950, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@ -1204,7 +1204,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &2562817607428992190
RectTransform:
m_ObjectHideFlags: 0
@ -1224,7 +1224,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 448.89996, y: -492.34}
m_SizeDelta: {x: 338, y: 67.2}
m_SizeDelta: {x: 0, y: 67.2}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &865176911362411280
MonoBehaviour:
@ -1460,8 +1460,8 @@ 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: 5.9, y: -0.000016217}
m_SizeDelta: {x: 87.8, y: 84}
m_AnchoredPosition: {x: -0.0000038147, y: -0.00000032116}
m_SizeDelta: {x: 59, y: 48}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6319655838325846258
CanvasRenderer:
@ -1491,7 +1491,7 @@ MonoBehaviour:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: 4df0b51ed49908a4791aed4bd1447949, type: 3}
m_Sprite: {fileID: 21300000, guid: c2be9ccdb746ede468beb68e69835985, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1

View File

@ -0,0 +1,158 @@
----- --家园建筑升级 -----
local TrainBuildLvUpPanel = Inherit(BasePanel)
local this = TrainBuildLvUpPanel
local HomeLand = ConfigManager.GetConfig(ConfigName.TrainBuild)
local HomeLandLevel = ConfigManager.GetConfig(ConfigName.TrainBuildLevel)
local costOneSec = ConfigManager.GetConfigData(ConfigName.SpecialConfig,170).Value
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
local data=nil
local Obj=nil
function TrainBuildLvUpPanel:InitComponent()
this.spLoader = SpriteLoader.New()
--当前两个名字
this.curName = Util.GetGameObject(this.gameObject,"Buildings/curName"):GetComponent("Text")
this.nextName = Util.GetGameObject(this.gameObject,"Buildings/nextName"):GetComponent("Text")
this.Content = Util.GetGameObject(this.gameObject,"Content")
this.Obtain = Util.GetGameObject(this.Content,"Obtain")
this.Cost = Util.GetGameObject(this.Content,"Cost")
--Obtain
this.limit = Util.GetGameObject(this.Obtain,"limit")
this.gain = Util.GetGameObject(this.Obtain,"gain")
this.gainIcon = Util.GetGameObject(this.Obtain,"gain/Icon"):GetComponent("Image")
this.gainNum = Util.GetGameObject(this.Obtain,"gain/Num"):GetComponent("Text")
this.gainAdd = Util.GetGameObject(this.Obtain,"gain/Add"):GetComponent("Text")
--cost
this.cost1Icon1 = Util.GetGameObject(this.Cost,"cost1/Icon"):GetComponent("Image")
this.cost1Num1 = Util.GetGameObject(this.Cost,"cost1/Num"):GetComponent("Text")
this.cost2 = Util.GetGameObject(this.Cost,"cost2")
this.cost2Name = Util.GetGameObject(this.Cost,"cost2/Text"):GetComponent("Text")
this.cost2Num = Util.GetGameObject(this.Cost,"cost2/Num"):GetComponent("Text")
--fastDone
this.fastDoneMoney = Util.GetGameObject(this.gameObject,"Btns/fastDone/Money")
this.fastDoneIcon = Util.GetGameObject(this.fastDoneMoney,"Icon"):GetComponent("Image")
this.fastDoneNum = Util.GetGameObject(this.fastDoneMoney,"Num"):GetComponent("Text")
this.fastDoneBtn = Util.GetGameObject(this.gameObject,"Btns/fastDone/BtnDo")
--Done
this.doneNum = Util.GetGameObject(this.gameObject,"Btns/Done/Money/Text"):GetComponent("Text")
this.doneBtn = Util.GetGameObject(this.gameObject,"Btns/Done/BtnDo")
end
function TrainBuildLvUpPanel:BindEvent()
Util.AddClick(this.fastDoneBtn, function()
-- local priviId = PrivilegeManager.GetPrivilegeRemainValue()
TrainBuildManager.ResumeCost(data.dataSingle,string.split(costOneSec,"#"),function (num)
MsgPanel.ShowTwo(string.format("是否花费%s妖晶立即升级",num),function() end,function()
NetManager.TrainingArchitectureUpRequest(data.dataMain.Id,2,function ()
Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnUpdateData)
--特效
Obj.effect2:SetActive(true)
Timer.New(function ()
Obj.effect2:SetActive(false)
end,1):Start()
PopupTipPanel.ShowTip(string.format("<color=#00FF00>%s</color>已升级至<color=#00FF00>%s</color>级",data.dataMain.Name,data.dataSingle.level))
self:ClosePanel()
end)
end,"取消","确定")
end)
end)
Util.AddClick(this.doneBtn, function()
TrainBuildManager.ResumeCost(data.dataSingle,nil,function ()
NetManager.TrainingArchitectureUpRequest(data.dataMain.Id,1,function ()
Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnUpdateData)
self:ClosePanel()
end)
end)
end)
Util.AddClick(this.gameObject,function ()
self:ClosePanel()
end)
end
function TrainBuildLvUpPanel:AddListener()
end
function TrainBuildLvUpPanel:RemoveListener()
end
function TrainBuildLvUpPanel:OnOpen(_args)
data = _args[1]
Obj = _args[2]
end
function TrainBuildLvUpPanel:OnShow()
local curData = data.dataSingle
local nextData = HomeLandLevel[curData.Id + 1]
local str = string.split(costOneSec,"#")
this.curName.text = string.format("%s %s级",data.dataMain.Name,curData.level)
this.nextName.text = string.format("%s级",nextData.level)
this.Obtain:SetActive(false)
if curData.Gain and curData.Gain>0 then
this.Obtain:SetActive(true)
--this.gainIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(curData.Gain[1]))
this.gainNum.text = curData.Gain
this.gainAdd.text = string.format(" +%s",nextData.Gain - curData.Gain)
end
this.Cost:SetActive(false)
if curData.Cost then
this.Cost:SetActive(true)
this.cost1Icon1.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(curData.Cost[1][1]))
local color1 = BagManager.GetTotalItemNum(curData.Cost[1][1]) >= curData.Cost[1][2] and "#A47C31" or "red"
this.cost1Num1.text = string.format("<color=%s>%s</color>",color1,curData.Cost[1][2])
end
this.cost2:SetActive(false)
if curData.Rule and #curData.Rule>0 and type(curData.Rule[1])~="userdata" then
this.cost2:SetActive(true)
local color = TrainBuildManager.BuildData[curData.Rule[1]].level < curData.Rule[2] and "FF0000" or "A47C31"
this.cost2Num.text = string.format("<color=#%s>%s到达%s级</color>",color,HomeLand[curData.Rule[1]].Name,curData.Rule[2])
else
end
this.fastDoneIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(tonumber(str[1])))
LogError("curData.Time===================="..curData.Time)
this.fastDoneNum.text = math.ceil(curData.Time/60)*tonumber(str[2])
this.doneNum.text = string.format("耗时:%s",this:CulculateTime(curData.Time))
ForceRebuildLayout(this.gain.transform)
ForceRebuildLayout(this.Obtain.transform)
ForceRebuildLayout(this.Cost.transform)
ForceRebuildLayout(this.Content.transform)
end
function TrainBuildLvUpPanel:CulculateTime(time)
if time < 60 then
return time..""
elseif time >= 60 and time < 3600 then
return math.floor(time/60)..""..(time%60)..""
elseif time >= 3600 and time < 86400 then
return math.floor(time/3600)..""..math.floor((time%3600)/60)..""
elseif time >= 86400 then
return math.floor(time/86400)..""..math.floor((time%86400)/3600)..""
end
end
function TrainBuildLvUpPanel:OnClose()
data=nil
end
function TrainBuildLvUpPanel:OnDestroy()
this.spLoader:Destroy()
end
return TrainBuildLvUpPanel

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6b56c98815a33484bb9f9c018be22ed9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -4,6 +4,7 @@ local HomeLand = ConfigManager.GetConfig(ConfigName.TrainBuild)
local HomeLandLevel = ConfigManager.GetConfig(ConfigName.TrainBuildLevel)
local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local trainConfig=ConfigManager.GetConfig(ConfigName.Train)
local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig)
function this.Initialize()
this.BuildData = {}
@ -29,6 +30,8 @@ function this.Initialize()
table.insert(this.allHeroId,configData.HeroID)
end
end
--所有正在特训的英雄id
this.trainHeroId={}
end
@ -91,6 +94,9 @@ function this.GetServerData(msg,func)
this.BuildData[value.id].endTime=value.startTime+singledata.Time
end
this.BuildData[value.id].dataSingle = singledata
if value.heroId then
table.insert(this.trainHeroId,value.heroId)
end
--end
end
end
@ -190,43 +196,9 @@ function this.Check1to5Building()
return false
end
--1-5建筑的单个升级
function this.singleUpgrade(id)
local data = this.BuildData[id].dataSingle
if HomeLand[id].UnlockLevel[1] == 1 and PlayerManager.level < HomeLand[id].UnlockLevel[2] then
elseif HomeLand[id].UnlockLevel[1] == 2 and HomeLandManager.BuildData[5].level < HomeLand[id].UnlockLevel[2] then
elseif HomeLand[id].UnlockLevel[1] == 3 and PlayerManager.level < GlobalSystemConfig[HomeLand[id].UnlockLevel[2]].OpenRules[2] then
else
if data.Cost and BagManager.GetTotalItemNum(data.Cost[1][1]) >= data.Cost[1][2] then--所需材料够
if not data.Rule or (this.BuildData[data.Rule[1]].level >= data.Rule[2]) then--到达升级条件
if this.BuildData[id].endTime <= GetTimeStamp() then
return true
end
end
end
end
return false
end
--1-4建筑的单个领取
function this.singleGet(id)
local data = this.BuildData[id]
if data.dataMain.Type == 1 and data.dataSingle.Gain and this.BuildData[5].level > data.dataMain.UnlockLevel[2] then
return (GetTimeStamp() - data.startTime)/60*data.dataSingle.Gain[2] >= data.dataSingle.Storage[1][2]
end
return false
end
--检测任务
function this.CheckMission()
local data = this.SetRewardData()
for index, value in ipairs(data) do
if value.state == 1 then
return true
end
end
return false
end
--===============设置按钮位置=================
local POS = {

View File

@ -0,0 +1,341 @@
local TrainBuildPanel = quick_class("TrainBuildPanel", BasePanel)
local HomeLandConfig = ConfigManager.GetConfig(ConfigName.TrainBuild)
local HomeLandLevel = ConfigManager.GetConfig(ConfigName.HomeLandLevel)
local HomeLandTask = ConfigManager.GetConfig(ConfigName.HomeLandTask)
local GlobalSystemConfig = ConfigManager.GetConfig(ConfigName.GlobalSystemConfig)
local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local costStr = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig,100).Value,"#")
local bool = false
function TrainBuildPanel:InitComponent()
self.spLoader = SpriteLoader.New()
-- if not self.playerInfoView then
-- self.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, self.transform)
-- end
self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform)
self.btnBack = Util.GetGameObject(self.gameObject,"btnBack")
self.map = Util.GetGameObject(self.gameObject,"Map")
self.Grid = Util.GetGameObject(self.map,"Grid")
self.Bg = Util.GetGameObject(self.map,"Bg")
self.Privi = Util.GetGameObject(self.map,"Privi")
self.PriviBtn = Util.GetGameObject(self.map,"goBtn")
self.RightUp = Util.GetGameObject(self.map,"RightUp")
self.RightDown = Util.GetGameObject(self.map,"RightDown")
self.helpBtn = Util.GetGameObject(self.RightUp, "helpBtn")
self.helpPosition=self.helpBtn:GetComponent("RectTransform").localPosition
--progress
self.helpBtn1 = Util.GetGameObject(self.progress,"Help1")
self.progressPre = Util.GetGameObject(self.progress,"progressPre")
self.preList1 = {}
--detail
self.preList2 = {}
--地图点信息
self.mapData = {}
for i = 1, 7 do
self.mapData[i] = {}
self.mapData[i].Obj = Util.GetGameObject(self.Bg,"Map ("..i..")")
self.mapData[i].Title = Util.GetGameObject(self.mapData[i].Obj,"Title")
self.mapData[i].levelImg = Util.GetGameObject(self.mapData[i].Title,"levelImg")
self.mapData[i].level = Util.GetGameObject(self.mapData[i].levelImg,"levelText"):GetComponent("Text")
self.mapData[i].NameImg = Util.GetGameObject(self.mapData[i].Title,"NameImg")
self.mapData[i].Name = Util.GetGameObject(self.mapData[i].Title,"NameImg/Text"):GetComponent("Text")
self.mapData[i].RedPoint = Util.GetGameObject(self.mapData[i].Title,"redpoint")
self.mapData[i].Lock = Util.GetGameObject(self.mapData[i].Title,"lock")
self.mapData[i].RedPoint:SetActive(false)
self.mapData[i].CanGet = Util.GetGameObject(self.mapData[i].Obj,"CanGet")
self.mapData[i].Icon = Util.GetGameObject(self.mapData[i].Obj,"CanGet/Image"):GetComponent("Image")
self.mapData[i].Btns = Util.GetGameObject(self.mapData[i].Obj,"Btns")
self.mapData[i].BtnsCanvas = self.mapData[i].Btns:GetComponent("Canvas")
self.mapData[i].OpenLimit = Util.GetGameObject(self.mapData[i].Title,"OpenLimit")
self.mapData[i].limitText = Util.GetGameObject(self.mapData[i].OpenLimit,"OpenLimitText"):GetComponent("Text")
self.mapData[i].upgradeImg = Util.GetGameObject(self.mapData[i].Obj,"Updating")
self.mapData[i].upgradeImg:SetActive(true)
self.mapData[i].updateTime = Util.GetGameObject(self.mapData[i].Obj,"updateTime")
self.mapData[i].updateTimeText = Util.GetGameObject(self.mapData[i].updateTime,"updateText"):GetComponent("Text")
self.mapData[i].timeSlide = Util.GetGameObject(self.mapData[i].updateTime,"Slide/Image"):GetComponent("Image")
self.mapData[i].btnDetail = Util.GetGameObject(self.mapData[i].Btns,"Detail")
self.mapData[i].btnUpgrade = Util.GetGameObject(self.mapData[i].Btns,"Upgrade")
self.mapData[i].upGradeRed = Util.GetGameObject(self.mapData[i].btnUpgrade,"upGradeRed")
self.mapData[i].btnCancel = Util.GetGameObject(self.mapData[i].Btns,"Cancel")
self.mapData[i].btnCancel:SetActive(false)
self.mapData[i].btnSpeedUp = Util.GetGameObject(self.mapData[i].Btns,"Speed")
self.mapData[i].leftTime = -1
self.mapData[i].showTime = -1
self.mapData[i].effect1 = Util.GetGameObject(self.mapData[i].upgradeImg,"c_jianzao")
self.mapData[i].effect2 = Util.GetGameObject(self.mapData[i].upgradeImg,"c_shengji")
self.mapData[i].effect1:SetActive(false)
self.mapData[i].effect2:SetActive(false)
end
self.curSelect = 0
end
function TrainBuildPanel:BindEvent()
Util.AddClick(self.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
--帮助按钮
Util.AddClick(self.helpBtn, function()
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.HomeLand, self.helpPosition.x,self.helpPosition.y)
end)
Util.AddClick(self.Bg, function()
self.curSelect = 0
for j = 1, 7 do
self.mapData[j].Btns:SetActive(false)
end
end)
for i = 1, 7 do
--打开菜单
Util.AddOnceClick(self.mapData[i].Obj,function ()
if self.curSelect ~= i then
for j = 1, 7 do
self.mapData[j].Btns:SetActive(false)
end
self.curSelect = i
if TrainBuildManager.BuildData[i].dataMain.IsOpen ~= 1 then
PopupTipPanel.ShowTip(string.format("%s 暂未开放",TrainBuildManager.BuildData[i].dataMain.Name))
return
end
if HomeLandConfig[i].UnlockLevel[1] == 2 and TrainBuildManager.BuildData[1].level < HomeLandConfig[i].UnlockLevel[2] then
PopupTipPanel.ShowTip(string.format("主城到达%s级开启",HomeLandConfig[i].UnlockLevel[2]))
return
end
self.mapData[i].Btns:SetActive(true)
PlayUIAnim(self.mapData[i].Btns)
end
end)
--打开升级界面
Util.AddOnceClick(self.mapData[i].btnUpgrade,function ()
--UIManager.OpenPanel(UIName.GeneralInfoPopup,GENERALINFO_TYPE.HomeLandUpgrade,{HomeLandManager.BuildData[i],self.mapData[i]})
UIManager.OpenPanel(UIName.TrainBuildLvUpPanel,{TrainBuildManager.BuildData[i],self.mapData[i]})
end)
--打开信息界面
Util.AddOnceClick(self.mapData[i].btnDetail,function ()
UIManager.OpenPanel(UIName.TrainSelectHeroPanel,TrainBuildManager.BuildData[i])
end)
--打开加速
Util.AddOnceClick(self.mapData[i].btnSpeedUp,function ()
local value = math.ceil((HomeLandManager.BuildData[i].endTime - GetTimeStamp())/tonumber(costStr[1]))*tonumber(costStr[3])
-- LogGreen("需要16"..tostring(value).." 现有:"..tostring(BagManager.GetTotalItemNum(16)))
if BagManager.GetTotalItemNum(16) >= value then
MsgPanel.ShowTwo(string.format("是否花费%s妖晶立即升级",value),function() end,function()
if BagManager.GetTotalItemNum(16) < value then
PopupTipPanel.ShowTip("妖晶不足!")
return
end
NetManager.ArchitectureOperateRequest({HomeLandManager.BuildData[i].dataMain.Id},2,0,function ()
self.mapData[i].leftTime = -1
PopupTipPanel.ShowTip(string.format("<color=#00FF00>%s</color>已升级至<color=#00FF00>%s</color>级",HomeLandManager.BuildData[i].dataMain.Name,HomeLandManager.BuildData[i].dataSingle.level))
--特效
self.mapData[i].effect2:SetActive(true)
Timer.New(function ()
self.mapData[i].effect2:SetActive(false)
end,1):Start()
NetManager.HomeInfoRequest(function ()
self:OnShow()
end)
end)
end,"取消","确定")
else
PopupTipPanel.ShowTip("妖晶不足!")
end
end)
end
end
function TrainBuildPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.UI.OnUpdateData, self.OnShow,self)
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, self.OnShow,self)
Game.GlobalEvent:AddEvent(GameEvent.Privilege.OnPrivilegeZeroUpdate, self.OnShow,self)
end
function TrainBuildPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnUpdateData, self.OnShow,self)
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, self.OnShow,self)
Game.GlobalEvent:RemoveEvent(GameEvent.Privilege.OnPrivilegeZeroUpdate, self.OnShow,self)
end
--待功能扩展(试图打开某个状态)
function TrainBuildPanel:OnOpen()
self.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.HomeLand })
end
function TrainBuildPanel:OnSortingOrderChange()
for i = 1, 7 do
local curObj = self.mapData[i]
Util.SetParticleSortLayer(curObj.effect1,self.sortingOrder + 1)
Util.SetParticleSortLayer(curObj.effect2,self.sortingOrder + 1)
curObj.BtnsCanvas.overrideSorting = true
curObj.BtnsCanvas.sortingOrder = self.sortingOrder + 2
end
end
function TrainBuildPanel:OnShow()
self.curSelect = 0
for j = 1, 7 do
self.mapData[j].Btns:SetActive(false)
end
self:SetBuildsState()
self:SetTime()
--self:InitDetailBar()
self:SetRedPoint()
end
--设置地图内建筑信息
function TrainBuildPanel:SetBuildsState()
for i = 1, 7 do
local data = TrainBuildManager.BuildData[i]
local curObj = self.mapData[i]
curObj.data = TrainBuildManager.BuildData[i]
curObj.OpenLimit:SetActive(true)
curObj.Lock:SetActive(true)
curObj.btnUpgrade:SetActive(false)
-- curObj.btnCancel:SetActive(false)
curObj.btnSpeedUp:SetActive(false)
curObj.levelImg:SetActive(false)
curObj.Name.text=data.dataMain.Name
Util.SetGray(curObj.NameImg,true)
curObj.effect1:SetActive(false)
curObj.updateTime:SetActive(false)
curObj.CanGet:SetActive(false)
Util.SetParticleSortLayer(curObj.effect1,self.sortingOrder + 1)
Util.SetParticleSortLayer(curObj.effect2,self.sortingOrder + 1)
curObj.BtnsCanvas.overrideSorting = true
curObj.BtnsCanvas.sortingOrder = self.sortingOrder + 2
if data.dataMain.IsOpen == 1 then--部分建筑未进入版本显示未开放
--如果主城未到等级,显示开启条件
if HomeLandConfig[i].UnlockLevel[1] == 1 and PlayerManager.level < HomeLandConfig[i].UnlockLevel[2] then
curObj.limitText.text = string.format("玩家等级到达%s级开启",HomeLandConfig[i].UnlockLevel[2])
elseif HomeLandConfig[i].UnlockLevel[1] == 2 and TrainBuildManager.BuildData[1].level < HomeLandConfig[i].UnlockLevel[2] then
curObj.limitText.text = string.format("主城到达%s级开启",HomeLandConfig[i].UnlockLevel[2])
else
curObj.OpenLimit:SetActive(false)
curObj.Lock:SetActive(false)
Util.SetGray(curObj.NameImg,false)
if data.dataSingle then
curObj.level.text = string.format("%s级",data.dataSingle.level)
curObj.levelImg:SetActive(true)
end
end
if data.dataSingle then
if data.endTime > GetTimeStamp() then--如果有结束时间说明在升级,可以取消,可以加速
-- curObj.btnCancel:SetActive(true)
curObj.btnSpeedUp:SetActive(true)
curObj.effect1:SetActive(true)
curObj.updateTime:SetActive(true)
curObj.leftTime = data.endTime - GetTimeStamp() >= 0 and data.endTime - GetTimeStamp() or -1
curObj.updateTimeText.text = TimeToFelaxible(curObj.leftTime)
curObj.timeSlide.fillAmount = (data.dataSingle.Time-curObj.leftTime)/data.dataSingle.Time
-- PlayUIAnim(curObj.upgradeImg)
else--如果没有就是可以点击升级
if data.dataSingle.Cost then
-- LogGreen("Name:"..tostring(data.dataSingle.Name).." cost:"..tostring(data.dataSingle.Cost[1][1]).."#"..data.dataSingle.Cost[1][2])
curObj.btnUpgrade:SetActive(true)
end
end
end
if data.heroId and data.heroId~="" then
LogError("data.heroid====================="..data.heroId)
local heroData=HeroManager.GetSingleHeroData(data.heroId)
curObj.Icon.sprite = self.spLoader:LoadSprite(GetResourcePath(heroData.heroConfig.Icon))
-- if not curObj.OpenLimit.activeInHierarchy then
-- curObj.showTime = data.startTime + 60
-- curObj.CanGet:SetActive(data.startTime + 60 < GetTimeStamp())
-- end
curObj.CanGet:SetActive(true)
PlayUIAnim(curObj.CanGet)
end
else
curObj.limitText.text = "暂未开放"
end
Util.AddOnceClick(curObj.CanGet,function ()
NetManager.TrainingRequest()
end)
end
end
--时间
function TrainBuildPanel:SetTime()
if self.timer then
self.timer:Stop()
self.timer = nil
end
self.timer = Timer.New(function ()
for i = 1, 7 do
local curObj = self.mapData[i]
curObj.updateTime:SetActive(curObj.leftTime >= 0)
if curObj.leftTime >= 0 then
curObj.updateTimeText.text = TimeToFelaxible(curObj.leftTime)
curObj.leftTime = curObj.leftTime -1
curObj.timeSlide.fillAmount = (curObj.data.dataSingle.Time-curObj.leftTime)/curObj.data.dataSingle.Time
if curObj.leftTime < 0 then
curObj.effect2:SetActive(true)
NetManager.TrainingArchitectureInfoRequest(function ()
self:OnShow()
if UIManager.IsOpen(UIName.MsgPanel) then
UIManager.ClosePanel(UIName.MsgPanel)
end
PopupTipPanel.ShowTip(string.format("<color=#00FF00>%s</color>已升级至<color=#00FF00>%s</color>级",curObj.data.dataMain.Name,curObj.data.dataSingle.level))
Timer.New(function ()
curObj.effect2:SetActive(false)
end,1):Start()
end)
end
end
--curObj.CanGet:SetActive(curObj.showTime > 0 and curObj.showTime < GetTimeStamp())
if curObj.showTime > 0 then
--local bool = (GetTimeStamp() - curObj.data.startTime)/60*curObj.data.dataSingle.Gain[2] >= curObj.data.dataSingle.Storage[1][2]
local img = bool and "f_fushengmeni_qipaohuang" or "f_fushengmeni_qipao"
--curObj.CanGet:GetComponent("Image").sprite = self.spLoader:LoadSprite(img)
end
end
end, 1, -1, true)
self.timer:Start()
end
function TrainBuildPanel:SetRedPoint()
end
function TrainBuildPanel:OnClose()
self.curSelect = 0
bool = false
for j = 1, 7 do
self.mapData[j].Btns:SetActive(false)
end
end
function TrainBuildPanel:OnDestroy()
self.spLoader:Destroy()
SubUIManager.Close(self.UpView)
self.UpView = nil
if self.timer then
self.timer:Stop()
self.timer = nil
end
end
return TrainBuildPanel

View File

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

View File

@ -0,0 +1,211 @@
----- 心愿抽卡弹窗 -----
local TrainSelectHeroPanel = quick_class("TrainSelectHeroPanel", BasePanel)
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
local this=TrainSelectHeroPanel
local buildData=nil
local curHeroId=nil
function this:InitComponent()
self.spLoader = SpriteLoader.New()
self.btn_close = Util.GetGameObject(self.gameObject,"bg/btn_close")
self.btn_star = Util.GetGameObject(self.gameObject,"bg/btn_star")
self.btn_end = Util.GetGameObject(self.gameObject,"bg/btn_end")
self.helpBtn = Util.GetGameObject(self.gameObject, "helpBtn")
self.scroll = Util.GetGameObject(self.gameObject,"selectList")
self.itemPre = Util.GetGameObject(self.gameObject,"itemPre")
self.title= Util.GetGameObject(self.gameObject,"bg/title"):GetComponent("Text")
self.infoTxt=Util.GetGameObject(self.gameObject,"bg/info"):GetComponent("Text")
self.costImg=Util.GetGameObject(self.gameObject,"bg/costImg"):GetComponent("Image")
self.costNum=Util.GetGameObject(self.gameObject,"bg/costNum"):GetComponent("Text")
-- 设置循环滚动,万一内容不停地加
local rootHight = self.scroll.transform.rect.height
local width = self.scroll.transform.rect.width
self.scrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.scroll.transform,
self.itemPre, nil, Vector2.New(width, rootHight), 1, 5, Vector2.New(20, 45))
self.scrollView.moveTween.MomentumAmount = 1
self.scrollView.moveTween.Strength = 2
self.itemList = {}
self.maskList = {}
--wishList
self.selctHero=Util.GetGameObject(self.gameObject,"bg/bglist/hero")
--tabList
self.tabListObj = {}
self.selectBtn = Util.GetGameObject(self.gameObject,"Tabs/grid/selectBtn")
for j = 1, 4 do
self.maskList[j] = {}
self.itemList[j] = {}
self.tabListObj[j] = Util.GetGameObject(self.gameObject,"Tabs/grid/Btn"..j)
end
self.helpPosition = self.helpBtn:GetComponent("RectTransform").localPosition
end
function this:BindEvent()
for i = 1, 4 do
Util.AddOnceClick(self.tabListObj[i],function ()
self.curSelect = i
this:Refresh(true,false)
end)
end
Util.AddOnceClick(self.btn_close,function ()
LogError("点击确定按钮")
self:ClosePanel()
end)
Util.AddOnceClick(self.btn_star,function ()
if buildData.heroId and buildData.heroId~="" then
PopupTipPanel.ShowTip("已有特训英雄")
return
end
if curHeroId==nil or curHeroId=="" then
PopupTipPanel.ShowTip("请选择特训英雄")
return
end
NetManager.TrainingRequest(buildData.dataMain.Id,curHeroId,1,function ()
self:Refresh()
end)
end)
Util.AddOnceClick(self.btn_end,function ()
if buildData.heroId and buildData.heroId~="" then
NetManager.TrainingRequest(buildData.dataMain.Id,buildData.heroId,2,function ()
self:Refresh()
end)
end
end)
--帮助按钮
Util.AddClick(self.helpBtn, function()
LogError("点击帮助按钮")
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.WishCard,self.helpPosition.x,self.helpPosition.y)
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnOpen(_data)
buildData=_data
self.title.text=buildData.dataMain.Name
self.infoTxt.text=buildData.dataMain.Name.."每分钟增加"..buildData.dataSingle.Gain.."特训经验"
curHeroId=buildData.heroId
LogError("buildData.dataMain.Id==="..buildData.dataMain.Id)
if buildData.heroId and buildData.heroId~="" then
self.btn_star:SetActive(false)
else
self.btn_star:SetActive(true)
end
end
function this:OnShow()
this:Refresh(true,false)
end
function this:Refresh(isTop,isAni)
--self.selectBtn:GetComponent("RectTransform").localPosition = self.tabListObj[self.curSelect]:GetComponent("RectTransform").localPosition
this:SetHeroList(isTop,isAni)
this:SetUpHero()
end
function this:SetUpHero()
local go = self.selctHero
local frame = Util.GetGameObject(go, "frame"):GetComponent("Image")
local icon = Util.GetGameObject(go, "icon"):GetComponent("Image")
local proIcon = Util.GetGameObject(go, "proIcon"):GetComponent("Image")
local starGrid = Util.GetGameObject(go, "star")
local choosed = Util.GetGameObject(go, "choosed")
local heroId = curHeroId
choosed:SetActive(false)
if heroId and heroId~="" then
go:SetActive(true)
local heroData = HeroManager.GetSingleHeroData(heroId)
frame.sprite = self.spLoader:LoadSprite(GetBgByHeroNatural(heroData.heroConfig.Natural))
icon.sprite = self.spLoader:LoadSprite(GetResourcePath(heroData.heroConfig.Icon))
proIcon.sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName))
SetHeroStars(self.spLoader,starGrid, heroData.star)
Util.AddOnceClick(go,function ()
end)
else
go:SetActive(false)
end
Util.AddLongPressClick(go,function ()
UIManager.OpenPanel(UIName.RoleGetInfoPopup, false, heroId, 5)
end,0.5)
end
function this:SetHeroList(isTop,isAni)
local heroList = TrainBuildManager.GetAllCanTrainHero()
local list={}
for k, v in pairs(heroList) do
if CheckListIsContainValue1(TrainBuildManager.trainHeroId,v.dynamicId)==false or v.dynamicId==buildData.heroId then
table.insert(list,v)
end
end
self.scrollView:SetData(list, function (index, item)
this:ShowSingleHero(item, list[index],index)
end,not isTop,not isAni)
end
function this:ShowSingleHero(go,data,index)
local heroData = data.heroConfig
Util.GetGameObject(go, "frame"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetBgByHeroNatural(heroData.Natural))
Util.GetGameObject(go, "icon"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetResourcePath(heroData.Icon))
Util.GetGameObject(go, "proIcon"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(heroData.PropertyName))
Util.GetGameObject(go, "name"):GetComponent("Text").text = heroData.ReadingName
Util.GetGameObject(go, "choosed/Text"):GetComponent("Text").text="特训中"
Util.GetGameObject(go, "lvBg/lv"):GetComponent("Text").text = data.lv
local choosed=Util.GetGameObject(go, "choosed")
choosed:SetActive(curHeroId==data.dynamicId)
local trainInfo=Util.GetGameObject(go, "trainLvBg")
local trainLv=Util.GetGameObject(go, "trainLvBg/Text"):GetComponent("Text")
local starGrid = Util.GetGameObject(go, "star")
SetHeroStars(self.spLoader,starGrid,data.star)
-- Util.AddLongPressClick(go,function ()
-- UIManager.OpenPanel(UIName.RoleGetInfoPopup, false, data.Reward[1], 5)
-- end,0.5)
Util.AddOnceClick(go,function()
if buildData.heroId and buildData.heroId~="" then
if data.dynamicId~=buildData.heroId then
PopupTipPanel.ShowTip("请先为当前英雄结束特训")
return
end
if data.dynamicId==buildData.heroId then
PopupTipPanel.ShowTip("当前英雄特训中")
return
end
end
if curHeroId~=data.dynamicId then
curHeroId=data.dynamicId
else
curHeroId=nil
end
choosed:SetActive(curHeroId==data.dynamicId)
this:SetUpHero()
end)
end
function this:OnClose()
end
function this:OnDestroy()
self.itemList = {}
self.maskList = {}
self.wishListObj = {}
self.tabListObj = {}
self.spLoader:Destroy()
end
return this

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6a4d85596cb251d409dc0e2124c4d4b1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -197,7 +197,7 @@ function this:InitComponent()
--家园
this.btnHomeLand = Util.GetGameObject(this.gameObject, "scene/layer4/btnHomeLand")
--洞府功能屏蔽
this.btnHomeLand:SetActive(false)
--this.btnHomeLand:SetActive(false)
--跨服
this.btnJumpServer = Util.GetGameObject(this.gameObject, "scene/layer4/btnJumpServer")
--跨服战斗功能屏蔽
@ -583,7 +583,11 @@ function this:BindEvent()
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.ARENA)
end)
Util.AddClick(this.btnHomeLand, function()
JumpManager.GoJump(40059)
--JumpManager.GoJump(40059)
NetManager.TrainingArchitectureInfoRequest(function()
UIManager.OpenPanel(UIName.TrainBuildPanel)
end)
this.ScenceBtnClick(FUNCTION_OPEN_TYPE.HOMELAND)
-- if ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.ENDLESS) then
-- PlayerManager.carbonType = 2

View File

@ -7627,6 +7627,11 @@ function NetManager.TrainingRequest(_id,_heroId,_type,_func)
local msg = HeroInfoProto_pb.TrainingResponse()
msg:ParseFromString(data)
LogError("特训请求")
if _type==1 then
table.insert(TrainBuildManager.trainHeroId,_heroId)
elseif _type==2 then
table.remove(TrainBuildManager.trainHeroId,_heroId)
end
TrainBuildManager.SetBuildInfo(msg.info)
if _func then
_func()