private void Awake() { #if UNITY_EDITOR _swipeDistance = 100; #endif RegisterSingleton(); this.Canvas = GetComponent <Canvas>(); LoadingScreenOnDisable.Show(); if (GameServer.IsServer) { ChangeToPanel(Panel.ServerPanel); ConnectingDialog.Hide(); CollectDialogMenuPage.Hide(); LoadingScreenOnDisable.Hide(); } else { SetProfileLoadedSubscriptions(); } this.UpdateAsObservable().Where(_ => Input.GetKeyDown(KeyCode.Escape)).Subscribe(_ => TopmostPageBack()) .AddTo(this); #if UNITY_EDITOR Observable.EveryUpdate().Where(x => Input.GetMouseButtonDown(0)).Subscribe(_ => { if (MatchManager.Instance != null || this.isSwiping) { return; } this.isSwiping = true; this.firstTouch = Input.mousePosition; }).AddTo(this); Observable.EveryUpdate().Subscribe(_ => { this.isSwiping = Input.GetMouseButton(0); }).AddTo(this); Observable.EveryUpdate().Where(x => Input.GetMouseButtonUp(0)).Subscribe(_ => { this.lastTouch = Input.mousePosition; if (MatchManager.Instance == null && this.isSwiping) { HandleMainMenuSwipes(); } }).AddTo(this); #else Observable.EveryUpdate().Where(x => Input.touchCount == 1).Subscribe(_ => { HandleTouches(); }).AddTo(this); #endif this.dialogStack.ObserveCountChanged().Subscribe(_ => { UpdateTopmostDialog(); }).AddTo(this); this.menuStack.ObserveCountChanged().Subscribe(_ => { UpdateTopmostPanel(); }).AddTo(this); CurrentPanel.Subscribe(_ => { HandleTopMenu(); HandleBottomMenu(); }).AddTo(this); }
private void InitialChangeToPanel(Panel panel) { if (!PlayerUnitsManager.playerBattleDeckLoaded.Value || !PlayerUnitsManager.playerUnitsLoaded.Value || !ProfileManager.Loaded.Value) { return; } ChangeToPanel(panel); ConnectingDialog.Hide(); CollectDialogMenuPage.Hide(); LoadingScreenOnDisable.Hide(); this._compositeDisposable.Clear(); TutorialManager.Instance.Setup(ProfileManager.m_tutorialCurrentState); // setup tutorial state }