少年修仙传客户端代码仓库
client_Zxw
2018-11-22 87ea0d7d91abc9d871ef1b1d349d17dafda86f9c
System/FindPrecious/FindPreciousModel.cs
@@ -8,7 +8,7 @@
namespace Snxxz.UI
{
    [XLua.LuaCallCSharp]
   public class FindPreciousModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk, IMapInitOk, ISwitchAccount
    public class FindPreciousModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk, IMapInitOk, ISwitchAccount
    {
        public const int PREPOSE_SECONDS = 120;
        public const int FINDPRECIOUS_REDPOINTID = 76000;
@@ -24,10 +24,10 @@
        }
        Dictionary<int, BossInfo> bossInfos = new Dictionary<int, BossInfo>();
        List<int> bossNotifies = new List<int>();
        List<BossNotify> bossNotifies = new List<BossNotify>();
        int m_CurrentBossNotify = 0;
        public int currentBossNotify {
        BossNotify m_CurrentBossNotify = default(BossNotify);
        public BossNotify currentBossNotify {
            get { return m_CurrentBossNotify; }
            private set {
                if (m_CurrentBossNotify != value)
@@ -88,7 +88,7 @@
        public void OnSwitchAccount()
        {
            m_CurrentBossNotify = 0;
            m_CurrentBossNotify = default(BossNotify);
            bossSubscribes.Clear();
            bossNotifies.Clear();
            FindPreciousTimer.Instance.Clear();
@@ -315,7 +315,7 @@
        {
            var sendInfo = new CA903_tagCGAttentionBoss();
            sendInfo.BossID = (uint)_bossId;
            sendInfo.IsAdd = 0;
            sendInfo.IsAdd = 9;
            GameNetSystem.Instance.SendInfo(sendInfo);
            bossSubscribes[_bossId] = new BossSubscribe(_bossId, 9);
@@ -337,37 +337,37 @@
            }
        }
        public void AddOneBossRebornNotify(int _bossId)
        public void AddOneBossRebornNotify(int bossId)
        {
            if (IsBossSubscribed(_bossId) && !bossNotifies.Contains(_bossId))
            if (IsBossSubscribed(bossId) && !ExitBossNotify(bossId))
            {
                var type = GetBossFindPreciousType(_bossId);
                var type = GetBossFindPreciousType(bossId);
                if (type == FindPreciousType.DemonJar && demonJarModel.GetSurplusTimes() <= 0)
                {
                }
                else
                {
                    bossNotifies.Add(_bossId);
                    bossNotifies.Add(new BossNotify(bossId, demonJarModel.autoChallenge));
                    currentBossNotify = GetNextBossNotify();
                }
            }
        }
        public void RemoveOneBossRebornNotify(int _bossId)
        public void RemoveOneBossRebornNotify(int bossId )
        {
            if (bossNotifies.Contains(_bossId))
            if (ExitBossNotify(bossId))
            {
                bossNotifies.Remove(_bossId);
                RemoveBossRebornNotify(bossId);
                currentBossNotify = GetNextBossNotify();
            }
        }
        public void ReportConfirmBossRebornNotify(int _bossId)
        public void ReportConfirmBossRebornNotify(BossNotify _notify)
        {
            if (bossNotifies.Contains(_bossId))
            if (bossNotifies.Contains(_notify))
            {
                bossNotifies.Remove(_bossId);
                bossNotifies.Remove(_notify);
            }
            currentBossNotify = GetNextBossNotify();
@@ -377,10 +377,10 @@
        {
            for (int i = bossNotifies.Count - 1; i >= 0; i--)
            {
                var bossId = bossNotifies[i];
                if (GetBossFindPreciousType(bossId) == _type)
                var notify = bossNotifies[i];
                if (GetBossFindPreciousType(notify.bossId) == _type)
                {
                    bossNotifies.Remove(bossId);
                    bossNotifies.Remove(notify);
                }
            }
@@ -441,7 +441,7 @@
            return FindPreciousType.None;
        }
        private int GetNextBossNotify()
        private BossNotify GetNextBossNotify()
        {
            if (bossNotifies.Count > 0)
            {
@@ -449,7 +449,29 @@
            }
            else
            {
                return 0;
                return default(BossNotify);
            }
        }
        private bool ExitBossNotify(int bossId)
        {
            foreach (var notify in bossNotifies)
            {
                return notify.bossId == bossId;
            }
            return false;
        }
        private void RemoveBossRebornNotify(int bossId)
        {
            for (var i = bossNotifies.Count; i >= 0; i--)
            {
                var notify = bossNotifies[i];
                if (notify.bossId == bossId)
                {
                    bossNotifies.RemoveAt(i);
                }
            }
        }
@@ -460,7 +482,7 @@
        private void InitializeBossNotify()
        {
            m_CurrentBossNotify = 0;
            m_CurrentBossNotify = default(BossNotify);
            bossNotifies.Clear();
            foreach (var boss in bossInfos.Values)
            {
@@ -714,6 +736,29 @@
        }
        public struct BossNotify
        {
            public int bossId;
            public bool demonJarAuto;
            public BossNotify(int bossId, bool demonJarAuto)
            {
                this.bossId = bossId;
                this.demonJarAuto = demonJarAuto;
            }
            public static bool operator ==(BossNotify _lhs, BossNotify _rhs)
            {
                return _lhs.bossId == _rhs.bossId && _lhs.demonJarAuto == _rhs.demonJarAuto;
            }
            public static bool operator !=(BossNotify _lhs, BossNotify _rhs)
            {
                return _lhs.bossId != _rhs.bossId || _lhs.demonJarAuto != _rhs.demonJarAuto;
            }
        }
    }
}