public static void SubscribeToPersistence <T1, T2>(this ReactiveDictionary <T1, T2> dictionary, string saveKey, CompositeDisposable disposables, bool isLocal = false)
        {
            dictionary.ObserveCountChanged().Subscribe(value =>
                                                       DIResolver.GetObject <PlayerDataManager>().TrySave(saveKey, dictionary.ToDictionary(x => x.Key, x => x.Value), isLocal)
                                                       ).AddTo(disposables);

            dictionary.ObserveReplace().Subscribe(value =>
                                                  DIResolver.GetObject <PlayerDataManager>().TrySave(saveKey, dictionary.ToDictionary(x => x.Key, x => x.Value), isLocal)
                                                  ).AddTo(disposables);
        }
        public static void SubscribeToPersistence <T>(this ReactiveCollection <T> collection, string saveKey, CompositeDisposable disposables, bool isLocal = false)
        {
            collection.ObserveCountChanged().Subscribe(value =>
                                                       DIResolver.GetObject <PlayerDataManager>().TrySave(saveKey, collection.ToList(), isLocal)
                                                       ).AddTo(disposables);

            collection.ObserveReplace().Subscribe(value =>
                                                  DIResolver.GetObject <PlayerDataManager>().TrySave(saveKey, collection.ToList(), isLocal)
                                                  ).AddTo(disposables);
        }
Exemple #3
0
        public UniTask Initialize()
        {
            _playerDataLoader = DIResolver.GetObject <PlayerDataLoader>();

            file = new ES3File(true);

            _isInitialized = true;

            return(UniTask.CompletedTask);
        }
        public UniTask Initialize()
        {
            _playerDataMutator      = DIResolver.GetObject <PlayerDataMutator>();
            _playerData             = DIResolver.GetObject <PlayerData>();
            _monoApplicationManager = DIResolver.GetObject <MonoApplicationManager>();

            _monoApplicationManager.RegisterOnApplicationFocus(this);

            return(UniTask.CompletedTask);
        }
 public static void SubscribeToPersistence <T>(this ReactiveProperty <T> property, string saveKey, CompositeDisposable disposables, bool isLocal = false)
 {
     property.Subscribe(value => DIResolver.GetObject <PlayerDataManager>().TrySave(saveKey, value, isLocal)
                        ).AddTo(disposables);
 }
Exemple #6
0
 public MemoryPoolBase <TValue> FromFactory <TFactory>() where TFactory : IFactory <TValue>
 {
     return(this.FromFactory(DIResolver.GetObject <TFactory>()));
 }