| | |
| | | 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;
|
| | |
| | | }
|
| | |
|
| | | 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)
|
| | |
| | |
|
| | | public void OnSwitchAccount()
|
| | | {
|
| | | m_CurrentBossNotify = 0;
|
| | | m_CurrentBossNotify = default(BossNotify);
|
| | | bossSubscribes.Clear();
|
| | | bossNotifies.Clear();
|
| | | FindPreciousTimer.Instance.Clear();
|
| | |
| | | {
|
| | | 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);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | 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();
|
| | |
| | | {
|
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | return FindPreciousType.None;
|
| | | }
|
| | |
|
| | | private int GetNextBossNotify()
|
| | | private BossNotify GetNextBossNotify()
|
| | | {
|
| | | if (bossNotifies.Count > 0)
|
| | | {
|
| | |
| | | }
|
| | | 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);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | private void InitializeBossNotify()
|
| | | {
|
| | | m_CurrentBossNotify = 0;
|
| | | m_CurrentBossNotify = default(BossNotify);
|
| | | bossNotifies.Clear();
|
| | | foreach (var boss in bossInfos.Values)
|
| | | {
|
| | |
| | |
|
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|