using BingoBrain.Core;

namespace BingoBrain
{
    public class BingoToyModel : BaseModel
    {
        public float animationTime = 6f;

        public string NextOpenWheelTimeStr
        {
            get
            {
                var val = PreferencesMgr.Instance.NextOpenWheelStampTime - GameHelper.GetNowTime();
                return val > 0 ? GameHelper.GetInterval(val) : "00:00:00";
            }
        }

        #region 生命周期

        protected override void OnInit()
        {
        }

        protected override void OnDispose()
        {
        }

        protected override void OnReset()
        {
        }

        #endregion

        #region 消息

        protected override void AddListener()
        {
            ctrlDispatcher.AddListener(CtrlMsg.GameNewDays, NewDay);
        }

        private void NewDay(object obj)
        {
            PreferencesMgr.Instance.IsOnceWheel = true;
        }

        protected override void RemoveListener()
        {
            ctrlDispatcher.RemoveListener(CtrlMsg.GameNewDays, NewDay);
        }

        #endregion
    }
}