|
SupremeVipBuyView = SupremeVipBuyView or BaseClass(BaseView)
|
|
local SupremeVipBuyView = SupremeVipBuyView
|
|
|
|
function SupremeVipBuyView:__init()
|
|
self.base_file = "supremeVip"
|
|
self.layout_file = "SupremeVipBuyView"
|
|
self.layer_name = "Activity"
|
|
self.destroy_imm = true
|
|
self.use_background = true
|
|
self.change_scene_close = true
|
|
self.hide_maincancas = true --是否隐藏主界面
|
|
-- self.append_to_ctl_queue = true --是否要添加进界面堆栈
|
|
self.need_show_money = false --是否要显示顶部的金钱栏
|
|
|
|
self.is_set_zdepth = true
|
|
|
|
self.model = SupremeVipModel:getInstance()
|
|
|
|
if self.model.login_red then
|
|
self.model.login_red = false
|
|
self.model:Fire(SupremeVipConst.UPDATE_SUPREME_VIP_MAIN_BUTTON_RED)
|
|
end
|
|
|
|
self.load_callback = function ()
|
|
self:LoadSuccess()
|
|
self:AddEvent()
|
|
end
|
|
self.open_callback = function ( )
|
|
self:UpdateView()
|
|
end
|
|
self.destroy_callback = function ( )
|
|
self:DestroySuccess()
|
|
end
|
|
end
|
|
|
|
function SupremeVipBuyView:Open( )
|
|
--self.data = data
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function SupremeVipBuyView:LoadSuccess()
|
|
self.nodes = {
|
|
"titleImg:img", "bg:raw", "way1:img", "way2:img",
|
|
"chargeBtn:obj",
|
|
"buyBtn:obj",
|
|
"closeBtn:obj", "proImg:img", "pro_text:tmp",
|
|
}
|
|
self:GetChildren(self.nodes)
|
|
|
|
self.chargeDayCheck = {}
|
|
self.chargeDayBg = {}
|
|
self.chargeDayNum = {}
|
|
self.chargeDayImg = {}
|
|
for i=1,7 do
|
|
self.chargeDayCheck[i] = self:GetChild("chargeDayCon/dayItem"..i.."/checkImg").gameObject
|
|
self.chargeDayBg[i] = self:GetChild("chargeDayCon/dayItem"..i.."/dayBg"):GetComponent("Image")
|
|
self.chargeDayNum[i] = self:GetChild("chargeDayCon/dayItem"..i.."/dayNum"):GetComponent("Image")
|
|
self.chargeDayImg[i] = self:GetChild("chargeDayCon/dayItem"..i.."/dayImg"):GetComponent("Image")
|
|
end
|
|
|
|
lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("supremeVip_buy_view"))
|
|
lua_resM:setOutsideImageSprite(self, self.way1_img, GameResPath.GetSupremeVipIcon("way_1"), true)
|
|
lua_resM:setOutsideImageSprite(self, self.way2_img, GameResPath.GetSupremeVipIcon("way_2"), true)
|
|
lua_resM:setOutsideImageSprite(self, self.titleImg_img, GameResPath.GetSupremeVipIcon("supremeVip_title_4"), true)
|
|
|
|
self.model:Fire(SupremeVipConst.REQUEST_CCMD_EVENT,45101)--请求自己的贵族信息
|
|
end
|
|
|
|
function SupremeVipBuyView:AddEvent()
|
|
local on_click = function ( click_obj )
|
|
if self.closeBtn_obj == click_obj then
|
|
self:Close()
|
|
elseif self.chargeBtn_obj == click_obj then
|
|
if not self.model:IsForeverSupremeVip() then
|
|
self:Close()
|
|
OpenFun.Open(450,1)
|
|
else
|
|
Message.show("已经是二阶贵族了","fault")
|
|
end
|
|
elseif self.buyBtn_obj == click_obj then
|
|
-- if not self.model:IsForeverSupremeVip() then
|
|
-- local cost = self.model:GetActivateForeverSupremeVipCost() or 1980
|
|
-- Alert.show("是否花费"..cost.."彩钻激活永久贵族?", Alert.Type.Two, function()
|
|
-- self.model:Fire(SupremeVipConst.REQUEST_CCMD_EVENT,45102,1)
|
|
-- end, nil, "是", "否")
|
|
-- else
|
|
-- Message.show("已经是永久贵族了")
|
|
-- end
|
|
if not self.model:IsForeverSupremeVip() then
|
|
self:Close()
|
|
OpenFun.Open(450,1)
|
|
else
|
|
Message.show("已经是二阶贵族了","fault")
|
|
end
|
|
end
|
|
end
|
|
AddClickEvent(self.closeBtn_obj, on_click)
|
|
AddClickEvent(self.chargeBtn_obj, on_click)
|
|
AddClickEvent(self.buyBtn_obj, on_click)
|
|
|
|
--贵族信息变更,这里要刷新充值天数
|
|
local function update_charge_day()
|
|
if self.is_loaded then
|
|
self:UpdateView()
|
|
end
|
|
end
|
|
self:BindEvent(self.model, SupremeVipConst.REFRESH_SUPREME_VIP_DATA, update_charge_day)
|
|
end
|
|
|
|
function SupremeVipBuyView:UpdateView()
|
|
local chargeDay = self.model:GetChargeDay()
|
|
for i=1,7 do
|
|
self.chargeDayCheck[i]:SetActive(i<=chargeDay)
|
|
if i<=chargeDay then
|
|
lua_resM:setImageSprite(self, self.chargeDayBg[i], "supremeVip_asset","supremeVip_tab_choose_bg",false)
|
|
lua_resM:setImageSprite(self, self.chargeDayNum[i], "supremeVip_asset","supremeVip_day_"..i,true)
|
|
lua_resM:setImageSprite(self, self.chargeDayImg[i], "supremeVip_asset","supremeVip_day_select",true)
|
|
else
|
|
lua_resM:setImageSprite(self, self.chargeDayBg[i], "supremeVip_asset","supremeVip_tab_nomal_bg",false)
|
|
lua_resM:setImageSprite(self, self.chargeDayNum[i], "supremeVip_asset","supremeVip_day_"..i.."_normal",true)
|
|
lua_resM:setImageSprite(self, self.chargeDayImg[i], "supremeVip_asset","supremeVip_day_normal",true)
|
|
end
|
|
end
|
|
local cur_price = self.model.total_charge or 0
|
|
local max_recharge = self.model:GetActivateForeverSupremeVipCost() or 1980
|
|
local cur_recharge = cur_price < max_recharge and cur_price or max_recharge
|
|
self.proImg_img.fillAmount = cur_recharge < max_recharge and cur_recharge/max_recharge or 1
|
|
self.pro_text_tmp.text = cur_recharge.."/"..max_recharge
|
|
end
|
|
|
|
function SupremeVipBuyView:DestroySuccess( )
|
|
|
|
end
|