xuanyuan
parent
926a33eb47
commit
e372c84cdb
|
@ -146,7 +146,7 @@ function CarbonTypePanelV2:BindEvent()
|
||||||
Util.AddClick(
|
Util.AddClick(
|
||||||
this.backBtn,
|
this.backBtn,
|
||||||
function()
|
function()
|
||||||
this:ClosePanel()
|
this:OnClose()
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,15 @@ local this = XuanYuanMirrorManager
|
||||||
this.levelData = {}
|
this.levelData = {}
|
||||||
this.buyTime = 0
|
this.buyTime = 0
|
||||||
this.freeTime = 0
|
this.freeTime = 0
|
||||||
|
this.buyTimeId = 0
|
||||||
|
this.freeTimeId = 0
|
||||||
this.curType = 0
|
this.curType = 0
|
||||||
function this.Initialize()
|
function this.Initialize()
|
||||||
raceTowerConfig = ConfigManager.GetConfig(ConfigName.RaceTowerConfig)
|
raceTowerConfig = ConfigManager.GetConfig(ConfigName.RaceTowerConfig)
|
||||||
raceTowerRewardConfig = ConfigManager.GetConfig(ConfigName.RaceTowerRewardConfig)
|
raceTowerRewardConfig = ConfigManager.GetConfig(ConfigName.RaceTowerRewardConfig)
|
||||||
|
local config = raceTowerConfig[1].Privilege
|
||||||
|
this.buyTimeId= config[2]
|
||||||
|
this.freeTimeId = config[1]
|
||||||
this.InitMirrorData()
|
this.InitMirrorData()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -78,12 +83,12 @@ function this.UpdateMirrorState(msg)
|
||||||
this.UpdateLevelState(v.id)
|
this.UpdateLevelState(v.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for k,v in pairs(this.levelData) do
|
-- for k,v in pairs(this.levelData) do
|
||||||
LogYellow("v.id:"..k.." state:"..v.state.." v.overTime:"..v.endingTime.." v.data:"..#v.data)
|
-- LogYellow("v.id:"..k.." state:"..v.state.." v.overTime:"..v.endingTime.." v.data:"..#v.data)
|
||||||
for n,m in ipairs(v.data) do
|
-- for n,m in ipairs(v.data) do
|
||||||
LogGreen("m.id:"..m.id.." state:"..m.state.." 组队条件:"..m.condition.. " 奖励预览:"..#m.rewardList)
|
-- LogGreen("m.id:"..m.id.." state:"..m.state.." 组队条件:"..m.condition.. " 奖励预览:"..#m.rewardList)
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.UpdateLevelState(type)
|
function this.UpdateLevelState(type)
|
||||||
|
@ -133,23 +138,32 @@ function this.PropertyName(_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
--设置剩余次数
|
--设置剩余次数
|
||||||
function this.GetTimeTip()
|
function this.GetTimeTip()
|
||||||
local config = raceTowerConfig[1].Privilege
|
|
||||||
local storeData=ConfigManager.GetConfigDataByDoubleKey(ConfigName.StoreConfig,"StoreId",7,"Limit",config[2])--商店表数据
|
-- LogBlue("购买总次数:"..PrivilegeManager.GetPrivilegeNumber(this.buyTimeId))
|
||||||
local buyTimeId= config[2]
|
-- LogBlue("购买使用的次数:"..PrivilegeManager.GetPrivilegeUsedTimes(this.buyTimeId))
|
||||||
local freeTimeId = config[1]
|
-- LogBlue("免费总次数:"..PrivilegeManager.GetPrivilegeNumber(this.freeTimeId))
|
||||||
this.buyTime= ShopManager.GetShopItemRemainBuyTimes(SHOP_TYPE.FUNCTION_SHOP,storeData.Id) --购买次数
|
-- LogBlue("免费使用次数:"..PrivilegeManager.GetPrivilegeUsedTimes(this.freeTimeId))
|
||||||
this.freeTime=PrivilegeManager.GetPrivilegeRemainValue(freeTimeId) --免费次数
|
this.buyTime = PrivilegeManager.GetPrivilegeRemainValue(this.buyTimeId)
|
||||||
|
--LogBlue("购买剩余次数:"..this.buyTime)
|
||||||
|
this.freeTime= PrivilegeManager.GetPrivilegeRemainValue(this.freeTimeId) --免费次数
|
||||||
|
--LogBlue("免费剩余次数:"..this.buyTime)
|
||||||
local str=""
|
local str=""
|
||||||
if this.freeTime>0 then
|
if this.freeTime > 0 then
|
||||||
str=string.format(Language[10344],tostring(this.freeTime))
|
str=string.format(Language[10344],tostring(this.freeTime))
|
||||||
else
|
else
|
||||||
str=string.format(Language[10345],tostring(this.buyTime))
|
str=string.format(Language[10345],tostring(this.buyTime))
|
||||||
end
|
end
|
||||||
LogBlue(str)
|
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function this.GetBuyTimesTip()
|
||||||
|
local config = raceTowerConfig[1].Privilege
|
||||||
|
local rechargeCommodityConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.RechargeCommodityConfig,"Id",4003)
|
||||||
|
local rechargeId =tonumber(rechargeCommodityConfig.OpenPrivilege[1])
|
||||||
|
return PrivilegeManager.GetPrivilegeOpenStatusById(rechargeId)
|
||||||
|
end
|
||||||
|
|
||||||
function this.GetMirrorLevelData(_type)
|
function this.GetMirrorLevelData(_type)
|
||||||
if this.levelData[_type] then
|
if this.levelData[_type] then
|
||||||
local temp = {}
|
local temp = {}
|
||||||
|
@ -212,8 +226,13 @@ function this.ExecuteFightBattle(id,type,func)
|
||||||
if result.result ==0 then
|
if result.result ==0 then
|
||||||
elseif result.result==1 then
|
elseif result.result==1 then
|
||||||
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
|
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
|
||||||
if this.levelData[this.curType] == 1 then
|
this.levelData[this.curType].passId = id
|
||||||
UIManager.OpenPanel(UIName.XuanYuanMirrorPanelList,this.curType,XuanYuanMirrorManager.GetMirrorLevelData(this.curType))
|
this.UpdateLevelState(this.curType)
|
||||||
|
PrivilegeManager.RefreshPrivilegeUsedTimes(XuanYuanMirrorManager.freeTimeId, 1)
|
||||||
|
if this.levelData[this.curType].state == 1 then
|
||||||
|
UIManager.OpenPanel(UIName.XuanYuanMirrorPanelList,this.curType)
|
||||||
|
else
|
||||||
|
UIManager.OpenPanel(UIName.XuanYuanMirrorPanel)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -134,7 +134,6 @@ this.UpdateCarbonContent = function()
|
||||||
BindRedPointObject(v.redPointType, Util.GetGameObject(go, "redPoint"))
|
BindRedPointObject(v.redPointType, Util.GetGameObject(go, "redPoint"))
|
||||||
go:GetComponent("Image").sprite = Util.LoadSprite(v.bg)
|
go:GetComponent("Image").sprite = Util.LoadSprite(v.bg)
|
||||||
Util.GetGameObject(go, "titileBg/Text"):GetComponent("Text").text =v.name
|
Util.GetGameObject(go, "titileBg/Text"):GetComponent("Text").text =v.name
|
||||||
LogGreen("k.state:"..XuanYuanMirrorManager.GetMirrorState(k))
|
|
||||||
local state = XuanYuanMirrorManager.GetMirrorState(k) == 1
|
local state = XuanYuanMirrorManager.GetMirrorState(k) == 1
|
||||||
if not state then
|
if not state then
|
||||||
local timeStr = this:GetOpenTime(k)
|
local timeStr = this:GetOpenTime(k)
|
||||||
|
@ -146,7 +145,7 @@ this.UpdateCarbonContent = function()
|
||||||
Util.SetGray(go,not state)
|
Util.SetGray(go,not state)
|
||||||
Util.AddOnceClick(go ,function()
|
Util.AddOnceClick(go ,function()
|
||||||
if state then
|
if state then
|
||||||
UIManager.OpenPanel(UIName.XuanYuanMirrorPanelList,k,XuanYuanMirrorManager.GetMirrorLevelData(k))
|
UIManager.OpenPanel(UIName.XuanYuanMirrorPanelList,k)
|
||||||
else
|
else
|
||||||
PopupTipPanel.ShowTip(type[k].neme.."未开启!")
|
PopupTipPanel.ShowTip(type[k].neme.."未开启!")
|
||||||
end
|
end
|
||||||
|
@ -165,8 +164,6 @@ end
|
||||||
|
|
||||||
|
|
||||||
function this:PlayAni()
|
function this:PlayAni()
|
||||||
-- 启动定时器
|
|
||||||
this.StartCountTime()
|
|
||||||
-- 开门音效
|
-- 开门音效
|
||||||
if not this.isPlayDoorAudio then
|
if not this.isPlayDoorAudio then
|
||||||
this.isPlayDoorAudio = true
|
this.isPlayDoorAudio = true
|
||||||
|
@ -187,23 +184,6 @@ function this.PlayScaleAnim()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.StartCountTime()
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
function this.FreshIconShow(id)
|
|
||||||
if not hasFresh then
|
|
||||||
hasFresh = true
|
|
||||||
|
|
||||||
this.refreshTimer = nil
|
|
||||||
this.refreshTimer = Timer.New(function ()
|
|
||||||
Util.SetGray(this.btnDaoxuan, not ActTimeCtrlManager.SingleFuncState(46))
|
|
||||||
this.StartCountTime()
|
|
||||||
end, 1)
|
|
||||||
this.refreshTimer:Start()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--界面关闭时调用(用于子类重写)
|
--界面关闭时调用(用于子类重写)
|
||||||
function this:OnClose()
|
function this:OnClose()
|
||||||
this.isPlayDoorAudio = false
|
this.isPlayDoorAudio = false
|
||||||
|
|
|
@ -1,69 +1,105 @@
|
||||||
require("Base/BasePanel")
|
require("Base/BasePanel")
|
||||||
XuanYuanMirrorPanelList = Inherit(BasePanel)
|
XuanYuanMirrorPanelList = Inherit(BasePanel)
|
||||||
|
local raceTowerConfig = ConfigManager.GetConfig(ConfigName.RaceTowerConfig)
|
||||||
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||||
local this = XuanYuanMirrorPanelList
|
local this = XuanYuanMirrorPanelList
|
||||||
local hasFresh = false
|
local hasFresh = false
|
||||||
local orginLayer = 0
|
local orginLayer = 0
|
||||||
local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
|
local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
|
||||||
|
local costNum = 0
|
||||||
|
local storeData = {}
|
||||||
local mirrors = {
|
local mirrors = {
|
||||||
[1] = {
|
[1] = {
|
||||||
id = "人杰宝镜", --人杰
|
id = "人杰宝镜", --人杰
|
||||||
bg = "x_xianyuan_renjietu01",
|
bg = "x_xianyuan_renjietu01",
|
||||||
tip = string.format("<color=#E5DDBF>%s</color>",specialConfig[71].Value),
|
tip = string.format("<color=#E5DDBF>%s</color>", specialConfig[71].Value)
|
||||||
},
|
},
|
||||||
[2] = {
|
[2] = {
|
||||||
id = "佛禅宝镜", --佛禅
|
id = "佛禅宝镜", --佛禅
|
||||||
bg = "x_xianyuan_fochantu01",
|
bg = "x_xianyuan_fochantu01",
|
||||||
tip = string.format("<color=#FFE3C2>%s</color>",specialConfig[72].Value),
|
tip = string.format("<color=#FFE3C2>%s</color>", specialConfig[72].Value)
|
||||||
},
|
},
|
||||||
[3] = {
|
[3] = {
|
||||||
id = "妖灵宝镜", --妖灵
|
id = "妖灵宝镜", --妖灵
|
||||||
bg = "x_xianyuan_yaolingtu01",
|
bg = "x_xianyuan_yaolingtu01",
|
||||||
tip = string.format("<color=#F3DBD5>%s</color>",specialConfig[73].Value),
|
tip = string.format("<color=#F3DBD5>%s</color>", specialConfig[73].Value)
|
||||||
},
|
},
|
||||||
[4] = {
|
[4] = {
|
||||||
id = "道玄宝镜", --道玄
|
id = "道玄宝镜", --道玄
|
||||||
bg = "x_xianyuan_daoxuantu01",
|
bg = "x_xianyuan_daoxuantu01",
|
||||||
tip = string.format("<color=#FFD09D>%s</color>",specialConfig[74].Value),
|
tip = string.format("<color=#FFD09D>%s</color>", specialConfig[74].Value)
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
local curType = 0
|
local curType = 0
|
||||||
local dataList = {}
|
local dataList = {}
|
||||||
local list = {}
|
local list = {}
|
||||||
local colorText = {
|
local colorText = {
|
||||||
sprite = { [0] = "s_slbz_1anniuhuise",[1] = "s_slbz_1anniuongse",[2] = "s_slbz_1anniuhuangse"},
|
sprite = {[0] = "s_slbz_1anniuhuise", [1] = "s_slbz_1anniuongse", [2] = "s_slbz_1anniuhuangse"},
|
||||||
color = { [0] = "3B3B3B",[1] = "855139",[2] = "8B670C"},
|
color = {[0] = "3B3B3B", [1] = "855139", [2] = "8B670C"},
|
||||||
text = { [0] = Language[10339],[1] = Language[10334],[2] = Language[10336] }
|
text = {[0] = Language[10339], [1] = Language[10334], [2] = Language[10336]}
|
||||||
}
|
}
|
||||||
local difficult = {
|
local difficult = {
|
||||||
text = {[1]=Language[10351],[2]=Language[10352],[3]=Language[10353],[4]=Language[12250],[5]=Language[10354],
|
text = {
|
||||||
[6]=Language[12148],[7]=Language[12251],[8]=Language[12252],[9]=Language[12253],[10]=Language[12253]},
|
[1] = Language[10351],
|
||||||
sprite = {[1]="x_xb_tiao_05",[2]="x_xb_tiao_05",[3]="x_xb_tiao_04",[4]="x_xb_tiao_04",[5]="x_xb_tiao_03",
|
[2] = Language[10352],
|
||||||
[6]="x_xb_tiao_03",[7]="x_xb_tiao_02",[8]="x_xb_tiao_02",[9]="x_xb_tiao_01",[10]="x_xb_tiao_01"},
|
[3] = Language[10353],
|
||||||
|
[4] = Language[12250],
|
||||||
|
[5] = Language[10354],
|
||||||
|
[6] = Language[12148],
|
||||||
|
[7] = Language[12251],
|
||||||
|
[8] = Language[12252],
|
||||||
|
[9] = Language[12253],
|
||||||
|
[10] = Language[12253]
|
||||||
|
},
|
||||||
|
sprite = {
|
||||||
|
[1] = "x_xb_tiao_05",
|
||||||
|
[2] = "x_xb_tiao_05",
|
||||||
|
[3] = "x_xb_tiao_04",
|
||||||
|
[4] = "x_xb_tiao_04",
|
||||||
|
[5] = "x_xb_tiao_03",
|
||||||
|
[6] = "x_xb_tiao_03",
|
||||||
|
[7] = "x_xb_tiao_02",
|
||||||
|
[8] = "x_xb_tiao_02",
|
||||||
|
[9] = "x_xb_tiao_01",
|
||||||
|
[10] = "x_xb_tiao_01"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
--初始化组件(用于子类重写)
|
--初始化组件(用于子类重写)
|
||||||
function this:InitComponent()
|
function this:InitComponent()
|
||||||
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
||||||
|
|
||||||
this.remainTimesTip = Util.GetGameObject(self.gameObject,"Panel/tip/remainTimesTip"): GetComponent("Text")
|
this.remainTimesTip = Util.GetGameObject(self.gameObject, "Panel/tip/remainTimesTip"):GetComponent("Text")
|
||||||
this.vipTips = Util.GetGameObject(self.gameObject,"Panel/tip/vipTips") : GetComponent("Text")
|
this.vipTips = Util.GetGameObject(self.gameObject, "Panel/tip/vipTips"):GetComponent("Text")
|
||||||
this.btnBack = Util.GetGameObject(self.gameObject,"Panel/BackBtn")
|
this.btnBack = Util.GetGameObject(self.gameObject, "Panel/BackBtn")
|
||||||
|
|
||||||
this.levelPre = Util.GetGameObject(self.gameObject,"Panel/Pre")
|
this.levelPre = Util.GetGameObject(self.gameObject, "Panel/Pre")
|
||||||
--local v21 = Util.GetGameObject(self.gameObject, "Panel/Scroll"):GetComponent("RectTransform").rect
|
--local v21 = Util.GetGameObject(self.gameObject, "Panel/Scroll"):GetComponent("RectTransform").rect
|
||||||
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.gameObject, "Panel/Scroll").transform,
|
this.ScrollView =
|
||||||
this.levelPre,nil,Vector2.New(919.6,1241.2), 1, 1, Vector2.New(0,117.7))
|
SubUIManager.Open(
|
||||||
|
SubUIConfig.ScrollCycleView,
|
||||||
|
Util.GetGameObject(self.gameObject, "Panel/Scroll").transform,
|
||||||
|
this.levelPre,
|
||||||
|
nil,
|
||||||
|
Vector2.New(919.6, 1241.2),
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
Vector2.New(0, 117.7)
|
||||||
|
)
|
||||||
this.ScrollView.moveTween.MomentumAmount = 1
|
this.ScrollView.moveTween.MomentumAmount = 1
|
||||||
this.ScrollView.moveTween.Strength = 1
|
this.ScrollView.moveTween.Strength = 1
|
||||||
this.prefab = Util.GetGameObject(self.gameObject,"ItemView")
|
this.prefab = Util.GetGameObject(self.gameObject, "ItemView")
|
||||||
end
|
end
|
||||||
|
|
||||||
--绑定事件(用于子类重写)
|
--绑定事件(用于子类重写)
|
||||||
function this:BindEvent()
|
function this:BindEvent()
|
||||||
Util.AddClick(this.btnBack, function()
|
Util.AddClick(
|
||||||
UIManager.OpenPanel(UIName.XuanYuanMirrorPanel)
|
this.btnBack,
|
||||||
this:OnClose()
|
function()
|
||||||
end)
|
UIManager.OpenPanel(UIName.XuanYuanMirrorPanel)
|
||||||
|
this:OnClose()
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
--添加事件监听(用于子类重写)
|
--添加事件监听(用于子类重写)
|
||||||
|
@ -80,35 +116,36 @@ this.RefreshPanel = function()
|
||||||
local data = XuanYuanMirrorManager.GetMirroData(curType)
|
local data = XuanYuanMirrorManager.GetMirroData(curType)
|
||||||
if data.passId == 0 or XuanYuanMirrorManager.GetMirrorState(curType) ~= 1 then
|
if data.passId == 0 or XuanYuanMirrorManager.GetMirrorState(curType) ~= 1 then
|
||||||
if data.passId == 0 then
|
if data.passId == 0 then
|
||||||
PopupTipPanel.ShowTip(mirrors[curType].id.."已重置!")
|
PopupTipPanel.ShowTip(mirrors[curType].id .. "已重置!")
|
||||||
elseif XuanYuanMirrorManager.GetMirrorState(curType) ~= 1 then
|
elseif XuanYuanMirrorManager.GetMirrorState(curType) ~= 1 then
|
||||||
PopupTipPanel.ShowTip(mirrors[curType].id.."已关闭!")
|
PopupTipPanel.ShowTip(mirrors[curType].id .. "已关闭!")
|
||||||
end
|
end
|
||||||
this:OnClose()
|
this:OnClose()
|
||||||
UIManager.OpenPanel(UIName.XuanYuanMirrorPanel)
|
UIManager.OpenPanel(UIName.XuanYuanMirrorPanel)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:OnOpen(_type,_data)
|
function this:OnOpen(_type)
|
||||||
this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.Main })
|
this.UpView:OnOpen({showType = UpViewOpenType.ShowRight, panelType = PanelType.Main})
|
||||||
curType = _type
|
curType = _type
|
||||||
XuanYuanMirrorManager.curType = curType
|
XuanYuanMirrorManager.curType = curType
|
||||||
dataList = _data
|
|
||||||
LogGreen("dataList:"..#dataList)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:SwitchView()
|
function this:SwitchView()
|
||||||
local curObj = Util.GetGameObject(self.gameObject,"title")
|
local curObj = Util.GetGameObject(self.gameObject, "title")
|
||||||
curObj:GetComponent("Image").sprite = Util.LoadSprite(mirrors[curType].bg)
|
curObj:GetComponent("Image").sprite = Util.LoadSprite(mirrors[curType].bg)
|
||||||
Util.GetGameObject(curObj,"Text"):GetComponent("Text").text = mirrors[curType].tip
|
Util.GetGameObject(curObj, "Text"):GetComponent("Text").text = mirrors[curType].tip
|
||||||
|
|
||||||
this.ScrollView:SetData(dataList, function (index, go)
|
this.ScrollView:SetData(
|
||||||
this:SetLevelData(go, dataList[index])
|
dataList,
|
||||||
table.insert(list,go)
|
function(index, go)
|
||||||
end)
|
this:SetLevelData(go, dataList[index])
|
||||||
|
table.insert(list, go)
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:NewItemView(config,gameObject,...)
|
function this:NewItemView(config, gameObject, ...)
|
||||||
local view = reimport(config.script)
|
local view = reimport(config.script)
|
||||||
if gameObject then
|
if gameObject then
|
||||||
this:playUIAnimsOnStart(gameObject)
|
this:playUIAnimsOnStart(gameObject)
|
||||||
|
@ -138,7 +175,7 @@ end
|
||||||
function this:playUIAnimsOnStart(gameObject)
|
function this:playUIAnimsOnStart(gameObject)
|
||||||
local anims = gameObject:GetComponentsInChildren(typeof(PlayFlyAnim))
|
local anims = gameObject:GetComponentsInChildren(typeof(PlayFlyAnim))
|
||||||
if anims.Length > 0 then
|
if anims.Length > 0 then
|
||||||
for i=0, anims.Length-1 do
|
for i = 0, anims.Length - 1 do
|
||||||
local anim = anims[i]
|
local anim = anims[i]
|
||||||
if anim.isPlayOnOpen then
|
if anim.isPlayOnOpen then
|
||||||
anim:PlayAnim(false)
|
anim:PlayAnim(false)
|
||||||
|
@ -148,97 +185,145 @@ function this:playUIAnimsOnStart(gameObject)
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:SetLevelData(go, data)
|
function this:SetLevelData(go, data)
|
||||||
local btnFight = Util.GetGameObject(go,"btnFight")
|
local btnFight = Util.GetGameObject(go, "btnFight")
|
||||||
btnFight:GetComponent("Image").sprite = Util.LoadSprite(colorText.sprite[data.state])
|
btnFight:GetComponent("Image").sprite = Util.LoadSprite(colorText.sprite[data.state])
|
||||||
local text = Util.GetGameObject(btnFight,"Text"):GetComponent("Text")
|
Util.GetGameObject(btnFight, "Text"):GetComponent("Text").text = string.format("<color=#%s>%s</color>", colorText.color[data.state], colorText.text[data.state])
|
||||||
text.text =string.format("<color=#%s>%s</color>",colorText.color[data.state],colorText.text[data.state])
|
local costIcon = Util.GetGameObject(btnFight, "Icon"):GetComponent("Image")
|
||||||
local tip = Util.GetGameObject(go,"Tip"):GetComponent("Text")
|
costIcon.gameObject:SetActive(false)
|
||||||
|
local costNumText = Util.GetGameObject(btnFight, "IconNum"):GetComponent("Text")
|
||||||
|
costNumText.gameObject:SetActive(false)
|
||||||
|
|
||||||
|
local tip = Util.GetGameObject(go, "Tip"):GetComponent("Text")
|
||||||
tip.gameObject:SetActive(true)
|
tip.gameObject:SetActive(true)
|
||||||
if data.state == 1 then
|
|
||||||
tip.text=data.condition
|
if data.state == 0 then
|
||||||
elseif data.state == 0 then
|
|
||||||
tip.gameObject:SetActive(false)
|
tip.gameObject:SetActive(false)
|
||||||
else
|
else
|
||||||
tip.text=Language[10337]
|
|
||||||
end
|
|
||||||
Util.AddOnceClick(btnFight,function()
|
|
||||||
if data.state == 1 then
|
if data.state == 1 then
|
||||||
this:OnClose()
|
tip.text = data.condition
|
||||||
LogGreen("curType"..curType)
|
else
|
||||||
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.XUANYUAN_MIRROR,curType,data)
|
tip.text = Language[10337]
|
||||||
elseif data.state == 0 then
|
end
|
||||||
|
if XuanYuanMirrorManager.freeTime < 1 then
|
||||||
|
costNumText.gameObject:SetActive(true)
|
||||||
|
costIcon.gameObject:SetActive(true)
|
||||||
|
costNumText.text = costNum
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Util.AddOnceClick(btnFight,function()
|
||||||
|
if data.state == 0 then
|
||||||
PopupTipPanel.ShowTip(Language[12255])
|
PopupTipPanel.ShowTip(Language[12255])
|
||||||
elseif data.state == 2 then
|
else
|
||||||
XuanYuanMirrorManager.ExecuteFightBattle(data.id,2,function()
|
--检测剩余次数
|
||||||
this:RefreshTimes()
|
if XuanYuanMirrorManager.buyTime <= 0 and XuanYuanMirrorManager.freeTime <= 0 then
|
||||||
end)
|
PopupTipPanel.ShowTip(Language[10342])
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local itemId = storeData.Cost[1][1] --消耗道具
|
||||||
|
if BagManager.GetItemCountById(itemId) < costNum and XuanYuanMirrorManager.freeTime <= 0 then
|
||||||
|
PopupTipPanel.ShowTip(string.format(Language[10343], itemConfig[itemId].Name))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if XuanYuanMirrorManager.freeTime <= 0 then
|
||||||
|
ShopManager.RequestBuyShopItem(SHOP_TYPE.FUNCTION_SHOP,storeData.Id,1,function()
|
||||||
|
PrivilegeManager.RefreshPrivilegeUsedTimes(XuanYuanMirrorManager.buyTimeId, 1)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
if data.state == 2 then
|
||||||
|
XuanYuanMirrorManager.ExecuteFightBattle(data.id,2,function()
|
||||||
|
PrivilegeManager.RefreshPrivilegeUsedTimes(XuanYuanMirrorManager.freeTimeId, 1)
|
||||||
|
this:OnShow()
|
||||||
|
end)
|
||||||
|
elseif data.state == 1 then
|
||||||
|
LogGreen("curType" .. curType)
|
||||||
|
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.XUANYUAN_MIRROR, curType, data)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
local rewardGrid = Util.GetGameObject(go,"Reward")
|
local rewardGrid = Util.GetGameObject(go, "Reward")
|
||||||
local rewards = {}
|
local rewards = {}
|
||||||
for i = 1,rewardGrid.transform.childCount do
|
for i = 1, rewardGrid.transform.childCount do
|
||||||
rewardGrid.transform:GetChild(i - 1).gameObject:SetActive(false)
|
rewardGrid.transform:GetChild(i - 1).gameObject:SetActive(false)
|
||||||
table.insert(rewards,rewardGrid.transform:GetChild(i - 1))
|
table.insert(rewards, rewardGrid.transform:GetChild(i - 1))
|
||||||
end
|
end
|
||||||
for n,m in ipairs(data.rewardList) do
|
for n, m in ipairs(data.rewardList) do
|
||||||
if m then
|
if m then
|
||||||
--设置概率掉落奖励
|
--设置概率掉落奖励
|
||||||
if m.israte == 0 then
|
if m.israte == 0 then
|
||||||
|
--设置扫荡掉落奖励
|
||||||
if not rewards[n] then
|
if not rewards[n] then
|
||||||
rewards[n] = newObjToParent(this.prefab, rewardGrid)
|
rewards[n] = newObjToParent(this.prefab, rewardGrid)
|
||||||
end
|
end
|
||||||
rewards[n].gameObject:SetActive(true)
|
rewards[n].gameObject:SetActive(true)
|
||||||
local o = this:NewItemView(SubUIConfig.ItemView,rewards[n])
|
local o = this:NewItemView(SubUIConfig.ItemView, rewards[n])
|
||||||
o:OnOpen(false, {m.id, m.num},0.78, false)
|
o:OnOpen(false, {m.id, m.num}, 0.78, false)
|
||||||
local image = Util.GetGameObject(rewards[n].gameObject,"PreciousShow")
|
local image = Util.GetGameObject(rewards[n].gameObject, "PreciousShow")
|
||||||
image.gameObject:SetActive(true)
|
image.gameObject:SetActive(true)
|
||||||
Util.GetGameObject(image,"Text").gameObject:SetActive(false)
|
Util.GetGameObject(image, "Text").gameObject:SetActive(false)
|
||||||
image:GetComponent("Image").sprite = Util.LoadSprite("x_xianyuan_gailvjiaobiao")
|
image:GetComponent("Image").sprite = Util.LoadSprite("x_xianyuan_gailvjiaobiao")
|
||||||
--设置扫荡掉落奖励
|
elseif data.state == 2 and m.israte == 1 then
|
||||||
elseif data.state == 2 and m.israte == 1 then
|
--设置未开启和挑战掉落奖励
|
||||||
if not rewards[n] then
|
if not rewards[n] then
|
||||||
rewards[n] = newObjToParent(this.prefab, rewardGrid)
|
rewards[n] = newObjToParent(this.prefab, rewardGrid)
|
||||||
end
|
end
|
||||||
rewards[n].gameObject:SetActive(true)
|
rewards[n].gameObject:SetActive(true)
|
||||||
local o = this:NewItemView(SubUIConfig.ItemView,rewards[n])
|
local o = this:NewItemView(SubUIConfig.ItemView, rewards[n])
|
||||||
o:OnOpen(false, {m.id, m.num},0.78, false)
|
o:OnOpen(false, {m.id, m.num}, 0.78, false)
|
||||||
local image = Util.GetGameObject(rewards[n].gameObject,"PreciousShow")
|
local image = Util.GetGameObject(rewards[n].gameObject, "PreciousShow")
|
||||||
image.gameObject:SetActive(false)
|
image.gameObject:SetActive(false)
|
||||||
--设置未开启和挑战掉落奖励
|
|
||||||
elseif (data.state == 1 or data.state == 0) and m.israte == 2 then
|
elseif (data.state == 1 or data.state == 0) and m.israte == 2 then
|
||||||
if not rewards[n] then
|
if not rewards[n] then
|
||||||
rewards[n] = newObjToParent(this.prefab, rewardGrid)
|
rewards[n] = newObjToParent(this.prefab, rewardGrid)
|
||||||
end
|
end
|
||||||
rewards[n].gameObject:SetActive(true)
|
rewards[n].gameObject:SetActive(true)
|
||||||
local o = this:NewItemView(SubUIConfig.ItemView,rewards[n])
|
local o = this:NewItemView(SubUIConfig.ItemView, rewards[n])
|
||||||
o:OnOpen(false, {m.id, m.num},0.78, false)
|
o:OnOpen(false, {m.id, m.num}, 0.78, false)
|
||||||
local image = Util.GetGameObject(rewards[n].gameObject,"PreciousShow")
|
local image = Util.GetGameObject(rewards[n].gameObject, "PreciousShow")
|
||||||
image.gameObject:SetActive(true)
|
image.gameObject:SetActive(true)
|
||||||
Util.GetGameObject(image,"Text").gameObject:SetActive(false)
|
Util.GetGameObject(image, "Text").gameObject:SetActive(false)
|
||||||
image:GetComponent("Image").sprite = Util.LoadSprite("x_xianyuan_shoucijiaobiao")
|
image:GetComponent("Image").sprite = Util.LoadSprite("x_xianyuan_shoucijiaobiao")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Util.GetGameObject(go,"Bg/BgQuality/title"):GetComponent("Text").text = mirrors[data.type].id
|
Util.GetGameObject(go, "Bg/BgQuality/title"):GetComponent("Text").text = mirrors[data.type].id
|
||||||
Util.GetGameObject(go,"Bg/BgQuality/difficult"):GetComponent("Text").text = difficult.text[data.difficulity]
|
Util.GetGameObject(go, "Bg/BgQuality/difficult"):GetComponent("Text").text = difficult.text[data.difficulity]
|
||||||
Util.GetGameObject(go,"Bg/BgQuality"):GetComponent("Image").sprite =Util.LoadSprite(difficult.sprite[data.difficulity])
|
Util.GetGameObject(go, "Bg/BgQuality"):GetComponent("Image").sprite =
|
||||||
Util.GetGameObject(go,"Bg/BgQuality/Text"):GetComponent("Text").text = data.power
|
Util.LoadSprite(difficult.sprite[data.difficulity])
|
||||||
|
Util.GetGameObject(go, "Bg/BgQuality/Text"):GetComponent("Text").text = data.power
|
||||||
end
|
end
|
||||||
|
|
||||||
--界面打开时调用(用于子类重写)
|
--界面打开时调用(用于子类重写)
|
||||||
function this:OnShow(...)
|
function this:OnShow(...)
|
||||||
this:SwitchView()
|
dataList = XuanYuanMirrorManager.GetMirrorLevelData(curType)
|
||||||
this:RefreshTimes()
|
this:RefreshTimes()
|
||||||
|
local buyTimeId = XuanYuanMirrorManager.buyTimeId
|
||||||
|
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)
|
||||||
|
costNum = storeData.Cost[2][buyTimes]
|
||||||
|
this:SwitchView()
|
||||||
end
|
end
|
||||||
|
|
||||||
--界面打开时调用(用于子类重写)
|
--界面打开时调用(用于子类重写)
|
||||||
function this:RefreshTimes()
|
function this:RefreshTimes()
|
||||||
-- this.remainTimesTip.text = XuanYuanMirrorManager.GetTimeTip()
|
this.remainTimesTip.text = XuanYuanMirrorManager.GetTimeTip()
|
||||||
-- this.vipTips.text = Language[12257]
|
if XuanYuanMirrorManager.GetBuyTimesTip() then
|
||||||
|
this.vipTips.gameObject:SetActive(false)
|
||||||
|
else
|
||||||
|
this.vipTips.gameObject:SetActive(true)
|
||||||
|
this.vipTips.text = Language[12257]
|
||||||
|
Util.AddOnceClick(
|
||||||
|
Util.GetGameObject(this.vipTips.gameObject, "GameObject"),
|
||||||
|
function()
|
||||||
|
UIManager.OpenPanel(UIName.MainRechargePanel, 3)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:OnSortingOrderChange()
|
function this:OnSortingOrderChange()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--界面关闭时调用(用于子类重写)
|
--界面关闭时调用(用于子类重写)
|
||||||
|
@ -252,4 +337,4 @@ function this:OnDestroy()
|
||||||
this.ScrollView = nil
|
this.ScrollView = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
return XuanYuanMirrorPanelList
|
return XuanYuanMirrorPanelList
|
||||||
|
|
|
@ -11,7 +11,6 @@ function this.Init(root, ...)
|
||||||
if temp[1] and temp[1] ~= 0 then
|
if temp[1] and temp[1] ~= 0 then
|
||||||
curType = temp[1]
|
curType = temp[1]
|
||||||
end
|
end
|
||||||
LogBlue("curType"..curType)
|
|
||||||
if temp[2] then
|
if temp[2] then
|
||||||
data = temp[2]
|
data = temp[2]
|
||||||
end
|
end
|
||||||
|
@ -68,7 +67,6 @@ function this.RefreshFormation(curFormation)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
LogBlue("index"..index)
|
|
||||||
if index >= tonumber(data.teamRules[1][2]) then
|
if index >= tonumber(data.teamRules[1][2]) then
|
||||||
this.root.tip:GetComponent("Text").text = string.format("<color=#FFFFFF>%s</color>", data.condition)
|
this.root.tip:GetComponent("Text").text = string.format("<color=#FFFFFF>%s</color>", data.condition)
|
||||||
else
|
else
|
||||||
|
@ -82,7 +80,8 @@ end
|
||||||
|
|
||||||
--- 关闭界面事件
|
--- 关闭界面事件
|
||||||
function this.OnCloseBtnClick()
|
function this.OnCloseBtnClick()
|
||||||
this.root:ClosePanel()
|
this.root.gameObject:SetActive(false)
|
||||||
|
UIManager.OpenPanel(UIName.XuanYuanMirrorPanelList,XuanYuanMirrorManager.curType)
|
||||||
end
|
end
|
||||||
|
|
||||||
return this
|
return this
|
||||||
|
|
Loading…
Reference in New Issue