【七界试炼】主界面基本完成

dev_chengFeng
ZhangBiao 2021-09-07 18:09:33 +08:00
parent 6078ae545a
commit 8c95c7f8ad
4 changed files with 1578 additions and 101 deletions

View File

@ -213,11 +213,11 @@ ConfigName = {
SurpriseBoxConfig = "SurpriseBox",
JourneyWithWind = "JourneyWithWind",
QijieHolyConfig = "QijieHolyConfig",
QijieRankingConfig = "QijieRanking",
QijieStageConfig = "QijieStage",
QijieStageBuffConfig = "QijieStageBuff",
QijieTreasureConfig = "QijieTreasure",
QijieUpgradeConfig = "QijieUpgrade",
QijieRanking = "QijieRanking",
QijieStage = "QijieStage",
QijieStageBuff = "QijieStageBuff",
QijieTreasure = "QijieTreasure",
QijieUpgrade = "QijieUpgrade",
}
require "Framework/GameDataBase"

View File

@ -6,14 +6,102 @@ local QijieStage = ConfigManager.GetConfig(ConfigName.QijieStage)
local QijieStageBuff = ConfigManager.GetConfig(ConfigName.QijieStageBuff)
local QijieTreasure = ConfigManager.GetConfig(ConfigName.QijieTreasure)
local QijieUpgrade = ConfigManager.GetConfig(ConfigName.QijieUpgrade)
local HeroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
function this.Initialize()
this.curLevel = 1
this.curData = this.GetCurLevelData()
this.curLevelId = 3004
this.curRank = 999
this.curScore = 1
this.curStageId = 1
end
function this.GetCurLevelData()
return QijieStage[this.curLevel]
--界面获取信息
function this.GetQiJieData()
--上阵列表赋值
local curFormation = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
this.formationList ={}
for j = 1, #curFormation.teamHeroInfos do
if curFormation.teamHeroInfos[j] then
table.insert(this.formationList,HeroManager.GetSingleHeroData(curFormation.teamHeroInfos[j].heroId).heroConfig)
end
end
--界面信息
local data = {}
data.curLevelId = this.curLevelId
data.curRank = this.curRank
data.curScore = this.curScore
data.curStageData = QijieStage[this.curLevelId]
return data
end
--进入界面前 获取服务器信息
function this.GetEnterDataFromServer(func)
NetManager.EnterQiJieShiLianRequest(function (msg)
this.RefreshDataFromServer(msg,func)
end)
end
--从服务器获取信息
function this.RefreshDataFromServer(msg,func)
this.curLevelId = msg.curLevelId
this.curRank = msg.curRank
this.curScore = msg.curScore
if func then
func()
end
end
--获取下方滑动条数据
function this.GetTabList()
local tabList = {}
for _, configInfo in ConfigPairs(QijieStage) do
if not tabList[configInfo.QijieType] then
tabList[configInfo.QijieType] = configInfo
end
end
return tabList
end
--检测该条目是否达成
function this.CheckGoalIsFinish(_dataId,_obj)
local goalData = QijieUpgrade[_dataId]
local tempList = {}
local final = true
for i = 1, #this.formationList do
table.insert(tempList,this.formationList[i])
end
-- LogGreen("Id:"..tostring(goalData.Id).." Describe:"..tostring(goalData.Describe).." PropertyName:"..tostring(goalData.PropertyName).." Profession:"..tostring(goalData.Profession).." Min:"..tostring(goalData.Min).." Max:"..tostring(goalData.Max))
if goalData.PropertyName and goalData.PropertyName > 0 then
for i = #tempList, 1,-1 do
if goalData.PropertyName ~= tempList[i].PropertyName then
table.remove(tempList,i)
end
end
end
if goalData.Profession and goalData.Profession > 0 then
for i = #tempList, 1,-1 do
if goalData.Profession ~= tempList[i].Profession then
table.remove(tempList,i)
end
end
end
if #tempList > 0 and goalData.Min and goalData.Min >= 0 then
if #tempList < goalData.Min then
final = false
end
end
if #tempList > 0 and goalData.Max and goalData.Max >= 0 then
if #tempList > goalData.Max then
final = false
end
end
_obj.text = string.format( "<color=#BAAF98>%s</color>",goalData.Describe)
if final then
_obj.text = string.format( "<color=#27DD65>%s</color>",goalData.Describe)
end
return final
end
return QiJieShiLianManager

View File

@ -1,5 +1,8 @@
require("Base/BasePanel")
local QiJieShiLianPanel = Inherit(BasePanel)
local QijieStage = ConfigManager.GetConfig(ConfigName.QijieStage)
local artConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
--初始化组件(用于子类重写)
function QiJieShiLianPanel:InitComponent()
self.spLoader = SpriteLoader.New()
@ -25,7 +28,14 @@ function QiJieShiLianPanel:InitComponent()
self.shopBtn = Util.GetGameObject(self.rightBtns,"shopBtn")
--下部
self.bottomBar = Util.GetGameObject(self.gameObject,"BottomBar")
--挑战加成
self.addtions = Util.GetGameObject(self.bottomBar,"Info/Content")
self.addNum = Util.GetGameObject(self.addtions,"Text"):GetComponent("Text")
self.goalList = {}
for i = 1, 3 do
self.goalList[i] = Util.GetGameObject(self.addtions,"goal ("..i..")")
end
--挑战奖励
self.rewards = Util.GetGameObject(self.bottomBar,"Reward/Content")
self.goBtn = Util.GetGameObject(self.bottomBar,"goBtn")
self.freeTime = Util.GetGameObject(self.bottomBar,"times/freeTime"):GetComponent("Text")
@ -33,6 +43,35 @@ function QiJieShiLianPanel:InitComponent()
self.buyBtn = Util.GetGameObject(self.bottomBar,"times/buyBtn")
--下方按钮
self.TabBox = Util.GetGameObject(self.gameObject,"TabBox")
self.box = Util.GetGameObject(self.TabBox,"box")
self.tabPre = Util.GetGameObject(self.TabBox,"tabPre")
self.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.box.transform,
self.tabPre, nil, Vector2.New(940.6, 150), 2, 1, Vector2.New(20, 0))
self.ScrollView.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(-8, 0)
self.ScrollView.gameObject:GetComponent("RectTransform").anchorMin = Vector2.New(0.5, 0.5)
self.ScrollView.gameObject:GetComponent("RectTransform").anchorMax = Vector2.New(0.5, 0.5)
self.ScrollView.gameObject:GetComponent("RectTransform").pivot = Vector2.New(0.5, 0.5)
self.ScrollView.moveTween.MomentumAmount = 1
self.ScrollView.moveTween.Strength = 2
self.ScrollView.elastic = false
self.rewardPre = Util.GetGameObject(self.bottomBar,"rewardPre")
self.ScrollView2 = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.rewards.transform,
self.rewardPre, nil, Vector2.New(450, 235), 2, 1, Vector2.New(0, 0))
self.ScrollView2.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(-8, 0)
self.ScrollView2.gameObject:GetComponent("RectTransform").anchorMin = Vector2.New(0.5, 0.5)
self.ScrollView2.gameObject:GetComponent("RectTransform").anchorMax = Vector2.New(0.5, 0.5)
self.ScrollView2.gameObject:GetComponent("RectTransform").pivot = Vector2.New(0.5, 0.5)
self.ScrollView2.moveTween.MomentumAmount = 1
self.ScrollView2.moveTween.Strength = 2
self.ScrollView2.elastic = false
--左右切换按钮
self.lastBtn = Util.GetGameObject(self.gameObject,"lastBtn")
self.nextBtn = Util.GetGameObject(self.gameObject,"nextBtn")
self.tempId = 10030
self.itemViewList = {}
end
--绑定事件(用于子类重写)
@ -67,6 +106,14 @@ function QiJieShiLianPanel:BindEvent()
Util.AddClick(self.buyBtn,function()
PopupTipPanel.ShowTip("购买次数!")
end)
Util.AddClick(self.lastBtn,function()
self.tempId = self.tempId - 1
self:Refresh()
end)
Util.AddClick(self.nextBtn,function()
self.tempId = self.tempId + 1
self:Refresh()
end)
end
--添加事件监听(用于子类重写)
@ -83,20 +130,101 @@ function QiJieShiLianPanel:OnOpen()
end
--界面打开时调用(用于子类重写)
function QiJieShiLianPanel:OnShow(...)
function QiJieShiLianPanel:OnShow()
self:Refresh()
end
function QiJieShiLianPanel:Refresh()
self.qijieData = QiJieShiLianManager.GetQiJieData()
self.configData = self.qijieData.curStageData
LogGreen("当前层数Id:"..tostring(self.qijieData.curLevelId))
self:SetTabBox()
self:SetTopBar()
self:SetBottomBar()
--设置立绘
if self.Live then
poolManager:UnLoadLive(self.bgName, self.Live)
end
LogRed("self.tempId:"..tostring(self.tempId))
if not heroConfig[self.tempId] then
return
end
local herodata = heroConfig[self.tempId]
local pos = herodata.Position
local scale = herodata.Scale
self.bgName = artConfig[herodata.Live].Name
self.Live = poolManager:LoadLive(self.bgName, self.aniRoot.transform, Vector3.one*scale, Vector2.New(pos[1],pos[2]))
end
--设置下方滑动条
function QiJieShiLianPanel:SetTabBox()
local tabList = QiJieShiLianManager.GetTabList()
self.ScrollView:SetData(tabList, function (index, go)
Util.GetGameObject(go,"Text"):GetComponent("Text").text = tabList[index].Chapter
local state = tabList[index].QijieType == self.configData.QijieType
local name = state and "r_hero_xuanze_001" or "r_hero_xuanze_002"
Util.GetGameObject(go,"Image"):GetComponent("Image").sprite = self.spLoader:LoadSprite(name)
Util.GetGameObject(go,"LockImage"):SetActive(not state)
end,false,true)
local num = (self.configData.QijieType - 1) > 0 and (self.configData.QijieType - 1) or 1
self.ScrollView:SetIndex(num)
end
--设置上方信息
function QiJieShiLianPanel:SetTopBar()
self.info.text = string.format( "本周排名:%s 本周积分:%s",self.qijieData.curRank,self.qijieData.curScore)
self.name.text = string.format( "%s·%s层",self.configData.Chapter,self.configData.Stage)
end
--设置下方挑战信息和奖励信息
function QiJieShiLianPanel:SetBottomBar()
--设置挑战加成数据
self.addNum.text = string.format( "能满足一种获得界灵数量+%s",self.configData.Addition[2]/100).."%"
for i = 1, #self.goalList do
local text = Util.GetGameObject(self.goalList[i],"Text"):GetComponent("Text")
local image = Util.GetGameObject(self.goalList[i],"Image"):GetComponent("Image")
local state = QiJieShiLianManager.CheckGoalIsFinish(self.configData.ConditionValue[i],text)--检测是否完成此条目(顺便设置文字)
local imgname = state and "q_qjsl_wfzjm_yjh" or "q_qjsl_wfzjm_wjh"
image.sprite = self.spLoader:LoadSprite(imgname)
end
--拿取奖励列表
local rewardList = {}
for i = 1, #self.configData.Reward do
table.insert(rewardList,self.configData.Reward[i])
end
table.insert(rewardList,self.configData.JielingReward)
--设置显示
for key, value in pairs(self.itemViewList) do
value.gameObject:SetActive(false)
end
self.ScrollView2:SetData(rewardList, function (index, go)
if not self.itemViewList[index] then
self.itemViewList[index] = SubUIManager.Open(SubUIConfig.ItemView, go.transform)
end
self.itemViewList[index]:OnOpen(false, rewardList[index], 1,false,false,false,self.sortingOrder)
self.itemViewList[index].gameObject:SetActive(true)
end,false,true)
end
--界面关闭时调用(用于子类重写)
function QiJieShiLianPanel:OnClose()
if self.Live then
poolManager:UnLoadLive(self.bgName, self.Live)
end
self.Live = nil
end
--界面销毁时调用(用于子类重写)
function QiJieShiLianPanel:OnDestroy()
self.spLoader:Destroy()
if self.Live then
poolManager:UnLoadLive(self.bgName, self.Live)
end
self.Live = nil
self.goalList = {}
self.itemViewList = {}
end
return QiJieShiLianPanel