public CLoading() { this._disposables?.Dispose(); this._disposables = new CompositeDisposable(); this._loadingCanvas = CAssets.LoadAndInstantiate <CLoadingCanvas>("Loading Canvas"); this._loadingUIRetainable = new CRetainable(); this._loadingUIRetainable.IsRetainedRx.Subscribe(retained => { if (retained) { this._loadingCanvas.ShowLoadingUI(); } else { this._loadingCanvas.HideLoadingUI(); } }) .AddTo(this._disposables); CApplication.QuittingEvent += () => { this._disposables?.Dispose(); }; }
public CBlockingEventsManager() { this.RetainedObjects = new HashSet <Object>(); // on menu this._isOnMenuRx?.Dispose(); this._isOnMenuRx = new BoolReactiveProperty(); this._isOnMenuRx.Subscribe(onMenu => { Debug.Log($"<color={"#4fafb6"}>IsOnMenuEvent: {onMenu}</color>"); this._onMenu?.Invoke(onMenu); }); // playing cutscene this._isPlayingCutsceneRx?.Dispose(); this._isPlayingCutsceneRx = new BoolReactiveProperty(); this._isPlayingCutsceneRx.Subscribe(isPlayingCutscene => { Debug.Log($"<color={"#cc5636"}>IsPlayingCutscene: {isPlayingCutscene}</color>"); this._onPlayCutscene?.Invoke(isPlayingCutscene); }); // is doing blocking action this._isDoingBlockingAction = null; this._isDoingBlockingAction = new CRetainable(); this._isDoingBlockingAction.IsRetainedRx.Subscribe(retained => { this._onDoingBlockingAction?.Invoke(retained); }); // blocking Event Happening Observable.CombineLatest( this._isOnMenuRx, this._isPlayingCutsceneRx, this._isDoingBlockingAction.IsRetainedRx, (isOnMenu, isPlayingCutscene, isDoingBlockingAction) => isOnMenu || isPlayingCutscene || isDoingBlockingAction) .Subscribe(blockingEventHappening => { Debug.Log($"<color={"#b62a24"}>IsBlockingEventHappening changed to: {blockingEventHappening}</color>"); this._isAnyBlockingEventHappening = blockingEventHappening; this._onAnyBlockingEventHappening?.Invoke(blockingEventHappening); }); }