xiyou_sanguo
parent
dc69fd3423
commit
a3f9c6700d
|
|
@ -190,6 +190,8 @@ local ManagerNames = {
|
|||
"DynamicActivity/DynamicActivityManager",
|
||||
"Hero/HeroSkinManager",
|
||||
"SacredTree/SacredTreeManager",
|
||||
--成神新三队
|
||||
"BecomeAGod/BecomeAGodManager",
|
||||
--牛气冲天管理器
|
||||
"NiuQiChongTian/NiuQiChongTianManager",
|
||||
--福星高照管理器
|
||||
|
|
|
|||
|
|
@ -0,0 +1,256 @@
|
|||
BecomeAGodManager = {};
|
||||
local this = BecomeAGodManager
|
||||
local towerInfos = nil
|
||||
local duoDuiHeroConfig = ConfigManager.GetConfig(ConfigName.DuoDuiTowerHero)
|
||||
function this.Initialize()
|
||||
towerInfos = {}
|
||||
end
|
||||
|
||||
function this.Init(msg)
|
||||
local infos = msg.info
|
||||
for i = 1, #infos do
|
||||
local config = ConfigManager.GetConfigData(ConfigName.DuoDuiTowerConfig, infos[i].type)
|
||||
local needFloor
|
||||
if infos[i].tier < 0 then
|
||||
needFloor = 0
|
||||
else
|
||||
needFloor = infos[i].tier
|
||||
end
|
||||
towerInfos[i] = {
|
||||
time = infos[i].time,
|
||||
type = infos[i].type,
|
||||
floor = needFloor,
|
||||
rank = infos[i].rank,
|
||||
freeId =
|
||||
config.PrivilegeType,
|
||||
buyId = config.PrivilegeType1
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function this.GetTowerData()
|
||||
return towerInfos
|
||||
end
|
||||
|
||||
function this.GetTowerDataByType(_type)
|
||||
local floor = this.GetTowerFloorByType(_type)
|
||||
local towerList = {}
|
||||
--ConfigManager.TryGetAllConfigsDataByDoubleKey(ConfigName.DuoDuiTower,"Type",_type,)
|
||||
if floor < 0 then
|
||||
floor = 0
|
||||
end
|
||||
if floor >= 300 - 10 then
|
||||
floor = 300 - 10
|
||||
end
|
||||
for i = floor + 1, floor + 10 do
|
||||
local data = this.GetFourMonsterInfoByWave(_type, i)
|
||||
if data then
|
||||
table.insert(towerList, data)
|
||||
end
|
||||
end
|
||||
return towerList
|
||||
end
|
||||
|
||||
function this.GetCurrFloorRewardByType(_type)
|
||||
local floor = this.GetTowerFloorByType(_type)
|
||||
--如果一层都没打显示第一层的奖励
|
||||
if floor <= 0 then
|
||||
floor = 1
|
||||
end
|
||||
LogError("floor======" .. floor)
|
||||
local config = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.DuoDuiTower, "Type", _type, "TowerNumber", floor)
|
||||
if config then
|
||||
return config.Income
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function this.SetSingleMonster(id)
|
||||
local herodata = {}
|
||||
local _configData = ConfigManager.GetConfigData(ConfigName.HeroConfig, id)
|
||||
herodata.heroConfig = _configData
|
||||
herodata.heroViewConfig = _configData
|
||||
herodata.live = GetResourcePath(_configData.Live)
|
||||
herodata.painting = GetResourcePath(_configData.Painting)
|
||||
herodata.icon = GetResourcePath(_configData.Icon)
|
||||
herodata.scale = _configData.Scale
|
||||
herodata.position = _configData.Position
|
||||
herodata.profession = _configData.Profession
|
||||
herodata.ProfessionResourceId = _configData.ProfessionResourceId
|
||||
if GetJobSpriteStrByJobNum(_configData.Profession) then
|
||||
herodata.professionIcon = GetJobSpriteStrByJobNum(_configData.Profession)
|
||||
else
|
||||
herodata.professionIcon = GetJobSpriteStrByJobNum(1)
|
||||
end
|
||||
herodata.name = _configData.ReadingName
|
||||
herodata.property = _configData.PropertyName
|
||||
return herodata
|
||||
end
|
||||
|
||||
function this.GetFourMonsterInfoByWave(curType, wave)
|
||||
LogError("curtype==" .. curType .. " wave==" .. wave)
|
||||
local tempConfigs = ConfigManager.TryGetAllConfigsDataByDoubleKey(ConfigName.DuoDuiTower, "Type", curType,
|
||||
"TowerNumber", wave)
|
||||
if not tempConfigs then
|
||||
return nil
|
||||
end
|
||||
local data = {}
|
||||
data.wave = wave
|
||||
data.firstReward = {}
|
||||
data.herodatas = {}
|
||||
data.monsterConfig = {}
|
||||
for i = 1, #tempConfigs do
|
||||
--奖励
|
||||
local tempConfig = tempConfigs[i]
|
||||
if tempConfig.Item and #tempConfig.Item > 0 and tempConfig.TowerWave1 == 1 then
|
||||
for j = 1, #tempConfig.Item do
|
||||
if tempConfig.Item[j][1] ~= nil and tempConfig.Item[j][1] ~= 0 then
|
||||
--LogError("tempConfig.Item[j][1]=="..tempConfig.Item[j][1].." tempConfig.Item[j][2]=="..tempConfig.Item[j][2])
|
||||
table.insert(data.firstReward, { id = tempConfig.Item[j][1], num = tempConfig.Item[j][2] })
|
||||
end
|
||||
end
|
||||
end
|
||||
--LogError("tempConfig.id=="..tempConfig.id)
|
||||
data.id = tempConfig.TowerNumber
|
||||
data.power = tempConfig.Force
|
||||
local id = tempConfig.Hero[5]
|
||||
local aaa = this.SetSingleMonster(duoDuiHeroConfig[id].Hero)
|
||||
table.insert(data.monsterConfig, tempConfig)
|
||||
table.insert(data.herodatas, aaa)
|
||||
end
|
||||
|
||||
-- local monsterGroupId = tempConfig.Monster
|
||||
-- -- 默认显示第一只怪
|
||||
-- local id = monsterGroupConfig[monsterGroupId].Contents[1][1]
|
||||
-- data.monster = monsterGroupConfig[monsterGroupId].Contents[1]
|
||||
-- data.monsterConfig = monsterConfig[id]
|
||||
-- data.herodata = this.SetSingleMonster(data.monsterConfig.MonsterId)
|
||||
return data
|
||||
end
|
||||
|
||||
function this.GetTowerFloorByType(_type)
|
||||
if towerInfos[_type] then
|
||||
return towerInfos[_type].floor
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function this.GetTowerTimeByType(_type)
|
||||
if towerInfos[_type] then
|
||||
return towerInfos[_type].time
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function this.SetTowerTimeByType(_type, _time)
|
||||
if towerInfos[_type] then
|
||||
towerInfos[_type].time = _time
|
||||
end
|
||||
end
|
||||
|
||||
function this.GetTowerBuyIdByType(_type)
|
||||
if towerInfos[_type] then
|
||||
return towerInfos[_type].buyId
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function this.GetTowerFreeIdByType(_type)
|
||||
if towerInfos[_type] then
|
||||
return towerInfos[_type].freeId
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
--获取当前等级和下一级的数据
|
||||
function this.GetPropText(_treeLv, _type)
|
||||
local data = {}
|
||||
local level = _treeLv
|
||||
local becomAGodSettingData = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.BecomeAGodSetting, "Type", _type)
|
||||
for k = 1, #becomAGodSettingData.PropertyGit do
|
||||
local configData = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.BecomeAGodPropertyGit, "Type",
|
||||
becomAGodSettingData.PropertyGit[k], "Level",
|
||||
level)
|
||||
local configNextData = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.BecomeAGodPropertyGit, "Type",
|
||||
becomAGodSettingData.PropertyGit[k],
|
||||
"Level",
|
||||
level + 1)
|
||||
--if configNextData then --如果当前神树等级超出魂灵宝所能达到的最大等级就取最大
|
||||
--configNextData = nil
|
||||
--end
|
||||
for i = 1, #configData.Property do
|
||||
local propArr = configData.Property[i]
|
||||
local propId = propArr[1]
|
||||
data[propId] = {}
|
||||
data[propId].currValue = propArr[2]
|
||||
if configNextData then
|
||||
local nextPropArr = configNextData.Property[i]
|
||||
data[propId].nextValue = nextPropArr[2]
|
||||
else
|
||||
local color = not bool and "A0A0A0" or "F3D98F"
|
||||
data[propId].nextValue = string.format(Language[12789], color)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return data
|
||||
end
|
||||
|
||||
function this.GetTimeTip(_type)
|
||||
--local config=ConfigManager.GetConfigData(ConfigName.DuoDuiTowerConfig,type)
|
||||
local buyTime = 0
|
||||
local freeTime = 0
|
||||
if towerInfos[_type] then
|
||||
buyTime = PrivilegeManager.GetPrivilegeRemainValue(towerInfos[_type].buyId)
|
||||
freeTime = PrivilegeManager.GetPrivilegeRemainValue(towerInfos[_type].freeId)
|
||||
end
|
||||
--免费次数
|
||||
return freeTime, buyTime
|
||||
end
|
||||
|
||||
function this.GetCost(campId)
|
||||
local buyTimeId = towerInfos[campId].buyId
|
||||
LogError("campId==" .. campId .. " buytimeid===" .. buyTimeId)
|
||||
local storeData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.StoreConfig, "StoreId", 7, "Limit", buyTimeId)
|
||||
--商店表数据
|
||||
local buyTimes = (PrivilegeManager.GetPrivilegeUsedTimes(buyTimeId) + 1) >
|
||||
PrivilegeManager.GetPrivilegeNumber(buyTimeId)
|
||||
and PrivilegeManager.GetPrivilegeNumber(buyTimeId) or (PrivilegeManager.GetPrivilegeUsedTimes(buyTimeId) + 1)
|
||||
return storeData.Id, storeData.Cost[1][1], storeData.Cost[2][buyTimes]
|
||||
end
|
||||
|
||||
-- function this.SetTowerFloorByType(_type)
|
||||
-- if towerInfos[_type] then
|
||||
-- towerInfos[_type].floor=towerInfos[_type].floor+1
|
||||
-- end
|
||||
-- return 0
|
||||
-- end
|
||||
|
||||
--检测红点状态
|
||||
function this.CheckRedPointStatus()
|
||||
local towers = ConfigManager.GetConfig(ConfigName.DuoDuiTowerConfig)
|
||||
if towers then
|
||||
for i, v in ConfigPairs(towers) do
|
||||
local isOpen = CheckFunctionOpen(i + 138)
|
||||
if isOpen then
|
||||
local freeTime = PrivilegeManager.GetPrivilegeRemainValue(v.PrivilegeType)
|
||||
if freeTime > 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function this.SetTowerFloorByType(_type, _num)
|
||||
if towerInfos[_type] then
|
||||
towerInfos[_type].floor = towerInfos[_type].floor + _num
|
||||
end
|
||||
end
|
||||
|
||||
function this.Destroy()
|
||||
towerInfos = nil
|
||||
end
|
||||
|
||||
return this
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 67c9ebcf3edfa1642b4c537b7fb470a2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,123 +1,40 @@
|
|||
require("Base/BasePanel")
|
||||
local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig)
|
||||
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||
local giftConfig = ConfigManager.GetConfig(ConfigName.GiftConfig)
|
||||
PlayerGiftPanel = Inherit(BasePanel)
|
||||
local isGonming = 0
|
||||
local tableName = { Language[12684], Language[10228] }
|
||||
local isUpZhen = false
|
||||
local this = PlayerGiftPanel
|
||||
local indexBtnNum = 0
|
||||
local tabs = {}
|
||||
local redTabs = {}
|
||||
local curHeroData = nil
|
||||
local teamHero
|
||||
local v1
|
||||
local allUpIds = {}
|
||||
local upSuitId = {}
|
||||
BecomeAGodPanel = Inherit(BasePanel)
|
||||
local this = BecomeAGodPanel
|
||||
--初始化组件(用于子类重写)RoleEquipChangePopup
|
||||
function PlayerGiftPanel:InitComponent()
|
||||
function BecomeAGodPanel:InitComponent()
|
||||
this.spLoader = SpriteLoader.New()
|
||||
this.bg2 = Util.GetGameObject(self.transform, "bg2")
|
||||
screenAdapte(this.bg2)
|
||||
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft })
|
||||
this.btnBack = Util.GetGameObject(self.transform, "btnBack/btnBack")
|
||||
|
||||
for i = 1, 2 do
|
||||
tabs[i] = Util.GetGameObject(self.transform, "Tabs/Btn" .. i)
|
||||
local nameTxt = Util.GetGameObject(tabs[i], "Text"):GetComponent("Text")
|
||||
nameTxt.fontSize = 40
|
||||
nameTxt.text = tableName[i]
|
||||
redTabs[i] = Util.GetGameObject(tabs[i], "red")
|
||||
if i == 2 then
|
||||
tabs[i]:SetActive(false)
|
||||
end
|
||||
--effectList[i] = Util.GetGameObject(self.transform, "bg/equipInfo/equip" .. i .. "/effect")
|
||||
end
|
||||
this.titleTxt = Util.GetGameObject(self.gameObject, "title"):GetComponent("Text")
|
||||
this.titleTxt.text = Language[10985]
|
||||
this.selectBtn = Util.GetGameObject(self.gameObject, "selectBtn")
|
||||
this.btnPrant = Util.GetGameObject(self.gameObject, "Tabs")
|
||||
this.btnPrant:SetActive(false)
|
||||
this.equipPreList2 = {}
|
||||
this.equipPreList = {}
|
||||
this.equipPre = Util.GetGameObject(self.gameObject, "equipPre")
|
||||
this.upItemPre = Util.GetGameObject(self.gameObject, "upItemPre")
|
||||
this.selsectSkillImage = Util.GetGameObject(self.gameObject, "selsectSkillImage")
|
||||
this.ScrollBar = Util.GetGameObject(self.gameObject, "listObj/bg/Scrollbar"):GetComponent("Scrollbar")
|
||||
local v2 = Util.GetGameObject(self.gameObject, "scroll"):GetComponent("RectTransform").rect
|
||||
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView,
|
||||
Util.GetGameObject(self.transform, "listObj/bg/scroll").transform,
|
||||
this.equipPre, this.ScrollBar, Vector2.New(v2.width, v2.height), 1, 5, Vector2.New(25, 20))
|
||||
this.ScrollView.moveTween.MomentumAmount = 1
|
||||
this.ScrollView.moveTween.Strength = 1
|
||||
|
||||
|
||||
v1 = Util.GetGameObject(self.gameObject, "upScroll"):GetComponent("RectTransform").rect
|
||||
this.UpScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView,
|
||||
Util.GetGameObject(self.transform, "upScroll").transform, this.upItemPre, nil, Vector2.New(v1.width, v1.height),
|
||||
1, 4, Vector2.New(50, 65))
|
||||
this.UpScrollView.moveTween.MomentumAmount = 1
|
||||
this.UpScrollView.moveTween.Strength = 1
|
||||
-- Util.GetGameObject(self.transform, "powerBtn"):GetComponent("Image").sprite = this.spLoader:LoadSprite("t_tongyong-zhanli_zh")
|
||||
this.force = Util.GetGameObject(self.transform, "powerBtn/value"):GetComponent("Text")
|
||||
this.itemNumText = Util.GetGameObject(self.transform, "itemNumText"):GetComponent("Text")
|
||||
this.upLvEffect = Util.GetGameObject(self.transform, "powerBtn/effect")
|
||||
|
||||
this.emptyObj = Util.GetGameObject(self.transform, "listObj/bg/emptyObj")
|
||||
this.emptyObj.gameObject:SetActive(false)
|
||||
this.mask = Util.GetGameObject(self.gameObject, "mask")
|
||||
this.mask:SetActive(false)
|
||||
this.lvTxt = Util.GetGameObject(self.gameObject, "collectLv"):GetComponent("Text")
|
||||
this.collectImg = Util.GetGameObject(self.gameObject, "collectImg"):GetComponent("Image")
|
||||
this.collectImg.sprite = this.spLoader:LoadSprite("gh_tt_8")
|
||||
this.barImg = Util.GetGameObject(self.gameObject, "progressbar/progress1"):GetComponent("Image")
|
||||
this.barNum = Util.GetGameObject(self.gameObject, "progressbar/num"):GetComponent("Text")
|
||||
this.btn_help = Util.GetGameObject(self.gameObject, "btn_help")
|
||||
|
||||
this.listObj = Util.GetGameObject(self.transform, "listObj")
|
||||
this.listCloseBtn = Util.GetGameObject(self.transform, "listObj/bg/btn_close")
|
||||
Util.GetGameObject(self.transform, "listObj/bg/title (1)"):GetComponent("Text").text = Language[12685]
|
||||
this.proTitle = Util.GetGameObject(self.transform, "proTitle/name/text"):GetComponent("Text")
|
||||
this.proTitle.text = Language[11823]
|
||||
this.proGrid = Util.GetGameObject(self.transform, "pro")
|
||||
this.proPre = Util.GetGameObject(self.transform, "pro/name")
|
||||
this.tipInfo = Util.GetGameObject(self.transform, "tipInfo"):GetComponent("Text")
|
||||
|
||||
this.proEmptyObj = Util.GetGameObject(self.transform, "proEmptyObj")
|
||||
Util.GetGameObject(self.transform, "proEmptyObj/TextImage/Text"):GetComponent("Text").text = Language[12687]
|
||||
this.godlist = {}
|
||||
for i = 1, 6 do
|
||||
this.godlist[i] = {}
|
||||
this.godlist[i].gob = Util.GetGameObject(self.transform, "bg2/godlist/god_" .. i)
|
||||
this.godlist[i].red = Util.GetGameObject(this.godlist[i].gob, "red")
|
||||
end
|
||||
end
|
||||
|
||||
--绑定事件(用于子类重写)
|
||||
function PlayerGiftPanel:BindEvent()
|
||||
Util.AddClick(this.listCloseBtn, function()
|
||||
this.listObj:SetActive(false)
|
||||
end)
|
||||
function BecomeAGodPanel:BindEvent()
|
||||
Util.AddClick(this.btn_help, function()
|
||||
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.Mingge, 0, 0)
|
||||
end)
|
||||
|
||||
Util.AddClick(this.collectImg.gameObject, function()
|
||||
-- local data = {}
|
||||
-- local singData = {}
|
||||
-- singData.title = "当前礼物总加成"
|
||||
-- singData.pro = IncarnationManager.GetproDesLst(GiftManager.GetPlayerGiftAddPro(),"00FF00")
|
||||
-- singData.tip ="" --"总加成包括化身之力提供的属性"
|
||||
-- table.insert(data,singData)
|
||||
-- UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.IncarnationDes,data)
|
||||
end)
|
||||
Util.AddClick(this.btnBack, function()
|
||||
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
||||
self:ClosePanel()
|
||||
end)
|
||||
for i = 1, 2 do
|
||||
Util.AddClick(tabs[i], function()
|
||||
-- isPlayAnim = true
|
||||
if i == indexBtnNum then
|
||||
return
|
||||
end
|
||||
indexBtnNum = i
|
||||
this:OnClickTabBtn(indexBtnNum)
|
||||
for i = 1, #this.godlist do
|
||||
--LogError("1===================点击了:" .. tostring(i))
|
||||
Util.AddClick(this.godlist[i].gob, function()
|
||||
--LogError("2===================点击了:" .. tostring(i))
|
||||
UIManager.OpenPanel(UIName.BecomeAGodPropertyPanel, i)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
@ -132,24 +49,23 @@ function this.ChangePowerValue()
|
|||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
function PlayerGiftPanel:AddListener()
|
||||
function BecomeAGodPanel:AddListener()
|
||||
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.RefreshWindowData)
|
||||
Game.GlobalEvent:AddEvent(GameEvent.Formation.OnFormationPowerChange, this.ChangePowerValue)
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
function PlayerGiftPanel:RemoveListener()
|
||||
function BecomeAGodPanel:RemoveListener()
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.RefreshWindowData)
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.Formation.OnFormationPowerChange, this.ChangePowerValue)
|
||||
end
|
||||
|
||||
--界面打开时调用(用于子类重写)
|
||||
function PlayerGiftPanel:OnOpen(...)
|
||||
function BecomeAGodPanel:OnOpen(...)
|
||||
local data = { ... }
|
||||
this.listObj:SetActive(false)
|
||||
end
|
||||
|
||||
function PlayerGiftPanel:OnShow()
|
||||
function BecomeAGodPanel:OnShow()
|
||||
teamHero = FormationManager.GetAllMainFormationHeroId()
|
||||
this.RefreshWindowData()
|
||||
end
|
||||
|
|
@ -168,253 +84,18 @@ function this:LeftBtnOnClick()
|
|||
|
||||
end
|
||||
|
||||
local collectNum = 0
|
||||
function this.RefreshWindowData()
|
||||
collectNum = 0
|
||||
this.ChangePowerValue()
|
||||
--显示上面赠送的
|
||||
local list = GiftManager.GetPlayerGifts()
|
||||
LogError("#list=============================" .. #list)
|
||||
local maxNum = 12
|
||||
if #list > maxNum then
|
||||
maxNum = #list + 4
|
||||
end
|
||||
local giftDatas = {}
|
||||
allUpIds = {}
|
||||
upSuitId = {}
|
||||
for i = 1, maxNum do
|
||||
local data = {}
|
||||
data.type = 1
|
||||
data.qua = 0
|
||||
data.id = 0
|
||||
data.isRed = false
|
||||
if i <= #list then
|
||||
data.id = list[i]
|
||||
data.type = 2
|
||||
data.qua = itemConfig[list[i]].Quantity
|
||||
if equipConfig[data.id] then
|
||||
collectNum = collectNum + equipConfig[data.id].Gift
|
||||
LogError("equipConfig[data.id].Gift==" .. equipConfig[data.id].Gift)
|
||||
end
|
||||
table.insert(allUpIds, data.id)
|
||||
table.insert(upSuitId, equipConfig[data.id].SuiteID)
|
||||
else
|
||||
data.isRed = GiftManager.CheckPlayerRedPoint()
|
||||
end
|
||||
table.insert(giftDatas, data)
|
||||
end
|
||||
table.sort(giftDatas, function(a, b)
|
||||
if a.type == b.type then
|
||||
if a.qua and a.qua == b.qua then
|
||||
return a.id < b.id
|
||||
else
|
||||
return a.qua > b.qua
|
||||
end
|
||||
else
|
||||
return a.type > b.type
|
||||
end
|
||||
end)
|
||||
|
||||
this.UpScrollView:SetData(giftDatas,
|
||||
function(index, go)
|
||||
this.SingleUpItemShow(go, giftDatas[index])
|
||||
end
|
||||
)
|
||||
--显示收集度
|
||||
local lv = 0
|
||||
local maxValue = 0
|
||||
|
||||
for k, v in ConfigPairs(giftConfig) do
|
||||
if collectNum >= v.Gift then
|
||||
lv = v.Id
|
||||
maxValue = v.Gift
|
||||
else
|
||||
maxValue = v.Gift
|
||||
break
|
||||
end
|
||||
end
|
||||
this.lvTxt.text = Language[12688] .. lv
|
||||
this.barNum.text = collectNum .. "/" .. maxValue
|
||||
this.barImg.fillAmount = collectNum / maxValue
|
||||
--显示下面可赠送的
|
||||
this:OnClickTabBtn(1)
|
||||
|
||||
local proList = IncarnationManager.GetproDesLst(GiftManager.GetPlayerGiftAddPro(), "00FF00")
|
||||
table.insert(proList, string.format(Language[12689], GiftManager.GetPlayerGiftAddPotencyLv()))
|
||||
table.insert(proList, string.format(Language[12187], GiftManager.GetPlayerGiftAdd()))
|
||||
if proList and #proList > 0 then
|
||||
this.proGrid:SetActive(true)
|
||||
this.proEmptyObj:SetActive(false)
|
||||
local len = this.proGrid.transform.childCount
|
||||
local create = #proList - len
|
||||
if create > 0 then
|
||||
for i = 1, create do
|
||||
newObjToParent(this.proPre, this.proGrid)
|
||||
end
|
||||
end
|
||||
len = this.proGrid.transform.childCount
|
||||
for i = 1, len do
|
||||
if i <= #proList then
|
||||
this.proGrid.transform:GetChild(i - 1).gameObject:SetActive(true)
|
||||
this.proGrid.transform:GetChild(i - 1):GetComponent("Text").text = proList[i]
|
||||
else
|
||||
this.proGrid.transform:GetChild(i - 1).gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
else
|
||||
this.proGrid:SetActive(false)
|
||||
this.proEmptyObj:SetActive(true)
|
||||
end
|
||||
--this.tipInfo.text=string.format("全体神将潜能等级+%s",GiftManager.GetPlayerGiftAddPotencyLv())
|
||||
end
|
||||
|
||||
--显示上面几个
|
||||
function this.SingleUpItemShow(_go, data)
|
||||
_go:SetActive(true)
|
||||
_go.transform:SetAsFirstSibling()
|
||||
local frame = _go:GetComponent("Image")
|
||||
local icon = Util.GetGameObject(_go, "icon"):GetComponent("Image")
|
||||
local name = Util.GetGameObject(_go, "name"):GetComponent("Text")
|
||||
local add = Util.GetGameObject(_go, "add")
|
||||
local red = Util.GetGameObject(_go, "red")
|
||||
local starGrid = Util.GetGameObject(_go, "starGrid")
|
||||
red:SetActive(data.isRed)
|
||||
if data.id and data.id ~= 0 then
|
||||
frame.sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(itemConfig[data.id].Quantity))
|
||||
icon.gameObject:SetActive(true)
|
||||
name.gameObject:SetActive(true)
|
||||
starGrid:SetActive(true)
|
||||
add:SetActive(false)
|
||||
name.text = SubString2(GetLanguageStrById(itemConfig[data.id].Name))
|
||||
icon.sprite = this.spLoader:LoadSprite(GetResourcePath(itemConfig[data.id].ResourceID))
|
||||
SetHeroStars(this.spLoader, starGrid, equipConfig[data.id].Star, 1, nil, -15)
|
||||
Util.AddOnceClick(icon.gameObject, function()
|
||||
BagManager.isBagPanel = false
|
||||
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2, this, data, 2, false, nil, nil, 4)
|
||||
end
|
||||
)
|
||||
else
|
||||
starGrid:SetActive(false)
|
||||
frame.sprite = this.spLoader:LoadSprite("r_characterbg_lanjin")
|
||||
icon.gameObject:SetActive(false)
|
||||
name.gameObject:SetActive(false)
|
||||
add:SetActive(true)
|
||||
end
|
||||
Util.AddOnceClick(add, function()
|
||||
this.listObj:SetActive(true)
|
||||
end)
|
||||
end
|
||||
|
||||
--点击装备按钮
|
||||
function this:OnClickTabBtn(_index)
|
||||
indexBtnNum = _index
|
||||
this:SetSelectBtn()
|
||||
local allEquip = BagManager.GetBagItemDataByItemType(ItemBaseType.PlayerGift)
|
||||
-- this:SortEquipDatas(allEquip)
|
||||
local count = 0
|
||||
for i = 1, #allEquip do
|
||||
count = count + 1
|
||||
if CheckListIsContainValue1(allUpIds, allEquip[i].id) or CheckListIsContainValue1(upSuitId, equipConfig[allEquip[i].id].SuiteID) then
|
||||
allEquip[i].isUp = 1
|
||||
else
|
||||
allEquip[i].isUp = 2
|
||||
end
|
||||
end
|
||||
table.sort(allEquip, function(a, b)
|
||||
if a.isUp == b.isUp then
|
||||
if a.quality == b.quality then
|
||||
return a.id < b.id
|
||||
else
|
||||
return a.quality > b.quality
|
||||
end
|
||||
else
|
||||
return a.isUp > b.isUp
|
||||
end
|
||||
end)
|
||||
--"装备数量:"
|
||||
this.itemNumText.text = Language[12690] .. count
|
||||
this:SetItemData(allEquip)
|
||||
|
||||
--this.CheckRedTab()
|
||||
end
|
||||
|
||||
function this:SetItemData(_itemDatas)
|
||||
if LengthOfTable(_itemDatas) == 0 then
|
||||
this.emptyObj.gameObject:SetActive(true)
|
||||
else
|
||||
this.emptyObj.gameObject:SetActive(false)
|
||||
end
|
||||
for k, v in pairs(this.equipPreList) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
this.ScrollView:SetData(
|
||||
_itemDatas,
|
||||
function(index, go)
|
||||
this.SingleItemDataShow(go, _itemDatas[index])
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function this.SingleItemDataShow(_go, _itemData)
|
||||
if not itemConfig[_itemData.id] then
|
||||
return
|
||||
end
|
||||
if not this.equipPreList[_go] then
|
||||
this.equipPreList[_go] = SubUIManager.Open(SubUIConfig.ItemView, _go.transform)
|
||||
end
|
||||
local redPoint = Util.GetGameObject(_go.transform, "redPoint")
|
||||
local tip = Util.GetGameObject(_go.transform, "tip")
|
||||
tip:SetActive(_itemData.isUp == 1)
|
||||
local isHave = CheckListIsContainValue1(allUpIds, _itemData.id) or
|
||||
CheckListIsContainValue1(upSuitId, equipConfig[_itemData.id].SuiteID)
|
||||
redPoint:SetActive(isHave == false)
|
||||
this.equipPreList[_go].gameObject:SetActive(true)
|
||||
this.equipPreList[_go].transform:SetAsFirstSibling()
|
||||
--if itemConfig[_itemData.id].ItemType == ItemType.Equip then
|
||||
this.equipPreList[_go]:OnOpen(false, { _itemData.id, _itemData.num }, 1.1, true, false, false, this.sortingOrder + 1,
|
||||
_itemData.idDyn)
|
||||
-- 0.查看属性 1.穿戴 2.卸下 3.交换
|
||||
--宝物界面
|
||||
Util.AddOnceClick(Util.GetGameObject(_go.transform, "mask"), function()
|
||||
BagManager.isBagPanel = true
|
||||
if isHave then
|
||||
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2, this, _itemData, 6, false, nil, curHeroData, 4)
|
||||
else
|
||||
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2, this, _itemData, 3, false, nil, curHeroData, 4)
|
||||
end
|
||||
end
|
||||
)
|
||||
--end
|
||||
end
|
||||
|
||||
function this:SetSelectBtn()
|
||||
this.selectBtn:SetActive(true)
|
||||
this.selectBtn.transform:SetParent(tabs[indexBtnNum].transform)
|
||||
this.selectBtn:GetComponent("RectTransform").anchoredPosition3D = Vector3(-12.28, 1.08, 0)
|
||||
this.selectBtn.transform:SetSiblingIndex(1)
|
||||
Util.GetGameObject(this.selectBtn.transform, "Text"):GetComponent("Text").text = GetCurLanguage() == -1 and
|
||||
tableName[indexBtnNum] or
|
||||
"<size=40>" ..
|
||||
tableName[indexBtnNum] ..
|
||||
"</size>" --typeTab[indexBtnNum]
|
||||
end
|
||||
|
||||
--选择图片设置父级
|
||||
function this.SelectImageSetParent(_objPoint)
|
||||
this.selsectSkillImage:SetActive(false)
|
||||
this.selsectSkillImage.transform:SetParent(_objPoint.transform)
|
||||
this.selsectSkillImage.transform.localScale = Vector3.one
|
||||
this.selsectSkillImage.transform.localPosition = Vector3.zero
|
||||
end
|
||||
|
||||
--界面关闭时调用(用于子类重写)
|
||||
function PlayerGiftPanel:OnClose()
|
||||
BagManager.isBagPanel = false
|
||||
function BecomeAGodPanel:OnClose()
|
||||
|
||||
end
|
||||
|
||||
--界面销毁时调用(用于子类重写)
|
||||
function PlayerGiftPanel:OnDestroy()
|
||||
function BecomeAGodPanel:OnDestroy()
|
||||
|
||||
end
|
||||
|
||||
return PlayerGiftPanel
|
||||
return BecomeAGodPanel
|
||||
|
|
|
|||
|
|
@ -1,125 +1,37 @@
|
|||
require("Base/BasePanel")
|
||||
local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig)
|
||||
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||
local giftConfig = ConfigManager.GetConfig(ConfigName.GiftConfig)
|
||||
PlayerGiftPanel = Inherit(BasePanel)
|
||||
local isGonming = 0
|
||||
local tableName = { Language[12684], Language[10228] }
|
||||
local isUpZhen = false
|
||||
local this = PlayerGiftPanel
|
||||
local indexBtnNum = 0
|
||||
local tabs = {}
|
||||
local redTabs = {}
|
||||
local curHeroData = nil
|
||||
local teamHero
|
||||
local v1
|
||||
local allUpIds = {}
|
||||
local upSuitId = {}
|
||||
BecomeAGodPropertyPanel = Inherit(BasePanel)
|
||||
local this = BecomeAGodPropertyPanel
|
||||
--初始化组件(用于子类重写)RoleEquipChangePopup
|
||||
function PlayerGiftPanel:InitComponent()
|
||||
function BecomeAGodPropertyPanel:InitComponent()
|
||||
this.secondScroll = Util.GetGameObject(self.transform, "secondScroll")
|
||||
this.properItemPre = Util.GetGameObject(self.transform, "propertyPre")
|
||||
this.propertyGrid = Util.GetGameObject(this.secondScroll, "grid")
|
||||
this.properList = {}
|
||||
this.properList[0] = {}
|
||||
this.properList[0].go = this.properItemPre
|
||||
this.properList[0].leftTxt = Util.GetGameObject(this.properItemPre, "leftTxt"):GetComponent("Text")
|
||||
this.properList[0].rightTxt = Util.GetGameObject(this.properItemPre, "rightTxt"):GetComponent("Text")
|
||||
this.spLoader = SpriteLoader.New()
|
||||
this.bg2 = Util.GetGameObject(self.transform, "bg2")
|
||||
screenAdapte(this.bg2)
|
||||
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft })
|
||||
this.btnBack = Util.GetGameObject(self.transform, "btnBack/btnBack")
|
||||
|
||||
for i = 1, 2 do
|
||||
tabs[i] = Util.GetGameObject(self.transform, "Tabs/Btn" .. i)
|
||||
local nameTxt = Util.GetGameObject(tabs[i], "Text"):GetComponent("Text")
|
||||
nameTxt.fontSize = 40
|
||||
nameTxt.text = tableName[i]
|
||||
redTabs[i] = Util.GetGameObject(tabs[i], "red")
|
||||
if i == 2 then
|
||||
tabs[i]:SetActive(false)
|
||||
end
|
||||
--effectList[i] = Util.GetGameObject(self.transform, "bg/equipInfo/equip" .. i .. "/effect")
|
||||
end
|
||||
this.titleTxt = Util.GetGameObject(self.gameObject, "title"):GetComponent("Text")
|
||||
this.titleTxt.text = Language[10985]
|
||||
this.selectBtn = Util.GetGameObject(self.gameObject, "selectBtn")
|
||||
this.btnPrant = Util.GetGameObject(self.gameObject, "Tabs")
|
||||
this.btnPrant:SetActive(false)
|
||||
this.equipPreList2 = {}
|
||||
this.equipPreList = {}
|
||||
this.equipPre = Util.GetGameObject(self.gameObject, "equipPre")
|
||||
this.upItemPre = Util.GetGameObject(self.gameObject, "upItemPre")
|
||||
this.selsectSkillImage = Util.GetGameObject(self.gameObject, "selsectSkillImage")
|
||||
this.ScrollBar = Util.GetGameObject(self.gameObject, "listObj/bg/Scrollbar"):GetComponent("Scrollbar")
|
||||
local v2 = Util.GetGameObject(self.gameObject, "scroll"):GetComponent("RectTransform").rect
|
||||
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView,
|
||||
Util.GetGameObject(self.transform, "listObj/bg/scroll").transform,
|
||||
this.equipPre, this.ScrollBar, Vector2.New(v2.width, v2.height), 1, 5, Vector2.New(25, 20))
|
||||
this.ScrollView.moveTween.MomentumAmount = 1
|
||||
this.ScrollView.moveTween.Strength = 1
|
||||
|
||||
|
||||
v1 = Util.GetGameObject(self.gameObject, "upScroll"):GetComponent("RectTransform").rect
|
||||
this.UpScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView,
|
||||
Util.GetGameObject(self.transform, "upScroll").transform, this.upItemPre, nil, Vector2.New(v1.width, v1.height),
|
||||
1, 4, Vector2.New(50, 65))
|
||||
this.UpScrollView.moveTween.MomentumAmount = 1
|
||||
this.UpScrollView.moveTween.Strength = 1
|
||||
-- Util.GetGameObject(self.transform, "powerBtn"):GetComponent("Image").sprite = this.spLoader:LoadSprite("t_tongyong-zhanli_zh")
|
||||
this.force = Util.GetGameObject(self.transform, "powerBtn/value"):GetComponent("Text")
|
||||
this.itemNumText = Util.GetGameObject(self.transform, "itemNumText"):GetComponent("Text")
|
||||
this.upLvEffect = Util.GetGameObject(self.transform, "powerBtn/effect")
|
||||
|
||||
this.emptyObj = Util.GetGameObject(self.transform, "listObj/bg/emptyObj")
|
||||
this.emptyObj.gameObject:SetActive(false)
|
||||
this.mask = Util.GetGameObject(self.gameObject, "mask")
|
||||
this.mask:SetActive(false)
|
||||
this.lvTxt = Util.GetGameObject(self.gameObject, "collectLv"):GetComponent("Text")
|
||||
this.collectImg = Util.GetGameObject(self.gameObject, "collectImg"):GetComponent("Image")
|
||||
this.collectImg.sprite = this.spLoader:LoadSprite("gh_tt_8")
|
||||
this.barImg = Util.GetGameObject(self.gameObject, "progressbar/progress1"):GetComponent("Image")
|
||||
this.barNum = Util.GetGameObject(self.gameObject, "progressbar/num"):GetComponent("Text")
|
||||
this.btn_help = Util.GetGameObject(self.gameObject, "btn_help")
|
||||
|
||||
this.listObj = Util.GetGameObject(self.transform, "listObj")
|
||||
this.listCloseBtn = Util.GetGameObject(self.transform, "listObj/bg/btn_close")
|
||||
Util.GetGameObject(self.transform, "listObj/bg/title (1)"):GetComponent("Text").text = Language[12685]
|
||||
this.proTitle = Util.GetGameObject(self.transform, "proTitle/name/text"):GetComponent("Text")
|
||||
this.proTitle.text = Language[11823]
|
||||
this.proGrid = Util.GetGameObject(self.transform, "pro")
|
||||
this.proPre = Util.GetGameObject(self.transform, "pro/name")
|
||||
this.tipInfo = Util.GetGameObject(self.transform, "tipInfo"):GetComponent("Text")
|
||||
|
||||
this.proEmptyObj = Util.GetGameObject(self.transform, "proEmptyObj")
|
||||
Util.GetGameObject(self.transform, "proEmptyObj/TextImage/Text"):GetComponent("Text").text = Language[12687]
|
||||
end
|
||||
|
||||
--绑定事件(用于子类重写)
|
||||
function PlayerGiftPanel:BindEvent()
|
||||
Util.AddClick(this.listCloseBtn, function()
|
||||
this.listObj:SetActive(false)
|
||||
end)
|
||||
function BecomeAGodPropertyPanel:BindEvent()
|
||||
Util.AddClick(this.btn_help, function()
|
||||
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.Mingge, 0, 0)
|
||||
end)
|
||||
|
||||
Util.AddClick(this.collectImg.gameObject, function()
|
||||
-- local data = {}
|
||||
-- local singData = {}
|
||||
-- singData.title = "当前礼物总加成"
|
||||
-- singData.pro = IncarnationManager.GetproDesLst(GiftManager.GetPlayerGiftAddPro(),"00FF00")
|
||||
-- singData.tip ="" --"总加成包括化身之力提供的属性"
|
||||
-- table.insert(data,singData)
|
||||
-- UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.IncarnationDes,data)
|
||||
end)
|
||||
Util.AddClick(this.btnBack, function()
|
||||
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
||||
self:ClosePanel()
|
||||
end)
|
||||
for i = 1, 2 do
|
||||
Util.AddClick(tabs[i], function()
|
||||
-- isPlayAnim = true
|
||||
if i == indexBtnNum then
|
||||
return
|
||||
end
|
||||
indexBtnNum = i
|
||||
this:OnClickTabBtn(indexBtnNum)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function this.ChangePowerValue()
|
||||
|
|
@ -132,26 +44,61 @@ function this.ChangePowerValue()
|
|||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
function PlayerGiftPanel:AddListener()
|
||||
function BecomeAGodPropertyPanel:AddListener()
|
||||
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.RefreshWindowData)
|
||||
Game.GlobalEvent:AddEvent(GameEvent.Formation.OnFormationPowerChange, this.ChangePowerValue)
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
function PlayerGiftPanel:RemoveListener()
|
||||
function BecomeAGodPropertyPanel:RemoveListener()
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.RefreshWindowData)
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.Formation.OnFormationPowerChange, this.ChangePowerValue)
|
||||
end
|
||||
|
||||
--界面打开时调用(用于子类重写)
|
||||
function PlayerGiftPanel:OnOpen(...)
|
||||
function BecomeAGodPropertyPanel:OnOpen(...)
|
||||
local data = { ... }
|
||||
this.listObj:SetActive(false)
|
||||
this.index = tonumber(data[1])
|
||||
end
|
||||
|
||||
function PlayerGiftPanel:OnShow()
|
||||
function BecomeAGodPropertyPanel:OnShow()
|
||||
teamHero = FormationManager.GetAllMainFormationHeroId()
|
||||
this.RefreshWindowData()
|
||||
local propertyShow = BecomeAGodManager.GetPropText(1, 1)
|
||||
this:SetPropertyShow(propertyShow)
|
||||
end
|
||||
|
||||
--设置属性的显示
|
||||
function BecomeAGodPropertyPanel:SetPropertyShow(_infos)
|
||||
local index = 1
|
||||
this.properList[0].go.gameObject:SetActive(true)
|
||||
for i = 1, #this.properList do
|
||||
this.properList[i].go.gameObject:SetActive(false)
|
||||
end
|
||||
LogError("xxxxxxxxxxxxxxxxxxxxxxx"..tostring(#_infos))
|
||||
for key, value in pairs(_infos) do
|
||||
if not this.properList[index] then
|
||||
this.properList[index] = {}
|
||||
this.properList[index].go = newObjToParent(this.properItemPre, this.propertyGrid)
|
||||
this.properList[index].leftTxt = Util.GetGameObject(this.properList[index].go, "leftTxt"):GetComponent(
|
||||
"Text")
|
||||
this.properList[index].rightTxt = Util.GetGameObject(this.properList[index].go, "rightTxt"):GetComponent(
|
||||
"Text")
|
||||
end
|
||||
this.properList[index].go.gameObject:SetActive(true)
|
||||
local proper = ConfigManager.GetConfigData(ConfigName.PropertyConfig, key)
|
||||
if proper.Style == 1 then
|
||||
this.properList[index].leftTxt.text = string.format("%s+%s", GetLanguageStrById(proper.Info), value
|
||||
.currValue)
|
||||
this.properList[index].rightTxt.text = isMax and Language[10209] or value.nextValue
|
||||
else
|
||||
this.properList[index].leftTxt.text = GetLanguageStrById(proper.Info) .. "+" .. value.currValue / 100 .. "%"
|
||||
this.properList[index].rightTxt.text = isMax and Language[10209] or value.nextValue / 100 .. "%"
|
||||
end
|
||||
index = index + 1
|
||||
|
||||
end
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(this.secondScroll.transform)
|
||||
end
|
||||
|
||||
function this:OnSortingOrderChange()
|
||||
|
|
@ -168,253 +115,18 @@ function this:LeftBtnOnClick()
|
|||
|
||||
end
|
||||
|
||||
local collectNum = 0
|
||||
function this.RefreshWindowData()
|
||||
collectNum = 0
|
||||
this.ChangePowerValue()
|
||||
--显示上面赠送的
|
||||
local list = GiftManager.GetPlayerGifts()
|
||||
LogError("#list=============================" .. #list)
|
||||
local maxNum = 12
|
||||
if #list > maxNum then
|
||||
maxNum = #list + 4
|
||||
end
|
||||
local giftDatas = {}
|
||||
allUpIds = {}
|
||||
upSuitId = {}
|
||||
for i = 1, maxNum do
|
||||
local data = {}
|
||||
data.type = 1
|
||||
data.qua = 0
|
||||
data.id = 0
|
||||
data.isRed = false
|
||||
if i <= #list then
|
||||
data.id = list[i]
|
||||
data.type = 2
|
||||
data.qua = itemConfig[list[i]].Quantity
|
||||
if equipConfig[data.id] then
|
||||
collectNum = collectNum + equipConfig[data.id].Gift
|
||||
LogError("equipConfig[data.id].Gift==" .. equipConfig[data.id].Gift)
|
||||
end
|
||||
table.insert(allUpIds, data.id)
|
||||
table.insert(upSuitId, equipConfig[data.id].SuiteID)
|
||||
else
|
||||
data.isRed = GiftManager.CheckPlayerRedPoint()
|
||||
end
|
||||
table.insert(giftDatas, data)
|
||||
end
|
||||
table.sort(giftDatas, function(a, b)
|
||||
if a.type == b.type then
|
||||
if a.qua and a.qua == b.qua then
|
||||
return a.id < b.id
|
||||
else
|
||||
return a.qua > b.qua
|
||||
end
|
||||
else
|
||||
return a.type > b.type
|
||||
end
|
||||
end)
|
||||
|
||||
this.UpScrollView:SetData(giftDatas,
|
||||
function(index, go)
|
||||
this.SingleUpItemShow(go, giftDatas[index])
|
||||
end
|
||||
)
|
||||
--显示收集度
|
||||
local lv = 0
|
||||
local maxValue = 0
|
||||
|
||||
for k, v in ConfigPairs(giftConfig) do
|
||||
if collectNum >= v.Gift then
|
||||
lv = v.Id
|
||||
maxValue = v.Gift
|
||||
else
|
||||
maxValue = v.Gift
|
||||
break
|
||||
end
|
||||
end
|
||||
this.lvTxt.text = Language[12688] .. lv
|
||||
this.barNum.text = collectNum .. "/" .. maxValue
|
||||
this.barImg.fillAmount = collectNum / maxValue
|
||||
--显示下面可赠送的
|
||||
this:OnClickTabBtn(1)
|
||||
|
||||
local proList = IncarnationManager.GetproDesLst(GiftManager.GetPlayerGiftAddPro(), "00FF00")
|
||||
table.insert(proList, string.format(Language[12689], GiftManager.GetPlayerGiftAddPotencyLv()))
|
||||
table.insert(proList, string.format(Language[12187], GiftManager.GetPlayerGiftAdd()))
|
||||
if proList and #proList > 0 then
|
||||
this.proGrid:SetActive(true)
|
||||
this.proEmptyObj:SetActive(false)
|
||||
local len = this.proGrid.transform.childCount
|
||||
local create = #proList - len
|
||||
if create > 0 then
|
||||
for i = 1, create do
|
||||
newObjToParent(this.proPre, this.proGrid)
|
||||
end
|
||||
end
|
||||
len = this.proGrid.transform.childCount
|
||||
for i = 1, len do
|
||||
if i <= #proList then
|
||||
this.proGrid.transform:GetChild(i - 1).gameObject:SetActive(true)
|
||||
this.proGrid.transform:GetChild(i - 1):GetComponent("Text").text = proList[i]
|
||||
else
|
||||
this.proGrid.transform:GetChild(i - 1).gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
else
|
||||
this.proGrid:SetActive(false)
|
||||
this.proEmptyObj:SetActive(true)
|
||||
end
|
||||
--this.tipInfo.text=string.format("全体神将潜能等级+%s",GiftManager.GetPlayerGiftAddPotencyLv())
|
||||
end
|
||||
|
||||
--显示上面几个
|
||||
function this.SingleUpItemShow(_go, data)
|
||||
_go:SetActive(true)
|
||||
_go.transform:SetAsFirstSibling()
|
||||
local frame = _go:GetComponent("Image")
|
||||
local icon = Util.GetGameObject(_go, "icon"):GetComponent("Image")
|
||||
local name = Util.GetGameObject(_go, "name"):GetComponent("Text")
|
||||
local add = Util.GetGameObject(_go, "add")
|
||||
local red = Util.GetGameObject(_go, "red")
|
||||
local starGrid = Util.GetGameObject(_go, "starGrid")
|
||||
red:SetActive(data.isRed)
|
||||
if data.id and data.id ~= 0 then
|
||||
frame.sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(itemConfig[data.id].Quantity))
|
||||
icon.gameObject:SetActive(true)
|
||||
name.gameObject:SetActive(true)
|
||||
starGrid:SetActive(true)
|
||||
add:SetActive(false)
|
||||
name.text = SubString2(GetLanguageStrById(itemConfig[data.id].Name))
|
||||
icon.sprite = this.spLoader:LoadSprite(GetResourcePath(itemConfig[data.id].ResourceID))
|
||||
SetHeroStars(this.spLoader, starGrid, equipConfig[data.id].Star, 1, nil, -15)
|
||||
Util.AddOnceClick(icon.gameObject, function()
|
||||
BagManager.isBagPanel = false
|
||||
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2, this, data, 2, false, nil, nil, 4)
|
||||
end
|
||||
)
|
||||
else
|
||||
starGrid:SetActive(false)
|
||||
frame.sprite = this.spLoader:LoadSprite("r_characterbg_lanjin")
|
||||
icon.gameObject:SetActive(false)
|
||||
name.gameObject:SetActive(false)
|
||||
add:SetActive(true)
|
||||
end
|
||||
Util.AddOnceClick(add, function()
|
||||
this.listObj:SetActive(true)
|
||||
end)
|
||||
end
|
||||
|
||||
--点击装备按钮
|
||||
function this:OnClickTabBtn(_index)
|
||||
indexBtnNum = _index
|
||||
this:SetSelectBtn()
|
||||
local allEquip = BagManager.GetBagItemDataByItemType(ItemBaseType.PlayerGift)
|
||||
-- this:SortEquipDatas(allEquip)
|
||||
local count = 0
|
||||
for i = 1, #allEquip do
|
||||
count = count + 1
|
||||
if CheckListIsContainValue1(allUpIds, allEquip[i].id) or CheckListIsContainValue1(upSuitId, equipConfig[allEquip[i].id].SuiteID) then
|
||||
allEquip[i].isUp = 1
|
||||
else
|
||||
allEquip[i].isUp = 2
|
||||
end
|
||||
end
|
||||
table.sort(allEquip, function(a, b)
|
||||
if a.isUp == b.isUp then
|
||||
if a.quality == b.quality then
|
||||
return a.id < b.id
|
||||
else
|
||||
return a.quality > b.quality
|
||||
end
|
||||
else
|
||||
return a.isUp > b.isUp
|
||||
end
|
||||
end)
|
||||
--"装备数量:"
|
||||
this.itemNumText.text = Language[12690] .. count
|
||||
this:SetItemData(allEquip)
|
||||
|
||||
--this.CheckRedTab()
|
||||
end
|
||||
|
||||
function this:SetItemData(_itemDatas)
|
||||
if LengthOfTable(_itemDatas) == 0 then
|
||||
this.emptyObj.gameObject:SetActive(true)
|
||||
else
|
||||
this.emptyObj.gameObject:SetActive(false)
|
||||
end
|
||||
for k, v in pairs(this.equipPreList) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
this.ScrollView:SetData(
|
||||
_itemDatas,
|
||||
function(index, go)
|
||||
this.SingleItemDataShow(go, _itemDatas[index])
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function this.SingleItemDataShow(_go, _itemData)
|
||||
if not itemConfig[_itemData.id] then
|
||||
return
|
||||
end
|
||||
if not this.equipPreList[_go] then
|
||||
this.equipPreList[_go] = SubUIManager.Open(SubUIConfig.ItemView, _go.transform)
|
||||
end
|
||||
local redPoint = Util.GetGameObject(_go.transform, "redPoint")
|
||||
local tip = Util.GetGameObject(_go.transform, "tip")
|
||||
tip:SetActive(_itemData.isUp == 1)
|
||||
local isHave = CheckListIsContainValue1(allUpIds, _itemData.id) or
|
||||
CheckListIsContainValue1(upSuitId, equipConfig[_itemData.id].SuiteID)
|
||||
redPoint:SetActive(isHave == false)
|
||||
this.equipPreList[_go].gameObject:SetActive(true)
|
||||
this.equipPreList[_go].transform:SetAsFirstSibling()
|
||||
--if itemConfig[_itemData.id].ItemType == ItemType.Equip then
|
||||
this.equipPreList[_go]:OnOpen(false, { _itemData.id, _itemData.num }, 1.1, true, false, false, this.sortingOrder + 1,
|
||||
_itemData.idDyn)
|
||||
-- 0.查看属性 1.穿戴 2.卸下 3.交换
|
||||
--宝物界面
|
||||
Util.AddOnceClick(Util.GetGameObject(_go.transform, "mask"), function()
|
||||
BagManager.isBagPanel = true
|
||||
if isHave then
|
||||
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2, this, _itemData, 6, false, nil, curHeroData, 4)
|
||||
else
|
||||
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2, this, _itemData, 3, false, nil, curHeroData, 4)
|
||||
end
|
||||
end
|
||||
)
|
||||
--end
|
||||
end
|
||||
|
||||
function this:SetSelectBtn()
|
||||
this.selectBtn:SetActive(true)
|
||||
this.selectBtn.transform:SetParent(tabs[indexBtnNum].transform)
|
||||
this.selectBtn:GetComponent("RectTransform").anchoredPosition3D = Vector3(-12.28, 1.08, 0)
|
||||
this.selectBtn.transform:SetSiblingIndex(1)
|
||||
Util.GetGameObject(this.selectBtn.transform, "Text"):GetComponent("Text").text = GetCurLanguage() == -1 and
|
||||
tableName[indexBtnNum] or
|
||||
"<size=40>" ..
|
||||
tableName[indexBtnNum] ..
|
||||
"</size>" --typeTab[indexBtnNum]
|
||||
end
|
||||
|
||||
--选择图片设置父级
|
||||
function this.SelectImageSetParent(_objPoint)
|
||||
this.selsectSkillImage:SetActive(false)
|
||||
this.selsectSkillImage.transform:SetParent(_objPoint.transform)
|
||||
this.selsectSkillImage.transform.localScale = Vector3.one
|
||||
this.selsectSkillImage.transform.localPosition = Vector3.zero
|
||||
end
|
||||
|
||||
--界面关闭时调用(用于子类重写)
|
||||
function PlayerGiftPanel:OnClose()
|
||||
BagManager.isBagPanel = false
|
||||
function BecomeAGodPropertyPanel:OnClose()
|
||||
|
||||
end
|
||||
|
||||
--界面销毁时调用(用于子类重写)
|
||||
function PlayerGiftPanel:OnDestroy()
|
||||
function BecomeAGodPropertyPanel:OnDestroy()
|
||||
|
||||
end
|
||||
|
||||
return PlayerGiftPanel
|
||||
return BecomeAGodPropertyPanel
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: aacbae51ee02b8d458ed5fe1cb626abd
|
||||
guid: 43843f7ffc141d44493510186f917339
|
||||
timeCreated: 1552897446
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
|
|
|
|||
|
|
@ -38,6 +38,12 @@ function Practice:InitComponent()
|
|||
self.giftBtn = Util.GetGameObject(self.Btns, "rightGrid/giftBtn")
|
||||
self.giftRedPoint = Util.GetGameObject(self.giftBtn, "redPoint")
|
||||
self.giftRedPoint:SetActive(false)
|
||||
--成神
|
||||
--[[
|
||||
self.becomeAGodBtn = Util.GetGameObject(self.Btns, "rightGrid/becomeAGodBtn")
|
||||
self.becomeAGodBtnRedPoint = Util.GetGameObject(self.becomeAGodBtn, "redPoint")
|
||||
self.becomeAGodBtnRedPoint:SetActive(false)
|
||||
]]
|
||||
--Util.GetGameObject(self.Btns, "rightGrid/giftBtn"):GetComponent("Image").sprite=self.spLoader:LoadSprite("s_gift_player_zh")
|
||||
self.fourQuadrantBtn = Util.GetGameObject(self.Btns, "rightGrid/yushenBtn")
|
||||
self.fourQuadrantRedPoint = Util.GetGameObject(self.fourQuadrantBtn, "redPoint")
|
||||
|
|
@ -118,6 +124,11 @@ function Practice:BindEvent()
|
|||
Util.AddClick(self.giftBtn, function()
|
||||
UIManager.OpenPanel(UIName.PlayerGiftPanel)
|
||||
end)
|
||||
--[[
|
||||
Util.AddClick(self.becomeAGodBtn, function()
|
||||
UIManager.OpenPanel(UIName.BecomeAGodPanel)
|
||||
end)
|
||||
]]
|
||||
Util.AddClick(self.gemBtn, function()
|
||||
local isOpen = CheckFunctionOpen(FUNCTION_OPEN_TYPE.GemNew)
|
||||
if isOpen then
|
||||
|
|
@ -464,6 +475,7 @@ function Practice:RefreshBtn()
|
|||
self.talsmanSoulBtn:SetActive(ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.TailsmanSoul))
|
||||
self.incarnationBtn:SetActive(ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.Incarnation))
|
||||
self.giftBtn:SetActive(CheckFunctionOpen(FUNCTION_OPEN_TYPE.Mingge))
|
||||
--self.becomeAGodBtn:SetActive(CheckFunctionOpen(FUNCTION_OPEN_TYPE.GodsWayTower_3))
|
||||
self.noOpenTip:SetActive(false)
|
||||
if XinXianConfig[PracticeManager.PracticeLevel + 1] then
|
||||
self.button:SetActive(true)
|
||||
|
|
|
|||
|
|
@ -1,114 +1,124 @@
|
|||
GodsWayTowerManager = {};
|
||||
local this = GodsWayTowerManager
|
||||
local towerInfos=nil
|
||||
local duoDuiHeroConfig=ConfigManager.GetConfig(ConfigName.DuoDuiTowerHero)
|
||||
local towerInfos = nil
|
||||
local duoDuiHeroConfig = ConfigManager.GetConfig(ConfigName.DuoDuiTowerHero)
|
||||
function this.Initialize()
|
||||
towerInfos={}
|
||||
towerInfos = {}
|
||||
end
|
||||
|
||||
function this.Init(msg)
|
||||
local infos=msg.info
|
||||
local infos = msg.info
|
||||
for i = 1, #infos do
|
||||
local config=ConfigManager.GetConfigData(ConfigName.DuoDuiTowerConfig,infos[i].type)
|
||||
local needFloor
|
||||
if infos[i].tier<0 then
|
||||
needFloor=0
|
||||
else
|
||||
needFloor=infos[i].tier
|
||||
end
|
||||
towerInfos[i]={time=infos[i].time,type=infos[i].type,floor=needFloor,rank=infos[i].rank,freeId=config.PrivilegeType,buyId=config.PrivilegeType1}
|
||||
local config = ConfigManager.GetConfigData(ConfigName.DuoDuiTowerConfig, infos[i].type)
|
||||
local needFloor
|
||||
if infos[i].tier < 0 then
|
||||
needFloor = 0
|
||||
else
|
||||
needFloor = infos[i].tier
|
||||
end
|
||||
towerInfos[i] = {
|
||||
time = infos[i].time,
|
||||
type = infos[i].type,
|
||||
floor = needFloor,
|
||||
rank = infos[i].rank,
|
||||
freeId =
|
||||
config.PrivilegeType,
|
||||
buyId = config.PrivilegeType1
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function this.GetTowerData()
|
||||
return towerInfos
|
||||
end
|
||||
|
||||
function this.GetTowerDataByType(_type)
|
||||
local floor=this.GetTowerFloorByType(_type)
|
||||
local towerList={}
|
||||
local floor = this.GetTowerFloorByType(_type)
|
||||
local towerList = {}
|
||||
--ConfigManager.TryGetAllConfigsDataByDoubleKey(ConfigName.DuoDuiTower,"Type",_type,)
|
||||
if floor<0 then
|
||||
floor=0
|
||||
if floor < 0 then
|
||||
floor = 0
|
||||
end
|
||||
if floor>=300-10 then
|
||||
floor=300-10
|
||||
if floor >= 300 - 10 then
|
||||
floor = 300 - 10
|
||||
end
|
||||
for i = floor+1, floor+10 do
|
||||
local data=this.GetFourMonsterInfoByWave(_type,i)
|
||||
for i = floor + 1, floor + 10 do
|
||||
local data = this.GetFourMonsterInfoByWave(_type, i)
|
||||
if data then
|
||||
table.insert(towerList,data)
|
||||
table.insert(towerList, data)
|
||||
end
|
||||
end
|
||||
return towerList
|
||||
end
|
||||
|
||||
function this.GetCurrFloorRewardByType(_type)
|
||||
local floor=this.GetTowerFloorByType(_type)
|
||||
local floor = this.GetTowerFloorByType(_type)
|
||||
--如果一层都没打显示第一层的奖励
|
||||
if floor<=0 then
|
||||
floor=1
|
||||
if floor <= 0 then
|
||||
floor = 1
|
||||
end
|
||||
LogError("floor======"..floor)
|
||||
local config=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.DuoDuiTower,"Type",_type,"TowerNumber",floor)
|
||||
LogError("floor======" .. floor)
|
||||
local config = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.DuoDuiTower, "Type", _type, "TowerNumber", floor)
|
||||
if config then
|
||||
return config.Income
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
function this.SetSingleMonster(id)
|
||||
local herodata = {}
|
||||
local _configData = ConfigManager.GetConfigData(ConfigName.HeroConfig,id)
|
||||
local _configData = ConfigManager.GetConfigData(ConfigName.HeroConfig, id)
|
||||
herodata.heroConfig = _configData
|
||||
herodata.heroViewConfig = _configData
|
||||
herodata.live = GetResourcePath(_configData.Live)
|
||||
herodata.painting = GetResourcePath(_configData.Painting)
|
||||
herodata.icon = GetResourcePath(_configData.Icon)
|
||||
herodata.scale = _configData.Scale
|
||||
herodata.position = _configData.Position
|
||||
herodata.profession = _configData.Profession
|
||||
herodata.ProfessionResourceId = _configData.ProfessionResourceId
|
||||
if GetJobSpriteStrByJobNum(_configData.Profession) then
|
||||
herodata.professionIcon = GetJobSpriteStrByJobNum(_configData.Profession)
|
||||
else
|
||||
herodata.professionIcon = GetJobSpriteStrByJobNum(1)
|
||||
end
|
||||
herodata.name = _configData.ReadingName
|
||||
herodata.property = _configData.PropertyName
|
||||
return herodata
|
||||
herodata.live = GetResourcePath(_configData.Live)
|
||||
herodata.painting = GetResourcePath(_configData.Painting)
|
||||
herodata.icon = GetResourcePath(_configData.Icon)
|
||||
herodata.scale = _configData.Scale
|
||||
herodata.position = _configData.Position
|
||||
herodata.profession = _configData.Profession
|
||||
herodata.ProfessionResourceId = _configData.ProfessionResourceId
|
||||
if GetJobSpriteStrByJobNum(_configData.Profession) then
|
||||
herodata.professionIcon = GetJobSpriteStrByJobNum(_configData.Profession)
|
||||
else
|
||||
herodata.professionIcon = GetJobSpriteStrByJobNum(1)
|
||||
end
|
||||
herodata.name = _configData.ReadingName
|
||||
herodata.property = _configData.PropertyName
|
||||
return herodata
|
||||
end
|
||||
|
||||
function this.GetFourMonsterInfoByWave(curType,wave)
|
||||
LogError("curtype=="..curType.." wave=="..wave)
|
||||
local tempConfigs = ConfigManager.TryGetAllConfigsDataByDoubleKey(ConfigName.DuoDuiTower,"Type",curType,"TowerNumber",wave)
|
||||
function this.GetFourMonsterInfoByWave(curType, wave)
|
||||
LogError("curtype==" .. curType .. " wave==" .. wave)
|
||||
local tempConfigs = ConfigManager.TryGetAllConfigsDataByDoubleKey(ConfigName.DuoDuiTower, "Type", curType,
|
||||
"TowerNumber", wave)
|
||||
if not tempConfigs then
|
||||
return nil
|
||||
end
|
||||
local data = {}
|
||||
data.wave = wave
|
||||
data.firstReward = {}
|
||||
data.herodatas={}
|
||||
data.monsterConfig={}
|
||||
data.herodatas = {}
|
||||
data.monsterConfig = {}
|
||||
for i = 1, #tempConfigs do
|
||||
--奖励
|
||||
local tempConfig=tempConfigs[i]
|
||||
if tempConfig.Item and #tempConfig.Item > 0 and tempConfig.TowerWave1==1 then
|
||||
local tempConfig = tempConfigs[i]
|
||||
if tempConfig.Item and #tempConfig.Item > 0 and tempConfig.TowerWave1 == 1 then
|
||||
for j = 1, #tempConfig.Item do
|
||||
if tempConfig.Item[j][1]~=nil and tempConfig.Item[j][1]~=0 then
|
||||
if tempConfig.Item[j][1] ~= nil and tempConfig.Item[j][1] ~= 0 then
|
||||
--LogError("tempConfig.Item[j][1]=="..tempConfig.Item[j][1].." tempConfig.Item[j][2]=="..tempConfig.Item[j][2])
|
||||
table.insert(data.firstReward,{id = tempConfig.Item[j][1],num = tempConfig.Item[j][2]})
|
||||
table.insert(data.firstReward, { id = tempConfig.Item[j][1], num = tempConfig.Item[j][2] })
|
||||
end
|
||||
end
|
||||
end
|
||||
--LogError("tempConfig.id=="..tempConfig.id)
|
||||
data.id = tempConfig.TowerNumber
|
||||
data.power = tempConfig.Force
|
||||
local id=tempConfig.Hero[5]
|
||||
local aaa=this.SetSingleMonster(duoDuiHeroConfig[id].Hero)
|
||||
table.insert(data.monsterConfig,tempConfig)
|
||||
table.insert(data.herodatas,aaa)
|
||||
local id = tempConfig.Hero[5]
|
||||
local aaa = this.SetSingleMonster(duoDuiHeroConfig[id].Hero)
|
||||
table.insert(data.monsterConfig, tempConfig)
|
||||
table.insert(data.herodatas, aaa)
|
||||
end
|
||||
|
||||
|
||||
-- local monsterGroupId = tempConfig.Monster
|
||||
-- -- 默认显示第一只怪
|
||||
-- local id = monsterGroupConfig[monsterGroupId].Contents[1][1]
|
||||
|
|
@ -120,60 +130,59 @@ end
|
|||
|
||||
function this.GetTowerFloorByType(_type)
|
||||
if towerInfos[_type] then
|
||||
return towerInfos[_type].floor
|
||||
return towerInfos[_type].floor
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function this.GetTowerTimeByType(_type)
|
||||
if towerInfos[_type] then
|
||||
return towerInfos[_type].time
|
||||
return towerInfos[_type].time
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function this.SetTowerTimeByType(_type,_time)
|
||||
function this.SetTowerTimeByType(_type, _time)
|
||||
if towerInfos[_type] then
|
||||
towerInfos[_type].time=_time
|
||||
towerInfos[_type].time = _time
|
||||
end
|
||||
end
|
||||
|
||||
function this.GetTowerBuyIdByType(_type)
|
||||
if towerInfos[_type] then
|
||||
return towerInfos[_type].buyId
|
||||
return towerInfos[_type].buyId
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function this.GetTowerFreeIdByType(_type)
|
||||
if towerInfos[_type] then
|
||||
return towerInfos[_type].freeId
|
||||
return towerInfos[_type].freeId
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
function this.GetTimeTip(_type)
|
||||
--local config=ConfigManager.GetConfigData(ConfigName.DuoDuiTowerConfig,type)
|
||||
local buyTime=0
|
||||
local freeTime=0
|
||||
local buyTime = 0
|
||||
local freeTime = 0
|
||||
if towerInfos[_type] then
|
||||
buyTime = PrivilegeManager.GetPrivilegeRemainValue(towerInfos[_type].buyId)
|
||||
freeTime= PrivilegeManager.GetPrivilegeRemainValue(towerInfos[_type].freeId)
|
||||
freeTime = PrivilegeManager.GetPrivilegeRemainValue(towerInfos[_type].freeId)
|
||||
end
|
||||
--免费次数
|
||||
return freeTime,buyTime
|
||||
return freeTime, buyTime
|
||||
end
|
||||
|
||||
function this.GetCost(campId)
|
||||
|
||||
local buyTimeId=towerInfos[campId].buyId
|
||||
LogError("campId=="..campId.." buytimeid==="..buyTimeId)
|
||||
local buyTimeId = towerInfos[campId].buyId
|
||||
LogError("campId==" .. campId .. " buytimeid===" .. buyTimeId)
|
||||
local storeData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.StoreConfig, "StoreId", 7, "Limit", buyTimeId)
|
||||
--商店表数据
|
||||
local buyTimes = (PrivilegeManager.GetPrivilegeUsedTimes(buyTimeId) + 1) > PrivilegeManager.GetPrivilegeNumber(buyTimeId)
|
||||
and PrivilegeManager.GetPrivilegeNumber(buyTimeId) or (PrivilegeManager.GetPrivilegeUsedTimes(buyTimeId) + 1)
|
||||
return storeData.Id, storeData.Cost[1][1],storeData.Cost[2][buyTimes]
|
||||
--商店表数据
|
||||
local buyTimes = (PrivilegeManager.GetPrivilegeUsedTimes(buyTimeId) + 1) >
|
||||
PrivilegeManager.GetPrivilegeNumber(buyTimeId)
|
||||
and PrivilegeManager.GetPrivilegeNumber(buyTimeId) or (PrivilegeManager.GetPrivilegeUsedTimes(buyTimeId) + 1)
|
||||
return storeData.Id, storeData.Cost[1][1], storeData.Cost[2][buyTimes]
|
||||
end
|
||||
|
||||
-- function this.SetTowerFloorByType(_type)
|
||||
|
|
@ -185,34 +194,29 @@ end
|
|||
|
||||
--检测红点状态
|
||||
function this.CheckRedPointStatus()
|
||||
local towers=ConfigManager.GetConfig(ConfigName.DuoDuiTowerConfig)
|
||||
local towers = ConfigManager.GetConfig(ConfigName.DuoDuiTowerConfig)
|
||||
if towers then
|
||||
for i, v in ConfigPairs(towers) do
|
||||
local isOpen=CheckFunctionOpen(i+138)
|
||||
local isOpen = CheckFunctionOpen(i + 138)
|
||||
if isOpen then
|
||||
local freeTime= PrivilegeManager.GetPrivilegeRemainValue(v.PrivilegeType)
|
||||
if freeTime>0 then
|
||||
return true
|
||||
end
|
||||
local freeTime = PrivilegeManager.GetPrivilegeRemainValue(v.PrivilegeType)
|
||||
if freeTime > 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
|
||||
end
|
||||
|
||||
function this.SetTowerFloorByType(_type, _num)
|
||||
if towerInfos[_type] then
|
||||
towerInfos[_type].floor=towerInfos[_type].floor + _num
|
||||
towerInfos[_type].floor = towerInfos[_type].floor + _num
|
||||
end
|
||||
end
|
||||
|
||||
function this.Destroy()
|
||||
towerInfos=nil
|
||||
towerInfos = nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return this
|
||||
return this
|
||||
|
|
|
|||
Loading…
Reference in New Issue