Beispiel #1
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Left)
     {
         TipMenu.SetActive(true);
         gameObject.GetComponent <Image> ().color = Color.white;
     }
 }
Beispiel #2
0
        public override Widget build(BuildContext context)
        {
            GlobalContext.context = context;
            return(new WillPopScope(
                       onWillPop: () => {
                TipMenu.dismiss();
                var promise = new Promise <bool>();
                if (VersionManager.needForceUpdate())
                {
                    promise.Resolve(false);
                }
                else if (LoginScreen.navigator?.canPop() ?? false)
                {
                    LoginScreen.navigator.pop();
                    promise.Resolve(false);
                }
                else if (Screen.orientation != ScreenOrientation.Portrait)
                {
                    //视频全屏时禁止物理返回按钮
                    EventBus.publish(sName: EventBusConstant.fullScreen, new List <object> {
                        true
                    });
                    promise.Resolve(false);
                }
                else if (navigator.canPop())
                {
                    navigator.pop();
                    promise.Resolve(false);
                }
                else
                {
                    if (Application.platform == RuntimePlatform.Android)
                    {
                        if (this._exitApp)
                        {
                            CustomToast.hidden();
                            promise.Resolve(true);
                            if (this._timer != null)
                            {
                                this._timer.Dispose();
                                this._timer = null;
                            }
                        }
                        else
                        {
                            this._exitApp = true;
                            CustomToast.show(new CustomToastItem(
                                                 context: context,
                                                 "再按一次退出",
                                                 TimeSpan.FromMilliseconds(2000)
                                                 ));
                            this._timer = Window.instance.run(TimeSpan.FromMilliseconds(2000),
                                                              () => { this._exitApp = false; });
                            promise.Resolve(false);
                        }
                    }
                    else
                    {
                        promise.Resolve(true);
                    }
                }

                return promise;
            },
                       child: new Navigator(
                           key: globalKey,
                           observers: new List <NavigatorObserver> {
                _routeObserve,
                _heroController
            },
                           onGenerateRoute: settings => new CustomPageRoute(
                               settings: settings,
                               fullscreenDialog: fullScreenRoutes.ContainsKey(key: settings.name),
                               builder: context1 => mainRoutes[key: settings.name](context: context1)
                               )
                           )
                       ));
        }
Beispiel #3
0
 public void CloseTipMenu()
 {
     TipMenu.SetActive(false);
 }