【命格】提交

dev_chengFeng
ZhangBiao 2021-12-08 15:40:43 +08:00
parent be16abf79a
commit ae3a2fa3e4
6 changed files with 59 additions and 33 deletions

View File

@ -71,8 +71,6 @@ function this.UpdateBagData(_itemData, isNoSendNewItemEvent)
if itemdata.type == ItemBaseType.SoulPrint then
SoulPrintManager.UpdateAllHavedSoulPrint({itemdata.id})
elseif itemdata.type == ItemBaseType.Gem then
GemManager.UpdateGemsFromBag(itemdata.id,itemdata.num)
end
end
@ -1106,8 +1104,6 @@ function this.BagIndicationRefresh(msg)
end
if itemConfig[v.itemId].ItemType == ItemType.LingShouChip then--灵兽碎片获得刷新红点
Game.GlobalEvent:DispatchEvent(GameEvent.Pokemon.PokemonChipRefresh)
elseif itemConfig[v.itemId].ItemType == ItemType.Gem then
GemManager.UpdateGemsFromBag(v.itemId,v.itemNum)
end
end
end

View File

@ -3,23 +3,27 @@ local this = GemManager
local gemConfig = ConfigManager.GetConfig(ConfigName.GemConfig)
function this.Initialize()
this.myGemList = {}--我穿戴命石的id
this.allGemList = {}--背包中的命石id。不包括穿戴的
this.typeGemList = {}
end
--获取服务器发来的背包中的命石数据信息
function this.UpdateGemsFromBag(_GemId,_num)
-- LogRed("Id:"..tostring(_GemId).." num:"..tostring(_num))
if not this.allGemList[_GemId] then
local data = {}
data.id = _GemId
data.num = _num
data.type = gemConfig[_GemId].Type
data.name = gemConfig[_GemId].Name
this.allGemList[_GemId] = data
else
this.allGemList[_GemId].num = _num
function this.GetGemsFromBagByType(_type)
local data = {}
local bagdata = BagManager.GetBagAllDataByItemType(ItemType.Gem)
for i = 1, #bagdata do
local tempdata = {}
tempdata.id = bagdata[i].id
tempdata.num = bagdata[i].num
tempdata.type = gemConfig[bagdata[i].id].Type
tempdata.name = gemConfig[bagdata[i].id].Name
if tempdata.type == _type or _type == 0 and tempdata.num > 0 then
table.insert(data,tempdata)
end
end
table.sort(data,function (a,b)
return a.id > b.id
end)
return data
end
function this.UpdateSingleGem(msg)
@ -30,6 +34,7 @@ function this.UpdateSingleGem(msg)
if not this.myGemList[msg.lifeGridInfo.gridId][msg.lifeGridInfo.gridIndex] then
this.myGemList[msg.lifeGridInfo.gridId][msg.lifeGridInfo.gridIndex] = nil
end
LogPink(string.format( "修改的位置[%s][%s] ID:%s",msg.lifeGridInfo.gridId,msg.lifeGridInfo.gridIndex,tostring(msg.lifeGridInfo.itemId)))
this.myGemList[msg.lifeGridInfo.gridId][msg.lifeGridInfo.gridIndex] = msg.lifeGridInfo.itemId
end
end
@ -52,18 +57,4 @@ function this.GetWearedGem(_GemList)
end
end
--获取当前命石对应类型的可替换的命石数据
function this.GetReplaceGems(_type)
local data = {}
for key, value in pairs(this.allGemList) do
if value.type == _type then
table.insert(data,value)
end
end
table.sort(data,function (a,b)
return a.id > b.id
end)
return data
end
return this

View File

@ -110,7 +110,7 @@ function Gem:SetGems()
local level = Util.GetGameObject(stoneGo,"Text"):GetComponent("Text")
local name = "r_RareItem_Specail_0222"
level.text = ""
if gemData[i] and gemData[i][j] then
if gemData[i] and gemData[i][j] and gemData[i][j] > 0 then
name = GetSpriteNameByItemId(gemData[i][j])
level.text = gemConfig[gemData[i][j]].Level
end

View File

@ -113,11 +113,21 @@ function RewardGemSingleShowPopup:OnShow()
this.scroll:SetActive(true)
this.btnJump:SetActive(true)
this.bottomBar:SetActive(true)
if gemConfig[itemSid].Level == 10 then--十级命石不显示合成
this.bottomBar:SetActive(false)
end
elseif this.openType == 2 then--装备命石时打开
this.btnClose:SetActive(true)
this.btnSure:SetActive(true)
this.btnJump:SetActive(true)
this.bottomBar:SetActive(true)
if gemConfig[itemSid].Level == 10 then--十级命石不显示合成
this.btnJump:SetActive(false)
end
elseif this.openType == 3 then--itemview打开
this.howGet:SetActive(true)
this.scroll:SetActive(true)
this.bottomBar:SetActive(false)
end
local creatJumpData = function(jumpDataList)

View File

@ -6,6 +6,8 @@ local parent
local sortingOrder=0
local args=nil
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
local gemConfig=ConfigManager.GetConfig(ConfigName.GemConfig)
local PropertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
function SelectGem:InitComponent(gameObject)
self.spLoader = SpriteLoader.New()
self.itemPre=Util.GetGameObject(gameObject,"ItemPre")
@ -41,7 +43,7 @@ function SelectGem:OnShow(_parent,_args)
SelectGem:Refresh(args[1])
end
function SelectGem:Refresh(Id)
local dataList = GemManager.GetReplaceGems(Id)
local dataList = GemManager.GetGemsFromBagByType(Id)
self.ScrollView:SetData(dataList, function(index, go)
self:SingleDataShow(go,dataList[index],index)
go:SetActive(true)
@ -66,6 +68,17 @@ function SelectGem:SingleDataShow(go,data,index)
self.itemList[go]:OnOpen(false, {data.id,0}, 1.1, false,false,false,sortingOrder + 1)
self.itemList[go].gameObject:SetActive(true)
name.text = GetStringByEquipQua(itemConfig[data.id].Quantity1,data.name)
local property = gemConfig[data.id].Property
local textDesc = ""
for i = 1, #property do
textDesc = textDesc..string.format( "全体神将%s+%s",PropertyConfig[property[i][1]].Info,property[i][2]/100).."%"
if property[i+1] then
textDesc = textDesc.."\n"
end
end
desc.text = textDesc
Util.AddOnceClick(btn,function ()
NetManager.LifeGridChangeRequest(1,args[1],args[2],data.id,function ()
if args[3] then

View File

@ -270,6 +270,10 @@ function ItemView:GetRewardShow(_itemData, effectLayer)
Util.AddOnceClick(self.frameBtn, function()
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,_itemData.backData.itemId,nil,self.isRewardItemPop,true)
end)
elseif _itemData.configData.ItemType == ItemType.Gem then
Util.AddOnceClick(self.frameBtn, function()
UIManager.OpenPanel(UIName.RewardGemSingleShowPopup, _itemData.backData.itemId,3)
end)
else
Util.AddOnceClick(self.frameBtn, function()
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, _itemData.backData.itemId,nil,self.isRewardItemPop)
@ -368,13 +372,17 @@ function ItemView:GetRewardShow(_itemData, effectLayer)
Util.AddOnceClick(self.frameBtn, function()
UIManager.OpenPanel(UIName.PokemonGetInfoPopup, true, _itemData.backData)
end)
elseif itemDataConFig.ItemType == ItemType.Incarnation then
elseif _itemData.ItemType == ItemType.Incarnation then
--5随机道具6符文
self.frame.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(itemConfig[ _itemData.backData.itemId].Quantity))
self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig[ _itemData.backData.itemId].ResourceID))
Util.AddOnceClick(self.frameBtn, function()
UIManager.OpenPanel(UIName.RewardTailsmanChipShowPopup, _itemData.backData.itemId, nil)
end)
elseif _itemData.ItemType == ItemType.Gem then
Util.AddOnceClick(self.frameBtn, function()
UIManager.OpenPanel(UIName.RewardGemSingleShowPopup, _itemData.backData.itemId,3)
end)
end
self.gameObject:GetComponent("RectTransform").localScale = Vector2.New(self.scale, self.scale)
end
@ -722,6 +730,12 @@ function ItemView:NoGetRewardShow(_reward, effectLayer, isShowAddImage)
Util.AddOnceClick(self.frameBtn, function()
UIManager.OpenPanel(UIName.RewardTailsmanChipShowPopup, itemSId, nil)
end)
elseif itemDataConFig.ItemType == ItemType.Gem then--命石
self.frame.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(itemConfig[itemSId].Quantity))
self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig[itemSId].ResourceID))
Util.AddOnceClick(self.frameBtn, function()
UIManager.OpenPanel(UIName.RewardGemSingleShowPopup, itemSId,3)
end)
else
--5随机道具6符文
self.frame.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(itemConfig[itemSId].Quantity))
@ -784,6 +798,8 @@ function ItemView:OnBtnCkickEvent(itemSId)
elseif itemDataConFig.ItemType == ItemType.SelfBox then
--道具自选箱
UIManager.OpenPanel(UIName.RewardBoxPanel,nil,itemDataConFig.Id)
elseif itemDataConFig.ItemType == ItemType.Gem then
UIManager.OpenPanel(UIName.RewardGemSingleShowPopup, itemDataConFig.Id,3)
else
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, itemDataConFig.Id,nil,self.isRewardItemPop,true)
end