using vnxbqy.UI;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
//玩家各奖励类型领取记录信息
|
class FuncAwardModel : ILModel<FuncAwardModel>
|
{
|
|
public event Action<int> onReceived; //领取状态变更回调
|
public Dictionary<int, int> rewardState = new Dictionary<int, int>();
|
|
public int isFuncPreNoticeOpen = 0;
|
|
protected override void Init()
|
{
|
GameEvent.playerLoginOkEvent += OnPlayerLoginOk;
|
isFuncPreNoticeOpen = int.Parse(FuncConfigConfig.Get("GameNoticeReward").Numerical3);
|
}
|
|
protected override void UnInit()
|
{
|
GameEvent.playerLoginOkEvent -= OnPlayerLoginOk;
|
}
|
|
//此处应改成公用
|
public void UpdateAwardState(HA30C_tagMCPlayerRewardGetRecord data)
|
{
|
rewardState[data.RewardType] = (int)data.RewardGetRecord;
|
onReceived?.Invoke(data.RewardType);
|
UpdateRedPoint();
|
HeroControler.Instance.FuncPush(203);
|
}
|
|
|
public Redpoint redpointWFQZ = new Redpoint(MainRedPoint.wfqzRedPoint);
|
|
void UpdateRedPoint()
|
{
|
redpointWFQZ.state = RedPointState.None;
|
if (TryGetAwardState(48) == 0)
|
{
|
redpointWFQZ.state = RedPointState.Simple;
|
}
|
}
|
|
public void OnPlayerLoginOk()
|
{
|
UpdateRedPoint();
|
}
|
|
// -1 代表不存在
|
public int TryGetAwardState(int awardType)
|
{
|
if (isFuncPreNoticeOpen == 0)
|
return -1;
|
|
if (!rewardState.ContainsKey(awardType))
|
return 0;
|
|
return rewardState[awardType];
|
}
|
}
|