parent
7285c52be1
commit
56e7492a91
|
@ -1,4 +1,4 @@
|
||||||
|
|
||||||
local _ShopTypeConfig = ConfigManager.GetConfig(ConfigName.StoreTypeConfig)
|
local _ShopTypeConfig = ConfigManager.GetConfig(ConfigName.StoreTypeConfig)
|
||||||
-- 通用得商店逻辑
|
-- 通用得商店逻辑
|
||||||
local ShopView = {}
|
local ShopView = {}
|
||||||
|
@ -16,7 +16,7 @@ function this:New(gameObject)
|
||||||
end
|
end
|
||||||
--初始化组件(用于子类重写)
|
--初始化组件(用于子类重写)
|
||||||
function this:InitComponent()
|
function this:InitComponent()
|
||||||
this.spLoader = SpriteLoader.New()
|
self.spLoader = SpriteLoader.New()
|
||||||
self.live = Util.GetGameObject(self.gameObject, "live")
|
self.live = Util.GetGameObject(self.gameObject, "live")
|
||||||
self.liveRoot = Util.GetGameObject(self.gameObject, "live/root")
|
self.liveRoot = Util.GetGameObject(self.gameObject, "live/root")
|
||||||
self.liveImg = Util.GetGameObject(self.gameObject, "live/img")
|
self.liveImg = Util.GetGameObject(self.gameObject, "live/img")
|
||||||
|
@ -359,7 +359,7 @@ function this:RefreshBase()
|
||||||
-- 刷新物品计算
|
-- 刷新物品计算
|
||||||
local shopInfo = ShopManager.GetShopInfoByType(self.ShopType)
|
local shopInfo = ShopManager.GetShopInfoByType(self.ShopType)
|
||||||
local costId, abcd = shopInfo.RefreshItem[1][1], shopInfo.RefreshItem[2]
|
local costId, abcd = shopInfo.RefreshItem[1][1], shopInfo.RefreshItem[2]
|
||||||
self.costIcon:GetComponent("Image").sprite = SetIcon(this.spLoader, costId)
|
self.costIcon:GetComponent("Image").sprite = SetIcon(self.spLoader, costId)
|
||||||
-- 商店特权正确性检测
|
-- 商店特权正确性检测
|
||||||
if not shopInfo.RefreshPrivilege or shopInfo.RefreshPrivilege == 0 then
|
if not shopInfo.RefreshPrivilege or shopInfo.RefreshPrivilege == 0 then
|
||||||
Log("错误:商店类型 == " .. self.ShopType .. "商店支持手动刷新,但是未配置刷新次数对应的特权id(无限制次数也需要配置特权id)请检查")
|
Log("错误:商店类型 == " .. self.ShopType .. "商店支持手动刷新,但是未配置刷新次数对应的特权id(无限制次数也需要配置特权id)请检查")
|
||||||
|
@ -373,7 +373,7 @@ function this:RefreshBase()
|
||||||
|
|
||||||
-- 商店标题
|
-- 商店标题
|
||||||
if self.ShopConfig.Title and self.ShopConfig.Title ~= "" then
|
if self.ShopConfig.Title and self.ShopConfig.Title ~= "" then
|
||||||
self.titleImg:GetComponent("Image").sprite = this.spLoader:LoadSprite(self.ShopConfig.Title)
|
self.titleImg:GetComponent("Image").sprite = self.spLoader:LoadSprite(self.ShopConfig.Title)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 对话显示
|
-- 对话显示
|
||||||
|
@ -467,17 +467,17 @@ function this:ShopItemAdapter(shopItem, itemData)
|
||||||
-- 折扣
|
-- 折扣
|
||||||
if price == 0 then
|
if price == 0 then
|
||||||
discountbg:SetActive(true)
|
discountbg:SetActive(true)
|
||||||
discountbg:GetComponent("Image").sprite = this.spLoader:LoadSprite("s_shop_zhekou_00_zh")
|
discountbg:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_shop_zhekou_00_zh")
|
||||||
else
|
else
|
||||||
local isDiscount = itemInfo.IsDiscount == 1
|
local isDiscount = itemInfo.IsDiscount == 1
|
||||||
discountbg:SetActive(isDiscount)
|
discountbg:SetActive(isDiscount)
|
||||||
if isDiscount then
|
if isDiscount then
|
||||||
discountbg:GetComponent("Image").sprite = this.spLoader:LoadSprite("s_shop_zhekou_0" .. itemInfo.DiscountDegree.."_zh")
|
discountbg:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_shop_zhekou_0" .. itemInfo.DiscountDegree.."_zh")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- 消耗物品的信息
|
-- 消耗物品的信息
|
||||||
itemPrice.text = PrintWanNum2(tonumber(price))--tostring(price)
|
itemPrice.text = PrintWanNum2(tonumber(price))--tostring(price)
|
||||||
costIcon.sprite = SetIcon(this.spLoader, costId)
|
costIcon.sprite = SetIcon(self.spLoader, costId)
|
||||||
|
|
||||||
-- 判断商品栏位是否解锁
|
-- 判断商品栏位是否解锁
|
||||||
local _IsUnLock = true
|
local _IsUnLock = true
|
||||||
|
@ -571,7 +571,7 @@ function this:RechargeShopItemAdapter(shopItem, itemData)
|
||||||
|
|
||||||
-- 计算数据
|
-- 计算数据
|
||||||
local itemInfo = ShopManager.GetRechargeItemInfo(itemData.goodsId)
|
local itemInfo = ShopManager.GetRechargeItemInfo(itemData.goodsId)
|
||||||
icon.sprite = this.spLoader:LoadSprite(GetResourcePath(itemInfo.Resources))
|
icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemInfo.Resources))
|
||||||
num.text = itemInfo.BaseReward[1][2]
|
num.text = itemInfo.BaseReward[1][2]
|
||||||
price.text = MoneyUtil.GetMoneyUnitNameWithMoney(itemInfo.Price) --.. MoneyUtil.GetMoney(itemInfo.Price)
|
price.text = MoneyUtil.GetMoneyUnitNameWithMoney(itemInfo.Price) --.. MoneyUtil.GetMoney(itemInfo.Price)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue