gm修改器 提交
parent
15c0eb101f
commit
2b4ad09b20
File diff suppressed because it is too large
Load Diff
|
@ -8171,6 +8171,23 @@ function NetManager.CompareNumRewardRequest(_func)
|
|||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--特权商店一键购买
|
||||
function NetManager.StoreOneClickPurchaseRequest(_id,_func)
|
||||
local data = PlayerInfoProto_pb.StoreOneClickPurchaseRequest()
|
||||
data.id=_id
|
||||
local msg = data:SerializeToString()
|
||||
Network:SendMessageWithCallBack(MessageTypeProto_pb.StoreOneClickPurchaseRequest,MessageTypeProto_pb.StoreOneClickPurchaseResponse,msg,function(buffer)
|
||||
local data = buffer:DataByte()
|
||||
local msg = PlayerInfoProto_pb.StoreOneClickPurchaseResponse()
|
||||
LogError("收到服务器返回礼包信息")
|
||||
msg:ParseFromString(data)
|
||||
if msg.drop then
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1)
|
||||
end
|
||||
if _func then
|
||||
_func()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return this
|
|
@ -6,10 +6,27 @@ local GMMaster=ConfigManager.GetConfig(ConfigName.GMMaster)
|
|||
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||
local rechargeCommodityConfig=ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||||
local icons={"gm_shuachong_scGM_02_zh","gm_shuachong_cjGM_02_zh","gm_shuachong_sjGM_02_zh","gm_shuachong_wsGM_02_zh"}
|
||||
local gmName={"白嫖GM","刷充GM","至尊GM","天选GM"}
|
||||
local sortingOrder = 0
|
||||
local isFirst=true
|
||||
local curBtn=nil
|
||||
local curConfig=nil
|
||||
local turnsInfo={
|
||||
[1]={name="GM商城",id=108, priId=2204,priName="天选GM"},
|
||||
[2]={name="白嫖商城",id=109,priId=2201,priName="白嫖GM"},
|
||||
[3]={name="超级商城",id=110,priId=2202,priName="刷充GM"},
|
||||
[4]={name="至尊商城",id=111,priId=2203,priName="至尊GM"},
|
||||
[5]={name="天选商城",id=112,priId=2204,priName="天选GM"},
|
||||
}
|
||||
local gmTipInfo={
|
||||
--[0]={name="白嫖商城",id=102,priId=2201,priName="刷充GM"},
|
||||
[1]={name="超级商城",id=110,priId=2202,priName="刷充GM"},
|
||||
[2]={name="至尊商城",id=111,priId=2203,priName="至尊GM"},
|
||||
[3]={name="天选商城",id=112,priId=2204,priName="天选GM"},
|
||||
}
|
||||
|
||||
local ShopType=0
|
||||
local curShopIndex=0
|
||||
--初始化组件(用于子类重写)
|
||||
function GMChangePanel:InitComponent()
|
||||
this.spLoader = SpriteLoader.New()
|
||||
|
@ -19,6 +36,7 @@ function GMChangePanel:InitComponent()
|
|||
this.addTxt=Util.GetGameObject(self.gameObject, "layout/top/value2"):GetComponent("Text")
|
||||
this.btn_add=Util.GetGameObject(self.gameObject, "layout/top/btn_chong")
|
||||
this.gmIcon=Util.GetGameObject(self.gameObject, "layout/top/Image"):GetComponent("Image")
|
||||
this.gmName=Util.GetGameObject(self.gameObject, "layout/top/name"):GetComponent("Text")
|
||||
this.btn_up=Util.GetGameObject(self.gameObject, "layout/top/btn_up")
|
||||
this.progress=Util.GetGameObject(self.gameObject, "layout/top/progress")
|
||||
this.progressTxt=Util.GetGameObject(self.gameObject, "layout/top/progress/value"):GetComponent("Text")
|
||||
|
@ -35,6 +53,18 @@ function GMChangePanel:InitComponent()
|
|||
this.scroll=Util.GetGameObject(self.gameObject, "layout/scroll")
|
||||
this.hint=Util.GetGameObject(self.gameObject, "layout/hint"):GetComponent("Text")
|
||||
this.info=Util.GetGameObject(self.gameObject, "layout/top/Text (1)"):GetComponent("Text")
|
||||
this.shopInfo=Util.GetGameObject(self.gameObject, "layout/shopInfo")
|
||||
this.btn_oneKey=Util.GetGameObject(self.gameObject, "layout/shopInfo/btn_oneKey")
|
||||
this.gmBtns={}
|
||||
for i = 1, 5 do
|
||||
this.gmBtns[i]={}
|
||||
this.gmBtns[i].btn=Util.GetGameObject(this.shopInfo, "Top/btn"..i)
|
||||
this.gmBtns[i].selectImg=Util.GetGameObject(this.shopInfo, "Top/btn"..i.."/SelectBG")
|
||||
this.gmBtns[i].selectImg:SetActive(false)
|
||||
this.gmBtns[i].nameTxt=Util.GetGameObject(this.shopInfo, "Top/btn"..i.."/Text"):GetComponent("Text")
|
||||
this.gmBtns[i].nameTxt.text=turnsInfo[i].name
|
||||
this.gmBtns[i].red=Util.GetGameObject(this.shopInfo, "Top/btn"..i.."/redPoint")
|
||||
end
|
||||
--设置滚动条
|
||||
local rootHight = this.scroll.transform.rect.height
|
||||
local width = this.scroll.transform.rect.width
|
||||
|
@ -58,8 +88,192 @@ function GMChangePanel:InitComponent()
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
this.itemPre=Util.GetGameObject(self.gameObject,"layout/shopInfo/scrollroot/shopItem")
|
||||
this.grid=Util.GetGameObject(self.gameObject,"layout/shopInfo/scrollroot")
|
||||
local rootHight = self.grid.transform.rect.height
|
||||
local width = self.grid.transform.rect.width
|
||||
this.shopScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.grid.transform,this.itemPre, nil, Vector2.New(width, rootHight), 1, 3, Vector2.New(40,20))
|
||||
this.shopScrollView.moveTween.MomentumAmount = 1
|
||||
this.shopScrollView.moveTween.Strength = 2
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-- 商店物品数据匹配
|
||||
function this.ShopItemAdapter(shopItem, itemData)
|
||||
-- 获取对象
|
||||
local effect = Util.GetGameObject(shopItem, "Fx_SquareFlow")
|
||||
effect.gameObject:SetActive(false)
|
||||
Util.SetParticleSortLayer(effect, this.sortingOrder + 1)
|
||||
local bg = Util.GetGameObject(shopItem, "GameObject/bg")
|
||||
local item = Util.GetGameObject(bg, "item")
|
||||
local itemName = Util.GetGameObject(bg, "itemName"):GetComponent("Text")
|
||||
local itemDes = Util.GetGameObject(bg, "itemDes"):GetComponent("Text")
|
||||
local limitBg = Util.GetGameObject(bg, "buyLimitbg")
|
||||
local limitTip = Util.GetGameObject(limitBg, "tip"):GetComponent("Text")
|
||||
local priceBg = Util.GetGameObject(bg, "pricebg")
|
||||
local itemPrice = Util.GetGameObject(bg, "pricebg/price"):GetComponent("Text")
|
||||
local costIcon = Util.GetGameObject(bg, "pricebg/costIcon"):GetComponent("Image")
|
||||
local discountbg = Util.GetGameObject(bg, "discountbg")
|
||||
local empty = Util.GetGameObject(shopItem, "empty")
|
||||
local yihuode = Util.GetGameObject(shopItem, "yihuode")
|
||||
local lock = Util.GetGameObject(shopItem, "lock")
|
||||
local lockTip = Util.GetGameObject(shopItem, "lock/tip"):GetComponent("Text")
|
||||
local new = Util.GetGameObject(shopItem, "GameObject/new")
|
||||
new:SetActive(false)
|
||||
-- 计算数据
|
||||
local itemInfo = ShopManager.GetShopItemInfo(itemData.id)
|
||||
local curBuyCount = itemData.buyNum
|
||||
local maxLimitCount = ShopManager.GetShopItemLimitBuyCount(itemData.id)
|
||||
local costId, price = ShopManager.calculateBuyCost(ShopType, itemData.id, 1)
|
||||
local goods = ShopManager.GetShopItemGoodsInfo(itemData.id)
|
||||
local con = ConfigManager.GetConfigData(ConfigName.ItemConfig,goods[1][1])
|
||||
itemName.text = SubString2(GetLanguageStrById(con.Name),8)
|
||||
if con.ItemType == ItemType.LingShouChip then
|
||||
local haveCount = BagManager.GetTotalItemNum(con.Id)
|
||||
itemName.text = itemName.text.."\n"..string.format("<color=%s><size=%s>%s(%s/%s)</size></color>",UIColorStr.BLACK, "25", "拥有:", haveCount, con.UsePerCount)
|
||||
end
|
||||
if con.ItemType == ItemType.Talisman then
|
||||
itemDes.gameObject:SetActive(true)
|
||||
if con.ItemDescribe then
|
||||
local str=string.split(con.ItemDescribe,',')
|
||||
if str[1] then
|
||||
itemDes.text=str[1]
|
||||
end
|
||||
else
|
||||
itemDes.gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
else
|
||||
itemDes.gameObject:SetActive(false)
|
||||
end
|
||||
--itemInfo.GoodsName
|
||||
-- 折扣
|
||||
if price == 0 then
|
||||
discountbg:SetActive(true)
|
||||
discountbg:GetComponent("Image").sprite = this.spLoader:LoadSprite("s_shop_zhekou_00_zh")
|
||||
else
|
||||
local isDiscount = itemInfo.IsDiscount == 1
|
||||
discountbg:SetActive(isDiscount)
|
||||
if isDiscount then
|
||||
discountbg:GetComponent("Image").sprite = this.spLoader:LoadSprite("s_shop_zhekou_0" .. itemInfo.DiscountDegree.."_zh")
|
||||
end
|
||||
end
|
||||
-- 消耗物品的信息
|
||||
itemPrice.text = PrintWanNum2(tonumber(price))--tostring(price)
|
||||
costIcon.sprite = SetIcon(this.spLoader, costId)
|
||||
|
||||
-- 判断商品栏位是否解锁
|
||||
local _IsUnLock = true
|
||||
if ShopType == SHOP_TYPE.GUILD_SHOP then
|
||||
local isUnLock, unLockLevel = MyGuildManager.GetGuildShopSortIsUnLock(itemInfo.Sort)
|
||||
if not isUnLock then
|
||||
_IsUnLock = false
|
||||
lockTip.text = string.format(Language[12036], unLockLevel)
|
||||
end
|
||||
end
|
||||
lock:SetActive(not _IsUnLock)
|
||||
priceBg.gameObject:SetActive(_IsUnLock)
|
||||
itemName.gameObject:SetActive(_IsUnLock)
|
||||
-- -- 限购
|
||||
limitBg:SetActive(maxLimitCount ~= -1)
|
||||
if ShopType==108 then
|
||||
limitTip.text ="永久限购".." "..maxLimitCount.."次"
|
||||
else
|
||||
limitTip.text ="每日限购".." "..maxLimitCount.."次"
|
||||
end
|
||||
SetTextVerTial(limitTip,Vector3.New(12.65,-4.2,0),"MiddleLeft")
|
||||
-- 售空 限购次数为-1 表示不限购
|
||||
local isEmpty = maxLimitCount ~= -1 and curBuyCount >= maxLimitCount
|
||||
if curBuyCount >= maxLimitCount then
|
||||
empty:SetActive(true)
|
||||
else
|
||||
empty:SetActive(false)
|
||||
end
|
||||
empty:SetActive(isEmpty)
|
||||
|
||||
-- 数据匹配
|
||||
if not this._GoodsItemList then
|
||||
this._GoodsItemList = {}
|
||||
end
|
||||
if not this._GoodsItemList[shopItem] then
|
||||
this._GoodsItemList[shopItem] = SubUIManager.Open(SubUIConfig.ItemView, item.transform)
|
||||
end
|
||||
Util.SetGray(this._GoodsItemList[shopItem].gameObject, not _IsUnLock)
|
||||
if isEmpty or not _IsUnLock then -- 物品空或者未解锁不现实物品特效
|
||||
this._GoodsItemList[shopItem]:OnOpen(false, goods[1],1,false,false,false)
|
||||
else
|
||||
this._GoodsItemList[shopItem]:OnOpen(false, goods[1],1,false,false,false,this.sortingOrder)
|
||||
end
|
||||
|
||||
-- 商品颜色显示
|
||||
local imgColor = isEmpty and Color.New(0.5, 0.5, 0.5, 1) or Color.New(1, 1, 1, 1)
|
||||
local textA = isEmpty and 0.7 or 1
|
||||
Util.SetColor(bg, imgColor)
|
||||
this.SetAlpha(itemName, textA)
|
||||
--SetAlpha(limitTip, textA)
|
||||
this.SetAlpha(itemPrice, textA)
|
||||
local isshow = false
|
||||
|
||||
yihuode.gameObject:SetActive(false)
|
||||
|
||||
-- 购买事件
|
||||
Util.AddOnceClick(lock, function()
|
||||
PopupTipPanel.ShowTip(Language[12038])
|
||||
end)
|
||||
Util.AddOnceClick(empty, function()
|
||||
PopupTipPanel.ShowTip(Language[12039])
|
||||
end)
|
||||
Util.AddOnceClick(bg, function()
|
||||
|
||||
-- 售空
|
||||
if isEmpty then
|
||||
PopupTipPanel.ShowTip(Language[12039])
|
||||
return
|
||||
end
|
||||
if not _IsUnLock then
|
||||
PopupTipPanel.ShowTip(Language[12038])
|
||||
return
|
||||
end
|
||||
local storeConfig=ConfigManager.GetConfigData(ConfigName.StoreConfig,itemData.id)
|
||||
if storeConfig and storeConfig.BuyRule then
|
||||
local lv=storeConfig.BuyRule[2]
|
||||
LogError("lv==========="..lv)
|
||||
if gmTipInfo[lv] then
|
||||
if OperatingManager.IsBuyGift(gmTipInfo[lv].priId)==false then
|
||||
PopupTipPanel.ShowTip("开通"..gmTipInfo[lv].priName.."后开启购买")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
UIManager.OpenPanel(UIName.ShopBuyPopup, ShopType, itemData.id)
|
||||
end)
|
||||
end
|
||||
|
||||
-- 设置文本透明度
|
||||
function this.SetAlpha(text, a)
|
||||
local color = text.color
|
||||
color.a = a
|
||||
text.color = color
|
||||
end
|
||||
---重置默认
|
||||
function this.ClearDefault()
|
||||
for i = 1, 5 do
|
||||
this.gmBtns[i].selectImg:SetActive(false)
|
||||
this.gmBtns[i].nameTxt.color=Color.New(0.71,0.64,0.51,1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--刷新商店显示
|
||||
local RefreshShopShow=function(self)
|
||||
local num=BagManager.GetItemCountById(1367)
|
||||
this.curTxt.text=num.."元"
|
||||
this.SwitchShop(curShopIndex)
|
||||
end
|
||||
--绑定事件(用于子类重写)
|
||||
function GMChangePanel:BindEvent()
|
||||
Util.AddClick(this.btn_close, function()
|
||||
|
@ -71,14 +285,58 @@ function GMChangePanel:BindEvent()
|
|||
Util.AddClick(this.btn_up, function()
|
||||
UIManager.OpenPanel(UIName.GMShuaChongTeQuan)
|
||||
end)
|
||||
for i = 1, 5 do
|
||||
Util.AddClick(this.gmBtns[i].btn, function()
|
||||
this.SwitchShop(i)
|
||||
end)
|
||||
end
|
||||
Util.AddClick(this.btn_oneKey, function()
|
||||
if gmTipInfo[curShopIndex-2] and OperatingManager.IsBuyGift(gmTipInfo[curShopIndex-2].priId)==false then
|
||||
PopupTipPanel.ShowTip("开通"..gmTipInfo[curShopIndex-2].priName.."后开启购买")
|
||||
return
|
||||
end
|
||||
local sureFunc=function()
|
||||
NetManager.StoreOneClickPurchaseRequest(turnsInfo[curShopIndex].id,function()
|
||||
RefreshShopShow()
|
||||
end)
|
||||
end
|
||||
local args={}
|
||||
args[1]="是否一键购买所有每日限购道具?"
|
||||
args[2]="购买"
|
||||
args[3]="取消"
|
||||
args[4]=sureFunc
|
||||
UIManager.OpenPanel(UIName.GMCommonConfirmPanel,args)
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function this.SwitchShop(index)
|
||||
this.ClearDefault()
|
||||
if index==1 then
|
||||
this.btn_oneKey:SetActive(false)
|
||||
else
|
||||
this.btn_oneKey:SetActive(true)
|
||||
end
|
||||
this.gmBtns[index].selectImg:SetActive(true)
|
||||
this.gmBtns[index].nameTxt.color=Color.New(1,0.95,0.85,1)
|
||||
ShopType=turnsInfo[index].id
|
||||
curShopIndex=index
|
||||
local list=ShopManager.GetShopDataByType(turnsInfo[index].id).storeItem
|
||||
this.shopScrollView:SetData(list, function (index, go)
|
||||
this.ShopItemAdapter(go,list[index])
|
||||
end,false)
|
||||
|
||||
end
|
||||
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
function GMChangePanel:AddListener()
|
||||
Game.GlobalEvent:AddEvent(GameEvent.Shop.OnShopInfoChange,RefreshShopShow,self)
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
function GMChangePanel:RemoveListener()
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.Shop.OnShopInfoChange,RefreshShopShow,self)
|
||||
end
|
||||
|
||||
--界面打开时调用(用于子类重写)
|
||||
|
@ -111,7 +369,8 @@ function GMChangePanel:ShowTopInfo()
|
|||
end
|
||||
end
|
||||
end
|
||||
this.gmIcon.sprite=this.spLoader:LoadSprite(icons[index])
|
||||
this.gmIcon.sprite=this.spLoader:LoadSprite("r_RareItem_Recipe_0001")
|
||||
this.gmName.text=gmName[index]
|
||||
local privile=ConfigManager.GetConfigData(ConfigName.PrivilegeTypeConfig,2101)
|
||||
if privile then
|
||||
maxnum=privile.Condition[index][2]
|
||||
|
@ -142,7 +401,15 @@ function this.TabBtnOnClick(btn,config)
|
|||
local dataList={}
|
||||
local aa=config.Unlock[1]
|
||||
local isOpen,tip=CheckGMIsOpen(aa[1],aa[2])
|
||||
--if isOpen then
|
||||
if config.Type==15 then
|
||||
this.shopInfo:SetActive(true)
|
||||
this.scroll:SetActive(false)
|
||||
this.SwitchShop(1)
|
||||
else
|
||||
this.shopInfo:SetActive(false)
|
||||
this.scroll:SetActive(true)
|
||||
|
||||
end
|
||||
this.hint.gameObject:SetActive(false)
|
||||
this.scroll:SetActive(true)
|
||||
for k, v in ConfigPairs(GMMaster) do
|
||||
|
@ -153,12 +420,6 @@ function this.TabBtnOnClick(btn,config)
|
|||
this.scrollView:SetData(dataList,function(index, rewardItem)
|
||||
this:SingleTask(rewardItem, dataList[index],isOpen,tip)
|
||||
end,not false,not false)
|
||||
-- else
|
||||
-- this.hint.gameObject:SetActive(true)
|
||||
-- this.hint.text=tip
|
||||
-- this.scroll:SetActive(false)
|
||||
-- end
|
||||
|
||||
end
|
||||
|
||||
function GMChangePanel:SingleTask(go,data,isOpen,tip)
|
||||
|
@ -221,11 +482,6 @@ function GMChangePanel:SingleTask(go,data,isOpen,tip)
|
|||
end
|
||||
--LogError("data.id=="..data.Id.." data.name=="..data.Type)
|
||||
local des=""
|
||||
-- for i = 1, #data.Price do
|
||||
-- if itemConfig[data.Price[i][1]] then
|
||||
-- des=des.." "..itemConfig[data.Price[i][1]].Name.." *"..data.Price[i][2]
|
||||
-- end
|
||||
-- end
|
||||
des=data.DisplayReward
|
||||
itemDes.text=des
|
||||
|
||||
|
@ -302,6 +558,7 @@ end
|
|||
--界面销毁时调用(用于子类重写)
|
||||
function GMChangePanel:OnDestroy()
|
||||
this.spLoader:Destroy()
|
||||
SubUIManager.Close(this.shopScrollView)
|
||||
|
||||
end
|
||||
return GMChangePanel
|
Loading…
Reference in New Issue