备份CatanBuilding瘦身独立工程
This commit is contained in:
71
Assets/Scripts/UI/Shop/GiftNoticePanel.cs
Normal file
71
Assets/Scripts/UI/Shop/GiftNoticePanel.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using game;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Unity.Notifications;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GiftNoticePanel : MonoBehaviour
|
||||
{
|
||||
Button btn_close;
|
||||
Button btn_mask;
|
||||
Button btn_watch1;
|
||||
Button btn_watch2;
|
||||
public RewardItemNew[] rewardItemNews;
|
||||
private Tables _tables;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_tables = GContext.container.Resolve<Tables>();
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_mask = transform.Find("mask").GetComponent<Button>();
|
||||
btn_watch1 = transform.Find("root/btn_watch1/btn_green").GetComponent<Button>();
|
||||
btn_watch2 = transform.Find("root/btn_watch2/btn_green").GetComponent<Button>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_close.onClick.AddListener(OnClose);
|
||||
btn_mask.onClick.AddListener(OnClose);
|
||||
btn_watch1.onClick.AddListener(OnClickNO);
|
||||
btn_watch2.onClick.AddListener(OnClickYES);
|
||||
|
||||
int id = GContext.container.Resolve<PlayerData>().priceLevel.DailyGiftDisplay;
|
||||
Item item = _tables.TbItem.GetOrDefault(id);
|
||||
var itemDataGift = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropIdAndType(item.RedirectID);
|
||||
//ItemDropPackage itemDropPackage = _tables.TbItemDropPackage.GetOrDefault(item.RedirectID);
|
||||
//if (itemDropPackage.ItemDisplay.Count > 0)
|
||||
//{
|
||||
// List<string> CountDisplay = GContext.container.Resolve<PlayerItemData>().ShowItemDropPackage(id, itemDropPackage);
|
||||
for (int i = 0; i < rewardItemNews.Length; i++)
|
||||
{
|
||||
if (i < itemDataGift.Count)
|
||||
{
|
||||
rewardItemNews[i].SetData(itemDataGift[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItemNews[i].transform.parent.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
void OnClickNO()
|
||||
{
|
||||
//不再显示此界面
|
||||
PlayerPrefs.SetInt("GiftNoticePanel", 1);
|
||||
OnClose();
|
||||
}
|
||||
void OnClickYES()
|
||||
{
|
||||
//开启通知
|
||||
OnClose();
|
||||
NotificationCenter.OpenNotificationSettings();
|
||||
}
|
||||
void OnClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.GiftNoticePanel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user