using System; using System.Collections.Generic; using MoleMole.Config; using UnityEngine; using proto; namespace MoleMole { [Serializable] public class UserLocalDataItem { [SerializeField] private uint _loginRandomNum; [SerializeField] private List _doneBehaviourList; [SerializeField] private Dictionary> _friendChatMsgMap; [SerializeField] private int _lastChapterID; [SerializeField] private int _lastActIndex; [SerializeField] private int _difficulty; [SerializeField] private string _storageShowTabName; [SerializeField] private ConfigNotificationSetting _personalNotificationSetting; [SerializeField] private HashSet _oldFriendUIDSet; [SerializeField] private HashSet _oldRequestUIDSet; [SerializeField] private DateTime _lastShowBindAccountWarningTime; [SerializeField] private DateTime _lastShowBindIdentityWarningTime; [SerializeField] private List _allMailSet; [SerializeField] private List _readMailIdList; [SerializeField] private HashSet _needPlayLevelAnimationSet; [SerializeField] private Dictionary _subSkillStatusDict; [SerializeField] private DateTime _endThunderWeatherTime; [SerializeField] private DateTime _nextRandomWeatherTime; [SerializeField] private string _currentWeatherConfigPath; [SerializeField] private int _currentWeatherSceneID; [SerializeField] private GetLastEndlessRewardDataRsp _lastRewardData; [SerializeField] private int _lastGalAvatarId; [SerializeField] private HashSet _oldBulletinIDSet; [SerializeField] private Dictionary _cabinNeedToShowLevelUpCompleteSet; [SerializeField] private Dictionary _cabinNeedToShowNewUnlockDict; [SerializeField] private string _receipt; [SerializeField] private int _payMethod; [SerializeField] private Dictionary _cabinTechTreeNodeVisited; [SerializeField] private DateTime _lastShowBulletinTime; [SerializeField] private byte[] _processingStageEndReq; [SerializeField] private WeatherInfo _lastWeatherInfo; [SerializeField] private Dictionary _visitedTutorial; [SerializeField] private DateTime _lastCrashReportTime; [SerializeField] private bool _enableRealTimeWeather; [SerializeField] private bool _hasShowInviteHintDialog; private bool _isDirty = true; public List DoneBehaviourList { get { if (_doneBehaviourList == null) { _doneBehaviourList = new List(); } return _doneBehaviourList; } set { _doneBehaviourList = value; } } public List ReadMailIdList { get { if (_readMailIdList == null) { _readMailIdList = new List(); } return _readMailIdList; } set { _readMailIdList = value; } } public Dictionary> FriendChatMsgMap { get { if (_friendChatMsgMap == null) { _friendChatMsgMap = new Dictionary>(); } return _friendChatMsgMap; } set { _friendChatMsgMap = value; } } public int LastChapterID { get { LevelModule instance = Singleton.Instance; if (!instance.HasChapter(_lastChapterID)) { _lastChapterID = Singleton.Instance.GetOneUnlockChapterID(); } return _lastChapterID; } set { _lastChapterID = value; } } public LevelDiffculty LastDifficulty { get { LevelModule instance = Singleton.Instance; if (!instance.GetChapterById(LastChapterID).HasLevelsOfDifficulty((LevelDiffculty)_difficulty)) { _difficulty = 1; } return (LevelDiffculty)(int)Enum.ToObject(typeof(LevelDiffculty), _difficulty); } set { _difficulty = (int)value; } } public int LastActIndex { get { return _lastActIndex; } set { _lastActIndex = value; } } public string StorageShowTabName { get { return _storageShowTabName; } set { _storageShowTabName = value; } } public ConfigNotificationSetting PersonalNotificationSetting { get { return _personalNotificationSetting; } set { _personalNotificationSetting = value; } } public HashSet OldFriendUIDSet { get { if (_oldFriendUIDSet == null) { _oldFriendUIDSet = new HashSet(); } return _oldFriendUIDSet; } set { _oldFriendUIDSet = value; } } public HashSet OldRequestUIDSet { get { if (_oldRequestUIDSet == null) { _oldRequestUIDSet = new HashSet(); } return _oldRequestUIDSet; } set { _oldRequestUIDSet = value; } } public DateTime LastShowBindAccountWarningTime { get { return _lastShowBindAccountWarningTime; } set { _lastShowBindAccountWarningTime = value; } } public DateTime LastShowBindIdentityWarningTime { get { return _lastShowBindIdentityWarningTime; } set { _lastShowBindIdentityWarningTime = value; } } public List OldMailCache { get { if (_allMailSet == null) { _allMailSet = new List(); } return _allMailSet; } set { _allMailSet = value; } } public HashSet NeedPlayLevelAnimationSet { get { if (_needPlayLevelAnimationSet == null) { _needPlayLevelAnimationSet = new HashSet(); } return _needPlayLevelAnimationSet; } set { _needPlayLevelAnimationSet = value; } } public Dictionary SubSkillStatusDict { get { if (_subSkillStatusDict == null) { _subSkillStatusDict = GetDefaultSubSkillStatusDict(); } return _subSkillStatusDict; } set { _subSkillStatusDict = value; } } public DateTime EndThunderDateTime { get { return _endThunderWeatherTime; } set { _endThunderWeatherTime = value; } } public DateTime NextRandomDateTime { get { return _nextRandomWeatherTime; } set { _nextRandomWeatherTime = value; } } public string CurrentWeatherConfigPath { get { if (string.IsNullOrEmpty(_currentWeatherConfigPath)) { _currentWeatherConfigPath = "Rendering/MainMenuAtmosphereConfig/Lightning"; } return _currentWeatherConfigPath; } set { _currentWeatherConfigPath = value; } } public int CurrentWeatherSceneID { get { return _currentWeatherSceneID; } set { _currentWeatherSceneID = value; } } public bool isDirty { get { return _isDirty; } } public GetLastEndlessRewardDataRsp LastRewardData { get { return _lastRewardData; } set { _lastRewardData = value; } } public HashSet OldBulletinIDSet { get { if (_oldBulletinIDSet == null) { _oldBulletinIDSet = new HashSet(); } return _oldBulletinIDSet; } set { _oldBulletinIDSet = value; } } public Dictionary CabinNeedToShowLevelUpCompleteSet { get { if (_cabinNeedToShowLevelUpCompleteSet == null) { _cabinNeedToShowLevelUpCompleteSet = new Dictionary(); _cabinNeedToShowLevelUpCompleteSet[(CabinType)2] = false; _cabinNeedToShowLevelUpCompleteSet[(CabinType)6] = false; _cabinNeedToShowLevelUpCompleteSet[(CabinType)7] = false; _cabinNeedToShowLevelUpCompleteSet[(CabinType)3] = false; _cabinNeedToShowLevelUpCompleteSet[(CabinType)4] = false; _cabinNeedToShowLevelUpCompleteSet[(CabinType)5] = false; _cabinNeedToShowLevelUpCompleteSet[(CabinType)1] = false; } return _cabinNeedToShowLevelUpCompleteSet; } set { _cabinNeedToShowLevelUpCompleteSet = value; } } public Dictionary CabinNeedToShowNewUnlockDict { get { if (_cabinNeedToShowNewUnlockDict == null) { _cabinNeedToShowNewUnlockDict = new Dictionary(); } return _cabinNeedToShowNewUnlockDict; } set { _cabinNeedToShowNewUnlockDict = value; } } public int LastGalAvatarId { get { return _lastGalAvatarId; } set { _lastGalAvatarId = value; } } public string Receipt { get { if (_receipt == null) { return string.Empty; } return _receipt; } set { _receipt = value; } } public int PayMethod { get { return _payMethod; } set { _payMethod = value; } } public DateTime LastShowBulletinTime { get { return _lastShowBulletinTime; } set { _lastShowBulletinTime = value; } } public uint LoginRandomNum { get { return _loginRandomNum; } set { _loginRandomNum = value; } } public byte[] ProcessingStageEndReq { get { return _processingStageEndReq; } set { _processingStageEndReq = value; } } public WeatherInfo LastWeatherInfo { get { return _lastWeatherInfo; } set { _lastWeatherInfo = value; } } public DateTime LastCrashReportTime { get { return _lastCrashReportTime; } set { _lastCrashReportTime = value; } } public bool EnableRealTimeWeather { get { return _enableRealTimeWeather; } set { _enableRealTimeWeather = value; } } public bool HasShowInviteHintDialog { get { return _hasShowInviteHintDialog; } set { _hasShowInviteHintDialog = value; } } public UserLocalDataItem() { _doneBehaviourList = new List(); _readMailIdList = new List(); _friendChatMsgMap = new Dictionary>(); _lastChapterID = 1; _lastActIndex = 0; _difficulty = 1; _storageShowTabName = "WeaponTab"; _personalNotificationSetting = new ConfigNotificationSetting(); _oldFriendUIDSet = new HashSet(); _oldRequestUIDSet = new HashSet(); _allMailSet = new List(); _needPlayLevelAnimationSet = new HashSet(); _currentWeatherSceneID = 0; _endThunderWeatherTime = TimeUtil.Now; _nextRandomWeatherTime = TimeUtil.Now; _oldBulletinIDSet = new HashSet(); _lastGalAvatarId = 0; _loginRandomNum = 0u; _lastWeatherInfo = new WeatherInfo(); _enableRealTimeWeather = true; _hasShowInviteHintDialog = false; } private Dictionary GetDefaultSubSkillStatusDict() { Dictionary dictionary = new Dictionary(); foreach (AvatarDataItem userAvatar in Singleton.Instance.UserAvatarList) { foreach (AvatarSkillDataItem skillData in userAvatar.skillDataList) { foreach (AvatarSubSkillDataItem avatarSubSkill in skillData.avatarSubSkillList) { if (avatarSubSkill.ShouldShowHintPoint()) { dictionary[avatarSubSkill.subSkillID] = avatarSubSkill.Status; } } } } return dictionary; } public void StartDirtyCheck() { _isDirty = false; } public bool EndDirtyCheck() { bool result = _isDirty; _isDirty = true; return result; } public void SetDirty() { _isDirty = true; } public int IsVisited_Tutorial(int stepID) { if (_visitedTutorial == null) { _visitedTutorial = new Dictionary(); } if (!_visitedTutorial.ContainsKey(stepID)) { return -1; } return _visitedTutorial[stepID]; } public void SetVisited_Tutorial(int stepID) { if (!_visitedTutorial.ContainsKey(stepID)) { _visitedTutorial.Add(stepID, 0); Singleton.Instance.Save(); } else if (_visitedTutorial[stepID] == 0) { _visitedTutorial[stepID] = 1; Singleton.Instance.Save(); } } public bool IsVisited_CabinTechTreeNode(int id) { if (_cabinTechTreeNodeVisited == null) { _cabinTechTreeNodeVisited = new Dictionary(); } if (!_cabinTechTreeNodeVisited.ContainsKey(id)) { _cabinTechTreeNodeVisited.Add(id, false); Singleton.Instance.Save(); } return _cabinTechTreeNodeVisited[id]; } public void SetVisited_CabinTechTreeNode(int id) { if (!_cabinTechTreeNodeVisited[id]) { _cabinTechTreeNodeVisited[id] = true; Singleton.Instance.Save(); } } } }