55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using asap.core;
|
|
using Assets.Scripts.UI.SocialRush;
|
|
using GameCore;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UniRx;
|
|
|
|
public class SocialRushEntranceBtn : EventButtonResource
|
|
{
|
|
[SerializeField] private BingoTimer timer;
|
|
[SerializeField] private Image icon;
|
|
[SerializeField] private Button button;
|
|
|
|
private void Awake()
|
|
{
|
|
GContext.OnEvent<SocialRushHideEntrance>()
|
|
.Subscribe(_ => gameObject.SetActive(false))
|
|
.AddTo(this);
|
|
var arc = GContext.container.Resolve<SocialRushArchitecture>();
|
|
if (arc == null || !arc.IsActive())
|
|
{
|
|
gameObject.SetActive(false);
|
|
return;
|
|
}
|
|
CheckResource(arc.TableContext.GetAddressableUrls());
|
|
button.onClick.AddListener(OnClickOpen);
|
|
}
|
|
|
|
protected override void OnLoadEventResource()
|
|
{
|
|
gameObject.SetActive(true);
|
|
var arc = GContext.container.Resolve<SocialRushArchitecture>();
|
|
var entranceData = arc.TableContext.GetEntranceData();
|
|
GContext.container.Resolve<IUIService>().SetImageSprite(icon, entranceData.IconUrl);
|
|
timer.Init(entranceData.TimerData);
|
|
timer.OnExpire += () => gameObject.SetActive(false);
|
|
if (arc.NeedPopup())
|
|
GContext.container.Resolve<IFaceUIService>().AddGiftFaceUIForce(arc.EventId, UITypes.SocialRushPanel);
|
|
RedPointManager.Instance.SetRedPointState(arc.RedPointKey, arc.IsFirstTime);
|
|
}
|
|
|
|
private async void OnClickOpen()
|
|
{
|
|
var arc = GContext.container.Resolve<SocialRushArchitecture>();
|
|
var go = await UIManager.Instance.ShowUINotLoading(UITypes.SocialRushPanel);
|
|
}
|
|
}
|
|
|
|
public class SocialRushEntranceData
|
|
{
|
|
public ITimerContext TimerData;
|
|
public string IconUrl;
|
|
} |