【云游商人】完成
parent
bb5268793e
commit
b9acaaa12c
|
@ -4953,7 +4953,6 @@ function this.ActiveUserMountRequest(mountId,func)
|
|||
end
|
||||
|
||||
function this.EquipUpLevelRequest(_activityId,_equipId,_itemId,_itemNum,func)
|
||||
LogPink("_activityId:"..tostring(_activityId).." _equipId:"..tostring(_equipId).." _itemId:"..tostring(_itemId).." _itemNum:"..tostring(_itemNum))
|
||||
local data = PlayerInfoProto_pb.EquipUpLevelRequest()
|
||||
data.activityId = _activityId
|
||||
data.equipId = _equipId
|
||||
|
|
|
@ -26,6 +26,7 @@ function CommonActPage:InitComponent()
|
|||
self.time = Util.GetGameObject(self.gameObject, "time")
|
||||
self.timeText = Util.GetGameObject(self.time, "timeText"):GetComponent("Text")
|
||||
self.btnHelp = Util.GetGameObject(self.gameObject, "btnHelp")
|
||||
self.helpPosition = self.btnHelp:GetComponent("RectTransform").localPosition
|
||||
self.itemPre = Util.GetGameObject(self.gameObject, "ItemPre")
|
||||
|
||||
-- 设置循环滚动,万一内容不停地加
|
||||
|
@ -41,6 +42,9 @@ function CommonActPage:InitComponent()
|
|||
end
|
||||
|
||||
function CommonActPage:BindEvent()
|
||||
Util.AddClick(self.btnHelp,function()
|
||||
UIManager.OpenPanel(UIName.HelpPopup,self.actConfig.HelpId,self.helpPosition.x,self.helpPosition.y)
|
||||
end)
|
||||
end
|
||||
|
||||
--界面打开时调用(用于子类重写)
|
||||
|
|
|
@ -17,7 +17,7 @@ function this.InitSingleTypeData(actType)
|
|||
local singleTypeData = {}
|
||||
local data = ActivityGiftManager.GetActivityTypeInfo(actType)
|
||||
local configData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ComposeActivity,"ActivityId",data.activityId)
|
||||
LogPink("Init".." activityId:"..tostring(data.activityId).." value:"..tostring(data.value).." startTime:"..tostring(data.startTime).." endTime:"..tostring(data.endTime))
|
||||
-- LogPink("Init".." activityId:"..tostring(data.activityId).." value:"..tostring(data.value).." startTime:"..tostring(data.startTime).." endTime:"..tostring(data.endTime))
|
||||
singleTypeData.activityId = data.activityId
|
||||
singleTypeData.value = data.value
|
||||
singleTypeData.startTime = data.startTime
|
||||
|
@ -32,7 +32,8 @@ function this.InitSingleTypeData(actType)
|
|||
reward.needItems = configData[i].NeedItems
|
||||
reward.count = configData[i].Count
|
||||
reward.composeType = configData[i].ComposeType
|
||||
LogGreen("i:"..tostring(i).." missionId:"..tostring(reward.missionId).." progress:"..tostring(reward.progress).." state:"..tostring(reward.state).." NeedItems:"..tostring(configData[i].NeedItems).." Count:"..tostring(configData[i].Count).." ComposeType:"..tostring(configData[i].ComposeType))
|
||||
reward.selectId = 0
|
||||
-- LogGreen("i:"..tostring(i).." missionId:"..tostring(reward.missionId).." progress:"..tostring(reward.progress).." state:"..tostring(reward.state).." NeedItems:"..tostring(configData[i].NeedItems).." Count:"..tostring(configData[i].Count).." ComposeType:"..tostring(configData[i].ComposeType))
|
||||
table.insert(singleTypeData.rewards,reward)
|
||||
end
|
||||
end
|
||||
|
@ -41,19 +42,32 @@ end
|
|||
|
||||
function this.UpdateSingleTypeData(actType)
|
||||
local data = ActivityGiftManager.GetActivityTypeInfo(actType)
|
||||
LogPink("Update".." activityId:"..tostring(data.activityId).." value:"..tostring(data.value).." startTime:"..tostring(data.startTime).." endTime:"..tostring(data.endTime))
|
||||
-- LogPink("Update".." activityId:"..tostring(data.activityId).." value:"..tostring(data.value).." startTime:"..tostring(data.startTime).." endTime:"..tostring(data.endTime))
|
||||
dataList[actType].activityId = data.activityId--应该无变化
|
||||
dataList[actType].value = data.value
|
||||
dataList[actType].startTime = data.startTime--应该无变化
|
||||
dataList[actType].endTime = data.endTime--应该无变化
|
||||
for i = 1, #data.mission do
|
||||
if data.mission[i] then
|
||||
dataList[actType].rewards[i].missionId = data.mission[i].missionId or 0--应该无变化
|
||||
dataList[actType].rewards[i].progress = data.mission[i].progress or 0
|
||||
dataList[actType].rewards[i].state = data.mission[i].state or 0
|
||||
LogGreen("i:"..tostring(i).." missionId:"..tostring(dataList[actType].rewards[i].missionId).." progress:"..tostring(dataList[actType].rewards[i].progress).." state:"..tostring(dataList[actType].rewards[i].state))
|
||||
for j = 1, #dataList[actType].rewards do
|
||||
if data.mission[i].missionId == dataList[actType].rewards[j].missionId then
|
||||
dataList[actType].rewards[j].missionId = data.mission[i].missionId or 0--应该无变化
|
||||
dataList[actType].rewards[j].progress = data.mission[i].progress or 0
|
||||
dataList[actType].rewards[j].state = data.mission[i].state or 0
|
||||
dataList[actType].rewards[j].selectId = 0
|
||||
-- LogBlue("i:"..tostring(i).." missionId:"..tostring(dataList[actType].rewards[i].missionId).." progress:"..tostring(dataList[actType].rewards[i].progress).." state:"..tostring(dataList[actType].rewards[i].state))
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(dataList[actType].rewards,function (a,b)
|
||||
if a.progress == b.progress then
|
||||
return a.missionId < b.missionId
|
||||
else
|
||||
return a.progress > b.progress
|
||||
end
|
||||
end)
|
||||
-- for i = 1, #dataList[actType].rewards do
|
||||
-- LogGreen("Id:"..tostring(dataList[actType].rewards[i].missionId).." 装备Id:"..tostring(dataList[actType].rewards[i].needItems[1]))
|
||||
-- end
|
||||
end
|
||||
|
||||
return CommonActPageManager
|
|
@ -1,7 +1,5 @@
|
|||
local ItemUpstarPre = {}
|
||||
ItemUpstarPre = {}
|
||||
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||
local parent
|
||||
local curSelectId = 0
|
||||
function ItemUpstarPre:New(gameObject)
|
||||
local b = {}
|
||||
b.gameObject = gameObject
|
||||
|
@ -22,7 +20,7 @@ function ItemUpstarPre:InitComponent()
|
|||
self.gridList[1] = Util.GetGameObject(self.midLayout,"itemNeed/item")
|
||||
self.gridList[2] = Util.GetGameObject(self.midLayout,"itemCost/item")
|
||||
self.gridList[3] = Util.GetGameObject(self.midLayout,"itemGet/item")
|
||||
self.itemList = {}
|
||||
-- self.itemList = {}
|
||||
self.btnMaskNeed = Util.GetGameObject(self.midLayout,"itemNeed/mask")
|
||||
self.btnMaskGet = Util.GetGameObject(self.midLayout,"itemGet/mask")
|
||||
self.btnMaskNeedAdd = Util.GetGameObject(self.midLayout,"itemNeed/mask/Image")
|
||||
|
@ -31,20 +29,20 @@ end
|
|||
--绑定事件(用于子类重写)
|
||||
function ItemUpstarPre:BindEvent()
|
||||
Util.AddClick(self.btnMaskNeed,function ()
|
||||
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.YunYouMan,self.data,function (itemId)
|
||||
curSelectId = itemId
|
||||
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.YunYouMan,self.data,function ()
|
||||
self:Refresh()
|
||||
end)
|
||||
end)
|
||||
Util.AddClick(self.btnExchange,function ()
|
||||
if curSelectId == 0 then
|
||||
-- LogPurple("self.data.selectId:"..tostring(self.data.selectId))
|
||||
if self.data.selectId == 0 then
|
||||
PopupTipPanel.ShowTip("请选择想要升级的装备!")
|
||||
return
|
||||
end
|
||||
local cost = ConfigManager.GetConfigData(ConfigName.ComposeBook,curSelectId).NeedCost
|
||||
NetManager.EquipUpLevelRequest(self.activityId,curSelectId,cost[1][1],cost[1][2],function (msg)
|
||||
local cost = ConfigManager.GetConfigData(ConfigName.ComposeBook,self.data.selectId).NeedCost
|
||||
NetManager.EquipUpLevelRequest(self.activityId,self.data.selectId,cost[1][1],cost[1][2],function (msg)
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1,function()
|
||||
self.parent:RefreshData(true,false,false)
|
||||
self.parent:RefreshData(true,true,false)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
@ -70,7 +68,7 @@ function ItemUpstarPre:SetData(_data,_parent,_sortingOrder,_activityId)
|
|||
end
|
||||
|
||||
function ItemUpstarPre:Refresh()
|
||||
local needItemId = (curSelectId == 0 or curSelectId == nil) and self.data.needItems[1] or curSelectId
|
||||
local needItemId = self.data.selectId == 0 and self.data.needItems[1] or self.data.selectId
|
||||
local configData = ConfigManager.GetConfigData(ConfigName.ComposeBook,needItemId)
|
||||
local rewardList = {configData.NeedItems[1],configData.NeedCost[1],configData.GoalItems[1]}
|
||||
--设置内容
|
||||
|
@ -81,6 +79,7 @@ function ItemUpstarPre:Refresh()
|
|||
if not self.itemList[i] then
|
||||
self.itemList[i] = SubUIManager.Open(SubUIConfig.ItemView,self.gridList[i].transform)
|
||||
end
|
||||
-- LogRed("id="..self.data.missionId..", sort="..self.sortingOrder)
|
||||
self.itemList[i]:OnOpen(false, rewardList[i], 1,false,false,false,self.sortingOrder)
|
||||
end
|
||||
self:SetMask()
|
||||
|
@ -88,7 +87,7 @@ function ItemUpstarPre:Refresh()
|
|||
end
|
||||
|
||||
function ItemUpstarPre:SetMask()
|
||||
if curSelectId == 0 then
|
||||
if self.data.selectId == 0 then
|
||||
self.btnMaskNeedAdd:SetActive(true)
|
||||
self.btnMaskGet:SetActive(true)
|
||||
Util.GetGameObject(self.itemList[1].gameObject,"effects"):SetActive(false)
|
||||
|
@ -114,9 +113,11 @@ function ItemUpstarPre:SetButton()
|
|||
end
|
||||
|
||||
function ItemUpstarPre:OnClose()
|
||||
curSelectId = 0
|
||||
self.data.selectId = 0
|
||||
self.gridList = {}
|
||||
self.itemList = {}
|
||||
for k,v in pairs(self.itemList) do
|
||||
SubUIManager.Close(v)
|
||||
end
|
||||
end
|
||||
|
||||
return ItemUpstarPre
|
|
@ -27,14 +27,13 @@ function this:InitComponent(gameObject)
|
|||
self.itemList = {}
|
||||
self.maskList = {}
|
||||
self.maskImageList = {}
|
||||
self.selectId = 0
|
||||
end
|
||||
|
||||
function this:BindEvent()
|
||||
Util.AddClick(this.confirm,function()
|
||||
parent:ClosePanel()
|
||||
if func then
|
||||
func(self.selectId)
|
||||
func()
|
||||
end
|
||||
end)
|
||||
Util.AddClick(this.cancel,function()
|
||||
|
@ -56,7 +55,6 @@ function this:OnShow(_parent,...)
|
|||
data = _args[1]
|
||||
func = _args[2]
|
||||
|
||||
-- self.equipList = BagManager.GetBagItemDataByItemType(ItemBaseType.Equip)
|
||||
local list = BagManager.GetBagItemDataByItemType(ItemBaseType.Equip)
|
||||
for i = 1, #data.needItems do
|
||||
for j = 1, #list do
|
||||
|
@ -102,19 +100,19 @@ function this:ShowSingleData(item,sdata,index)
|
|||
self.itemList[index].gameObject:SetActive(true)
|
||||
self.maskList[index] = itemmask
|
||||
self.maskImageList[index] = maskImage
|
||||
self.maskImageList[index]:SetActive(self.selectId == sdata.itemConfig.Id)
|
||||
self.maskImageList[index]:SetActive(data.selectId == sdata.itemConfig.Id)
|
||||
|
||||
|
||||
Util.AddOnceClick(self.maskList[index],function ()
|
||||
for i = 1, #self.maskImageList do
|
||||
self.maskImageList[i]:SetActive(false)
|
||||
end
|
||||
if self.selectId == sdata.itemConfig.Id then
|
||||
if data.selectId == sdata.itemConfig.Id then
|
||||
self.maskImageList[index]:SetActive(false)
|
||||
self.selectId = 0
|
||||
data.selectId = 0
|
||||
else
|
||||
self.maskImageList[index]:SetActive(true)
|
||||
self.selectId = sdata.itemConfig.Id
|
||||
data.selectId = sdata.itemConfig.Id
|
||||
end
|
||||
end)
|
||||
|
||||
|
@ -122,12 +120,12 @@ end
|
|||
|
||||
function this:OnClose()
|
||||
self.equipList={}
|
||||
self.itemList = {}
|
||||
self.maskList = {}
|
||||
self.maskImageList = {}
|
||||
end
|
||||
|
||||
function this:OnDestroy()
|
||||
self.itemList = {}
|
||||
end
|
||||
|
||||
return this
|
Loading…
Reference in New Issue