protected override void Beat() { if (!m_bIsActive || (syncRequest != null && syncRequest.Running)) { return; } CacheKeyInfo keyInfo = CacheKeyContants.CHAR_DATA_SNAPSHOT_KEY.BuildCacheInfo(PlayerManager.Instance.GetCharBaseData().CharId); CharacterDataSnapshot data = CacheManager.GetInsance().Get(keyInfo) as CharacterDataSnapshot; if (data == null) { return; } SyncCharDataRequest request = new SyncCharDataRequest(); foreach (TBase tbase in data.DataList) { if (tbase is CharBaseInfo) { request.CharBaseInfo = tbase as CharBaseInfo; continue; } if (tbase is CharCounterInfo) { request.CharCounterInfo = tbase as CharCounterInfo; continue; } if (tbase is CharBagInfo) { request.CharBagInfo = tbase as CharBagInfo; continue; } if (tbase is CharMissionInfo) { request.CharMissionInfo = tbase as CharMissionInfo; continue; } } syncRequest = new AsyncSyncCharDataRequest(request); syncRequest.SyncVersion = data.Version; syncRequest.TryRequest(); }
protected override void Beat() { if (!m_bIsActive ||(syncRequest != null && syncRequest.Running)) { return; } CacheKeyInfo keyInfo = CacheKeyContants.CHAR_DATA_SNAPSHOT_KEY.BuildCacheInfo(PlayerManager.Instance.GetCharBaseData().CharId); CharacterDataSnapshot data = CacheManager.GetInsance().Get(keyInfo) as CharacterDataSnapshot; if (data == null) { return; } SyncCharDataRequest request = new SyncCharDataRequest(); foreach (TBase tbase in data.DataList) { if (tbase is CharBaseInfo) { request.CharBaseInfo = tbase as CharBaseInfo; continue; } if (tbase is CharCounterInfo) { request.CharCounterInfo = tbase as CharCounterInfo; continue; } if (tbase is CharBagInfo) { request.CharBagInfo = tbase as CharBagInfo; continue; } if (tbase is CharMissionInfo) { request.CharMissionInfo = tbase as CharMissionInfo; continue; } } syncRequest = new AsyncSyncCharDataRequest(request); syncRequest.SyncVersion = data.Version; syncRequest.TryRequest(); }