147 lines
5.7 KiB
Lua
147 lines
5.7 KiB
Lua
require("Base/BasePanel")
|
|
AssociationPanel = Inherit(BasePanel)
|
|
local this = AssociationPanel
|
|
local rewardList = {}
|
|
|
|
function this:InitComponent()
|
|
this.btnBack = Util.GetGameObject(this.gameObject, "btnBack")
|
|
this.btnShare = Util.GetGameObject(this.gameObject, "btnShare")
|
|
this.btnInterest1 = Util.GetGameObject(this.gameObject, "btnInterest1")
|
|
this.btnInterest2 = Util.GetGameObject(this.gameObject, "btnInterest2")
|
|
|
|
this.reward1 = Util.GetGameObject(this.gameObject, "reward1")
|
|
this.reward2 = Util.GetGameObject(this.gameObject, "reward2")
|
|
this.reward3 = Util.GetGameObject(this.gameObject, "reward3")
|
|
end
|
|
|
|
function this:BindEvent()
|
|
Util.AddClick(this.btnBack, function()
|
|
this:ClosePanel()
|
|
end)
|
|
Util.AddClick(this.btnInterest1, function ()
|
|
if PlayerPrefs.GetInt(PlayerManager.uid.."FB1") == 1 then
|
|
NetManager.GetAccountVerifyReward(2, function (msg)
|
|
UIManager.OpenPanel(UIName.RewardItemPopup, msg.reward, 1, function ()
|
|
PlayerPrefs.SetInt(PlayerManager.uid.."FB1", 2)
|
|
this:OnShow()
|
|
end)
|
|
end)
|
|
else
|
|
if PlayerPrefs.GetInt(PlayerManager.uid.."FB1") == 0 then
|
|
PlayerPrefs.SetInt(PlayerManager.uid.."FB1", 1)
|
|
end
|
|
local url = ConfigManager.GetConfigDataByKey(ConfigName.SpecialConfig, "Key", "FB_FanGroup_URL").Value
|
|
UnityEngine.Application.OpenURL(url)
|
|
this:OnShow()
|
|
end
|
|
end)
|
|
Util.AddClick(this.btnInterest2, function ()
|
|
if PlayerPrefs.GetInt(PlayerManager.uid.."FB2") == 1 then
|
|
NetManager.GetAccountVerifyReward(3, function (msg)
|
|
UIManager.OpenPanel(UIName.RewardItemPopup, msg.reward, 1, function ()
|
|
PlayerPrefs.SetInt(PlayerManager.uid.."FB2", 2)
|
|
this:OnShow()
|
|
end)
|
|
end)
|
|
else
|
|
if PlayerPrefs.GetInt(PlayerManager.uid.."FB2") == 0 then
|
|
PlayerPrefs.SetInt(PlayerManager.uid.."FB2", 1)
|
|
end
|
|
local url = ConfigManager.GetConfigDataByKey(ConfigName.SpecialConfig, "Key", "FB_Forum_URL").Value
|
|
UnityEngine.Application.OpenURL(url)
|
|
this:OnShow()
|
|
end
|
|
end)
|
|
Util.AddClick(this.btnShare, function()
|
|
if AppConst.isSDKLogin then
|
|
if ActivityGiftManager.shareIsGet == 1 then
|
|
NetManager.GetAccountVerifyReward(4, function (msg)
|
|
UIManager.OpenPanel(UIName.RewardItemPopup, msg.reward, 1, function ()
|
|
this:OnShow()
|
|
end)
|
|
end)
|
|
else
|
|
SDKMgr:LoginPanel_Btn1()
|
|
this:OnShow()
|
|
end
|
|
end
|
|
end)
|
|
end
|
|
|
|
function this:AddListener()
|
|
end
|
|
|
|
function this:RemoveListener()
|
|
end
|
|
|
|
function this:OnOpen()
|
|
end
|
|
|
|
function this:OnShow()
|
|
CheckRedPointStatus(RedPointType.Association_FB1)
|
|
CheckRedPointStatus(RedPointType.Association_FB2)
|
|
CheckRedPointStatus(RedPointType.Association_Share)
|
|
if PlayerPrefs.GetInt(PlayerManager.uid.."FB1") == 1 then
|
|
Util.GetGameObject(this.btnInterest1, "Text"):GetComponent("Text").text = GetLanguageStrById(50501)
|
|
else
|
|
Util.GetGameObject(this.btnInterest1, "Text"):GetComponent("Text").text = GetLanguageStrById(50498)
|
|
end
|
|
if PlayerPrefs.GetInt(PlayerManager.uid.."FB2") == 1 then
|
|
Util.GetGameObject(this.btnInterest2, "Text"):GetComponent("Text").text = GetLanguageStrById(50501)
|
|
else
|
|
Util.GetGameObject(this.btnInterest2, "Text"):GetComponent("Text").text = GetLanguageStrById(50499)
|
|
end
|
|
if ActivityGiftManager.shareIsGet == 1 then
|
|
Util.GetGameObject(this.btnShare, "Text"):GetComponent("Text").text = GetLanguageStrById(50501)
|
|
else
|
|
Util.GetGameObject(this.btnShare, "Text"):GetComponent("Text").text = GetLanguageStrById(50500)
|
|
end
|
|
Util.GetGameObject(this.btnInterest1, "redpoint"):SetActive(ActivityGiftManager.GetFB1Redpoint())
|
|
Util.GetGameObject(this.btnInterest2, "redpoint"):SetActive(ActivityGiftManager.GetFB2Redpoint())
|
|
Util.GetGameObject(this.btnShare, "redpoint"):SetActive(ActivityGiftManager.GetShareRedpoint())
|
|
for i = 1, #rewardList do
|
|
for j = 1, #rewardList[i] do
|
|
rewardList[i][j].gameObject:SetActive(false)
|
|
end
|
|
end
|
|
|
|
local list = {
|
|
{"FB_FanGroup_Reward", this.reward1},
|
|
{"FB_Forum_Reward", this.reward2},
|
|
{"FB_Share_Reward", this.reward3},
|
|
}
|
|
|
|
for v = 1, #list do
|
|
local value = ConfigManager.GetConfigDataByKey(ConfigName.SpecialConfig, "Key", list[v][1]).Value
|
|
local reward = string.split(value, "|")
|
|
for i = 1, #reward do
|
|
if not rewardList[list[v][2]] then
|
|
rewardList[list[v][2]] = {}
|
|
end
|
|
if not rewardList[list[v][2]][i] then
|
|
rewardList[list[v][2]][i] = SubUIManager.Open(SubUIConfig.ItemView, list[v][2].transform)
|
|
end
|
|
local data = string.split(reward[i], "#")
|
|
rewardList[list[v][2]][i]:OnOpen(false, data, 0.6)
|
|
if v == 1 then
|
|
rewardList[list[v][2]][i]:SetCorner(4, PlayerPrefs.GetInt(PlayerManager.uid.."FB1") == 2)
|
|
elseif v == 2 then
|
|
rewardList[list[v][2]][i]:SetCorner(4, PlayerPrefs.GetInt(PlayerManager.uid.."FB2") == 2)
|
|
elseif v == 3 then
|
|
rewardList[list[v][2]][i]:SetCorner(4, ActivityGiftManager.shareIsGet == 2)
|
|
end
|
|
rewardList[list[v][2]][i].gameObject:SetActive(true)
|
|
end
|
|
end
|
|
end
|
|
|
|
function this:OnSortingOrderChange()
|
|
end
|
|
|
|
function this:OnClose()
|
|
end
|
|
|
|
function this:OnDestroy()
|
|
end
|
|
|
|
return AssociationPanel |