| | |
| | | using Snxxz.UI; |
| | | //登录奖励 |
| | | [XLua.LuaCallCSharp]
|
| | | public class LoginRewardModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
| | | public class LoginRewardModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity
|
| | | {
|
| | | public event Action LoginAwardInfoUpdate;//领奖记录变更
|
| | | public event Action<int> onStateUpate;
|
| | |
|
| | | public Dictionary<int, WeekPartyDayInfoClass> LoginAwardInfoDic = new Dictionary<int, WeekPartyDayInfoClass>();//领奖信息
|
| | | public Dictionary<int, WeekPartyDayClass> LoginAwardDayDic = new Dictionary<int, WeekPartyDayClass>();//每天的奖励信息
|
| | | public Dictionary<int, WeekPartyActionClass> LoginAwardDic = new Dictionary<int, WeekPartyActionClass>();//活动模板信息
|
| | |
| | | public int DayNow = 0;//当前天
|
| | | public int SelectedNow = 0;//获取选择天
|
| | | public int LimitLV = 0;//限制等级
|
| | | private const int Redpoint_key = 6666;//登录奖励红点
|
| | | public Redpoint redPointStre = new Redpoint(666, Redpoint_key);
|
| | | private const int Redpoint_key = 20921;//登录奖励红点
|
| | | public Redpoint redPointStre = new Redpoint(209, Redpoint_key);
|
| | |
|
| | | public bool IsOpen
|
| | | {
|
| | | get
|
| | | {
|
| | | return OperationTimeHepler.Instance.SatisfyOpenCondition(Operation.LoginReward);
|
| | | }
|
| | | }
|
| | |
|
| | | public bool IsAdvance
|
| | | {
|
| | | get
|
| | | {
|
| | | return OperationTimeHepler.Instance.SatisfyAdvanceCondition(Operation.LoginReward);
|
| | | }
|
| | | }
|
| | |
|
| | | public bool priorityOpen
|
| | | {
|
| | | get
|
| | | {
|
| | | if (redPointStre.state == RedPointState.GetReward || redPointStre.state == RedPointState.Simple)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | else
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | |
| | | OpenServerActivityCenter.Instance.Register(21, this);
|
| | | OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | |
| | | {
|
| | | GetDay();
|
| | | SetRedPoint();
|
| | | OperationTimeHepler.Instance.operationStartEvent -= OperationStartEvent;
|
| | | OperationTimeHepler.Instance.dayResetEvent -= DayResetEvent;
|
| | | OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent;
|
| | | OperationTimeHepler.Instance.dayResetEvent += DayResetEvent;
|
| | | }
|
| | | private void OperationEndEvent(Operation arg1, int arg2)
|
| | | {
|
| | | if (arg1 == Operation.LoginReward && arg2 == 0)
|
| | | {
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | onStateUpate(21);
|
| | | }
|
| | | }
|
| | | }
|
| | | private void DayResetEvent(int obj)
|
| | | {
|
| | | if (obj == (int)Operation.LoginReward)
|
| | | {
|
| | | GetDay();
|
| | | SetRedPoint();
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | onStateUpate(21);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void OperationStartEvent(Operation arg1, int arg2)
|
| | | {
|
| | | if (arg1 == Operation.LoginReward)
|
| | | {
|
| | | GetDay();
|
| | | SetRedPoint();
|
| | | if (arg2 == 0 && onStateUpate != null)
|
| | | {
|
| | | onStateUpate(21);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | |
| | | public void LoginAwardInfo(HAA0C_tagMCActLoginAwardInfo info)//登录奖励活动信息
|
| | | {
|
| | | LimitLV = info.LimitLV;
|
| | | LoginAwardDayDic.Clear();
|
| | | LoginAwardDic.Clear();
|
| | | //LoginAwardDayDic.Clear();
|
| | | //LoginAwardDic.Clear();
|
| | | for (int i = 0; i < info.DayCnt; i++)//每天的奖励信息
|
| | | {
|
| | | int Index = i;
|
| | |
| | | LoginAwardInfoDic.Add(dayindex, loginAwardPlayerClass);
|
| | | }
|
| | | }
|
| | | GetDay();
|
| | | SetRedPoint();
|
| | | if (LoginAwardInfoUpdate != null)
|
| | | {
|
| | |
| | | }
|
| | | private void SetRedPointID()//设置红点ID
|
| | | {
|
| | | if (RedPointDic.Count > 0)
|
| | | if (RedPointDic.Count >= 7)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | return RedPointState.GetReward;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | return RedPointState.None;
|
| | | }
|
| | |
|
| | | private void GetDay()
|
| | | public void GetDay()
|
| | | {
|
| | | OperationBase operationBase;
|
| | | if (OperationTimeHepler.Instance.TryGetOperationTime(Operation.LoginReward, out operationBase))
|
| | | {
|
| | | DayNow = (operationBase as EventDaysTime).GetInDayNow();
|
| | | int inday = (operationBase as EventDaysTime).GetInDayNow();
|
| | | if (LoginAwardInfoDic.Count <= 0 && inday <= 0)
|
| | | {
|
| | | DayNow = 0;
|
| | | } else if (inday >= 0 && LoginAwardInfoDic.Count > 0 && inday < LoginAwardInfoDic.Count)
|
| | | {
|
| | | DayNow = inday;
|
| | | }
|
| | | else if (LoginAwardInfoDic.Count > 0 && inday >= LoginAwardInfoDic.Count)
|
| | | {
|
| | | DayNow = LoginAwardInfoDic.Count - 1;
|
| | | }
|
| | | }
|
| | | }
|
| | | public bool IsOpenFeatures()
|
| | | {
|
| | | bool Isbool = false;
|
| | | Isbool = (OperationTimeHepler.Instance.SatisfyOpenCondition(Operation.LoginReward)
|
| | | || OperationTimeHepler.Instance.SatisfyAdvanceCondition(Operation.LoginReward));
|
| | | return Isbool;
|
| | | }
|
| | | } |
| | | |
| | | |