sk-client/Assets/ManagedResources/~Lua/Modules/Questionnaire/PhoneBuildingPanel.lua

83 lines
2.4 KiB
Lua

require("Base/BasePanel")
PhoneBuildingPanel = Inherit(BasePanel)
local this = PhoneBuildingPanel
local items = {}
function this:InitComponent()
this.mask = Util.GetGameObject(this.gameObject, "mask")
this.btnBack = Util.GetGameObject(this.gameObject, "btnBack")
this.btnGo = Util.GetGameObject(this.gameObject, "btnGo")
this.grid = Util.GetGameObject(this.gameObject, "grid")
this.pre = Util.GetGameObject(this.gameObject, "grid/pre")
end
function this:BindEvent()
Util.AddClick(this.mask, function()
this:ClosePanel()
end)
Util.AddClick(this.btnBack, function()
this:ClosePanel()
end)
Util.AddClick(this.btnGo, function()
if tonumber(ActivityGiftManager.phoneBuildingRewardIsGet) == 0 then
SDKMgr:CustomerService()
elseif tonumber(ActivityGiftManager.phoneBuildingRewardIsGet) == 1 then
NetManager.GetAccountVerifyReward(1, function (msg)
UIManager.OpenPanel(UIName.RewardItemPopup, msg.reward, 1, function ()
this:OnOpen()
end)
end)
end
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnOpen()
CheckRedPointStatus(RedPointType.PhoneBuilding)
Util.SetGray(this.btnGo, ActivityGiftManager.phoneBuildingRewardIsGet == 2)
if ActivityGiftManager.phoneBuildingRewardIsGet == 0 then
this.btnGo:GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont("X1_shoujibangding_anniu"))
else
this.btnGo:GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont("X1_shoujibangding_anniu2"))
end
local config = ConfigManager.GetConfigDataByKey(ConfigName.SpecialConfig, "Key", "Phone_Binding_Reward")
local data = string.split(config.Value, "|")
for i = 1, #items do
items[i].go:SetActive(false)
end
for i = 1, #data do
local reward = string.split(data[i], "#")
if not items[i] then
items[i] = {}
items[i].go = newObjToParent(this.pre, this.grid.transform)
items[i].item = SubUIManager.Open(SubUIConfig.ItemView, Util.GetGameObject(items[i].go, "pos").transform)
end
items[i].item:OnOpen(false, reward, 0.75)
items[i].go:SetActive(true)
end
end
function this:OnShow()
end
function this:OnSortingOrderChange()
end
function this:OnClose()
end
function this:OnDestroy()
items = {}
end
return PhoneBuildingPanel