71 lines
1.6 KiB
C#
71 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using Framework;
|
|
using PhxhSDK;
|
|
|
|
public class SignUpManager: Singlenton<SignUpManager>, IInitable
|
|
{
|
|
private Dictionary<int, SignObjAccumulate> _accumulateDic;
|
|
|
|
public void Init()
|
|
{
|
|
_Init();
|
|
EventManager.Instance.Register(EventManager.EventName.CheckNeedShowSignUp, _OnCheckShowSignUp);
|
|
}
|
|
|
|
public void Release()
|
|
{
|
|
EventManager.Instance.Unregister(EventManager.EventName.CheckNeedShowSignUp, _OnCheckShowSignUp);
|
|
}
|
|
private void _Init()
|
|
{
|
|
_accumulateDic = new Dictionary<int, SignObjAccumulate>();
|
|
}
|
|
|
|
private void _CreateSignObjs()
|
|
{
|
|
_CreateAccumulateObjs();
|
|
}
|
|
|
|
//创建累计充值的对象
|
|
private void _CreateAccumulateObjs()
|
|
{
|
|
if (_accumulateDic.Count > 0)
|
|
{
|
|
_accumulateDic.Clear();
|
|
}
|
|
_CreateAccumulateObj(1);
|
|
}
|
|
|
|
private void _CreateAccumulateObj(int signId)
|
|
{
|
|
if (!_accumulateDic.ContainsKey(signId))
|
|
{
|
|
var accSignObj = SignObjAccumulate.CreateObj(signId);
|
|
_accumulateDic.Add(signId, accSignObj);
|
|
}
|
|
}
|
|
|
|
private void _OnCheckShowSignUp()
|
|
{
|
|
if (_accumulateDic.Count > 0)
|
|
{
|
|
return;
|
|
}
|
|
_CreateSignObjs();
|
|
|
|
if (_accumulateDic[1].IsNeedToShow)
|
|
{
|
|
UIManager.Instance.OpenWindow(UINameConst.UI_DailyBonus, 1);
|
|
}
|
|
}
|
|
|
|
public SignObjAccumulate GetAccumulateSignObj(int signId)
|
|
{
|
|
if (_accumulateDic.TryGetValue(signId, out var obj))
|
|
{
|
|
return obj;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
} |